Neo4j icon

Neo4j

Interact with a Neo4j graph database

Create Relationship

AI-generated

Overview

This node enables interaction with a Neo4j graph database, specifically allowing users to create relationships between nodes. It is useful in scenarios where you want to model and store connections or associations between entities, such as social networks (e.g., "Person KNOWS Person"), organizational structures (e.g., "Employee WORKS_AT Company"), or any domain where relationships between data points are important.

For example, you can use this node to:

  • Link a person node to a company node with a "WORKS_AT" relationship.
  • Connect two people with a "KNOWS" relationship.
  • Define custom relationships with properties like roles or timestamps.

Properties

Name Meaning
Start Node Match Labels Optional labels to identify the starting node of the relationship (e.g., "Person").
Start Node Match Properties Required JSON object defining unique properties to find the starting node (e.g., {"ID": "123"}).
End Node Match Labels Optional labels to identify the ending node of the relationship (e.g., "Company").
End Node Match Properties Required JSON object defining unique properties to find the ending node (e.g., {"ID": "456"}).
Relationship Type Required string specifying the type of the relationship (e.g., "KNOWS", "WORKS_AT"). Must be valid Neo4j type name.
Relationship Properties Optional JSON object containing properties for the relationship itself (e.g., {"since": "2023", "role": "Developer"}).
Options > Return Data Boolean option to specify whether to return the created relationship's element ID, type, and properties.

Output

The node outputs JSON data representing the created relationship if the "Return Data" option is enabled. This output typically includes:

  • The unique identifier of the created relationship.
  • The type/name of the relationship.
  • Any properties assigned to the relationship.

If binary data were involved (not applicable here), it would summarize the meaning of that data, but this node focuses on JSON output describing graph relationships.

Dependencies

  • Requires connection to a Neo4j graph database.
  • Needs an API key credential or equivalent authentication configured in n8n to access the Neo4j instance.
  • The node depends on internal routing and operation modules to handle the execution logic.

Troubleshooting

  • Common Issues:
    • Failure to uniquely identify start or end nodes due to incorrect or incomplete match properties.
    • Invalid relationship type names (must only contain letters, numbers, and underscores).
    • Connection errors if the Neo4j credentials or endpoint are misconfigured.
  • Error Messages:
    • Errors indicating missing required properties usually mean the JSON objects for node matching are empty or malformed.
    • Authentication errors suggest issues with the provided API key or credentials.
  • Resolutions:
    • Ensure that the start and end node match properties correctly identify existing nodes in the database.
    • Validate the relationship type string against Neo4j naming rules.
    • Verify and update credentials and network connectivity settings.

Links and References

Discussion