In Galaxybase, how to find a certain vertex or edge in JavaAPI?

Advertisements

I’m currently using JavaAPI in Galaxybase to query graph.The way I use to find a certain vertex is retrieveVertex, and retrieveEdge to find a certain Edge. I’m wondering if there are any other ways to find a certain vertex or edge.

>Solution :

A certain vertex can be found by an external unique identifier (primary key) by retrieveVertexByPk or by its global unique internal id (long) by retrieveVertex.

Edges do not have a primary key, but each edge is assigned a global unique edge id, of type String, upon entry. So, the easiest way to find an certain edge is to use the global unique edge id. Of course, it is also possible to find an edge by its start and end vertexes. Galaxybase supports storing multiple edges between two points, so this method returns an iterator. You can iterate through this iterator to find the edge you want.

In addition, Galaxybase provides a method that returns an edge instead of an iterator, retrieveEdgeByVertexPK. This method not only gives the start and end vertexes, but also gives some property information on the edge as a filtering condition. At the end, it returns an edge between the start and end vertexes that meets this filtering condition.

Leave a ReplyCancel reply