import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
public class SameAge {
public static void main(String[] args) {
Graph graph = TinkerGraph.open();
Vertex a = graph.addVertex();
Vertex b = graph.addVertex();
Vertex c = graph.addVertex();
a.property("name", "Henry");
a.property("age", "9");
b.property("name", "Carlos");
b.property("age", "9");
c.property("name", "Teagan");
c.property("age", "7");
a.addEdge("knows", b);
a.addEdge("knows", c);
GraphTraversalSource g = graph.traversal();
GraphTraversal<Vertex, String> query = g.V(a).as("start").properties("age").as("years").select("start").out().has("age", "9").values("name");
while (query.hasNext()) {
String result = query.next();
System.out.println("result = " + result);
}
}
}
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/6041a87d-a8b6-4fa6-863a-8fabcaac6e81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CA%2Bf9seXU850j2Zr-h0Oqk-50Pbw7apmh%3D_pNS49iP39_EpBj_g%40mail.gmail.com.