Getting OrientVertex objects from OrientDB

I'm having issues with the Graph OrientDB API in Java.

Problem:

Return vertices (OrientVertex or Vertex?) From a constant local graph database with several vertices / edges created using the console.

So, I was able to query the database from what I now think is the Document API using

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

But this will not work for Tops. How to execute queries that return a list of vertices in my database?

Thanks in advance.

+4
source share
3 answers

, Graph API. getRawGraph() API- Graph , API- ( ).

OrientGraph,

  • orientGraph#getVertex*(..)/orientGraph#getVertices*(..)
  • Query: orientGraph#query().has("key", value).vertices()
  • gremlin
  • orientGraph#command(...).execute(). ( @wolf4ood)
+3

rawGraph orientGraph OrientVertex

:

graph = factory.getTx();
String query = String.format("select * from V where name like \"%s\"", criteria);
OSQLSynchQuery<OrientVertex> qr = new OSQLSynchQuery<OrientVertex>(query);
Iterable<OrientVertex> vertices = graph.command(qr).execute();
+5

, , age .., getVertices(), , , getVertexByKey() . : Vertex v2=graph.getVertices("name","Business").iterator().next();

So, we got the top, not knowing the RID of the record. I don't know if this is the best method for this, but it does the job.

0
source

All Articles