1

So i'm working on a personal project that involves japanese language. In this project i also use a Neo4J database.

I stumbled upon a very peculiar issue that i would like your expertise on.

Basically, i retrieve some japanese characters (called Hiragana) from my DB. There's nothing special to it. I separated the Hiragana characters in several sub-categories, based on the fact that a syllable is made out of one character (for instance 'に', 'ni') or two (for instance 'にょ', 'nyo', which is made from ni (に) and yo (よ)).

So i have the following structure in my categories (a bit simplified here) :

Hiragana ------- Single character hiragana (like に)
            |--- Double character hiragana (like にょ)

Each of these categories are linked to nodes (called items here) which contain the hiragana value (like に or にょ). To retrieve these characters, i make a query that sounds like "give me all the characters that belong to a sublist of list "Hiragana". The actual code is nothing special and goes like this :

match(list:item_list)-[:sub_list*0..]->(sublist)-[:list_item]->(kana:item)-[:romaji]->(romaji:item)
where list.name =~'(?i)Hiragana'
return kana.value as item, romaji.value as answer  ORDER BY kana asc

From this, i get the following error :

Don't know how to compare that. Left: Node[496]{value:"にゅ"} (NodeProxy);
Right: Node[498]{value:"にょ"} (NodeProxy)

From the start, i'm puzzled that the DB engine doesn't know how to compare these, because they seem to have the same type (NodeProxy). Also, i don't feel that my query was trying to compare the value of the nodes with other nodes.

Anyway, i started to modify the query, because i had used it before and it worked. After searching a while, i noticed that, in my return clause, if i changed kana.value as item to, let's say kana.value as kana, it suddenly works again.

I changed that value some more and got the following results :

  • kana.value as item : KO
  • kana.value as kana : OK
  • kana.value as test : KO
  • kana.value as es : KO
  • kana.value as question : KO
  • kana.value as romaji : KO
  • kana.value as hiragana : KO
  • return kana.value : KO
  • kana.value as a : KO
  • kana.value as kanak : KO

So only "kana.value as kana" worked, for whatever reason...

Do you guys have any idea what's going on? Could this be a bug and not a mistake on my part?

Loïc.

PS : I use the graphaware library in php to call the database, but the issue is unrelated, as the error also happens in the noe4j browser

Loïc N.
  • 353
  • 3
  • 17

1 Answers1

0

I didn't find the root cause of this issue, but i found a workaround.

I'm not satisfied about leaving this issue unsolved, but i don't want to spend anymore time on this than necessary, and i don't want you guys to lose time on this either.

Work-around

So what i did was to modify a part of my query. Instead of naming nodes "kana" and returning "kana.value", i changed the name to "character", and i now return "character.value".

It works, don't ask me why.

Old query :

match(list:item_list)-[:sub_list*0..]->(sublist)-[:list_item]->(kana:item)-[:romaji]->(romaji:item)
where list.name =~'(?i)Hiragana'
return kana.value as item, romaji.value as answer  ORDER BY kana asc

New query :

match(list:item_list)-[:sub_list*0..]->(sublist)-[:list_item]->(character:item)-[:romaji]->(romaji:item)
where list.name =~ '(?i)Hiragana' return character.value as item, romaji.value as answer

Regards,

Loïc.

Loïc N.
  • 353
  • 3
  • 17