gpt4 book ai didi

neo4j - 标签或属性名称是否可以包含空格?

转载 作者:行者123 更新时间:2023-12-04 10:49:15 25 4
gpt4 key购买 nike

我想使用包含空格而不是CamelCase的标签/属性。这有可能吗?

例如“架构描述元素”

最佳答案

是的,可以,但是您需要在标签或属性名称前后加上反引号。

CREATE (n:`Architecture Description Element` { `property name`:"It works!" })
http://console.neo4j.org/r/kctf37
手册 section 2.1

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.


关于属性的相应段落没有提到属性名称限制,但是在Cypher一章中, section 9.3中有一段关于标识符名称的段落,内容为

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.


如果从 shell 程序使用dump命令导出子图,则所有属性和标签名称都会被反引号包围,无论是否需要反引号。您可能要考虑对以编程方式生成的查询执行相同的操作。

关于neo4j - 标签或属性名称是否可以包含空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31959660/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com