Gremlin hasId 使用父级的 属性
Gremlin hasId using property of parent
我想通过 id 过滤 out
。 id 的值在父级的 属性 上。示例:
g.V('1234')
.as('parent')
.out()
.has(id, parent.childId). <--- how do I get the parent id?
如何解决这个问题?
我能得到的最接近的是以下查询,但它似乎忽略了 has
并且只是 returns out
.[=21= 的所有结果]
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()
.
您可以使用 where by
方法比较 ID。例如:
where(eq('parent')).by('childProp').by('childId')
我想通过 id 过滤 out
。 id 的值在父级的 属性 上。示例:
g.V('1234')
.as('parent')
.out()
.has(id, parent.childId). <--- how do I get the parent id?
如何解决这个问题?
我能得到的最接近的是以下查询,但它似乎忽略了 has
并且只是 returns out
.[=21= 的所有结果]
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()
.
您可以使用 where by
方法比较 ID。例如:
where(eq('parent')).by('childProp').by('childId')