← 返回 Skills 市场
fisa712

Knowledge Graph - Neo4j Integration

作者 Muhammad Asif · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
43
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install neo4j-integration
功能描述
Connect to Neo4j graph databases and execute Cypher queries for storing, querying, and managing knowledge graph data using the property graph model. Full sup...
使用说明 (SKILL.md)

Neo4j Integration

Connect to Neo4j graph databases and execute Cypher queries for efficient knowledge graph management.

This skill enables seamless interaction with Neo4j graph databases using the official Python driver. It provides connection management, query execution, transaction support, and result mapping for the property graph model.

Quick Start

Use When

  • Working with Neo4j-backed knowledge graphs
  • Executing Cypher queries on graph data
  • Creating or updating nodes and relationships
  • Importing graph data into Neo4j
  • Querying graph structures with complex patterns
  • Managing graph database transactions
  • Creating indexes for performance optimization
  • Building production graph applications

Inputs

  • Neo4j connection credentials (URI, username, password)
  • Cypher queries with optional parameters
  • Node/relationship definitions
  • Bulk data for import
  • Transaction context

Outputs

  • Query results (nodes, relationships, properties)
  • Execution statistics and metrics
  • Success/failure status
  • Record counts and performance data

Connection & Authentication

Supported Protocols

bolt://        - Unencrypted connection
neo4j://       - Standard connection (recommended)
neo4j+s://     - TLS-encrypted connection
neo4j+ssc://   - Self-signed certificate

Connection Configuration

config = {
    "uri": "neo4j://localhost:7687",
    "username": "neo4j",
    "password": "secure_password",
    "encrypted": True,
    "trust": "TRUST_ALL_CERTIFICATES"
}

Connection Pool

  • Default pool size: 50 connections
  • Configurable connection limits
  • Automatic connection recycling
  • Health checks for stale connections

Property Graph Model

Neo4j uses a property graph model with three core elements:

1. Nodes

Represent entities with labels and properties.

CREATE (p:Person {name: "Alice", age: 30, email: "[email protected]"})
CREATE (c:Company {name: "TechCorp", industry: "Technology"})

Properties:

  • Name: String identifier
  • Properties: Key-value pairs
  • Labels: Type classification (Person, Company, etc.)

2. Relationships

Connect nodes with typed, directed edges and properties.

CREATE (a:Person)-[:WORKS_AT {since: 2020}]->(c:Company)
CREATE (a:Person)-[:KNOWS {strength: 0.8}]->(b:Person)

Characteristics:

  • Direction: Start node → End node
  • Type: Uppercase name (WORKS_AT, KNOWS, etc.)
  • Properties: Optional metadata
  • Can be traversed in both directions with \x3C-

3. Properties

Attributes on nodes and relationships.

String: "text value"
Integer: 42
Float: 3.14
Boolean: true/false
DateTime: timestamp
List: [1, 2, 3]

Core Cypher Query Patterns

MATCH - Find Data

MATCH (p:Person) WHERE p.age > 30 RETURN p.name, p.age

CREATE - Add Data

CREATE (p:Person {name: "Bob", age: 25}) RETURN p

MERGE - Create or Update

MERGE (p:Person {name: "Alice"}) SET p.age = 31 RETURN p

MATCH + CREATE - Add Relationships

MATCH (a:Person {name: "Alice"}), (b:Person {name: "Bob"})
CREATE (a)-[:KNOWS]->(b) RETURN a, b

DELETE - Remove Data

MATCH (p:Person {name: "Old Person"}) DELETE p

RETURN + ORDER BY + LIMIT

MATCH (p:Person) RETURN p ORDER BY p.age DESC LIMIT 10

Advanced Query Features

Aggregations

MATCH (p:Person) RETURN COUNT(p), AVG(p.age), MAX(p.age)

Collection Functions

MATCH (p:Person)-[:KNOWS]->(friends:Person)
RETURN p.name, COLLECT(friends.name) AS friend_list

Conditional Logic

MATCH (p:Person) 
RETURN p.name, CASE WHEN p.age > 30 THEN "Senior" ELSE "Junior" END AS level

Path Queries

MATCH path = (a:Person)-[:KNOWS*1..3]->(b:Person)
WHERE a.name = "Alice" AND b.name = "Bob"
RETURN path, LENGTH(path) AS hops

Graph Algorithms

MATCH (n:Person) WHERE exists(n.pagerank) RETURN n ORDER BY n.pagerank DESC

Transaction Management

Simple Transaction

BEGIN
CREATE (p:Person {name: "Alice"})
CREATE (c:Company {name: "TechCorp"})
COMMIT

Rollback on Error

BEGIN
CREATE (p:Person {name: "Alice"})
ROLLBACK

Properties

  • Atomicity: All-or-nothing execution
  • Consistency: Graph constraints maintained
  • Isolation: ACID compliance
  • Durability: Persistent storage

Indexes & Performance

Create Index

CREATE INDEX person_name FOR (p:Person) ON (p.name)
CREATE INDEX company_id FOR (c:Company) ON (c.id)

Index Types

  • Range Index - Efficient for range queries
  • Full-text Index - Text search capability
  • Lookup Index - Universal index
  • Unique Index - Constraint enforcement

Query Optimization

  1. Use indexes on filtered properties - WHERE clauses
  2. Avoid cartesian products - Join on common properties
  3. Limit result sets - Use LIMIT clause
  4. Batch imports - Load data in chunks
  5. Profile queries - EXPLAIN/PROFILE for analysis

Bulk Operations

Import CSV

LOAD CSV WITH HEADERS FROM "file:///data.csv" AS row
CREATE (p:Person {name: row.name, age: toInteger(row.age)})

Batch Create

UNWIND $nodes AS node
CREATE (n {id: node.id, name: node.name})

Batch Update

UNWIND $updates AS update
MATCH (p:Person {id: update.id})
SET p.age = update.age

Result Mapping

Simple Results

MATCH (p:Person) RETURN p.name, p.age

Maps to:

[
    {"name": "Alice", "age": 30},
    {"name": "Bob", "age": 25}
]

Node Results

MATCH (p:Person) RETURN p

Maps to Python Node objects with:

  • id: Node internal ID
  • labels: List of labels
  • properties: Dict of properties

Relationship Results

MATCH (a)-[r]->(b) RETURN r

Maps to Relationship objects with:

  • id: Relationship internal ID
  • type: Relationship type
  • properties: Dict of properties
  • start_node_id: Source node ID
  • end_node_id: Target node ID

Error Handling

Common Errors

Error Cause Solution
Connection refused Neo4j not running Start Neo4j server
Authentication failed Wrong credentials Verify username/password
Syntax error Invalid Cypher Check query syntax
Constraint violation Duplicate/invalid data Check constraints
Timeout Query too slow Add indexes, optimize query
Out of memory Too much data Batch operations, paginate

Retry Logic

  • Connection failures: Automatic retry with exponential backoff
  • Transient errors: Configurable retry attempts
  • Circuit breaker: Fail fast on persistent failures

Best Practices

Use parameterized queries - Prevent injection attacks
Create appropriate indexes - Improve query performance
Batch large imports - Avoid memory exhaustion
Use transactions - Ensure data consistency
Profile queries - Identify performance bottlenecks
Close connections - Prevent resource leaks
Limit result sets - Avoid network overhead
Normalize node names - Prevent duplicate nodes
Document schemas - Maintain data governance
Monitor database - Track performance metrics

Integration Points

This skill integrates with:

  • GraphQL Graph Mapping - Expose Neo4j via GraphQL
  • Graph Query Optimization - Optimize Cypher queries
  • Schema Validation - Validate graph structure
  • CSV Graph Loader - Import CSV to Neo4j
  • Constraint Generator - Define database constraints
  • REST API Wrapper - Expose Neo4j as REST API

Recommended Libraries

Neo4j Python Driver

  • neo4j - Official driver (4.x/5.x)
  • neomodel - Python ORM for Neo4j
  • py2neo - Pythonic interface

Query Building

  • cypher-dsl-python - Build Cypher programmatically
  • ipython-cypher - Jupyter integration

Data Processing

  • pandas - Data frame operations
  • polars - Efficient data loading
  • networkx - Graph analysis

Visualization

  • graphistry - Interactive graph visualization
  • pyvis - Network visualization
  • neovis.js - Neo4j visualization

Related Skills

  • RDF Triple Store Integration - Alternative graph database
  • TigerGraph Connector - Distributed graph platform
  • JanusGraph Connector - Scalable graph database
  • GraphQL Graph Mapping - API layer on Neo4j
  • Graph Query Optimization - Improve query performance

Version: 1.0.0

安全使用建议
Review this skill carefully before installing. It does not appear to steal data or run hidden code, but do not rely on its Python connector for real Neo4j production work until it is replaced with an actual Neo4j driver implementation and destructive query examples are handled with explicit safeguards.
能力评估
Purpose & Capability
The stated purpose is a production Neo4j integration with real connection management, Cypher execution, transactions, indexes, bulk operations, and result mapping, but the Python connector uses simulated connections and canned query results.
Instruction Scope
The instructions encourage live database operations, including CREATE, MERGE, DELETE, indexes, transactions, and bulk import, without clearly warning users that examples can mutate or delete real data.
Install Mechanism
No install hooks, package installation steps, background services, or obfuscated setup behavior were found; static scan and VirusTotal telemetry were clean.
Credentials
Requesting Neo4j credentials and presenting production-readiness is disproportionate to a connector that does not actually use the official driver or verify database state.
Persistence & Privilege
The skill does not show local persistence, privilege escalation, or autonomous background execution, but it does describe database mutation and transaction authority that the included implementation does not faithfully provide.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install neo4j-integration
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /neo4j-integration 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of neo4j-integration skill. - Connects to Neo4j graph databases using the property graph model. - Supports Cypher query execution, transactions, indexing, and bulk operations. - Provides result mapping for nodes, relationships, and properties. - Includes comprehensive documentation for setup, usage, error handling, and best practices. - Compatible with standard, encrypted, and self-signed Neo4j connection protocols.
元数据
Slug neo4j-integration
版本 1.0.0
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Knowledge Graph - Neo4j Integration 是什么?

Connect to Neo4j graph databases and execute Cypher queries for storing, querying, and managing knowledge graph data using the property graph model. Full sup... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 43 次。

如何安装 Knowledge Graph - Neo4j Integration?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install neo4j-integration」即可一键安装,无需额外配置。

Knowledge Graph - Neo4j Integration 是免费的吗?

是的,Knowledge Graph - Neo4j Integration 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Knowledge Graph - Neo4j Integration 支持哪些平台?

Knowledge Graph - Neo4j Integration 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Knowledge Graph - Neo4j Integration?

由 Muhammad Asif(@fisa712)开发并维护,当前版本 v1.0.0。

💬 留言讨论