【问题标题】:Gremlin: Get list of vertices that do not have certain property fieldsGremlin:获取不具有某些属性字段的顶点列表
【发布时间】:2019-04-02 16:32:20
【问题描述】:

我想查找至少缺少以下属性之一的人员列表:Title、DisplayName、FirstName、LastName、Id、Email。

我尝试了以下方法,但出现错误 "java.lang.ArrayIndexOutOfBoundsException"

如果我只运行前三行,我会得到那些没有 DisplayName 且该属性为空值的人的结果,但是没有标题的属性列。

g.V().hasLabel('people').hasNot('Title')
.or().hasLabel('people').hasNot('DisplayName')
.or().hasLabel('people').hasNot('FirstName')
.or().hasLabel('people').hasNot('LastName')
.or().hasLabel('people').hasNot('Id')
.or().hasLabel('people').hasNot('Email')

【问题讨论】:

    标签: orientdb gremlin


    【解决方案1】:

    您为什么使查询过于复杂?谁不只是这个:

    g.V().hasLabel('people').not(
        has('Title').has('DisplayName').
        has('FirstName').has('LastName').
        has('Id').has('Email'))
    

    但是,我并不清楚您的期望是什么(“但是没有标题的属性列”的陈述有点令人困惑),但也许重写的查询已经对您有所帮助(如果没有,那么请提供一些样本数据和预期结果,这总是可以更容易地回答与遍历相关的问题)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-08
      • 2017-12-19
      • 1970-01-01
      • 2023-01-15
      • 2019-08-24
      相关资源
      最近更新 更多