【问题标题】:Gremlin query to select vertex based on count of out edges on a particular subset of out vertexGremlin 查询以根据输出顶点的特定子集上的输出边数来选择顶点
【发布时间】:2019-10-27 18:37:05
【问题描述】:

例如 Graph [Account, User] 中有两种类型的顶点。帐户顶点与用户顶点有边,表示用户列表形成帐户顶点。 用户顶点有两个属性(名称、电话号码)。我想选择与 2 个以上名称以 foo 开头的用户关联的帐户。

输出不应包含与用户顶点有超过 2 条边的帐户,但在所有这些用户中,只有 1 个用户的名称以 foo 开头。在最低限度,2 个用户的名字应该以 foo 开头。

【问题讨论】:

    标签: graph gremlin tinkerpop tinkerpop3


    【解决方案1】:

    这个查询可以做到:

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

    【讨论】:

      猜你喜欢
      • 2019-05-14
      • 1970-01-01
      • 2023-01-15
      • 1970-01-01
      • 1970-01-01
      • 2021-12-07
      • 1970-01-01
      • 1970-01-01
      • 2018-02-06
      相关资源
      最近更新 更多