Skip to content

Vertex Centric Queries

rustyrazorblade edited this page Mar 4, 2013 · 7 revisions

Vertex Centric Queries

Overview

Vertex centric queries allow you to take advantage of primary keys

We've tried to stick closely to the Blueprints spec for vertex centric queries.

Examples

# 10 things that Jon likes or hates
jon.query().labels(Likes, Hates).limit(10).direction(OUT).vertices()
blake.query().labels(Teaches).direction(OUT).edges()
eric.query().labels(Drinks).limit(1000).direction(OUT).vertices() # returns too many beers - need to put a limit
blake.query().labels(EnrolledIn).interval('enthusiasm', 2, 9).vertices()

We can also filter by ranges

jon.query().labels(Attends).has('gpa', 3.0, GREATER_THAN).direction(OUT).vertices()

We can go in any direction - IN, OUT, BOTH are all supported.

blake.query().labels(LIKES).direction(IN).edges() # returns a lot of edges, everyone likes blake
eric.query().labels(LIKES).direction(BOTH).vertexIds() # anyone eric likes, and who likes him

Differences

Clone this wiki locally