知识库

使用 Cypher 和 APOC 将属性值迁移到标签

从 Neo4j 3.0 及存储过程和 APOC 的引入开始,您可以使用存储过程 apoc.create.addLabels,通过 Cypher 将属性迁移到标签,如下所示:

// create a node with property studio
create (n:Movies {name: 'A Few Good Men', studio: 'Warner Brothers'})
// move the 'studio' property to a label and remove it as a property
MATCH (n:Movies)
call apoc.create.addLabels([ id(n) ], [ n.studio ]) yield node
with node
remove node.studio
return node
© . All rights reserved.