Elffuss BraidHub

kikocis/GraphRAG-SDK public

1808f1a742dc · 2.2 KiBRenderedRawPermalink
1# Construct a knowledge graph from a GitHub repository
2
3The main entities and relations extracted:
4
5## Entities
6
7- File
8- Directory
9- Commit
10- Branch
11- Repository
12- Organization
13- User
14
15## Relations
16
17- (Repository)-[CONTAINS]->(File)
18- (Repository)-[CONTAINS]->(Directory)
19- (Repository)-[CONTAINS]->(Commit)
20- (Repository)-[CONTAINS]->(branch)
21- (Organization)-[OWNS]->(Repository)
22- (User)-[STAR]->(Repository)
23- (User)-[PART_OF]->(Organization)
24
25## Run
26
27Run FalkorDB:
28```sh
29docker run -p 6379:6379 -p 3000:3000 -it --rm -v ./data:/data falkordb/falkordb:edge
30```
31
32Construct knowledge graph from github URL
33```sh
34python examples/github/github.py -r https://github.com/falkorDB/falkordb
35```
36
37## Output
38
39```sh
40python examples/github/github.py
412024-06-10 10:05:36,912 - graphrag_sdk.kg - DEBUG - Run in progress
42...
43Question: List a few stargazers
44
452024-06-10 10:07:55,729 - graphrag_sdk.query_graph - DEBUG - Model suggested query: MATCH (u:User)-[:STAR]->(r:Repository) RETURN u.Name, r.Name LIMIT 5
46
47Answer: Here are a few stargazers:
481. User: dekelev - Repository: FalkorDB
492. User: qdrddr - Repository: FalkorDB
503. User: MikeLP - Repository: FalkorDB
514. User: johnpccd - Repository: FalkorDB
525. User: ohdearquant - Repository: FalkorDB
53
54Question: Does the FalkorDB repository has a 'main' branch?
55
562024-06-10 10:08:08,774 - graphrag_sdk.query_graph - DEBUG - Model suggested query: MATCH (:Repository {Name: 'FalkorDB'})-[:CONTAINS]->(b:Branch {Name: 'main'}) RETURN b
57
58Answer: No, the FalkorDB repository does not have a 'main' branch in the knowledge graph.
59
60How can I help you with?
61Summerise stargazers locations
62
632024-06-10 10:27:51,036 - graphrag_sdk.query_graph - DEBUG - Model suggested query: MATCH (u:User)-[:STAR]->(r:Repository) RETURN u.Location, COUNT(u) as StargazersCount
64
65Answer: Here is a summary of stargazers locations along with the count of stargazers from each location:
66- San Francisco, CA USA: 1 stargazer
67- Sydney, Australia: 1 stargazer
68- Houston, TX: 1 stargazer
69- Mountain: 1 stargazer
70- Bengaluru, India: 1 stargazer
71- New York: 1 stargazer
72- Bangkok, Thailand: 1 stargazer
73- Russia: 1 stargazer
74- Israel: 1 stargazer
75- Unknown Location: 37 stargazers
76- Mempool: 1 stargazer
77```