Joan
Joan

Reputation: 4300

Gremlin Java and querying

I'm a bit confused about Gremlin in Java.   As I understand I have 2 different ways of querying:

graph.query().has("firstName", "Joan").has("lastName", "G").vertices()

or:

new GremlinPipeline(graph.getVertices("firstName", "Joan")).has("lastName", "G").cast(Vertex.class).toList()

I quiet like the first one but why we don't get the all benefits of a GremlinPipeline, filter, select, as, back... ?
In other words why .query() is not returning a GremlinPipeline?

Upvotes: 1

Views: 164

Answers (1)

Daniel Kuppitz
Daniel Kuppitz

Reputation: 10904

.query() is the core API. Under the hood GremlinPipeline uses this API to chain your steps together. Usually I only use .query() when I have a 1-level-depth traversal without filters.

Cheers, Daniel

Upvotes: 1

Related Questions