在关系上添加自动唯一索引(CYPHER、Neo4j)
Adding Automate Unique Indexes on Relationships (CYPHER, Neo4j)
我在 Neo4j 中有一组关系,我想在这些关系上自动添加唯一索引,有人知道如何自动完成吗?
如果有一个关于如何生成自动唯一值以与查询中的新实体相关联的示例,那也很好。谢谢。
Neo4j 有 "automatic" indexes for nodes, but not relationships. You can create legacy indexes for relationships, but they are no longer the preferred way to index, and relationships will not be added automatically to such an index. You are responsible for "manually" adding nodes/relationships to legacy indexes. In neo4j 3.0, there are APOC procedures for manual indexes 你可以从 Cypher 调用,这更方便,但它仍然不是 "automatic".
注意:APOC程序必须installed on the neo4j server才能使用。
在 neo4j 3.0 中,您的 Cypher 代码现在可以使用 APOC procedures to get UUIDs。例如,获取单个 UUID:
CALL apoc.create.uuid YIELD uuid
目前看来,CONSTRAINTs,因此唯一索引,只能应用于节点。不知道有没有计划把这个功能扩展到人际关系。
我在 Neo4j 中有一组关系,我想在这些关系上自动添加唯一索引,有人知道如何自动完成吗?
如果有一个关于如何生成自动唯一值以与查询中的新实体相关联的示例,那也很好。谢谢。
Neo4j 有 "automatic" indexes for nodes, but not relationships. You can create legacy indexes for relationships, but they are no longer the preferred way to index, and relationships will not be added automatically to such an index. You are responsible for "manually" adding nodes/relationships to legacy indexes. In neo4j 3.0, there are APOC procedures for manual indexes 你可以从 Cypher 调用,这更方便,但它仍然不是 "automatic".
注意:APOC程序必须installed on the neo4j server才能使用。
在 neo4j 3.0 中,您的 Cypher 代码现在可以使用 APOC procedures to get UUIDs。例如,获取单个 UUID:
CALL apoc.create.uuid YIELD uuid
目前看来,CONSTRAINTs,因此唯一索引,只能应用于节点。不知道有没有计划把这个功能扩展到人际关系。