retrieve particular properties from orienttb vertex

30 views Asked by At

I am trying to retrieve particular property of a vertex, say id. Is there a way to do it? I know the other way is to retrieve the entire vertex and then get the property i am interested. Note: I am trying to fetch from java.

graph.getRawGraph().command(new OCommandSQL("select from person").execute());

Then fetch id from each vertex, However is it possible to do following?

graph.getRawGraph().command(new OCommandSQL("select id from person").execute());
1

There are 1 answers

1
Michela Bonizzi On

With OrientDB version 3.0.1 you can try something like this:

String statement = "select from person";
OResultSet rs = db.query(statement);
while(rs.hasNext())
{
    OResult row = rs.next();
    System.out.println(row.getProperty("id").toString() + " " + row.getProperty("name").toString());
}
rs.close();

this is the output:

enter image description here


Hope it helps.

Regards