我有两个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 $elementsthis 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 $elementsThis 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
更多推荐
发布评论