Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/ROOT/content-nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
** xref:syntax/parsing.adoc[]
** xref:syntax/naming.adoc[]
** xref:syntax/variables.adoc[]
** xref:syntax/reserved.adoc[]
** xref:syntax/keywords.adoc[]
** xref:syntax/parameters.adoc[]
** xref:syntax/operators.adoc[]
** xref:syntax/comments.adoc[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ Cypher Shell also offers specific link:{neo4j-docs-base-uri}/operations-manual/{
| 21.3
| <token>, <separator>, and <identifier>
| GQL specifies a list of link:https://standards.iso.org/iso-iec/39075/ed-1/en/ISO_IEC_39075(en).bnf.txt[reserved words] that cannot be used for unquoted variable names, labels, and property names.
Cypher also specifies a list of xref:syntax/reserved.adoc[reserved keywords], but it differs from GQL's.
Cypher also specifies a list of xref:syntax/keywords.adoc[reserved keywords], but it differs from GQL's.
|===
2 changes: 1 addition & 1 deletion modules/ROOT/pages/syntax/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Further information can be found in the following sections:
* xref::syntax/parsing.adoc[Parsing]
* xref::syntax/naming.adoc[Naming rules and recommendations]
* xref::syntax/variables.adoc[Variables]
* xref::syntax/reserved.adoc[Reserved keywords]
* xref::syntax/keywords.adoc[Keywords]
* xref::syntax/parameters.adoc[Parameters]
* xref::syntax/operators.adoc[Operators]
* xref::syntax/comments.adoc[Comments]
363 changes: 363 additions & 0 deletions modules/ROOT/pages/syntax/keywords.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,363 @@
:description: This section contains a list of reserved keywords in Cypher.

[[cypher-keywords]]
= Keywords

Keywords are words with a predefined meaning in Cypher.

Keywords are not recommended to be used as identifiers in the following contexts:

* Variables
* Labels
* Relationship types
* Function names
* Procedure names

If a snippet of Cypher can both be a keyword and an unquoted identifier, it is interpreted as a keyword.

For instance in the following, `true` could be the variable `true` or the Boolean literal value `true`. Since `true` is a keyword, the query returns a single Boolean `true` value.

.Query
[source, cypher, role=test-result-skip]
----
WITH 123 AS true
RETURN true AS x
----

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| x

| true

1+d|Rows: 1
|===

If any keyword is quoted in backticks (```), such as `++`true`++`, it is always interpreted as an identifier in the given context.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If any keyword is quoted in backticks (```), such as `++`true`++`, it is always interpreted as an identifier in the given context.
If a keyword is quoted in backticks (```), such as `++`true`++`, it is interpreted as an identifier in the given context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with your suggestion.

However, if we like my proposal above, we may want to do something like following here:

A quoted identifier equal to a keyword is interpreted as an identifier (even if it is equal to a keyword).


.Query
[source, cypher, role=test-result-skip]
----
WITH 123 AS true
RETURN `true` AS x
----

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| x

| 123

1+d|Rows: 1
|===


== List of keywords

The following lists all keywords in Cypher.

Note that with future functionality, Cypher may be extended with additional keywords.

=== A
`ACCESS`
`ACTIVE`
`ADMIN`
`ADMINISTRATOR`
`ALIAS`
`ALIASES`
`ALL`
`ALL_SHORTEST_PATHS`
`ALTER`
`AND`
`ANY`
`ARRAY`
`AS`
`ASC`
`ASCENDING`
`ASSIGN`
`AT`
`AUTH`

=== B
`BINDINGS`
`BOOL`
`BOOLEAN`
`BOOSTED`
`BOTH`
`BREAK`
`BUILT`
`BY`

=== C
`CALL`
`CASCADE`
`CASE`
`CHANGE`
`CIDR`
`COLLECT`
`COMMAND`
`COMMANDS`
`COMPOSITE`
`CONCURRENT`
`CONSTRAINT`
`CONSTRAINTS`
`CONTAINS`
`CONTINUE`
`COPY`
`COUNT`
`CREATE`
`CSV`
`CURRENT`

=== D
`DATA`
`DATABASE`
`DATABASES`
`DATE`
`DATETIME`
`DBMS`
`DEALLOCATE`
`DEFAULT`
`DEFINED`
`DELETE`
`DENY`
`DESC`
`DESCENDING`
`DESTROY`
`DETACH`
`DIFFERENT`
`DISTINCT`
`DRIVER`
`DROP`
`DRYRUN`
`DUMP`
`DURATION`

=== E
`EACH`
`EDGE`
`ELEMENT`
`ELEMENTS`
`ELSE`
`ENABLE`
`ENCRYPTED`
`END`
`ENDS`
`ERROR`
`EXECUTABLE`
`EXECUTE`
`EXIST`
`EXISTENCE`
`EXISTS`

=== F
`FAIL`
`FALSE`
`FIELDTERMINATOR`
`FINISH`
`FLOAT`
`FOR`
`FOREACH`
`FROM`
`FULLTEXT`
`FUNCTION`
`FUNCTIONS`

=== G, H
`GRANT`
`GRAPH`
`GRAPHS`
`GROUP`
`GROUPS`

`HEADERS`
`HOME`

=== I
`ID`
`IF`
`IMMUTABLE`
`IMPERSONATE`
`IN`
`INDEX`
`INDEXES`
`INF`
`INFINITY`
`INSERT`
`INT`
`INTEGER`
`IS`

=== J, K, L, M
`JOIN`

`KEY`

`LABEL`
`LABELS`
`LEADING`
`LIMITROWS`
`LIST`
`LOAD`
`LOCAL`
`LOOKUP`

`MANAGEMENT`
`MAP`
`MATCH`
`MERGE`

=== N
`NAME`
`NAMES`
`NAN`
`NEW`
`NFC`
`NFD`
`NFKC`
`NFKD`
`NODE`
`NODES`
`NODETACH`
`NONE`
`NORMALIZE`
`NORMALIZED`
`NOT`
`NOTHING`
`NOWAIT`
`NULL`

=== O
`OF`
`OFFSET`
`ON`
`ONLY`
`OPTION`
`OPTIONAL`
`OPTIONS`
`OR`
`ORDER`

=== P
`PASSWORD`
`PASSWORDS`
`PATH`
`PATHS`
`PLAINTEXT`
`POINT`
`POPULATED`
`PRIMARIES`
`PRIMARY`
`PRIVILEGE`
`PRIVILEGES`
`PROCEDURE`
`PROCEDURES`
`PROPERTIES`
`PROPERTY`
`PROVIDER`
`PROVIDERS`

=== R
`RANGE`
`READ`
`REALLOCATE`
`REDUCE`
`REL`
`RELATIONSHIP`
`RELATIONSHIPS`
`REMOVE`
`RENAME`
`REPEATABLE`
`REPLACE`
`REPORT`
`REQUIRE`
`REQUIRED`
`RESTRICT`
`RETURN`
`REVOKE`
`ROLE`
`ROLES`
`ROW`
`ROWS`

=== S
`SCAN`
`SEC`
`SECOND`
`SECONDARIES`
`SECONDARY`
`SECONDS`
`SEEK`
`SERVER`
`SERVERS`
`SET`
`SETTING`
`SETTINGS`
`SHORTEST`
`SHORTEST_PATH`
`SHOW`
`SIGNED`
`SINGLE`
`SKIPROWS`
`START`
`STARTS`
`STATUS`
`STOP`
`STRING`
`SUPPORTED`
`SUSPENDED`

=== T
`TARGET`
`TERMINATE`
`TEXT`
`THEN`
`TIME`
`TIMESTAMP`
`TIMEZONE`
`TO`
`TOPOLOGY`
`TRAILING`
`TRANSACTION`
`TRANSACTIONS`
`TRAVERSE`
`TRIM`
`TRUE`
`TYPE`
`TYPED`
`TYPES`

=== U
`UNION`
`UNIQUE`
`UNIQUENESS`
`UNWIND`
`URL`
`USE`
`USER`
`USERS`
`USING`

=== V, W, X, Y, Z
`VALUE`
`VARCHAR`
`VECTOR`
`VERTEX`

`WAIT`
`WHEN`
`WHERE`
`WITH`
`WITHOUT`
`WRITE`

`XOR`

`YIELD`

`ZONE`
`ZONED`


Loading
Loading