FetchPlan orientDB结果不正确

时间:2015-07-08 13:18:55

标签: java orientdb

我正在使用orient 2.1-rc4,执行以下命令:我的动机是仅获取传出顶点路径。

1。使用简单图形

得出正确的结果
create class Depends extends E
create vertex set name="persians"
create vertex set name="vikings" 
create vertex set name="teutons"
create vertex set name="mayans" 
create vertex set name="aztecs"

select * from v

\#   |@RID|@CLASS|name    
0   |#9:0|V     |persians
1   |#9:1|V     |vikings 
2   |#9:2|V     |teutons 
3   |#9:3|V     |mayans  
4   |#9:4|V     |aztecs  

create edge Depends from #9:0 to #9:2
create edge Depends from #9:1 to #9:2
create edge Depends from #9:2 to #9:3
create edge Depends from #9:2 to #9:4

SELECT @this.toJSON('fetchPlan:in_*:-2 *:-1') FROM #9:2

{"out_Depends":[{"out":"#9:2","in":{"name":"mayans","in_Depends":["#11:2"]}},{"out":"#9:2","in":{"name":"aztecs","in_Depends":["#11:3"]}}],"name":"teutons"}

仅按预期获取传出节点。

2。结果不正确

再添加两个顶点:

create vertex set name="britons"                       
create vertex set name="mongols"
create edge Depends from #9:5 to #9:0
create edge Depends from #9:6 to #9:4

select * from e
----+-----+-------+----+----
\#   |@RID |@CLASS |out |in  
----+-----+-------+----+----
0   |#11:0|Depends|#9:0|#9:2
1   |#11:1|Depends|#9:1|#9:2
2   |#11:2|Depends|#9:2|#9:3
3   |#11:3|Depends|#9:2|#9:4
4   |#11:4|Depends|#9:5|#9:0
5   |#11:5|Depends|#9:6|#9:4
----+-----+-------+----+----

尝试按照http://orientdb.com/docs/last/Fetching-Strategies.html

获取out顶点
SELECT @this.toJSON('fetchPlan:in_*:-2') FROM #9:2
{"out_Depends":["#11:2","#11:3"],"name":"teutons"}

并非所有的顶点都被提取

SELECT @this.toJSON('fetchPlan:in_*:-2 *:-1') FROM #9:2
{"out_Depends":[{"out":"#9:2","in":{"name":"mayans","in_Depends":["#11:2"]}},{"out":"#9:2","in":{"in_Depends":["#11:3",{"out":{"name":"mongols","out_Depends":["#11:5"]},"in":"#9:4"}],"name":"aztecs"}}],"name":"teutons"}

获取了额外的顶点蒙古,这意味着该规则尚未应用于其他级别。 (out_Depends仅从第0级排除)

根据文档

添加[*]以在所有级别上应用排除规则
SELECT @this.toJSON('fetchPlan:[*]in_*:-2 *:-1') FROM #9:2
{"out_Depends":[{"out":"#9:2","in":{"name":"mayans","in_Depends":["#11:2"]}},{"out":"#9:2","in":{"in_Depends":["#11:3",{"out":{"name":"mongols","out_Depends":["#11:5"]},"in":"#9:4"}],"name":"aztecs"}}],"in_Depends":[{"out":{"name":"persians","out_Depends":["#11:0"],"in_Depends":[{"out":{"name":"britons","out_Depends":["#11:4"]},"in":"#9:0"}]},"in":"#9:2"},{"out":{"name":"vikings","out_Depends":["#11:1"]},"in":"#9:2"}],"name":"teutons"}
然而,

这会取整个树。 有人可以提出建议吗?

1 个答案:

答案 0 :(得分:0)

我按照您的说明操作,您的查询有效,是否可以发布您的数据库的图像?