Hi,
The following code illustrates my concern/confusion.
@Test
public void testHasId() {
final TinkerGraph graph = TinkerGraph.open();
Vertex a = graph.addVertex(T.label, "A");
Vertex b = graph.addVertex(T.label, "B");
List<Vertex> vertices =
graph.traversal().V().hasId(a.id()).hasId(b.id()).toList();
Assert.assertTrue(vertices.isEmpty());
}
The test fails as the both vertices are returned.
Is this expected, I expected 'and' not 'or' behavior.
Similar to,
@Test
public void testHasLabel() {
final TinkerGraph graph = TinkerGraph.open();
Vertex a = graph.addVertex(T.label, "A");
Vertex b = graph.addVertex(T.label, "B");
List<Vertex> vertices =
graph.traversal().V().hasLabel("A").hasLabel("B").toList();
Assert.assertTrue(vertices.isEmpty());
}
This one passes.
I checked the docs,
|hasLabel(labels...)|: Remove the traverser if its element does not have
any of the labels.
|hasId(ids...)|: Remove the traverser if its element does not have any
of the ids.
Seems they should behave the same?
I am working on version 3.2.4
Thanks
Pieter