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 TypeMethodDescriptionStream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity>Executes a custom Cypher query without parameters and returns a stream ofCommunicationEntity.Stream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity>Executes a custom Cypher query with parameters and returns a stream ofCommunicationEntity.voidedge(org.eclipse.jnosql.communication.semistructured.CommunicationEntity source, String label, org.eclipse.jnosql.communication.semistructured.CommunicationEntity target) Creates a relationship (edge) between twoCommunicationEntitynodes.voidremove(org.eclipse.jnosql.communication.semistructured.CommunicationEntity source, String label, org.eclipse.jnosql.communication.semistructured.CommunicationEntity target) Removes an existing relationship (edge) between twoCommunicationEntitynodes.Stream<org.eclipse.jnosql.communication.semistructured.CommunicationEntity>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, updateMethods 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 ofCommunicationEntity.- Parameters:
cypher- the Cypher query to execute.parameters- the parameters to bind to the query.- Returns:
- a stream of
CommunicationEntityrepresenting the query result. - Throws:
NullPointerException- ifcypherorparametersis null.
-
cypher
Executes a custom Cypher query without parameters and returns a stream ofCommunicationEntity.- Parameters:
cypher- the Cypher query to execute.- Returns:
- a stream of
CommunicationEntityrepresenting the query result. - Throws:
NullPointerException- ifcypheris 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
CommunicationEntityrepresenting related nodes. - Throws:
NullPointerException- ifstartNodeId,label, ordepthis 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 twoCommunicationEntitynodes.- 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- ifsource,target, orlabelis 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 twoCommunicationEntitynodes.- Specified by:
removein interfaceorg.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- ifsource,target, orlabelis null.
-