Parameterized edges creation in existing graph

Hi :gremlin_smile: , I'm currently experimenting with Janusgraph. My graph is a directed hierachical graph coming straight from parsing an XML file. After this first bulk load, I want to add multiple new edges between vertices to create shortcuts or remove property duplication.
This was easily done using Cypher and a double MATCH but struggle to do the same thing in Gremlin.

I created a small dataset in Gremlify https://gremlify.com/jf036ue70jj/4

g.V()
    .hasLabel('E')
    .as('e')
    .local(
        // this first block alone returns only 6 pairs i,j
        select('e').values('bName').as('i').
        select('e').values('cName').as('j').
        select('i', 'j')
        
        // matching corresponding B->C vertices does not work (48 results)
        .V()
            .hasLabel('B').has('name', select('i')).as('b')
            .out('has').has('name', select('j')).as('c')
        //addE 'connected' from 'e' to 'c'
        .select('e', 'b', 'c')
    )


I tried project(), local(), combinations of select() and map() but I think I'm missing something really basic.
Thanks :furnace:
Solution
You've stumbled upon a common gap in Gremlin... has() steps cannot currently take a traversal as an argument. It's listed as a roadmap item for a future TinkerPop 4.x release: https://github.com/apache/tinkerpop/blob/087b3070914123055d3e4ededc2550f12715a0b4/docs/src/dev/future/index.asciidoc#has-traversal
GitHub
Apache TinkerPop - a graph computing framework. Contribute to apache/tinkerpop development by creating an account on GitHub.
Was this page helpful?