use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class FullTextSearchDescriptionTest method filterDiscardsTheVerticesThatContainThePropertyWithADifferentTypeOfValue.
@Test
public void filterDiscardsTheVerticesThatContainThePropertyWithADifferentTypeOfValue() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(vertex -> vertex.withTimId("v1").withProperty(PROPERTY, "value12344324")).withVertex(vertex -> vertex.withTimId("v2").withProperty(PROPERTY, 12334)).withVertex(vertex -> vertex.withTimId("v3").withProperty(PROPERTY, "value1")).build().traversal().V();
FullTextSearchParameter fullTextSearchParameter = new FullTextSearchParameter(NAME, "value");
instance.filter(traversal, fullTextSearchParameter);
assertThat(traversal.toList(), containsInAnyOrder(likeVertex().withTimId("v1"), likeVertex().withTimId("v3")));
}
use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class PropertyTest method getTraversalReturnsATraversalThatOrdersByStringValue.
@Test
public void getTraversalReturnsATraversalThatOrdersByStringValue() {
GraphTraversal<Vertex, Vertex> traversal = newGraph().withVertex(v -> v.withTimId("id1").withProperty(PROPERTY, "123")).withVertex(v -> v.withTimId("id2").withProperty(PROPERTY, "1234")).withVertex(v -> v.withTimId("id3").withProperty(PROPERTY, "254")).build().traversal().V();
Property instance = Property.localProperty().withName(PROPERTY).build();
GraphTraversal<?, ?> orderTraversal = instance.getTraversal();
List<Vertex> vertices = traversal.order().by(orderTraversal, Order.incr).toList();
assertThat(vertices, contains(likeVertex().withTimId("id1"), likeVertex().withTimId("id2"), likeVertex().withTimId("id3")));
}
use of org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal in project timbuctoo by HuygensING.
the class Gremlin method evaluateQuery.
private String evaluateQuery(String query) throws ScriptException {
GraphTraversal traversalResult = (GraphTraversal) engine.eval(query, bindings);
StringBuilder result = new StringBuilder();
while (traversalResult.hasNext()) {
dumpItem(traversalResult.next(), result);
}
if (result.length() > 0) {
return result.toString();
} else {
return "No results...";
}
}
Aggregations