OrientDB在图形模式下的边缘(OrientDB edge in the graph mode)

系统教程 行业动态 更新时间:2024-06-14 16:57:40
OrientDB在图形模式下的边缘(OrientDB edge in the graph mode)

我有两个v类:vuser和vlang和e类:说话。

所以:vuser - > speaks - > vlang

然后,我试图在图中看到说'ar'的用户,我的查询是下一个:

select expand(in('speaks')) from vlang where lang = 'ar'

有了这个,我看到了用户,而不是vlang和边缘的顶点。 如何显示lang ='ar'的边缘和vlang? 我已经阅读了OrientDB文档,但是我没有看到这个问题类型。

提前致谢。

I have two v class: vuser and vlang and e class: speaks.

So: vuser -> speaks -> vlang

Then I´m trying to see in my graph the users that speaks 'ar' and my query is the next:

select expand(in('speaks')) from vlang where lang = 'ar'

With this, I see the users but not the vertex from vlang and the edge. How can I show the edge and the vlang where lang = 'ar'? I have read the OrientDB doc but I didn´t see this question type.

Thanks in advance.

最满意答案

如果你在v 2.2上,你可以使用MATCH来做这件事:

MATCH {class:vlang, as:lang, where:(lang = 'ar')} <-speaks- {as:user} RETURN $elements

这返回用户和lang顶点。 如果您还需要边缘,则可以使用以下语法:

MATCH {class:vlang, as:lang, where:(lang = 'ar')} .inE("speaks"){as:theEdge} .outV(){as:user} RETURN $elements

这将仅返回单个边/顶点一次,作为结果集中的单独项目。

如果您想查看单个模式,可以更改RETURN子句: RETURN $patterns

完整的语法如下: http : //orientdb.com/docs/2.2.x/SQL-Match.html

If you are on v 2.2 you can use a MATCH for this:

MATCH {class:vlang, as:lang, where:(lang = 'ar')} <-speaks- {as:user} RETURN $elements

this returns user and lang vertices. If you also need the edge, you can use this syntax:

MATCH {class:vlang, as:lang, where:(lang = 'ar')} .inE("speaks"){as:theEdge} .outV(){as:user} RETURN $elements

This will return single edges/vertices only once, as a separate item in the result set.

If you want to see the single patterns, you can change the RETURN clause: RETURN $patterns

Full syntax here: http://orientdb.com/docs/2.2.x/SQL-Match.html

更多推荐

本文发布于:2023-04-13 12:35:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/52f480a44388083ef2a258893ef57ebb.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图形   边缘   模式下   OrientDB   graph

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!