From 1c0300c249bdd0b44b3d09524878ad630cfb675a Mon Sep 17 00:00:00 2001 From: Nicola Vitucci Date: Wed, 17 Sep 2025 11:00:35 +0100 Subject: [PATCH 1/5] Add first round of grammar snippets --- .../syntax/clauses/call-procedure.bnf | 4 + .../ROOT/examples/syntax/clauses/create.bnf | 4 + .../ROOT/examples/syntax/clauses/delete.bnf | 4 + .../ROOT/examples/syntax/clauses/filter.bnf | 4 + .../ROOT/examples/syntax/clauses/foreach.bnf | 4 + modules/ROOT/examples/syntax/clauses/let.bnf | 4 + .../ROOT/examples/syntax/clauses/limit.bnf | 4 + .../ROOT/examples/syntax/clauses/load-csv.bnf | 4 + .../ROOT/examples/syntax/clauses/match.bnf | 14 ++ .../ROOT/examples/syntax/clauses/merge.bnf | 4 + .../syntax/clauses/optional-match.bnf | 4 + .../ROOT/examples/syntax/clauses/order-by.bnf | 4 + .../ROOT/examples/syntax/clauses/remove.bnf | 4 + .../ROOT/examples/syntax/clauses/return.bnf | 4 + modules/ROOT/examples/syntax/clauses/set.bnf | 4 + .../syntax/clauses/show-functions.bnf | 11 ++ .../syntax/clauses/show-procedures.bnf | 4 + .../examples/syntax/clauses/show-settings.bnf | 4 + .../syntax/clauses/show-transactions.bnf | 8 ++ modules/ROOT/examples/syntax/clauses/skip.bnf | 4 + .../syntax/clauses/terminate-transactions.bnf | 7 + .../ROOT/examples/syntax/clauses/unwind.bnf | 4 + modules/ROOT/examples/syntax/clauses/use.bnf | 4 + .../ROOT/examples/syntax/clauses/where.bnf | 4 + modules/ROOT/examples/syntax/clauses/with.bnf | 4 + .../examples/syntax/constraints/create.bnf | 64 +++++++++ .../ROOT/examples/syntax/constraints/drop.bnf | 8 ++ .../ROOT/examples/syntax/constraints/show.bnf | 26 ++++ .../syntax/indexes/create-fulltext.bnf | 22 +++ .../examples/syntax/indexes/create-lookup.bnf | 16 +++ .../examples/syntax/indexes/create-point.bnf | 20 +++ .../examples/syntax/indexes/create-range.bnf | 23 ++++ .../examples/syntax/indexes/create-text.bnf | 20 +++ .../examples/syntax/indexes/create-vector.bnf | 24 ++++ .../ROOT/examples/syntax/indexes/create.bnf | 19 +++ modules/ROOT/examples/syntax/indexes/drop.bnf | 4 + modules/ROOT/examples/syntax/indexes/show.bnf | 27 ++++ .../syntax/patterns/graph-pattern.bnf | 10 ++ .../ROOT/examples/syntax/patterns/labels.bnf | 19 +++ .../syntax/patterns/legacy-shortest-path.bnf | 4 + .../examples/syntax/patterns/match-mode.bnf | 13 ++ .../ROOT/examples/syntax/patterns/nodes.bnf | 14 ++ .../examples/syntax/patterns/path-length.bnf | 28 ++++ .../examples/syntax/patterns/path-pattern.bnf | 27 ++++ .../syntax/patterns/property-key-value.bnf | 10 ++ modules/ROOT/examples/syntax/patterns/qpp.bnf | 12 ++ .../patterns/quantified-relationships.bnf | 4 + .../examples/syntax/patterns/quantifiers.bnf | 19 +++ .../syntax/patterns/relationships.bnf | 18 +++ .../patterns/shortest-path-functions.bnf | 4 + .../syntax/patterns/shortest-paths.bnf | 40 ++++++ modules/ROOT/images/railroad/match.svg | 126 ++++++++++++++++++ modules/ROOT/pages/clauses/call.adoc | 3 + modules/ROOT/pages/clauses/create.adoc | 4 + modules/ROOT/pages/clauses/delete.adoc | 7 +- modules/ROOT/pages/clauses/filter.adoc | 5 + modules/ROOT/pages/clauses/foreach.adoc | 7 +- modules/ROOT/pages/clauses/let.adoc | 7 +- modules/ROOT/pages/clauses/limit.adoc | 5 + .../ROOT/pages/clauses/listing-functions.adoc | 5 + .../pages/clauses/listing-procedures.adoc | 5 + .../ROOT/pages/clauses/listing-settings.adoc | 5 + modules/ROOT/pages/clauses/load-csv.adoc | 5 + modules/ROOT/pages/clauses/match.adoc | 7 +- modules/ROOT/pages/clauses/merge.adoc | 4 + .../ROOT/pages/clauses/optional-match.adoc | 5 + modules/ROOT/pages/clauses/order-by.adoc | 5 + modules/ROOT/pages/clauses/remove.adoc | 4 + modules/ROOT/pages/clauses/return.adoc | 5 + modules/ROOT/pages/clauses/set.adoc | 5 + modules/ROOT/pages/clauses/skip.adoc | 7 +- .../pages/clauses/transaction-clauses.adoc | 10 +- modules/ROOT/pages/clauses/unwind.adoc | 4 + modules/ROOT/pages/clauses/use.adoc | 5 + modules/ROOT/pages/clauses/where.adoc | 5 + modules/ROOT/pages/clauses/with.adoc | 5 + modules/ROOT/pages/constraints/syntax.adoc | 13 ++ modules/ROOT/pages/indexes/syntax.adoc | 45 +++++++ modules/ROOT/pages/patterns/reference.adoc | 65 +++++++++ modules/ROOT/partials/syntax.adoc | 10 ++ 80 files changed, 1000 insertions(+), 7 deletions(-) create mode 100644 modules/ROOT/examples/syntax/clauses/call-procedure.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/create.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/delete.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/filter.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/foreach.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/let.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/limit.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/load-csv.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/match.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/merge.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/optional-match.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/order-by.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/remove.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/return.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/set.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/show-functions.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/show-procedures.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/show-settings.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/show-transactions.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/skip.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/terminate-transactions.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/unwind.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/use.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/where.bnf create mode 100644 modules/ROOT/examples/syntax/clauses/with.bnf create mode 100644 modules/ROOT/examples/syntax/constraints/create.bnf create mode 100644 modules/ROOT/examples/syntax/constraints/drop.bnf create mode 100644 modules/ROOT/examples/syntax/constraints/show.bnf create mode 100644 modules/ROOT/examples/syntax/indexes/create-fulltext.bnf create mode 100644 modules/ROOT/examples/syntax/indexes/create-lookup.bnf create mode 100644 modules/ROOT/examples/syntax/indexes/create-point.bnf create mode 100644 modules/ROOT/examples/syntax/indexes/create-range.bnf create mode 100644 modules/ROOT/examples/syntax/indexes/create-text.bnf create mode 100644 modules/ROOT/examples/syntax/indexes/create-vector.bnf create mode 100644 modules/ROOT/examples/syntax/indexes/create.bnf create mode 100644 modules/ROOT/examples/syntax/indexes/drop.bnf create mode 100644 modules/ROOT/examples/syntax/indexes/show.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/graph-pattern.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/labels.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/legacy-shortest-path.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/match-mode.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/nodes.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/path-length.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/path-pattern.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/property-key-value.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/qpp.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/quantified-relationships.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/quantifiers.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/relationships.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/shortest-path-functions.bnf create mode 100644 modules/ROOT/examples/syntax/patterns/shortest-paths.bnf create mode 100644 modules/ROOT/images/railroad/match.svg create mode 100644 modules/ROOT/partials/syntax.adoc diff --git a/modules/ROOT/examples/syntax/clauses/call-procedure.bnf b/modules/ROOT/examples/syntax/clauses/call-procedure.bnf new file mode 100644 index 000000000..cf9d11e10 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/call-procedure.bnf @@ -0,0 +1,4 @@ +# call-procedure + + ::= + [ "OPTIONAL" ] "CALL" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/create.bnf b/modules/ROOT/examples/syntax/clauses/create.bnf new file mode 100644 index 000000000..88d68bfcc --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/create.bnf @@ -0,0 +1,4 @@ +# create + + ::= + "CREATE" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/delete.bnf b/modules/ROOT/examples/syntax/clauses/delete.bnf new file mode 100644 index 000000000..1a1a684e6 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/delete.bnf @@ -0,0 +1,4 @@ +# delete + + ::= + [ "DETACH" | "NODETACH" ] "DELETE" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/filter.bnf b/modules/ROOT/examples/syntax/clauses/filter.bnf new file mode 100644 index 000000000..747a6a742 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/filter.bnf @@ -0,0 +1,4 @@ +# filter + + ::= + "FILTER" [ "WHERE" ] \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/foreach.bnf b/modules/ROOT/examples/syntax/clauses/foreach.bnf new file mode 100644 index 000000000..b3e2fc755 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/foreach.bnf @@ -0,0 +1,4 @@ +# foreach + + ::= + "FOREACH" "(" ")" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/let.bnf b/modules/ROOT/examples/syntax/clauses/let.bnf new file mode 100644 index 000000000..f85606dc2 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/let.bnf @@ -0,0 +1,4 @@ +# let + + ::= + "LET" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/limit.bnf b/modules/ROOT/examples/syntax/clauses/limit.bnf new file mode 100644 index 000000000..87a93ad9f --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/limit.bnf @@ -0,0 +1,4 @@ +# limit + + ::= + "LIMIT" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/load-csv.bnf b/modules/ROOT/examples/syntax/clauses/load-csv.bnf new file mode 100644 index 000000000..5f0c4436b --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/load-csv.bnf @@ -0,0 +1,4 @@ +# load-csv + + ::= + "LOAD CSV" [ "WITH HEADERS" ] [ ] \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/match.bnf b/modules/ROOT/examples/syntax/clauses/match.bnf new file mode 100644 index 000000000..4bbb2f8d0 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/match.bnf @@ -0,0 +1,14 @@ +# match + + ::= + "MATCH" + + ::= + [ ] [ { "," }... ] [ ] + + ::= + "REPEATABLE" { "ELEMENT" [ "BINDINGS" ] | "ELEMENTS" } + | "DIFFERENT" { "RELATIONSHIP" [ "BINDINGS" ] | "RELATIONSHIPS" } + + ::= + [ "=" ] [ ] \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/merge.bnf b/modules/ROOT/examples/syntax/clauses/merge.bnf new file mode 100644 index 000000000..ad5d8b5e6 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/merge.bnf @@ -0,0 +1,4 @@ +# merge + + ::= + "MERGE" [ ] \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/optional-match.bnf b/modules/ROOT/examples/syntax/clauses/optional-match.bnf new file mode 100644 index 000000000..d74751912 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/optional-match.bnf @@ -0,0 +1,4 @@ +# optional-match + + ::= + "OPTIONAL" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/order-by.bnf b/modules/ROOT/examples/syntax/clauses/order-by.bnf new file mode 100644 index 000000000..e24e748ab --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/order-by.bnf @@ -0,0 +1,4 @@ +# order-by + + ::= + "ORDER BY" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/remove.bnf b/modules/ROOT/examples/syntax/clauses/remove.bnf new file mode 100644 index 000000000..2066e9722 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/remove.bnf @@ -0,0 +1,4 @@ +# remove + + ::= + "REMOVE" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/return.bnf b/modules/ROOT/examples/syntax/clauses/return.bnf new file mode 100644 index 000000000..46098016b --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/return.bnf @@ -0,0 +1,4 @@ +# return + + ::= + "RETURN" [ ] \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/set.bnf b/modules/ROOT/examples/syntax/clauses/set.bnf new file mode 100644 index 000000000..1db01ad67 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/set.bnf @@ -0,0 +1,4 @@ +# set + + ::= + "SET" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/show-functions.bnf b/modules/ROOT/examples/syntax/clauses/show-functions.bnf new file mode 100644 index 000000000..011b5ec8d --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/show-functions.bnf @@ -0,0 +1,11 @@ +# show-functions + + ::= + "SHOW" [ "ALL" | "BUILT IN" | "USER DEFINED" ] { "FUNCTION" | "FUNCTIONS" } [ ] [ ] + + ::= + "EXECUTABLE" [ "BY CURRENT USER" | "BY" ] + + ::= + "YIELD" [ ] [ ] [ ] [ ] [ ] + | \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/show-procedures.bnf b/modules/ROOT/examples/syntax/clauses/show-procedures.bnf new file mode 100644 index 000000000..f34bd39e2 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/show-procedures.bnf @@ -0,0 +1,4 @@ +# show-procedures + + ::= + "SHOW" [ ] [ ] \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/show-settings.bnf b/modules/ROOT/examples/syntax/clauses/show-settings.bnf new file mode 100644 index 000000000..6b7ce0786 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/show-settings.bnf @@ -0,0 +1,4 @@ +# show-settings + + ::= + "SHOW" [ ] [ ] \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/show-transactions.bnf b/modules/ROOT/examples/syntax/clauses/show-transactions.bnf new file mode 100644 index 000000000..b4ed7594a --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/show-transactions.bnf @@ -0,0 +1,8 @@ +# show-transactions + + ::= + "SHOW" { "TRANSACTION" | "TRANSACTIONS" } [ ] [ ] + + ::= + "YIELD" [ ] [ ] [ ] [ ] [ ] + | \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/skip.bnf b/modules/ROOT/examples/syntax/clauses/skip.bnf new file mode 100644 index 000000000..c4d67a781 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/skip.bnf @@ -0,0 +1,4 @@ +# skip + + ::= + \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/terminate-transactions.bnf b/modules/ROOT/examples/syntax/clauses/terminate-transactions.bnf new file mode 100644 index 000000000..6fa8aef89 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/terminate-transactions.bnf @@ -0,0 +1,7 @@ +# terminate-transactions + + ::= + "TERMINATE" { "TRANSACTION" | "TRANSACTIONS" } [ ] + + ::= + "YIELD" [ ] [ ] [ ] [ ] [ ] \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/unwind.bnf b/modules/ROOT/examples/syntax/clauses/unwind.bnf new file mode 100644 index 000000000..94ceac658 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/unwind.bnf @@ -0,0 +1,4 @@ +# unwind + + ::= + "UNWIND" "AS" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/use.bnf b/modules/ROOT/examples/syntax/clauses/use.bnf new file mode 100644 index 000000000..ef49b7f95 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/use.bnf @@ -0,0 +1,4 @@ +# use + + ::= + "USE" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/where.bnf b/modules/ROOT/examples/syntax/clauses/where.bnf new file mode 100644 index 000000000..c76a6104f --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/where.bnf @@ -0,0 +1,4 @@ +# where + + ::= + "WHERE" \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/clauses/with.bnf b/modules/ROOT/examples/syntax/clauses/with.bnf new file mode 100644 index 000000000..f60fc4267 --- /dev/null +++ b/modules/ROOT/examples/syntax/clauses/with.bnf @@ -0,0 +1,4 @@ +# with + + ::= + "WITH" [ ] [ ] \ No newline at end of file diff --git a/modules/ROOT/examples/syntax/constraints/create.bnf b/modules/ROOT/examples/syntax/constraints/create.bnf new file mode 100644 index 000000000..9d04a6013 --- /dev/null +++ b/modules/ROOT/examples/syntax/constraints/create.bnf @@ -0,0 +1,64 @@ +# create-constraint + + ::= + "CREATE CONSTRAINT" [ | ] [ "IF NOT EXISTS" ] [ ] + + ::= + "OPTIONS" + + ::= + + | "(" [ { "," }... ] ")" + + ::= + "." + + ::= + + | + + ::= + + | + | + | + + ::= + + | + | + | + + ::= + "FOR" "REQUIRE" "IS" [ "NODE" ] "KEY" + + ::= + "FOR" "REQUIRE" "IS" [ "NODE" ] "UNIQUE" + + ::= + "FOR" "REQUIRE" "IS NOT NULL" + + ::= + "FOR" "REQUIRE" { [ "IS" ] "::" | "IS TYPED" } + + ::= + "FOR" "REQUIRE" "IS" [ "RELATIONSHIP" | "REL" ] "KEY" + + ::= + "FOR" "REQUIRE" "IS" [ "RELATIONSHIP" | "REL" ] "UNIQUE" + + ::= + "FOR" "REQUIRE" "IS NOT NULL" + + ::= + "FOR" "REQUIRE" { [ "IS" ] "::" | "IS TYPED" } + + ::= + "(" ":"