0

尝试这样的事情

List<Edge> result = g.traversal().V().hasLabel("contextlabel").where(__.otherV().hasLabel(labelName)).bothE().toList();

但是低于错误 org.apache.tinkerpop.gremlin.orientdb.OrientVertex 不能转换为 org.apache.tinkerpop.gremlin.structure.Edge

4

1 回答 1

1

您收到该错误是因为V()返回 anVertex然后您尝试使用where()which 将其Vertex作为要评估的流中的传入项目进行过滤。它尝试调用otherV()which 不是可用的方法Vertex...该方法适用于边缘。我认为你只是bothE()在错误的地方,因此

g.V().hasLabel("contextlabel").
  bothE().
  where(__.otherV().hasLabel(labelName)).
于 2018-10-19T10:30:47.773 回答