Grupo-Abraxas / slothql

Graph Query Language for Scala
MIT License
1 stars 1 forks source link

Preserve syntax #157

Closed krabbit93 closed 2 years ago

krabbit93 commented 2 years ago

Syntax merge WITH sentence with and without alias

MATCH (`a0`:`Node`) -[:`to`]-> (`b0`:`Node`) 
MATCH (`c0`) WHERE `c0`.`z` = `a0`.`xyz` 
WITH `a0`, `b0`, `c0`.`z` AS `z0` 
RETURN `a0`, `z0`

This sentence was generated with:

 Match { case (a @ Node("Node")) - Rel("to") > (b @ Node("Node")) =>
    Match {
      case c if c.prop[Int]("z") === a.prop[Int]("xyz") =>
        With(*(a, b), c.prop[Int]("z")) { z =>
          (a.props, z)
        }
    }
  }