cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Illegal characters in property names

"MATCH (n:Topics {topic: "Italian Cuisine"}) set n.topic_zh-CN = "意大利美食" RETURN n"

Hi, Well, as you can see above I'm trying to add language based properties for a node. What I shuold clafify is that this all works fine for most 2 and 3 letter ISO-639-1 language codes; French (fr), German (de) etc. all worked fine, and then there was Chinese.

Now, if there were one 'type' of Chinese (zh) that'd be handy, but there's simplified (zh-CN) and traditiona; (zh-TW) and these two are not only not alike, they're the exception to the rule in the data. Nep4j seems to be throwing an error on the hyphen in zh-CN. The question becomes, what, if anything, can be done about this?

Appreciate the input.

B

2 REPLIES 2

Hi Byron,

Property names which include special characters like - must be put inside backticks. This eliminates any syntactic ambiguity which would arise: is the - a hyphen used as part of the property name or is it a minus sign.

Surround the property name with backticks to allow special characters:

CREATE (n:Topics {topic: "Italian Cuisine"}) set n.`topic_zh-CN` = "意大利美食" RETURN n

-ABK

Hi Andreas.

Ah, right! As this is all done in a loop there seems no harm in putting all the property names in backticks. Thanks for the hand on this. Learn something new most days, today being one of them.

B