Skip to content

avoidable reserved word clashes #31

@steveliles

Description

@steveliles

The grammar defines a large number of reserved words which is immediately giving me trouble on an existing graph that had no issues in cypher. In this particular graph (movies) I'm having issues because I have an edge label "cast" and a numeric property "year", but both "cast" and "year" are reserved words such that I have to escape them both:

MATCH (p1:Person)<-[r1:`cast`]-(m1:Movie)-[r2:director]->(p2:Person)
RETURN DISTINCT p1.name, m1.`year`, m1.title, p2.name
ORDER BY m1.`year`, m1.title asc
LIMIT 10

Without escaping I get syntax errors where the message is:

no viable alternative at input \'MATCH p = (n:!Teacher)-[e:cast\'

(The message itself is not terribly helpful, but I've yet to investigate whether there is enough info in the parsing context to be able to determine that the root cause is a misuse of a reserved word in order to do better).

It seems like it should be possible to narrow the contexts in which these words are reserved, since many of them are likely choices for property or label names (min, max, year, month, day, start, unit, reference, product, cast, right, record, order, optional, interval, group, end, date, etc) and it should be clear from the context that a property or label name was intended and not the reserved word (see the example query above).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions