I have a FramedGraph object with Vertices of different classes, for instance Person and Location. I would like to retrieve all vertices of the "Person" class. Here is my current method.
public List<Person> listPeople() {
List<Person> people = new ArrayList<Person>();
Iterator iterator = g.getVertices().iterator();
while (iterator.hasNext()) {
Vertex v = (Vertex) iterator.next();
Person p = (Person) g.getVertex(v.getId(), Person.class);
people.add(p);
}
return people;
}
This feels terrifically inefficient since I am looping over all vertices then dipping back in for one at a time. I looked into using the Gremlin syntax, but I don't see how to restrict by a Frames class. Is there a more efficient retrieval method? Thanks..