Skip to content

Commit 262a680

Browse files
committed
feat: update neo4jdatbase
Signed-off-by: Otavio Santana <[email protected]>
1 parent 40edf14 commit 262a680

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

jnosql-neo4j/src/main/java/org/eclipse/jnosql/databases/neo4j/communication/DefaultNeo4JDatabaseManager.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ public Stream<CommunicationEntity> executeQuery(String cypher, Map<String, Objec
179179
}
180180

181181
@Override
182-
public Stream<CommunicationEntity> traverse(String startNodeId, String relationship, int depth) {
182+
public Stream<CommunicationEntity> traverse(String startNodeId, String label, int depth) {
183183
Objects.requireNonNull(startNodeId, "Start node ID is required");
184-
Objects.requireNonNull(relationship, "Relationship type is required");
184+
Objects.requireNonNull(label, "Relationship type is required");
185185

186186
String cypher = "MATCH (startNode) WHERE elementId(startNode) = $elementId " +
187-
"MATCH (startNode)-[r:" + relationship + "*1.." + depth + "]-(endNode) " +
187+
"MATCH (startNode)-[r:" + label + "*1.." + depth + "]-(endNode) " +
188188
"RETURN endNode";
189189

190190
try (Transaction tx = session.beginTransaction()) {
@@ -198,14 +198,14 @@ public Stream<CommunicationEntity> traverse(String startNodeId, String relations
198198
}
199199

200200
@Override
201-
public void edge(CommunicationEntity source, String relationshipType, CommunicationEntity target) {
201+
public void edge(CommunicationEntity source, String label, CommunicationEntity target) {
202202
Objects.requireNonNull(source, "Source entity is required");
203203
Objects.requireNonNull(target, "Target entity is required");
204-
Objects.requireNonNull(relationshipType, "Relationship type is required");
204+
Objects.requireNonNull(label, "Relationship type is required");
205205

206206
String cypher = "MATCH (s) WHERE elementId(s) = $sourceElementId " +
207207
"MATCH (t) WHERE elementId(t) = $targetElementId " +
208-
"CREATE (s)-[r:" + relationshipType + "]->(t)";
208+
"CREATE (s)-[r:" + label + "]->(t)";
209209

210210
try (Transaction tx = session.beginTransaction()) {
211211
var sourceId = source.find(ID).orElseThrow(() ->
@@ -224,14 +224,14 @@ public void edge(CommunicationEntity source, String relationshipType, Communicat
224224
}
225225

226226
@Override
227-
public void remove(CommunicationEntity source, String relationshipType, CommunicationEntity target) {
227+
public void remove(CommunicationEntity source, String label, CommunicationEntity target) {
228228
Objects.requireNonNull(source, "Source entity is required");
229229
Objects.requireNonNull(target, "Target entity is required");
230-
Objects.requireNonNull(relationshipType, "Relationship type is required");
230+
Objects.requireNonNull(label, "Relationship type is required");
231231

232232
String cypher = "MATCH (s) WHERE elementId(s) = $sourceElementId " +
233233
"MATCH (t) WHERE elementId(t) = $targetElementId " +
234-
"MATCH (s)-[r:" + relationshipType + "]-(t) DELETE r";
234+
"MATCH (s)-[r:" + label + "]-(t) DELETE r";
235235

236236
var sourceId = source.find(ID).orElseThrow(() ->
237237
new EdgeCommunicationException("The source entity should have the " + ID + " property")).get();

jnosql-neo4j/src/main/java/org/eclipse/jnosql/databases/neo4j/communication/Neo4JDatabaseManager.java

+10-10
Original file line numberDiff line numberDiff line change
@@ -61,35 +61,35 @@ public interface Neo4JDatabaseManager extends DatabaseManager {
6161
Stream<CommunicationEntity> executeQuery(String cypher, Map<String, Object> parameters);
6262

6363
/**
64-
* Traverses the graph starting from a node and follows the specified relationship type up to a given depth.
64+
* Traverses the graph starting from a node and follows the specified label type up to a given depth.
6565
*
6666
* @param startNodeId the ID of the starting node.
67-
* @param relationship the type of relationship to traverse.
67+
* @param label the type of label to traverse.
6868
* @param depth the traversal depth limit.
6969
* @return a stream of {@link CommunicationEntity} representing related nodes.
70-
* @throws NullPointerException if {@code startNodeId}, {@code relationship}, or {@code depth} is null.
70+
* @throws NullPointerException if {@code startNodeId}, {@code label}, or {@code depth} is null.
7171
*/
72-
Stream<CommunicationEntity> traverse(String startNodeId, String relationship, int depth);
72+
Stream<CommunicationEntity> traverse(String startNodeId, String label, int depth);
7373

7474
/**
7575
* Creates a relationship (edge) between two {@link CommunicationEntity} nodes.
7676
*
7777
* @param source the source entity.
7878
* @param target the target entity.
79-
* @param relationshipType the type of relationship to create.
79+
* @param label the type of relationship to create.
8080
* @throws EdgeCommunicationException if either the source or target entity does not exist in the database.
81-
* @throws NullPointerException if {@code source}, {@code target}, or {@code relationshipType} is null.
81+
* @throws NullPointerException if {@code source}, {@code target}, or {@code label} is null.
8282
*/
83-
void edge(CommunicationEntity source, String relationshipType, CommunicationEntity target);
83+
void edge(CommunicationEntity source, String label, CommunicationEntity target);
8484

8585
/**
8686
* Removes an existing relationship (edge) between two {@link CommunicationEntity} nodes.
8787
*
8888
* @param source the source entity, which must already exist in the database.
8989
* @param target the target entity, which must already exist in the database.
90-
* @param relationshipType the type of relationship to remove.
90+
* @param label the type of relationship to remove.
9191
* @throws EdgeCommunicationException if either the source or target entity does not exist in the database.
92-
* @throws NullPointerException if {@code source}, {@code target}, or {@code relationshipType} is null.
92+
* @throws NullPointerException if {@code source}, {@code target}, or {@code label} is null.
9393
*/
94-
void remove(CommunicationEntity source, String relationshipType, CommunicationEntity target);
94+
void remove(CommunicationEntity source, String label, CommunicationEntity target);
9595
}

0 commit comments

Comments
 (0)