简体   繁体   English

为什么 gremlin-server 没有通过它的 ID 返回一条边?

[英]Why is gremlin-server not returning an edge by it's ID?

I'm using gremlin-server 3.4.11 and connecting to it with java tinkerpop gremlin-driver.我正在使用 gremlin-server 3.4.11 并使用 java tinkerpop gremlin-driver 连接到它。

gE() returns all the edges: gE()返回所有边:

[
  {
    "id": 18,
    "label": "RELATED",
    "type": "edge",
    "inVLabel": "GREMLIN2",
    "outVLabel": "GREMLIN1",
    "inV": 16,
    "outV": 14
  }
]

but gE(18) OR gE().hasId(18) returns empty list:gE(18) OR gE().hasId(18)返回空列表:

[]

Why is that?这是为什么? I would assume, that the corresponding edge would be returned, but it is not.我假设会返回相应的边缘,但事实并非如此。 What am I missing here?我在这里想念什么?

Note : I tried to create an edge with gV(14).addE('RELATED').property('id', 'someId').to(gV(16)) .. this is then found with gE().has('id', 'someId') , BUT it is not the ID of the edge, merely property named 'id'.注意:我尝试使用gV(14).addE('RELATED').property('id', 'someId').to(gV(16))创建一条边 .. 然后使用gE().has('id', 'someId') ,但它不是边缘的 ID,只是名为 'id' 的属性。 hasId() step also returns empty list. hasId()步骤也返回空列表。

Any hints would be greatly appreciated!任何提示将不胜感激!

Are you using TinkerGraph?你在使用 TinkerGraph 吗? Is yes, the IDs are stored as long internally.是的,ID 在内部存储的long

Please try gE(18L)请尝试gE(18L)

There are a number of different Graphs;有许多不同的图表; If you are using Tinker Graph then you have to use: the format L. This is because the ID value is stored as a long internally for the tinkerPop Graph.如果您使用的是 Tinker Graph,那么您必须使用:格式 L。这是因为 ID 值在 tinkerPop Graph 内部存储为 long。 Some use case examples are: gV(1L) this will return a vertex with an ID of 1. Likewise, the ID's for edges are stored as longs too;一些用例示例如下: gV(1L) 这将返回一个 ID 为 1 的顶点。同样,边的 ID 也存储为 long; gE(2L) returns the edge with an ID of 2 gE(2L) 返回 ID 为 2 的边

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

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