Hi Pieter, that's a nasty bug. I just verified that it's also a bug in master/:
gremlin> graph = TinkerGraph.open() ==>tinkergraph[vertices:0 edges:0] gremlin> a = graph.addVertex(label, "A") ==>v[0] gremlin> b = graph.addVertex(label, "B") ==>v[1] gremlin> graph.traversal().V().hasId(a.id()).hasId(b.id()) ==>v[0] ==>v[1] gremlin> graph.traversal().V().hasId(a.id()).hasId(b.id()).explain() ==>Traversal Explanation ========================================================================================== Original Traversal [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] ConnectiveStrategy [D] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] MatchPredicateStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] FilterRankingStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] InlineFilterStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] IncidentToAdjacentStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] AdjacentToIncidentStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] RepeatUnrollStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] CountStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] PathRetractionStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] LazyBarrierStrategy [O] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] TinkerGraphCountStrategy [P] [GraphStep(vertex,[]), HasStep([~id.eq(0), ~id.eq(1)])] TinkerGraphStepStrategy [P] [TinkerGraphStep(vertex,[0, 1])] ProfileStrategy [F] [TinkerGraphStep(vertex,[0, 1])] StandardVerificationStrategy [V] [TinkerGraphStep(vertex,[0, 1])] Final Traversal [TinkerGraphStep(vertex,[0, 1])] gremlin> Gremlin.version() ==>3.3.0-SNAPSHOT Can you create a ticket? Cheers, Daniel On Sun, May 28, 2017 at 10:45 AM, pieter gmail <pieter.mar...@gmail.com> wrote: > 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 > >