user1056805
user1056805

Reputation: 2933

Using Tinkerpop Frames, how do I get all of the incoming or outgoing edges of a Vertex regardless of their label?

The Tinkerpop Frames wiki says that a vertex can be given the annotation below in order to get all people that a given person "knows". But how would I find all people related to a given person regardless of what the label is on the edge that connects them? Is this possible?

 @Adjacency(label="knows")
 public Iterable<Person> getKnowsPeople();

Thanks!

Upvotes: 0

Views: 415

Answers (1)

Richard Clayton
Richard Clayton

Reputation: 7562

You can't without modifying the underlying framework. In the AdjacencyAnnotationHandler.processVertex method, you will find that Frames simply calls the getVertices() method of the target Blueprints Vertex:

if (ClassUtilities.isGetMethod(method)) {
   final FramedVertexIterable r = new FramedVertexIterable(framedGraph, 

   vertex.getVertices(
      adjacency.direction(), adjacency.label()), 
      ClassUtilities.getGenericClass(method));


    if (ClassUtilities.returnsIterable(method)) {
      return r;
    } else {
      return r.iterator().hasNext() ? r.iterator().next() : null;
    }
} 

If you need the functionality you've requested, modify this statement to return all vertices or use some convention (like an asterisk in for the value of the label) to perform some expression based binding.

https://github.com/tinkerpop/frames/blob/master/src/main/java/com/tinkerpop/frames/annotations/AdjacencyAnnotationHandler.java

Upvotes: 1

Related Questions