2013-10-14 79 views
1

的綜合指數我在OrientDB(使用TinkerPop有關堆棧)的曲線圖,並且需要使邊緣值/屬性/字段和邊緣的非常快的查找/出頂點。邊緣&屬性(TinkerPop有關/ orientDB)

因此,基本上,用戶將需要查找如下:

SELECT FROM myEdges WHERE inVertex = {VertexIdentity},outVertex = {VertexIdentity},property1 = 'XYZ'

本質上,它是一個組合索引對於邊緣類,有3個屬性:inVertex,outVertex & property1

基本上 - 如果用戶已經有2個頂點的VertexIdentity(可能是#CLUSTER_ID:RECORD_ID),並且屬性值(in這種情況下,xyz) - 它將允許非常快looku看P如果該組合中的曲線已經存在(如果2個頂點與property1聯) - 而不進行遍歷。

到目前爲止,我發現下面的代碼,以幫助複合索引,但我不能看它是否可能包括輸入/​​輸出在這個頂點(用於圖形邊緣)。

https://github.com/orientechnologies/orientdb/blob/master/tests/src/test/java/com/orientechnologies/orient/test/database/auto/SQLSelectCompositeIndexDirectSearchTest.java

是否有可能?

回答

1

你可以用OrientDB做到這一點,只是創建針對進出性能的綜合指數太(之前在E級聲明它們)。

這也用作限制,以避免多個邊緣連接相同的頂點。

3

這是工作的罰款邊緣部的獨特性:

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"); 
graph.command(declareIn).execute(); 
graph.command(declareOut).execute();    
graph.command(createIndexUniqueEdge).execute(); 

在你的情況下只是一個屬性添加到邊緣類,因此在指數