2013-10-14 85 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(); 

在你的情况下只是一个属性添加到边缘类,因此在指数