Interface Neo4JDatabaseManager

All Superinterfaces:
AutoCloseable, org.eclipse.jnosql.communication.semistructured.DatabaseManager, org.eclipse.jnosql.communication.graph.GraphDatabaseManager

public interface Neo4JDatabaseManager extends org.eclipse.jnosql.communication.graph.GraphDatabaseManager
This specialization of DatabaseManager is designed for Neo4j databases.

Neo4j does not natively support Time-To-Live (TTL) operations, but TTL can be managed using the APOC library. Implementations of this interface should handle TTL-related methods accordingly—either by integrating APOC's TTL features or throwing UnsupportedOperationException if TTL is not supported.

All write operations, including insert and update, will be executed within a transaction. When performing batch inserts using an iterable, the entire operation will be executed as a single transaction to ensure consistency.

 Neo4JDatabaseManager manager = ...; // Obtain an instance
 CommunicationEntity entity = CommunicationEntity.of("User");
 entity.add("name", "Alice");
 entity.add("age", 30);

 manager.insert(entity); // Insert into Neo4j
 

Ensure proper transaction and session management when implementing this interface. Unsupported TTL operations should result in an UnsupportedOperationException.

See Also:
  • DatabaseManager
  • Method Summary

    Modifier and Type
    Method
    Description
    Stream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity>
    cypher(String cypher)
    Executes a custom Cypher query without parameters and returns a stream of CommunicationEntity.
    Stream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity>
    cypher(String cypher, Map<String,Object> parameters)
    Executes a custom Cypher query with parameters and returns a stream of CommunicationEntity.
    void
    edge(org.eclipse.jnosql.communication.semistructured.CommunicationEntity source, String label, org.eclipse.jnosql.communication.semistructured.CommunicationEntity target)
    Creates a relationship (edge) between two CommunicationEntity nodes.
    void
    remove(org.eclipse.jnosql.communication.semistructured.CommunicationEntity source, String label, org.eclipse.jnosql.communication.semistructured.CommunicationEntity target)
    Removes an existing relationship (edge) between two CommunicationEntity nodes.
    Stream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity>
    traverse(String startNodeId, String label, int depth)
    Traverses the graph starting from a node and follows the specified label type up to a given depth.

    Methods inherited from interface org.eclipse.jnosql.communication.semistructured.DatabaseManager

    close, count, count, delete, deleteAndCount, exists, insert, insert, insert, insert, name, prepare, prepare, query, query, select, selectCursor, singleResult, update, update, update

    Methods inherited from interface org.eclipse.jnosql.communication.graph.GraphDatabaseManager

    deleteEdge, edge, findEdgeById
  • Method Details

    • cypher

      Stream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity> cypher(String cypher, Map<String,Object> parameters)
      Executes a custom Cypher query with parameters and returns a stream of CommunicationEntity.
      Parameters:
      cypher - the Cypher query to execute.
      parameters - the parameters to bind to the query.
      Returns:
      a stream of CommunicationEntity representing the query result.
      Throws:
      NullPointerException - if cypher or parameters is null.
    • cypher

      Stream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity> cypher(String cypher)
      Executes a custom Cypher query without parameters and returns a stream of CommunicationEntity.
      Parameters:
      cypher - the Cypher query to execute.
      Returns:
      a stream of CommunicationEntity representing the query result.
      Throws:
      NullPointerException - if cypher is null.
    • traverse

      Stream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity> traverse(String startNodeId, String label, int depth)
      Traverses the graph starting from a node and follows the specified label type up to a given depth.
      Parameters:
      startNodeId - the ID of the starting node.
      label - the type of label to traverse.
      depth - the traversal depth limit.
      Returns:
      a stream of CommunicationEntity representing related nodes.
      Throws:
      NullPointerException - if startNodeId, label, or depth is null.
    • edge

      void edge(org.eclipse.jnosql.communication.semistructured.CommunicationEntity source, String label, org.eclipse.jnosql.communication.semistructured.CommunicationEntity target)
      Creates a relationship (edge) between two CommunicationEntity nodes.
      Parameters:
      source - the source entity.
      target - the target entity.
      label - the type of relationship to create.
      Throws:
      EdgeCommunicationException - if either the source or target entity does not exist in the database.
      NullPointerException - if source, target, or label is null.
    • remove

      void remove(org.eclipse.jnosql.communication.semistructured.CommunicationEntity source, String label, org.eclipse.jnosql.communication.semistructured.CommunicationEntity target)
      Removes an existing relationship (edge) between two CommunicationEntity nodes.
      Specified by:
      remove in interface org.eclipse.jnosql.communication.graph.GraphDatabaseManager
      Parameters:
      source - the source entity, which must already exist in the database.
      target - the target entity, which must already exist in the database.
      label - the type of relationship to remove.
      Throws:
      EdgeCommunicationException - if either the source or target entity does not exist in the database.
      NullPointerException - if source, target, or label is null.