简体   繁体   English

Gremlin 查询 select 顶点基于输出顶点的特定子集上的输出边数

[英]Gremlin query to select vertex based on count of out edges on a particular subset of out vertex

For example, there are two types of vertex in Graph [ Account, User].例如 Graph [Account, User] 中有两种类型的顶点。 Account vertexes have edges to user vertex denoting a list of users form an Account vertex.帐户顶点与用户顶点有边,表示用户列表形成帐户顶点。 User vertex has two property ( name, phoneNumber).用户顶点有两个属性(名称,电话号码)。 I want to select accounts who are connected to more than 2 users whose name starts with foo.我想要 select 帐户连接到两个以上名称以 foo 开头的用户。

The output should not contain accounts who have more than 2 edges to User vertex but out of all those users, only 1 user's name starts with foo. output 不应包含与用户顶点有超过 2 条边的帐户,但在所有这些用户中,只有 1 个用户的名称以 foo 开头。 At minima, 2 users should have name which starts with foo.在最低限度,2 个用户的名字应该以 foo 开头。

This query would do it:这个查询会这样做:

g.V().hasLabel("Account")
.where(out().hasLabel("User")
.has("name", startingWith("foo"))
.count().is(gte(2)))

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

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