Neo4j Link Service to Resource Type icon

Neo4j Link Service to Resource Type

創建服務 (Service) 與所需資源類型 (ResourceType) 之間的 :REQUIRES_RESOURCE 關係

Neo4j Link Service to Resource Type

AI-generated

Overview

This node creates a relationship in a Neo4j graph database between two existing nodes: a Service node and a ResourceType node. Specifically, it links a Service node to a ResourceType node with a REQUIRES_RESOURCE relationship, indicating that the service requires that particular resource type.

Common scenarios where this node is useful:

  • Modeling dependencies between services and the types of resources they require in a graph database.
  • Building or maintaining a service catalog with resource requirements represented as graph relationships.
  • Automating the creation of service-resource dependency graphs for infrastructure or application management.

Practical example:
If you have a microservice architecture and want to represent which services depend on which resource types (e.g., databases, message queues), this node can create those links in Neo4j by specifying the UUIDs of the service and resource type nodes.


Properties

Name Meaning
Service ID The UUID of the Service node to link from.
Resource Type ID The UUID of the ResourceType node to link to.

Output

The node outputs an array of JSON objects corresponding to each input item processed. Each output item contains:

  • All original input JSON fields.
  • A new field relationshipCreated with the string "REQUIRES_RESOURCE" if the relationship was successfully created.
  • If the relationship could not be created (e.g., nodes not found), an error field describing the failure.

Example successful output JSON:

{
  "serviceId": "uuid-of-service",
  "resourceTypeId": "uuid-of-resource-type",
  "relationshipCreated": "REQUIRES_RESOURCE"
}

Example error output JSON:

{
  "serviceId": "uuid-of-service",
  "resourceTypeId": "uuid-of-resource-type",
  "error": "Relationship creation failed or nodes not found."
}

The node does not output binary data.


Dependencies

  • Requires a Neo4j database accessible via host, port, username, password, and optionally a database name.
  • Requires credentials configured in n8n containing these connection details.
  • Uses the official Neo4j driver to connect and run Cypher queries.
  • The node expects the Service and ResourceType nodes to already exist in the database with properties service_id and type_id respectively.

Troubleshooting

Common issues:

  • Missing or incomplete Neo4j credentials: The node will throw an error if any required credential fields are missing.
  • Neo4j connection failures: Errors establishing connection or verifying connectivity will cause the node to fail.
  • Service or ResourceType nodes not found: If either node with the specified UUID does not exist, the relationship cannot be created.
  • Empty or invalid input parameters: Both Service ID and Resource Type ID must be provided; otherwise, the node throws an error.

Error messages and resolutions:

  • "Neo4j credentials are not fully configured."
    Ensure all required Neo4j connection details (host, port, username, password) are correctly set in the credentials.

  • "Failed to establish Neo4j connection."
    Check network connectivity, Neo4j server status, and credential correctness.

  • "Service ID and Resource Type ID are required."
    Verify that both IDs are provided as inputs for each item.

  • "Relationship creation failed or nodes not found."
    Confirm that nodes with the given UUIDs exist in the database.


Links and References

Discussion