From 16c2843a67c157db692ce95e03a4fd7a99749a61 Mon Sep 17 00:00:00 2001 From: Mats Rydberg Date: Thu, 4 May 2017 14:11:17 +0200 Subject: [PATCH] Add tests verifying NODE KEY works in grammar --- grammar/basic-grammar.xml | 2 ++ grammar/commands.xml | 15 ++++++++------- tools/grammar/src/test/resources/cypher.txt | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/grammar/basic-grammar.xml b/grammar/basic-grammar.xml index e9c8276c40..e31b98b59f 100644 --- a/grammar/basic-grammar.xml +++ b/grammar/basic-grammar.xml @@ -666,6 +666,8 @@ ALL NONE SINGLE + NODE + KEY diff --git a/grammar/commands.xml b/grammar/commands.xml index 925006fde8..0c8ee91462 100644 --- a/grammar/commands.xml +++ b/grammar/commands.xml @@ -53,7 +53,7 @@ - CREATE &SP; CONSTRAINT &SP; &SP; + ADD &SP; CONSTRAINT &SP; &SP; FOR &SP; &SP; REQUIRE &SP; @@ -75,17 +75,18 @@ - - + + + - - UNIQUE &SP; &WS; , &WS; + + UNIQUE &SP; - - exists ( ) + + NODE &SP; KEY &SP; &WS; , &WS; diff --git a/tools/grammar/src/test/resources/cypher.txt b/tools/grammar/src/test/resources/cypher.txt index 5509dbdd70..f1c53a8bf4 100644 --- a/tools/grammar/src/test/resources/cypher.txt +++ b/tools/grammar/src/test/resources/cypher.txt @@ -267,16 +267,22 @@ MATCH (a) CALL proc( )§ MATCH (a) CALL proc( a, b , c )§ MATCH (a) CALL proc( a, b , c ) YIELD a, b , c§ CALL proc( ) RETURN *§ -CREATE CONSTRAINT foo +ADD CONSTRAINT foo FOR (p:Person) REQUIRE UNIQUE p.name§ -CREATE CONSTRAINT bar -FOR (p:Person) -REQUIRE UNIQUE p.name, p.email§ -CREATE CONSTRAINT baz +ADD CONSTRAINT baz FOR (p:Person) REQUIRE exists(p.name)§ -CREATE CONSTRAINT cru +ADD CONSTRAINT cru FOR ()-[r:REL]-() REQUIRE exists(r.property)§ DROP CONSTRAINT foo_bar_baz§ +ADD CONSTRAINT nodeKey +FOR (n:Node) +REQUIRE NODE KEY n.prop§ +ADD CONSTRAINT nodeKey +FOR (n:Node) +REQUIRE NODE KEY n.p1, n.p2, n.p3§ +ADD CONSTRAINT nodeKey +FOR (n:Node) +REQUIRE NODE KEY n.p1 ,n.p2, n.p3§