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
14 stars 0 forks source link

Crashing when similar name in yaml file #11

Closed lusamino closed 1 year ago

lusamino commented 2 years ago

Hi all,

I have had a really weird error when providing the yaml file to the converter, and it truly took me some time to find out the reason.

The error looked as follows:

ValueError: The arguments list has not the same number of opening and closing brackets: "MPs.city")_birt

And I knew it was coming from one of the following lines in the yaml file:

    IF_NOT_EMPTY(NODE("City", "Location"), "BirthPlace_City") city_birth:
        + name = MPs.BirthPlace_City         
    IF_NOT_EMPTY(IF_REL_NOT_EXISTS(RELATION(person, "BORN_IN", city_birth)), "BirthPlace_City"):

but I could not understand the reason. I was suspecting the wrappers, and their order, might be causing the issue, but I could not find a pattern. Then, I finally realize it was all a conflict with

    IF_NOT_EMPTY(NODE("City", "Location"), "city") city:
        + name = EXTR_CITY(MPs.city)

It seems it all boils down to some conflict in naming between city and city_birth, because now the following is working:

    IF_NOT_EMPTY(NODE("City", "Location"), "BirthPlace_City") birth_city:
        + name = MPs.BirthPlace_City         
    IF_NOT_EMPTY(IF_REL_NOT_EXISTS(RELATION(person, "BORN_IN", birth_city)), "BirthPlace_City"):

Therefore, I believe this is a bug that needs to be solved, as it should not be happening, and it took way a lot of time to find out.

Thank you so much!

jkminder commented 2 years ago

Hi, can you please check the version you are running? I was not able to reproduce the issue.

The error reminds me of how I parsed the schema config in older versions (was messy and couldn't handle such "overlapping" identifiers), see this issue. Since version 0.5.0 i'm using a more sophisticated parser based on regular grammars that should be able to handle this.

Thats why i'm suspecting you are running <0.5.0. Please make sure you are running the newest version 0.6.1 (or at least 0.5.0). If you can still reproduce this issue, can you post the complete config schema?