Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Neo4j:可以标记关系吗?_Neo4j - Fatal编程技术网

Neo4j:可以标记关系吗?

Neo4j:可以标记关系吗?,neo4j,Neo4j,我曾经为节点和关系使用过标签 根据官方文件,while同时用于节点和关系 match pth=(c:contact)-[r:Stakeholder]->(l:lead) return pth 我觉得很奇怪。我一直使用和查询关系的标签,例如 MATCH ()-[r:LabelName]-() return r; 关系是否可以像节点那样进行标记,或者是否存在差异?关系具有“类型”而不是标签 比如说 match (c:contact)-[r]->(l:lead) return Dis

我曾经为节点和关系使用过标签

根据官方文件,while同时用于节点和关系

match pth=(c:contact)-[r:Stakeholder]->(l:lead) return pth 
我觉得很奇怪。我一直使用和查询关系的标签,例如

MATCH ()-[r:LabelName]-() return r;

关系是否可以像节点那样进行标记,或者是否存在差异?

关系具有“类型”而不是标签

比如说

match (c:contact)-[r]->(l:lead) return Distinct(type(r)) as DistinctRel
将返回联系人和潜在客户之间的不同关系类型

╒═══════════╕
│DistinctRel│
╞═══════════╡
│Stakeholder│
├───────────┤
│Influencer │
└───────────┘
是的,您可以使用标签之类的类型返回已知关系

match pth=(c:contact)-[r:Stakeholder]->(l:lead) return pth 
将只返回与利益相关者有关系的联系人和潜在客户

与可以有多个标签的节点不同,关系只能有一种类型

关系属性也会有所不同

match pth=(c:contact {name:'Adrian Dumitrascu'})-[r:Stakeholder]->(l:lead)  set r.property=10
在名为Adrian的联系人和他的潜在客户之间的利益相关者关系中,将名为“property”的属性设置为10

match pth=(c:contact {name:'Adrian Dumitrascu'})-[r:Stakeholder]->(l:lead) return type(r) as Type, r.property

Type         r.property
Stakeholder  10

我不明白为什么节点的标签不同于rel的类型。除了每个实体的出现次数外,它们似乎是相同的。此外,node的属性和rel的属性看起来是相同的概念。我没有答案:(这可能取决于它们在框架中的使用方式。标签将节点分组到集合中,关系是您遍历图形的方式。原因可能就在其中的某个地方。无论如何,希望上面的示例有所帮助。我理解您的示例,我知道如何使用标签和关系,但我仍然不理解结构d。)节点标签和rel类型之间的差异