neo4j-query
Query Neo4j knowledge graph for entities, relationships, and graph analysis.
- License 许可
- MIT
- 最近更新
- 2026-04-09
- Stars
- ★ 245
- Forks
- 15
01 前言 Front Matter
- name
- neo4j-query
- triggers
- [ "neo4j", "knowledge graph", "entities", "relationships", "graph query", "cypher" ]
- description
- Query Neo4j knowledge graph for entities, relationships, and graph analysis.
03 SKILL.md 正文
Neo4j Query Skill
Query the Neo4j knowledge graph to investigate entities, relationships, and graph structure.
Connection Details
- URI:
bolt://localhost:7687(orNEO4J_URIenv var) - User:
neo4j(orNEO4J_USERenv var) - Password:
refinerypass(orNEO4J_PASSWORDenv var)
Python Usage
from qq.knowledge.neo4j_client import Neo4jClient
# Initialize client
client = Neo4jClient()
# Execute raw Cypher query
results = client.execute("MATCH (n) RETURN n LIMIT 10")
# Get graph summary (entity and relationship counts by type)
summary = client.get_graph_summary()
# Get entity by name
entity = client.get_entity("entity_name")
# Get related entities (up to N hops)
related = client.get_related_entities("entity_name", depth=2, limit=20)
# Close when done
client.close()
Common Cypher Queries
Count entities and relationships
-- Total entities
MATCH (n) RETURN count(n) as total_entities
-- Entities by type
MATCH (n) RETURN labels(n)[0] as type, count(n) as count ORDER BY count DESC
-- Total relationships
MATCH ()-[r]->() RETURN count(r) as total_relationships
-- Relationships by type
MATCH ()-[r]->() RETURN type(r) as type, count(r) as count ORDER BY count DESC
Find orphan entities (no relationships)
-- Entities with no incoming or outgoing relationships
MATCH (n) WHERE NOT (n)--() RETURN n.name, labels(n)[0] as type
Analyze connectivity
-- Entities with most connections
MATCH (n)-[r]-() RETURN n.name, labels(n)[0] as type, count(r) as connections ORDER BY connections DESC LIMIT 10
-- Distribution of relationship counts per entity
MATCH (n)
OPTIONAL MATCH (n)-[r]-()
WITH n, count(r) as rel_count
RETURN rel_count, count(n) as entities_with_this_count ORDER BY rel_count
Sample entities and relationships
-- Sample entities with their properties
MATCH (n) RETURN n.name, labels(n)[0] as type, n.description LIMIT 20
-- Sample relationships with endpoints
MATCH (a)-[r]->(b) RETURN a.name, type(r), b.name LIMIT 20
CLI Usage
# Use cypher-shell directly
docker exec -it qq-neo4j-1 cypher-shell -u neo4j -p refinerypass "MATCH (n) RETURN count(n)"
04 同仓库更多 Skills
test
Run TTS round-trip tests — pure-logic unit tests and optional integration tests against live TTS/STT services.
speak
Speak text aloud using the Magpie TTS container in the realtime-api Docker stack. Zero external dependencies — just curl + aplay.
deploy
Build and deploy the realtime-api Docker container with full verification that deployed code matches local source.
memory
Unified memory management for notes, knowledge graph, RAG search, and file analysis. Use when working with: (1) Core memory — protected identity, projects, relationships, and system facts that should never be forgotten, (2) Working notes — per-session ephemeral notes organized by section, (3) MongoDB RAG — vector-search-enabled notes with importance scoring, decay, deduplication, and archival, (4) Neo4j knowledge graph — entities, relationships, merge duplicates, reinforce mentions, Cypher queries, (5) File analysis — deep file reading that extracts knowledge into all memory layers, (6) Service initialization — health-check, start/stop MongoDB, Neo4j, TEI embeddings via docker-compose with partial setup support.
coding
Enhanced coding assistance
memory
Unified memory management for notes, knowledge graph, RAG search, and file analysis. Use when working with: (1) Core memory — protected identity, projects, relationships, and system facts that should never be forgotten, (2) Working notes — per-session ephemeral notes organized by section, (3) MongoDB RAG — vector-search-enabled notes with importance scoring, decay, deduplication, and archival, (4) Neo4j knowledge graph — entities, relationships, merge duplicates, reinforce mentions, Cypher queries, (5) File analysis — deep file reading that extracts knowledge into all memory layers, (6) Service initialization — health-check, start/stop MongoDB, Neo4j, TEI embeddings via docker-compose with partial setup support.