从节点属性设置标签 [英] Set label from a nodes property

查看:61
本文介绍了从节点属性设置标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从节点属性之一为节点添加标签?
我有一个很大的CSV文件,在一列中有一个标签。使用LOAD CSV命令无法从CSV列值设置节点标签。
还有其他方法吗?

How can i add a label for a node from one of the nodes properties ? I have a large CSV-file with a label in one column. With the LOAD CSV command its not possible to set a nodes label from a CSV-column value. Is there anoter way ?

推荐答案

APOC 过程Neo4j插件包含一些有用的过程用于帮助重构图形( https://neo4j-contrib.github。 io / neo4j-apoc-procedures /#_ graph_refactorings

The APOC procedures Neo4j plugin contains some useful procedures for helping to refactor a graph (https://neo4j-contrib.github.io/neo4j-apoc-procedures/#_graph_refactorings)

对于您的需求,可以使用以下过程:

For your needs, you can use the following procedure :

CALL apoc.create.addLabels( node, [ properties ] )

这里是一个示例:

MATCH (n:Movie)
CALL apoc.create.addLabels( id(n), [ n.genre ] ) YIELD node
REMOVE node.genre
RETURN node

要安装APOC扩展,请下载与您的Neo4j版本有关的.jar文件,将其放入Neo4j安装的 / plugins 文件夹中,然后重新启动Neo4j。

For installing APOC extension, download the .jar file regarding your Neo4j version, place it into /plugins folder in your Neo4j installation, then restarts Neo4j.

这篇关于从节点属性设置标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆