Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit dfe6b8c

Browse files
committed
tests fixes
1 parent f9420b6 commit dfe6b8c

File tree

6 files changed

+198
-310
lines changed

6 files changed

+198
-310
lines changed

src/main/java/com/arangodb/tinkerpop/gremlin/client/ArangoDBGraphClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ public Iterator<VertexData> getVertexNeighbors(String vertexId, List<String> edg
489489
bindVars.put("graph", graph.name());
490490
bindVars.put("edgeCollections", edgeCollections);
491491
String query = "FOR v IN 1..1 " + getArangoDirectionFromGremlinDirection(direction).getAqlName() +
492-
" @start GRAPH @graph OPTIONS { edgeCollections: @edgeCollections, uniqueVertices: 'global', order: 'bfs' } RETURN v";
492+
" @start GRAPH @graph OPTIONS { edgeCollections: @edgeCollections, order: 'bfs' } RETURN v";
493493
return executeAqlQuery(query, bindVars, null, VertexData.class);
494494
}
495495

src/main/java/com/arangodb/tinkerpop/gremlin/client/ArangoDBQueryBuilder.java

Lines changed: 0 additions & 297 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@
88

99
package com.arangodb.tinkerpop.gremlin.client;
1010

11-
import java.util.ArrayList;
1211
import java.util.List;
1312
import java.util.Map;
14-
import java.util.Optional;
1513

16-
import org.apache.commons.collections4.CollectionUtils;
17-
import org.apache.commons.lang3.StringUtils;
1814
import org.slf4j.Logger;
1915
import org.slf4j.LoggerFactory;
2016

@@ -74,83 +70,6 @@ String getAqlName() {
7470

7571
}
7672

77-
/**
78-
* Options for vertices in Graph Traversals.
79-
*
80-
* @author Horacio Hoyos Rodriguez (@horaciohoyosr)
81-
*/
82-
83-
enum UniqueVertices {
84-
85-
/** It is guaranteed that there is no path returned with a duplicate vertex. */
86-
PATH("path"),
87-
88-
/** it is guaranteed that each vertex is visited at most once during the traversal, no
89-
* matter how many paths lead from the start vertex to this one. */
90-
GLOBAL("global"),
91-
92-
/** No uniqueness check is applied on vertices - (default). */
93-
NONE("none");
94-
95-
/** The aql name. */
96-
private final String aqlName;
97-
98-
/**
99-
* Instantiates a new unique vertices.
100-
*
101-
* @param aqlName the aql name
102-
*/
103-
UniqueVertices(String aqlName) {
104-
this.aqlName = aqlName;
105-
}
106-
107-
/**
108-
* Gets the aql name.
109-
*
110-
* @return the aql name
111-
*/
112-
String getAqlName() {
113-
return aqlName;
114-
}
115-
}
116-
117-
/**
118-
* Options for edges in Graph Traversals.
119-
*
120-
* @author Horacio Hoyos Rodriguez (@horaciohoyosr)
121-
*/
122-
123-
enum UniqueEdges {
124-
125-
/** It is guaranteed that there is no path returned with a duplicate edge - (default). */
126-
PATH("path"),
127-
128-
/** No uniqueness check is applied on edges. <b>Note</b>: Using this configuration the
129-
* traversal will follow cycles in edges. */
130-
NONE("none");
131-
132-
/** The aql name. */
133-
private final String aqlName;
134-
135-
/**
136-
* Instantiates a new unique edges.
137-
*
138-
* @param aqlName the aql name
139-
*/
140-
UniqueEdges(String aqlName) {
141-
this.aqlName = aqlName;
142-
}
143-
144-
/**
145-
* Gets the aql name.
146-
*
147-
* @return the aql name
148-
*/
149-
String getAqlName() {
150-
return aqlName;
151-
}
152-
}
153-
15473
/**
15574
* Create a new QueryBuilder with config of whether Collection Names should be prefixed with Graph name or not.
15675
*/
@@ -206,26 +125,6 @@ public ArangoDBQueryBuilder documentsById(
206125
return this;
207126
}
208127

209-
/**
210-
* Append a Document statement to find a single element in the graph. This segment should be
211-
* used in conjunction with the {@link #with(List, Map)} segment.
212-
*
213-
* @param id the id to look for
214-
* @param loopVariable the loop variable name
215-
* @param bindVars the the map of bind parameters
216-
* @return a reference to this object.
217-
*/
218-
219-
public ArangoDBQueryBuilder documentById(
220-
String id,
221-
String loopVariable,
222-
Map<String, Object> bindVars) {
223-
queryBuilder.append(String.format("LET %s = Document(@id)\n", loopVariable));
224-
bindVars.put("id", id);
225-
logger.debug("documentById", queryBuilder.toString());
226-
return this;
227-
}
228-
229128
/**
230129
* Append an union segment.
231130
* @param collections the collections that participate in the union
@@ -274,202 +173,6 @@ public ArangoDBQueryBuilder iterateCollection(
274173
return this;
275174
}
276175

277-
/**
278-
* Add a graph iteration segment.
279-
* @param graphName the graph name
280-
* @param vertexVariable the vertex variable
281-
* @param edgeVariable the edge variable
282-
* @param pathVariable the path variable
283-
* @param min edges and vertices returned by this query will start at the traversal depth of min
284-
* @param max up to max length paths are traversed
285-
* @param direction follow edges pointing in the direction
286-
* @param startVertex the start vertex id
287-
* @param bindVars the map of bind parameters
288-
*
289-
* @return a reference to this object.
290-
*/
291-
292-
public ArangoDBQueryBuilder iterateGraph(
293-
String graphName,
294-
String vertexVariable,
295-
Optional<String> edgeVariable,
296-
Optional<String> pathVariable,
297-
Optional<Integer> min,
298-
Optional<Integer> max,
299-
Direction direction,
300-
String startVertex,
301-
Map<String, Object> bindVars) {
302-
queryBuilder.append(String.format("FOR %s", vertexVariable));
303-
if (edgeVariable.isPresent()) {
304-
queryBuilder.append(String.format(", %s", edgeVariable.get()));
305-
}
306-
if (pathVariable.isPresent()) {
307-
queryBuilder.append(String.format(", %s", pathVariable.get()));
308-
}
309-
queryBuilder.append("\n IN ");
310-
if (min.isPresent()) {
311-
queryBuilder.append(min.get());
312-
if (max.isPresent()) {
313-
queryBuilder.append(String.format("..%s", max.get()));
314-
}
315-
queryBuilder.append(" ");
316-
}
317-
queryBuilder.append(direction.getAqlName()).append(" @startVertex\n")
318-
.append(" GRAPH '").append(graphName).append("'\n"); // FIXME Graph could be a parameter
319-
bindVars.put("startVertex", startVertex);
320-
logger.debug("iterateGraph", queryBuilder.toString());
321-
return this;
322-
}
323-
324-
/**
325-
* Iterate over a collection of edges.
326-
* @param graphName the graph name
327-
* @param vertexVariable the vertex variable
328-
* @param edgeVariable the edge variable
329-
* @param pathVariable the path variable
330-
* @param min edges and vertices returned by this query will start at the traversal depth of min
331-
* @param max up to max length paths are traversed
332-
* @param direction follow edges pointing in the direction
333-
* @param edgeCollections the edge collections
334-
* @param startVertex the start vertex id
335-
* @param bindVars the map of bind parameters
336-
*
337-
* @return a reference to this object.
338-
*/
339-
340-
public ArangoDBQueryBuilder iterateEdges(
341-
String graphName,
342-
String vertexVariable,
343-
Optional<String> edgeVariable,
344-
Optional<String> pathVariable,
345-
Optional<Integer> min,
346-
Optional<Integer> max,
347-
Direction direction,
348-
List<String> edgeCollections,
349-
String startVertex, Map<String, Object> bindVars) {
350-
queryBuilder.append(String.format("FOR %s", vertexVariable));
351-
edgeVariable.ifPresent(ev -> queryBuilder.append(String.format(", %s", ev)));
352-
pathVariable.ifPresent(pv -> queryBuilder.append(String.format(", %s", pv)));
353-
queryBuilder.append("\n IN ");
354-
min.ifPresent(queryBuilder::append);
355-
max.ifPresent(m -> queryBuilder.append(String.format("..%s", m)));
356-
queryBuilder.append(direction.getAqlName()).append(" @startVertex\n");
357-
String separator = "";
358-
for (String c : edgeCollections) {
359-
queryBuilder.append(separator);
360-
separator = ", ";
361-
queryBuilder.append(String.format("@@col%s", iterateCnt));
362-
bindVars.put(String.format("@col%s", iterateCnt++), c);
363-
}
364-
bindVars.put("@startVertex", startVertex);
365-
logger.debug("iterateGraph", queryBuilder.toString());
366-
return this;
367-
}
368-
369-
/**
370-
* Add a Graph options segment.
371-
*
372-
* @see UniqueVertices
373-
* @see UniqueEdges
374-
* @param onVertices the vertices options
375-
* @param onEdges the edges options
376-
* @param bfs if true, the traversal will be executed breadth-first, else it will
377-
* be executed depth-first.
378-
* @return a reference to this object.
379-
*/
380-
381-
public ArangoDBQueryBuilder graphOptions(
382-
Optional<UniqueVertices> onVertices,
383-
Optional<UniqueEdges> onEdges,
384-
boolean bfs) {
385-
if (onVertices.isPresent() || onEdges.isPresent() || bfs) {
386-
queryBuilder.append(" OPTIONS {");
387-
if (onVertices.isPresent()) {
388-
queryBuilder.append(String.format("uniqueVertices: '%s', ", onVertices.get().getAqlName()));
389-
}
390-
if (onEdges.isPresent()) {
391-
queryBuilder.append(String.format("uniqueEdges: '%s', ", onEdges.get().getAqlName()));
392-
}
393-
if (bfs) {
394-
queryBuilder.append("bfs: true");
395-
}
396-
queryBuilder.append("}\n");
397-
}
398-
logger.debug("graphOptions", queryBuilder.toString());
399-
return this;
400-
}
401-
402-
/**
403-
* Add a filter same collections segment, i.e. element represented by variable must be in any
404-
* of the provided collections.
405-
* @param filterVariable the filter variable
406-
* @param collections the collections to filter by
407-
* @param bindVars the map of bind parameters
408-
*
409-
* @return a reference to this object.
410-
*/
411-
412-
public ArangoDBQueryBuilder filterSameCollections(
413-
String filterVariable,
414-
List<String> collections,
415-
Map<String, Object> bindVars) {
416-
if (!collections.isEmpty()) {
417-
queryBuilder.append(" FILTER (IS_SAME_COLLECTION(");
418-
String separator = "";
419-
for (String c : collections) {
420-
queryBuilder.append(separator);
421-
separator = String.format(", %s) OR IS_SAME_COLLECTION(", filterVariable);
422-
queryBuilder.append(String.format("@@col%s", iterateCnt));
423-
bindVars.put(String.format("@col%s", iterateCnt++), c);
424-
}
425-
queryBuilder.append(String.format(", %s))\n", filterVariable));
426-
}
427-
filtered = true;
428-
logger.debug("filterSameCollections", queryBuilder.toString());
429-
return this;
430-
}
431-
432-
/**
433-
* Add a filter on element properties segment. The filter operations are defined using a
434-
* #link {@link ArangoDBPropertyFilter}.
435-
*
436-
* @param propertyFilter the property filter
437-
* @param filterVariable the filter variable
438-
* @param bindVars the map of bind parameters
439-
* @return a reference to this object.
440-
*/
441-
442-
public ArangoDBQueryBuilder filterProperties(
443-
ArangoDBPropertyFilter propertyFilter,
444-
String filterVariable,
445-
Map<String, Object> bindVars) {
446-
List<String> filterSegments = new ArrayList<String>();
447-
propertyFilter.addAqlSegments(String.format("%s.", filterVariable), filterSegments, bindVars);
448-
if (CollectionUtils.isNotEmpty(filterSegments)) {
449-
if (filtered) {
450-
queryBuilder.append(" AND ");
451-
} else {
452-
queryBuilder.append(" FILTER ");
453-
}
454-
queryBuilder.append(StringUtils.join(filterSegments, " AND ")).append("\n");
455-
}
456-
logger.debug("filterProperties", queryBuilder.toString());
457-
return this;
458-
}
459-
460-
/**
461-
* Add a limit segment to limit the number of elements returned.
462-
*
463-
* @param limit the limit number
464-
* @return a reference to this object.
465-
*/
466-
467-
public ArangoDBQueryBuilder limit(Long limit) {
468-
queryBuilder.append(" LIMIT " + limit.toString());
469-
logger.debug("limit", queryBuilder.toString());
470-
return this;
471-
}
472-
473176
/**
474177
* Add a RETURN Segment.
475178
* TODO provide finer grained return statements

src/main/java/com/arangodb/tinkerpop/gremlin/structure/ArangoDBGraph.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
@Graph.OptIn(Graph.OptIn.SUITE_PROCESS_STANDARD)
139139
@Graph.OptIn("com.arangodb.tinkerpop.gremlin.StructureIntegrateSuite")
140140
@Graph.OptIn("com.arangodb.tinkerpop.gremlin.ArangoDBTestSuite")
141+
@Graph.OptIn("com.arangodb.tinkerpop.gremlin.custom.CustomStandardSuite")
141142
@Graph.OptOut(
142143
test = "org.apache.tinkerpop.gremlin.structure.util.detached.DetachedGraphTest",
143144
method = "testAttachableCreateMethod",
@@ -182,18 +183,6 @@
182183
test = "org.apache.tinkerpop.gremlin.structure.VertexTest$AddEdgeTest",
183184
method = "shouldAddEdgeWithUserSuppliedStringId",
184185
reason = "FIXME")
185-
@Graph.OptOut(
186-
test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest$Traversals",
187-
method = "g_V_both_both_count",
188-
reason = "FIXME")
189-
@Graph.OptOut(
190-
test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest$Traversals",
191-
method = "g_V_repeatXoutX_timesX3X_count",
192-
reason = "FIXME")
193-
@Graph.OptOut(
194-
test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.CountTest$Traversals",
195-
method = "g_V_repeatXoutX_timesX8X_count",
196-
reason = "FIXME")
197186
public class ArangoDBGraph implements Graph {
198187

199188
/**

0 commit comments

Comments
 (0)