opencypher/cypher-for-gremlin

addRelation Translation too complex

sandszhouSZ opened this issue · 2 comments

Cypher:
MATCH (a:Person),(b:Person) where a.name = $fromName and b.name = $toName CREATE (a)-[ r:Person {name: $rName, prop: $rName} ]->(b) RETURN r"

Gremlin:
g.V().as('a').hasLabel('Person').V().as('b').hasLabel('Person').where(
__.and(
.choose(.constant('qiaogong_0119-0-0'), __.constant('qiaogong_0119-0-0'), __.constant(' cypher.null')).is(neq(' cypher.null')).as(' GENERATED1').select('a').values('name').where(eq(' GENERATED1')),
.choose(.constant('qiaogong_0119-0-1'), __.constant('qiaogong_0119-0-1'), __.constant(' cypher.null')).is(neq(' cypher.null')).as(' GENERATED2').select('b').values('name').where(eq(' GENERATED2'))))
.addE('Person').from('a').to('b').as('r').
property('name', .choose(.constant('qiaogong_0119-0-0-1'), __.constant('qiaogong_0119-0-0-1'), .constant(' cypher.null'))).
property('prop', .choose(.constant('qiaogong_0119-0-0-1'), .constant('qiaogong_0119-0-0-1'), .constant(' cypher.null'))).
select('r').project('r').by(.choose(neq(' cypher.null'), .project(' cypher.element', ' cypher.inv', ' cypher.outv').by(.valueMap().with('~tinkerpop.valueMap.tokens')).by(.inV().id()).by(
.outV().id())))

the Gremlin's dsl almost impossible to execute, cost too much time

#342 , #334 has the same problem, so i think Instead of letting users not use parameter,the better way may be RemoveUselessNullChecks

how can I print gremlin-sql?