jkminder / data2neo

Data2Neo is a library that simplifies the conversion of data in relational format to a graph knowledge database.
https://data2neo.jkminder.ch
Apache License 2.0
15 stars 0 forks source link

config_parser.py has trouble with compiling overlapping identifiers. #1

Closed jkminder closed 2 years ago

jkminder commented 2 years ago

Example:

ENTITY("Session"):
    NODE("Year") year:
        + year = YEAR_FROM_DATE(Session.StartDate)

    REQUIRED(RELATION(sessionnode, "DURING", year)):
        - name = Session.SessionName
        - type = Session.TypeName
        - date_start = DATE(Session.StartDate)
        - date_end = DATE(Session.EndDate)

    IF_END_DIFFERENT(NODE("Year")) year_end:
        + year = YEAR_FROM_DATE(Session.StartDate)

    IF_END_DIFFERENT(REQUIRED(RELATION(sessionnode, "DURING", year_end))):
        + name = Session.SessionName
        - type = Session.TypeName
        - date_start = DATE(Session.StartDate)
        - date_end = DATE(Session.EndDate)

The config parser/compiler has problems here due to how identifiers (year and year_end) are parsed. The identifier year_end is sometimes parsed first as year (not always though, not yet sure why). Which gives weird parser errors (it identifies the substring year first-> "year"_end). Requires rewrite of compiler in config_parser.py.

Temporary Solution: Make sure your identifiers non-overlapping. E.g. year and yend instead of year and year_end.