Hello,

times(0) means "go through the loop 0 times." However, given that its a post 
times(0), then it would go through once.

I just updated the RepeatUnrollStrategy to only do unrolling for times > 0  to 
keep things consistent with previous behavior — though times(0) is a really 
weird case.

Thanks,
Marko.

http://markorodriguez.com



> On Jul 16, 2016, at 11:40 AM, pieter-gmail <pieter.mar...@gmail.com> wrote:
> 
> More investigation, shows that the new RepeatUnrollStrategy completely
> removes the RepeatStep because of the times 0 logic.
> 
> For the global case the leaves behind the GraphStep and the HasStep thus
> returning a1.
> 
> For the LocalStep case the LocalSteps are now empty (after the
> RepeatSteps have been removed) throwing a FastNoSuchElementException and
> thus returning no elements.
> 
> However I think we first need to understand what the expected semantics
> of a before times(0) is.
> I have a feeling that my previous passing tests were just getting lucky?
> 
> Thanks
> Pieter
> 
> 
> On 16/07/2016 18:37, pieter-gmail wrote:
>> Hi,
>> 
>> I am running the following tests on 3.2.1-SNAPSHOT
>> 
>>    @Test
>>    public void testRepeat() {
>>        final TinkerGraph g = TinkerGraph.open();
>>        Vertex a1 = g.addVertex(T.label, "A", "name", "a1");
>>        Vertex b1 = g.addVertex(T.label, "B", "name", "b1");
>>        Vertex b2 = g.addVertex(T.label, "B", "name", "b2");
>>        Vertex b3 = g.addVertex(T.label, "B", "name", "b3");
>>        a1.addEdge("ab", b1);
>>        a1.addEdge("ab", b2);
>>        a1.addEdge("ab", b3);
>>        Vertex c1 = g.addVertex(T.label, "C", "name", "c1");
>>        Vertex c2 = g.addVertex(T.label, "C", "name", "c2");
>>        Vertex c3 = g.addVertex(T.label, "C", "name", "c3");
>>        b1.addEdge("bc", c1);
>>        b1.addEdge("bc", c2);
>>        b1.addEdge("bc", c3);
>> 
>>        //this passes   
>>        List<Vertex> vertices =
>> g.traversal().V().hasLabel("A").<Vertex>times(0).repeat(out("ab").out("bc")).toList();
>>        assertEquals(1, vertices.size());
>>        assertTrue(vertices.contains(a1));
>> 
>>        //this fails
>>        vertices =
>> g.traversal().V().hasLabel("A").local(__.<Vertex>times(0).repeat(out("ab").out("bc"))).toList();
>>        assertEquals(1, vertices.size());
>>        assertTrue(vertices.contains(a1));
>>    }
>> 
>> Previously on 3.2.0-incubating the test passed.
>> 
>> Is this a bug or a new interpretation of the while do zero times logic?
>> 
>> Thanks
>> Pieter
>> 
>> 
>> 
> 

Reply via email to