use of com.tinkerpop.blueprints.Vertex in project gremlin by tinkerpop.
the class BackStepTest method test_g_v4_out_filterXlang_eq_javaX_backX1X.
public void test_g_v4_out_filterXlang_eq_javaX_backX1X() {
super.test_g_v4_out_filterXlang_eq_javaX_backX1X(new GremlinPipeline(g.getVertex(4)).out().filter(new PipeFunction<Vertex, Boolean>() {
public Boolean compute(Vertex v) {
return v.getProperty("lang").equals("java");
}
}).back(1));
super.test_g_v4_out_filterXlang_eq_javaX_backX1X(new GremlinPipeline(g.getVertex(4)).optimize(false).out().filter(new PipeFunction<Vertex, Boolean>() {
public Boolean compute(Vertex v) {
return v.getProperty("lang").equals("java");
}
}).back(1));
}
use of com.tinkerpop.blueprints.Vertex in project gremlin by tinkerpop.
the class BackStepTest method test_g_v4_out_asXhereX_filterXlang_eq_javaX_backXhereX_propertyXnameX.
public void test_g_v4_out_asXhereX_filterXlang_eq_javaX_backXhereX_propertyXnameX() {
super.test_g_v4_out_asXhereX_filterXlang_eq_javaX_backXhereX_propertyXnameX(new GremlinPipeline(g.getVertex(4)).out().as("here").filter(new PipeFunction<Vertex, Boolean>() {
public Boolean compute(Vertex v) {
return v.getProperty("lang").equals("java");
}
}).back("here").property("name"));
super.test_g_v4_out_asXhereX_filterXlang_eq_javaX_backXhereX_propertyXnameX(new GremlinPipeline(g.getVertex(4)).optimize(false).out().as("here").filter(new PipeFunction<Vertex, Boolean>() {
public Boolean compute(Vertex v) {
return v.getProperty("lang").equals("java");
}
}).back("here").property("name"));
}
use of com.tinkerpop.blueprints.Vertex in project gremlin by tinkerpop.
the class FilterStepTest method test_g_v1_out_filterXage_gt_30X.
public void test_g_v1_out_filterXage_gt_30X() {
super.test_g_v1_out_filterXage_gt_30X(new GremlinPipeline(g.getVertex(1)).out().filter(new PipeFunction<Vertex, Boolean>() {
public Boolean compute(Vertex vertex) {
Integer age = (Integer) vertex.getProperty("age");
return age != null && age > 30;
}
}));
super.test_g_v1_out_filterXage_gt_30X(new GremlinPipeline(g.getVertex(1)).optimize(false).out().filter(new PipeFunction<Vertex, Boolean>() {
public Boolean compute(Vertex vertex) {
Integer age = (Integer) vertex.getProperty("age");
return age != null && age > 30;
}
}));
}
use of com.tinkerpop.blueprints.Vertex in project gremlin by tinkerpop.
the class GroupByStepTest method test_g_V_groupByXlang_nameX.
public void test_g_V_groupByXlang_nameX() {
Map<?, List<?>> m = new HashMap<Object, List<?>>();
super.test_g_V_groupByXlang_nameX(new GremlinPipeline(g.getVertices()).groupBy(m, new PipeFunction<Vertex, String>() {
public String compute(Vertex vertex) {
return (String) vertex.getProperty("lang");
}
}, new PipeFunction<Vertex, String>() {
public String compute(Vertex vertex) {
return (String) vertex.getProperty("name");
}
}), (Map) m);
m = new HashMap<Object, List<?>>();
super.test_g_V_groupByXlang_nameX(new GremlinPipeline(g.getVertices()).optimize(false).groupBy(m, new PipeFunction<Vertex, String>() {
public String compute(Vertex vertex) {
return (String) vertex.getProperty("lang");
}
}, new PipeFunction<Vertex, String>() {
public String compute(Vertex vertex) {
return (String) vertex.getProperty("name");
}
}), (Map) m);
}
use of com.tinkerpop.blueprints.Vertex in project gremlin by tinkerpop.
the class SelectStepTest method test_g_v1_asXaX_outXknowsX_asXbX_select.
public void test_g_v1_asXaX_outXknowsX_asXbX_select(final Iterator<Row> pipe) {
int counter = 0;
while (pipe.hasNext()) {
counter++;
List list = pipe.next();
assertEquals(list.size(), 2);
assertEquals(((Vertex) list.get(0)).getId().toString(), "1");
assertTrue(((Vertex) list.get(1)).getId().toString().equals("2") || ((Vertex) list.get(1)).getId().toString().equals("4"));
}
assertEquals(counter, 2);
}
Aggregations