简体   繁体   English

如何在OrientDB中获得可用的连接顶点

[英]How to get the available connected vertex in OrientDB

I have a case: I want to get all the connected vertex (including the middle vertex) from a base vertex. 我有一个例子:我想从基本顶点获取所有连接的顶点(包括中间顶点)。

For example, the graph as below enter image description here 例如,如下图在此处输入图像描述

I want to query all the connected vertexes from vertex ("giggs"), and I also want to query the connected path. 我想从顶点(“ giggs”)查询所有连接的顶点,我也想查询连接的路径。 ex: "giggs"->"192.168.0.1"->"ronaldo"->"192.168.0.2"->"veri". 例如:“ giggs”->“ 192.168.0.1”->“ ronaldo”->“ 192.168.0.2”->“ veri”。 I used query as below: 我使用如下查询:

MATCH {class: ic, as: s, where: (title = 'giggs')}.(outE(){where: 'some condition'}.inV().inE(){where: 'some condition'}.outV()){class: %s, as: t, while: ($depth <= 5), where: ($matched.s != $currentMatch)} RETURN $paths

I can get all the target nodes, ex: "veri", but I don't know the preceding vertex of "veri" and the edge between "veri" and its preceding vertex. 我可以得到所有目标节点,例如:“ veri”,但是我不知道“ veri”的前一个顶点以及“ veri”与其前一个顶点之间的边缘。

So how I can write the query? 那我怎么写查询呢? Thanks in advance. 提前致谢。

Try this: 尝试这个:

TRAVERSE both() FROM (SELECT EXPAND(s) FROM (MATCH {CLASS:ic, AS:s, WHERE:(name='giggs')} RETURN s))

Hope it helps 希望能帮助到你

Regards 问候

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

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