# Neo4j (/integrations/neo4j)





{/* MANUAL-CONTENT-START:intro */}

Use [Neo4j](https://neo4j.com) in Sim to query graph data with Cypher and create, merge, update, or delete nodes and relationships. Pass query results to later workflow steps for processing or storage.

{/* MANUAL-CONTENT-END */}

## Use the block [#usage-instructions]

Query, create, merge, update, and delete nodes and relationships.

## Actions [#actions]

### Neo4j Query [#neo4j-query]

Execute MATCH queries to read nodes and relationships from Neo4j graph database. For best performance and to prevent large result sets, include LIMIT in your query (e.g., "MATCH (n:User) RETURN n LIMIT 100") or use LIMIT $limit with a limit parameter.

<ReferenceDetails>
  #### Input [#input]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `host` | string | Yes | Neo4j server hostname or IP address |
  | `port` | number | Yes | Neo4j server port (default: 7687 for Bolt protocol) |
  | `database` | string | Yes | Database name to connect to (e.g., "neo4j", "movies", "social") |
  | `username` | string | Yes | Neo4j username |
  | `password` | string | Yes | Neo4j password |
  | `encryption` | string | No | Connection encryption mode (enabled, disabled) |
  | `cypherQuery` | string | Yes | Cypher query to execute (e.g., "MATCH (n:Person) RETURN n LIMIT 10", "MATCH (a)-\[r]->(b) WHERE a.name = $name RETURN a, r, b") |
  | `parameters` | object | No | Parameters for the Cypher query as a JSON object. Use for any dynamic values including LIMIT (e.g., query: "MATCH (n) RETURN n LIMIT $limit", parameters: \{limit: 100}). |

  #### Output [#output]

  | Parameter | Type | Description |
  | - | - | - |
  | `message` | string | Operation status message |
  | `records` | array | Array of records returned from the query |
  | `recordCount` | number | Number of records returned |
  | `summary` | json | Query execution summary with timing and counters |
</ReferenceDetails>

### Neo4j Create [#neo4j-create]

Execute CREATE statements to add new nodes and relationships to Neo4j graph database

<ReferenceDetails>
  #### Input [#input-1]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `host` | string | Yes | Neo4j server hostname or IP address |
  | `port` | number | Yes | Neo4j server port (default: 7687 for Bolt protocol) |
  | `database` | string | Yes | Database name to connect to (e.g., "neo4j", "movies", "social") |
  | `username` | string | Yes | Neo4j username |
  | `password` | string | Yes | Neo4j password |
  | `encryption` | string | No | Connection encryption mode (enabled, disabled) |
  | `cypherQuery` | string | Yes | Cypher CREATE statement to execute (e.g., "CREATE (n:Person \{name: $name, age: $age})", "CREATE (a)-\[:KNOWS]->(b)") |
  | `parameters` | object | No | Parameters for the Cypher query as a JSON object (e.g., \{"name": "Alice", "age": 30}) |

  #### Output [#output-1]

  | Parameter | Type | Description |
  | - | - | - |
  | `message` | string | Operation status message |
  | `summary` | json | Creation summary with counters for nodes and relationships created |
</ReferenceDetails>

### Neo4j Merge [#neo4j-merge]

Execute MERGE statements to find or create nodes and relationships in Neo4j (upsert operation)

<ReferenceDetails>
  #### Input [#input-2]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `host` | string | Yes | Neo4j server hostname or IP address |
  | `port` | number | Yes | Neo4j server port (default: 7687 for Bolt protocol) |
  | `database` | string | Yes | Database name to connect to (e.g., "neo4j", "movies", "social") |
  | `username` | string | Yes | Neo4j username |
  | `password` | string | Yes | Neo4j password |
  | `encryption` | string | No | Connection encryption mode (enabled, disabled) |
  | `cypherQuery` | string | Yes | Cypher MERGE statement to execute (e.g., "MERGE (n:Person \{name: $name}) ON CREATE SET n.created = timestamp()", "MERGE (a)-\[r:KNOWS]->(b)") |
  | `parameters` | object | No | Parameters for the Cypher query as a JSON object (e.g., \{"name": "Alice", "email": "[alice@example.com](mailto:alice@example.com)"}) |

  #### Output [#output-2]

  | Parameter | Type | Description |
  | - | - | - |
  | `message` | string | Operation status message |
  | `summary` | json | Merge summary with counters for nodes/relationships created or matched |
</ReferenceDetails>

### Neo4j Update [#neo4j-update]

Execute SET statements to update properties of existing nodes and relationships in Neo4j

<ReferenceDetails>
  #### Input [#input-3]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `host` | string | Yes | Neo4j server hostname or IP address |
  | `port` | number | Yes | Neo4j server port (default: 7687 for Bolt protocol) |
  | `database` | string | Yes | Database name to connect to (e.g., "neo4j", "movies", "social") |
  | `username` | string | Yes | Neo4j username |
  | `password` | string | Yes | Neo4j password |
  | `encryption` | string | No | Connection encryption mode (enabled, disabled) |
  | `cypherQuery` | string | Yes | Cypher query with MATCH and SET statements to update properties (e.g., "MATCH (n:Person \{name: $name}) SET n.age = $age", "MATCH (n) WHERE n.id = $id SET n += $props") |
  | `parameters` | object | No | Parameters for the Cypher query as a JSON object (e.g., \{"name": "Alice", "age": 31, "props": \{"city": "NYC"}}) |

  #### Output [#output-3]

  | Parameter | Type | Description |
  | - | - | - |
  | `message` | string | Operation status message |
  | `summary` | json | Update summary with counters for properties set |
</ReferenceDetails>

### Neo4j Delete [#neo4j-delete]

Execute DELETE or DETACH DELETE statements to remove nodes and relationships from Neo4j

<ReferenceDetails>
  #### Input [#input-4]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `host` | string | Yes | Neo4j server hostname or IP address |
  | `port` | number | Yes | Neo4j server port (default: 7687 for Bolt protocol) |
  | `database` | string | Yes | Database name to connect to (e.g., "neo4j", "movies", "social") |
  | `username` | string | Yes | Neo4j username |
  | `password` | string | Yes | Neo4j password |
  | `encryption` | string | No | Connection encryption mode (enabled, disabled) |
  | `cypherQuery` | string | Yes | Cypher query with MATCH and DELETE/DETACH DELETE statements (e.g., "MATCH (n:Person \{name: $name}) DELETE n", "MATCH (n) DETACH DELETE n") |
  | `parameters` | object | No | Parameters for the Cypher query as a JSON object (e.g., \{"name": "Alice", "id": 123}) |
  | `detach` | boolean | No | Whether to use DETACH DELETE to remove relationships before deleting nodes |

  #### Output [#output-4]

  | Parameter | Type | Description |
  | - | - | - |
  | `message` | string | Operation status message |
  | `summary` | json | Delete summary with counters for nodes and relationships deleted |
</ReferenceDetails>

### Neo4j Execute [#neo4j-execute]

Execute arbitrary Cypher queries on Neo4j graph database for complex operations

<ReferenceDetails>
  #### Input [#input-5]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `host` | string | Yes | Neo4j server hostname or IP address |
  | `port` | number | Yes | Neo4j server port (default: 7687 for Bolt protocol) |
  | `database` | string | Yes | Database name to connect to (e.g., "neo4j", "movies", "social") |
  | `username` | string | Yes | Neo4j username |
  | `password` | string | Yes | Neo4j password |
  | `encryption` | string | No | Connection encryption mode (enabled, disabled) |
  | `cypherQuery` | string | Yes | Cypher query to execute (e.g., "CALL db.labels()", "MATCH (n) RETURN count(n)", "CREATE INDEX FOR (n:Person) ON (n.name)") |
  | `parameters` | object | No | Parameters for the Cypher query as a JSON object (e.g., \{"name": "Alice", "limit": 100}) |

  #### Output [#output-5]

  | Parameter | Type | Description |
  | - | - | - |
  | `message` | string | Operation status message |
  | `records` | array | Array of records returned from the query |
  | `recordCount` | number | Number of records returned |
  | `summary` | json | Execution summary with timing and counters |
</ReferenceDetails>

### Neo4j Introspect [#neo4j-introspect]

Introspect a Neo4j database to discover its schema including node labels, relationship types, properties, constraints, and indexes.

<ReferenceDetails>
  #### Input [#input-6]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `host` | string | Yes | Neo4j server hostname or IP address |
  | `port` | number | Yes | Neo4j server port (default: 7687 for Bolt protocol) |
  | `database` | string | Yes | Database name to connect to (e.g., "neo4j", "movies", "social") |
  | `username` | string | Yes | Neo4j username |
  | `password` | string | Yes | Neo4j password |
  | `encryption` | string | No | Connection encryption mode (enabled, disabled) |

  #### Output [#output-6]

  | Parameter | Type | Description |
  | - | - | - |
  | `message` | string | Operation status message |
  | `labels` | array | Array of node labels in the database |
  | `relationshipTypes` | array | Array of relationship types in the database |
  | `nodeSchemas` | array | Array of node schemas with their properties |
  | `relationshipSchemas` | array | Array of relationship schemas with their properties |
  | `constraints` | array | Array of database constraints |
  | `indexes` | array | Array of database indexes |
</ReferenceDetails>
