简体   繁体   English

Orientdb:遍历没有产生正确的输出

[英]Orientdb : Traversal not producing correct output

Can anybody tell me how to get all nodes and edges in a traversal? 谁能告诉我如何遍历所有节点和边?

For example, if I run the following query: 例如,如果我运行以下查询:

select from (TRAVERSE in(), inE() FROM (SELECT FROM Example_Class WHERE @rid = #13:187))

the result changes every time. 结果每次都会改变。

Requirement: Get all unordered nodes and edges from a specific node (#13:187 in the example above). 要求:从特定节点获取所有无序节点和边(在上例中为#13:187)。

One way to retrieve the edges and nodes encountered while traversing a graph from a particular node, say NODE, is using the query: 从特定节点(即NODE)遍历图形时,检索遇到的边线和节点的一种方法是使用查询:

> traverse outE(), inV() from NODE 

Here is an example. 这是一个例子。 First, let's just run out() to retrieve the encountered nodes (here the start (#11:11) and end (#11:15)); 首先,我们只需要运行out()来检索遇到的节点(这里是起点(#11:11)和终点(#11:15)); the resultant rows give the edge information: 结果行提供边缘信息:

> traverse out() from #11:11

----+------+------+-----+-------+-------
#   |@RID  |@CLASS|label|in_E3  |out_E3 
----+------+------+-----+-------+-------
0   |#11:11|Circle|4    |[#15:2]|[#15:4]
1   |#11:15|Circle|8    |[#15:4]|null   
----+------+------+-----+-------+-------

Here the picture is: (#11:11) -[#15:4]> (#11:15) 这里的图片是:(#11:11)-[#15:4]>(#11:15)

Now let's formulate the query so that the rows of the result-set include both nodes and edges: 现在,让我们对查询进行公式化,以便结果集的行同时包含节点和边:

> traverse outE(), inV() from #11:11

----+------+------+-----+-------+-------+------+------
#   |@RID  |@CLASS|label|in_E3  |out_E3 |in    |out   
----+------+------+-----+-------+-------+------+------
0   |#11:11|Circle|4    |[#15:2]|[#15:4]|null  |null  
1   |#15:4 |E3    |4>8  |null   |null   |#11:15|#11:11
2   |#11:15|Circle|8    |[#15:4]|null   |null  |null  
----+------+------+-----+-------+-------+------+------

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM