-
Notifications
You must be signed in to change notification settings - Fork 5
Expressions
Marijn van Wezel edited this page Dec 15, 2022
·
5 revisions
php-cypher-dsl can be used to build complex queries in Cypher.
To match only movies released in the 1990s:
$released = variable("nineties")->property("released");
$expression = $released->gte(1990)->and($released->lt(2000));
$this->assertSame("((nineties.released >= 1990) AND (nineties.released < 2000))", $expression->toQuery());
To match all actors except Tom Hanks:
$name = variable("actor")->property("name");
$expression = $name->notEquals("Tom Hanks");
$this->assertSame("(actor.name <> 'Tom Hanks')", $expression->toQuery());
It is possible to use raw text in an expression.
$released = variable("nineties")->property("released");
$expression = $released->gte(1990)->and(Query::rawExpression("(nineties IS NOT NULL)"));
$this->assertSame("((nineties.released >= 1990) AND (nineties IS NOT NULL))", $expression->toQuery());