简体   繁体   English

Gremlin查询中的引用属性

[英]Referencing property in Gremlin query

I'm trying to do a query that looks somewhat like this: 我试图做一个看起来像这样的查询:

g.V('myId').as('me').out('member').hasLabel('myLabel').in('member').has('identifier', 'me.identifier')

Where me.identifier would be changed to something that actually works. 将me.identifier更改为实际可行的地方。 I just have no clue how to reference the property value of "identifier" 我只是不知道如何引用“标识符”的属性值

Let's first consider what your query: 首先考虑一下您的查询:

g.V('myId').as('me').
  out('member').hasLabel('myLabel').
  in('member').has('identifier', 'me.identifier')

says in English: "find a vertex with the id of 'myId', then traverse outgoing 'member' edges to vertices that have the label of 'myLabel', then traverse incoming 'member' edges to vertices that have a property value of 'me.identifier' for the 'identifier' property" 用英语说:“找到一个id为'myId'的顶点,然后将传出的'成员'边缘遍历到带有'myLabel'标签的顶点,然后将传入的'成员'边缘遍历到属性值为''的顶点me.identifier”(用于“ identifier”属性)

Now, maybe that's not exactly what you want. 现在,也许这并不是您想要的。 For some reason, I gather that you want to: "find a vertex with the id of 'myId', then traverse outgoing 'member' edges to vertices that have the label of 'myLabel', then traverse incoming 'member' edges to vertices that have an id of 'myId'" in which case it's: 出于某种原因,我收集了您要进行的操作:“找到id为'myId'的顶点,然后将传出的'成员'边缘遍历到带有'myLabel'标签的顶点,然后将传入的'成员'边缘遍历到顶点的id为“ myId””,则为:

g.V('myId').
  out('member').hasLabel('myLabel').
  in('member').hasId('myId')

But then I also gather than you might want to: "find a vertex with the id of 'myId', then traverse outgoing 'member' edges to vertices that have the label of 'myLabel', then traverse incoming 'member' edges to vertices that have an identifier property with the same value of as the 'identifier' property of the start vertex with 'myId'" in which case it's: 但是随后,我也比您可能想要的收集了更多的信息:“找到id为'myId'的顶点,然后将传出的'成员'边缘遍历到带有'myLabel'标签的顶点,然后将传入的'成员'边缘遍历到顶点其identifier属性的值与带有“ myId”的起始顶点的“标识符”属性的值相同,在这种情况下,它是:

g.V('myId').as('me').
  out('member').hasLabel('myLabel').
  in('member').as('them').
  where('them', eq('me')).
    by('identifier')

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

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