Graph-databases – Retrieve orientVertex objects from OrientDB

I encountered a problem when using OrientDB’s Graph API in Java.

Question:

From the persistent map database Retrieve vertices (OrientVertex or Vertex?), and create multiple vertices/edges through the console.

So, I have been able to query the database from the document API I think I use now

< /p>

graph = factory.getTx();
String string = String.format("select * from V where name like \"%s\"", criteria);
OSQLSynchQuery< ODocument> query = new OSQLSynchQuery(string);
List results = graph.getRawGraph().command(query).execute();

But this does not apply Vertices. How to run a query that returns a list of vertices in the database?

Thanks in advance.

View the code, you are using Graph API. After calling getRawGraph(), you no longer use Graph API, but Document API (the method name is a bit confusing).

There are several possibilities to refer to OrientGraph

>Use orientGraph#getVertex *(..)/ orientGraph#getVertices *(..) method style
>Use Query object: orientGraph#query().has(“key”,value).vertices()
>Use gremlin query language>Use orientGraph#command(…).execute(). In this case, the command is executed outside of the transaction (thanks @wolf4ood)

I encountered a problem when using OrientDB’s Graph API in Java.

Question:

Retrieving vertices (OrientVertex or Vertex?) from the persistent map database, and Create multiple vertices/edges through the console.

So, I have been able to query the database from the document API I think I use now

graph = factory. getTx();
String string = String.format("select * from V where name like \"%s\"", criteria);
OSQLSynchQuery query = new OSQLSynchQuery( string);
List results = graph.getRawGraph().command(query).execute();

But this does not apply to Vertices. How to run the vertex list returned in the database Inquire?

Thanks in advance.

Check the code, you are using the Graph API. After calling getRawGraph(), you no longer use the Graph API Instead, use the Document API (the method name is a bit confusing).

There are several possibilities to refer to OrientGraph

>Use orientGraph#getVertex *(..)/ orientGraph#getVertices *(..)Method style
>Use Query object: orientGraph#query().has(“key”,value).vertices()
>Use gremlin query language>Use orientGraph#command( …).Execute(). In this case, the command is executed outside of the transaction (thanks @wolf4ood)

Leave a Comment

Your email address will not be published.