[英]OrientDB SQL: Retrieve vertices with non-zero degree
I would like to retrieve all vertices in a SQL query that have at least one connection (non-zero degree). 我想在SQL查询中检索至少具有一个连接(非零度)的所有顶点。 Just returning the rid is probably OK, but it would be nice to select properties too.
仅返回rid可能就可以了,但是也可以选择属性。
The edges have "in" and "out" properties, so I could make a set of those. 边缘具有“入”和“出”属性,因此我可以设置其中的一组。 I'm not sure how to do this with OrientDB sql.
我不确定如何使用OrientDB sql执行此操作。
Also, I thought there would be some way to do it more naturally by querying vertices directly. 另外,我认为可以通过直接查询顶点来更自然地进行处理。 I see the vertices have IN and OUT recorded, and the edge Class name underneath.
我看到顶点记录了入和出,以及下面的边类名称。 But I do not know how to access the vertex IN and OUT in a SQL query.
但是我不知道如何在SQL查询中访问顶点IN和OUT。
The following query should do the trick 下面的查询应该可以解决问题
SELECT FROM V WHERE both().size() > 0
If you need additional properties or additional filters, you can just add them to the query, eg. 如果您需要其他属性或其他过滤器,则可以将它们添加到查询中,例如。
SELECT property1, property2 FROM V WHERE both().size() > 0 and foo = 'bar'
IN and OUT are accessed with in()
and out()
. IN和OUT通过
in()
和out()
进行访问。 These can go right after SELECT
to retrieve them, or, in the predicate as where Luigi has used both()
(short for in()
and out()
). 这些可以在
SELECT
之后立即获取它们,或者在谓词中Luigi使用both()
( in()
和out()
缩写)。
The complete list of "graphy" functions is in the docs, here , in the first column. 的“造影”功能的完整列表是在文档, 在这里 ,在第一列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.