【问题标题】:Gremlin hasId using property of parentGremlin hasId 使用父级的属性
【发布时间】:2021-06-20 18:30:27
【问题描述】:

我想按 id 过滤 out。 id 的值在父级的属性上。示例:

g.V('1234')
    .as('parent')
    .out()
        .has(id, parent.childId). <--- how do I get the parent id?

如何解决这个问题?

我能得到的最接近的是以下查询,但它似乎忽略了has,只是返回了out 的所有结果。

g.V('123')
    .as('parent')
        .values('childId')
        .as('childIdValue')
    .select('parent')
        .out('hasChild')
        .has('id', select('childIdValue'))

编辑

当使用 Id 以外的顶点属性时,它会按预期工作。示例:

g.V('123')
    .as('parent')
        .values('childId')
        .as('childIdValue')
    .select('parent')
        .out('hasChild')
        .has('childProp', select('childIdValue'))

我已经尝试了所有我能想到的id 的变体。 'id', id, id().

【问题讨论】:

    标签: gremlin azure-cosmosdb-gremlinapi


    【解决方案1】:

    您可以使用 where by 方法比较 ID。例如:

    where(eq('parent')).by('childProp').by('childId')
    

    【讨论】:

    • 正是我需要的。感谢您向我介绍where by
    猜你喜欢
    • 2022-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-09
    • 2012-08-31
    • 1970-01-01
    • 2011-11-06
    相关资源
    最近更新 更多