Tinkerpop Frames: Query vertices based on interface type -


i'm using tinkerpop frames create set of vertices , edges. adding new vertex simple retreiving vertices based on type seems bit difficult.

assume have class a , b , want add new 1 so:

framedgraph.addvertex(null, a.class); framedgraph.addvertex(null, b.class); 

that's straight forward. if want retrieve vertices type a?

doing failed, because returned vertices (both a , b).

framedgraph.query().vertices(a.class); 

is there possible way this. tried check documentations , test cases no luck. how can retreive list of vertices of type a only

this question looks it's duplicate of - how find vertices of specific class tinkerpop frames (also asked today).

as far understand, tinkerpop frame framework acts wrapper class around vertex. vertex isn't stored interface class. such, need way identify vertex being of particular type.

my solution, added @typefield , @typevalue annotations frame classes. use these values query framedgraph.

the documentation these annotations can found here: https://github.com/tinkerpop/frames/wiki/typed-graph

example code

@typefield("type") @typevalue("person") interface person extends vertexframe { /* ... */ } 

then define framedgraphfactory adding typedgraphmodulebuilder this.

static final framedgraphfactory factory = new framedgraphfactory(     new typedgraphmodulebuilder()         .withclass(person.class)         //add more classes use above annotations.          .build() ); 

then retrieve vertices of type person

iterable<person> people = framedgraph.getvertices('type', 'person', person.class); 

i'm not sure efficient/succinct solution (i'd see @stephen mallette suggests). it's not available, it'd logical able like:

// framedgraph.getvertices(person.class) 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -