Reputation: 19
I created an index in orientdb with all edges of a graph. to make the query:
select from index: Where unique_edge key = # 9: 1
as a result in the web console I get
OCompositeKey {keys = [# 9: 1, # 9: 0]}
OCompositeKey {keys = [# 9: 1, # 12: 0]}
and the same query in java console have
# 3: -1
# 3: -1
I need to get the vertices of the edges that is
# 9: 1, # 9: 0, # 12: 0.
Someone could help me?
Upvotes: 2
Views: 74
Reputation: 3570
You could use
select both() from #9:1
becuase your index will not improve the speed.
Hope it helps.
Upvotes: 1
Reputation: 19
To create de index
OCommandSQL declareIn= new OCommandSQL();
declareIn.setText("CREATE PROPERTY E.in LINK");
OCommandSQL declareOut= new OCommandSQL();
declareOut.setText("CREATE PROPERTY E.out LINK");
OCommandSQL createIndexUniqueEdge= new OCommandSQL();
createIndexUniqueEdge.setText("CREATE INDEX unique_edge ON E (in, out) UNIQUE");
orientDBGraph.command(declareIn).execute();
orientDBGraph.command(declareOut).execute();
orientDBGraph.command(createIndexUniqueEdge).execute();
System.out.println(createIndexUniqueEdge.getText());
String query10 = "select from index:unique_edge where key=#9:1";
Iterable<OrientVertex> res10 = orientDBGraph.command(new OCommandSQL(query10)).execute();
while(res10.iterator().hasNext()){
OrientVertex source = res10.iterator().next();
System.out.println(source.getId());
}
Upvotes: -1