How to get the type of class from a vertex?

25 views
Skip to first unread message

Academia Learning Centro de inglés y de formación

unread,
Nov 21, 2016, 4:28:55 AM11/21/16
to orient-...@googlegroups.com
Hello, I want to empty the db and I was testing this way (I do not know if it's the right one)

Iterable<Vertex> resultIteratorVertices = graph.getVertices(true);
for (Vertex v : resultIteratorVertices){
   graph.command( new OCommandSQL("TRUNCATE CLASS "+ v.getClass + " POLYMORPHIC UNSAFE") ).execute();
}

To remove all records from all classes, but I can not figure out how to get the type of class from each record



EDIT: I think that the best way is:
graph.command( new OCommandSQL("TRUNCATE CLASS V POLYMORPHIC UNSAFE") ).execute();
graph.command( new OCommandSQL("TRUNCATE CLASS E POLYMORPHIC UNSAFE") ).execute();


Ivan Mainetti

unread,
Nov 21, 2016, 4:52:38 AM11/21/16
to OrientDB
why you don't just delete and recreate the entire db?

Academia Learning Centro de inglés y de formación

unread,
Nov 21, 2016, 5:01:42 AM11/21/16
to OrientDB
To not delete all classes / schemas / tables only the records

Ivan Mainetti

unread,
Nov 21, 2016, 7:50:43 AM11/21/16
to orient-...@googlegroups.com
what about something like:

Iterable<Edge> resultIteratorEdges = g.getEdges(true);
for (Edge e : resultIteratorEdges){
e.remove();
}

Iterable<Vertex> resultIteratorVertices = g.getVertices(true);
for (Vertex v : resultIteratorVertices){
v.remove();
}


Academia Learning Centro de inglés y de formación

unread,
Nov 21, 2016, 8:49:26 AM11/21/16
to OrientDB
Mm I do not know, I think truncate is more appropriate, but I do not know ..
Reply all
Reply to author
Forward
0 new messages