I'd like to use labels / properties that include spaces rather than CamelCase. Is this possible and if so how?
e.g. 'Architecture Description Element'
Yes you can, but you need to surround the label or property name with backticks.
CREATE (n:`Architecture Description Element` { `property name`:"It works!" })
http://console.neo4j.org/r/kctf37
The manual section 2.1 says
Label names
Any non-empty Unicode string can be used as a label name. In Cypher, you may need to use the backtick (`) syntax to avoid clashes with Cypher identifier rules or to allow non-alphanumeric characters in a label. By convention, labels are written with CamelCase notation, with the first letter in upper case. For instance, User or CarOwner.
The corresponding paragraph about properties doesn't speak to property name restrictions, but in the Cypher chapter there is a passage about identifier names in section 9.3 that says
Identifier names are case sensitive, and can contain underscores and alphanumeric characters (a-z, 0-9), but must always start with a letter. If other characters are needed, you can quote the identifier using backquote (`) signs.
The same rules apply to property names.
If you use the dump command from the shell to export a subgraph all property and label names will be surrounded by backticks, whether they need it or not. You may want to consider doing same for programmatically generated queries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With