File size: 1,338 Bytes
34367da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from neo4j import GraphDatabase

d = GraphDatabase.driver(
    "neo4j+s://054eff27.databases.neo4j.io",
    auth=("neo4j", "Qrt37mkb0xBZ7_ts5tG1J70K2mVDGPMF2L7Njlm7cg8")
)

with d.session() as s:
    print("=" * 50)
    print("πŸ“Š NEO4J KNOWLEDGE GRAPH STATUS")
    print("=" * 50)
    
    # Node counts by label
    r = s.run("""
        MATCH (n) 
        RETURN labels(n)[0] as label, count(*) as count 
        ORDER BY count DESC LIMIT 20
    """)
    
    print("\nπŸ“¦ NODES BY TYPE:")
    total = 0
    for x in r:
        print(f"   {x['label']}: {x['count']:,}")
        total += x['count']
    print(f"   ─────────────────")
    print(f"   TOTAL: {total:,}")
    
    # Relationship counts
    r = s.run("""
        MATCH ()-[r]->() 
        RETURN type(r) as type, count(*) as count 
        ORDER BY count DESC LIMIT 10
    """)
    
    print("\nπŸ”— RELATIONSHIPS:")
    for x in r:
        print(f"   {x['type']}: {x['count']:,}")
    
    # Recent LocalFile samples
    r = s.run("""
        MATCH (lf:LocalFile)
        RETURN lf.name as name, lf.category as cat, lf.fileType as type
        ORDER BY lf.harvestedAt DESC
        LIMIT 10
    """)
    
    print("\nπŸ“„ RECENT LOCAL FILES:")
    for x in r:
        print(f"   [{x['cat']}] {x['name'][:40]} ({x['type']})")

d.close()