Is it possible for a label or property name to include spaces?

I would like to use labels / properties that include spaces, not CamelCase. Is this possible, and if so, how?

eg. "Architecture Description Element"

+5
source share
1 answer

Yes you can, but you need to surround the label or property name with reverse windows.

CREATE (n:`Architecture Description Element` { `property name`:"It works!" }) 

http://console.neo4j.org/r/kctf37

The manual section 2.1 says

Shortcut 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 the Cypher identifier rules or to allow non-alphanumeric characters in the label. By convention, shortcuts are recorded with a CamelCase entry, with the first letter in upper case. For example, User or CarOwner.

The corresponding property paragraph does not refer to property name restrictions, but the Cypher chapter has an excerpt about identifier names in section 9.3 that says

Name identifiers are case sensitive and may contain underscores and alphanumeric characters (az, 0-9), but must always begin with a letter. If other characters are needed, you can quote the identifier using backquote (`) characters.

The same rules apply to property names.

If you use the dump command from the shell to export the subgraph, all property names and shortcuts will be surrounded by reverse windows, whether they need it or not. You might want to do the same for programmed queries.

+9
source

All Articles