Hi there,

Trying to find all paths between 2 vertices using Gremlin/Groovy
This query returns many paths

g.v("#21:7").as("person").both("RELATED").loop("person"){it.object.id != 
"#16:10" && it.loops < 4}.path

so, I'm trying to filter out unwanted using filter or has

g.v("#21:7").as("person").both("RELATED").loop("person"){it.object.id != 
"#16:10" && it.loops < 4}.filter{it.id == '#16:10'}.path

or

g.v("#21:7").as("person").both("RELATED").loop("person"){it.object.id != 
"#16:10" && it.loops < 4}.has('@rid','#16:10').path()

both of these queries return nothing. However, using Java API

        OrientGraph graph = 
DatabaseManager.getInstance().getDatabase("remote:192.168.200.128/ePersona").getConnection();
        final Vertex src = graph.getVertex("#21:7");
        final Vertex target = graph.getVertex("#16:10");
        long start = System.currentTimeMillis();
        GremlinPipeline pipe = new GremlinPipeline(src).as("person");

        List path = pipe.both("RELATED").except("person").loop("person", 
new PipeFunction<LoopPipe.LoopBundle, Boolean>() {
            @Override
            public Boolean compute(LoopPipe.LoopBundle loopBundle) {
                return loopBundle.getLoops() < 4 && 
((Vertex)loopBundle.getObject()).getId()!=src.getId() && 
((Vertex)loopBundle.getObject()).getId()!= target.getId()  ;
            }
        }).filter(new PipeFunction<Vertex, Boolean>() {
            @Override
            public Boolean compute(Vertex o) {
                return o.getId() == target.getId();
            }
        }).path().toList();

path - contains 153 accurate results.
Question: What's wrong with Groovy queries, which are using filter/has ?

Thanks!

-Andrey

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to