[英]Gremlin: Select Vertices that have edges that share a property
This is in gremlin-scala. 这是在格林贝斯卡拉。 I have the traversal at a Vertex point (which is what '_' stands for below: 我在顶点处遍历(以下是“ _”的意思:
_.as("vertex").outE().as("outEdge").in().inE().as("inEdge")
.select("inEdge","outEdge").by("fullName")
.where("inEdge", P.eq("outEdge")).select("vertex")
But I am getting an error referencing the .in() after the .as("outEdge") statement: 但是我在.as(“ outEdge”)语句后引用.in()时遇到错误:
Error:(55, 40) Cannot prove that org.apache.tinkerpop.gremlin.structure.Edge <:< gremlin.scala.Vertex.
Can anyone help me figure out what is going wrong here, and more importantly, is this the correct way to find Vertices that have a matching property on its edges? 谁能帮我弄清楚这里出了什么问题,更重要的是,这是找到边缘具有匹配属性的顶点的正确方法吗?
Thanks in advance. 提前致谢。
I think that syntax is incorrect. 我认为语法不正确。 Change: 更改:
_.as("vertex").outE().as("outEdge").in()
to 至
_.as("vertex").outE().as("outEdge").inV()
when you do outE()
you are on an edge, so you must traverse to a Vertex which would be either inV()
(the vertex adjacent to where you started), outV()
(the vertex you started from since you traversed outE()
, or bothV()
which would yield both the vertices at either end of the edge. 当您执行outE()
您将处于一条边上,因此您必须遍历一个顶点,该顶点将是inV()
(与inV()
所在位置相邻的顶点), outV()
(从遍历outE()
或bothV()
,这将在边的任一端产生两个顶点。
I think your method for comparing properties makes sense. 我认为您比较属性的方法很有意义。 Someone else might post a way to simplify further. 其他人可能会发布进一步简化的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.