关于将CSV导入Neo4J的问题

技术标签: CSV.  neo4j

我有三个关于进口CSV的问题:

  1. 是否可以使命令忽略CSV文件中的第一行?(因为导入许多文件,更改所有文件是不方便的)
  2. 如果CSV文件中的相应属性为空,则是否可以使关系或节点的属性为空?
  3. 是否有可能具有不同(数量)属性的相同类型的节点?

看答案

1)是的,您可以在负载CSV中使用跳过:

LOAD CSV WITH HEADERS FROM "file:///dummyfile.csv" AS row
WITH row
SKIP 1
MERGE (n:Node {id: row[0]})

2)如果CSV列值为null,则相应的属性值也为空。如果它为空,则不会创建属性

假设以下CSV:

id,title,desc
1,title 1,desc1
2,,desc 2

和以下加载CSV:

LOAD CSV WITH HEADERS FROM "https://gist.githubusercontent.com/ikwattro/ed85bfc98c9298924c154ecf3e0ab2aa/raw/54a9303c365a7698c87728d458f8de703a9c22e1/load.csv" AS row
CREATE (n:Post {id: row['id'], title: row['title'], description: row['desc']})

这将创建以下内容:

╒══════════════════════════════════════════════════╕
│"n"                                               │
╞══════════════════════════════════════════════════╡
│{"description":"desc1","id":"1","title":"title 1"}│
├──────────────────────────────────────────────────┤
│{"description":"desc 2","id":"2"}                 │
└──────────────────────────────────────────────────┘

3)是的,neo4j是lequeraless,您无需在具有相同标签的节点上具有相同数量的属性


智能推荐

neo4j 遇到的问题

neo4j 遇到的问题 Expected ‘–nodes’ to have at least 1 valid item, but had 0 [] 网上说路径问题,但是我的跟路径没关 是文件名打错了。。。这回对了 neo4j-admin import --nodes data\Person.csv --nodes data\Phone.csv --nodes d...

neo4j手动导入csv文件报错Neo.ClientError.Statement.ExternalResourceFailed

Neo.ClientError.Statement.ExternalResourceFailed 解决方法: 1.csv文件需要放下neo4j安装路径下的import文件夹里 2.这个错误是格式问题,我是直接xlsx改后缀csv出错,可以打开另存为 问题解决...

neo4j安装与导入问题

4.0.5启动一直有问题,换成3.4.1启动成功 还是别用最新版了,不知道什么问题 Java 使用1.8 导入语句: neo4j-admin import --database mygrapy --nodes data/Person.csv --nodes data/Phone.csv --nodes data/Application.csv --relationships data/Person...

Neo4j中关于数据的导入和导出方法总结(一)

数据的导入方式: 一、使用neo4j-import命令: 使用条件:①关闭neo4j;②无法在原有数据库添加,只能重新生成一个数据库;③导入文件格式为CSV         参数:--into:数据库名称 --bad-tolerance:能容忍的错误数据条数(即超过指定条数程序直接挂掉),默认1000--multili...

RDF 导入 Neo4j 的分析

以CommonCoreOntologies/RadioTransceiver为例先: ccos:RadioTransceiver rdf:type owl:Class ;                       rdfs:subClassOf ccos:RadioCommunicati...

猜你喜欢

neo4j的介绍和数据导入

因研究需要引入了对图数据库neo4j的应用,本文主要介绍为为什么在安全威胁中引入图数据库,以及图数据库neo4j的优点,同时介绍了neo4j的数据导入,基于python操作neo4j。 1.安全背景 大型入侵检测基础设施中产生的大量误报使操作人员很难将误报与真正的攻击区分开来。减少这一问题的一种方法是使用元警报或规则,它们可以识别报警流中的已知攻击模式。这种方法的明显风险是,规则库可能不完整,对于...

neo4j导入.csv文件时常见问题之Neo.ClientError.Statement.ExternalResourceFailed解决方法

在使用图数据库neo4j中的LOAD CSV操作导入本地数据时可能会出现报错:Neo.ClientError.Statement.ExternalResourceFailed 这个错误一般是格式造成的,下面就来讲其中最常见的两点。 一、地址格式错误 LOAD CSV WITH HEADERS FROM “file:///CE.csv” AS line 语句中的 &ldquo...

Neo4j import导入方法

一: neo4j-admin import --nodes E:\NEO4J\neo4j-community-3.5.1\import/movies.csv --nodes E:\NEO4J\neo4j-community-3.5.1\import/actors.csv --relationships E:\NEO4J\neo4j-community-3.5.1\import/roles.csv ...

Unity3D之Mecanim动画系统学习笔记(六):使用脚本控制动画

控制人物动画播放 这里我重新弄了一个简单的场景和新的Animator Controller来作为示例。 下面先看看Animator Controller的配置: 人物在站立状态只能进入走路,走路只能进入奔跑或返回站立,奔跑只能进入跳跃或返回走路,跳跃则只能返回奔跑。 参数方面为两个参数: Float类型的moveSpeed; Trigger类型的Jump; 连线直接的转换条件为:moveSpeed...

华为云数据湖工厂服务DLF

1. DLF服务说明 参考官网:https://support.huaweicloud.com/productdesc-dlf/dlf_07_001.html ,数据湖工厂服务(Data Lake Factory,简称DLF)是华为云大数据重要的平台产品,它可管理多种大数据服务,提供一站式的大数据开发环境、全托管的大数据调度能力,极大降低用户使用大数据的门槛,帮助用户快速构建大数据处理中心。 使用...

问答精选

Sql Query With Select and IF

here is my table description: Table Name : Orders Columns : ID, NO, Quantity, Base, Code First my query should check the value of Code, if value of Code is 'B' then OUTPUT VALUE should be Code+Base if...

EmberJS and web components: extend an existing HTML tag within an initializer (is it possible?)

Edit: this issue only seems to be in the .hbs rendering as this code does work when the extended web component is inserted in the top level index.html of the EmberJS project Edit 2: However, when I pu...

I can't find the error in my socket python program

I was following a socket tutorial and suddenly there was a bug in my code that I couldn't understand or find Can anyone help me find the bug? I referenced with the tutorial code and it doesn't work. T...

Datatables - fixedHeader with scrollX

I am trying to use Datatables with fixedheader (v3) as well as enable horizontal scrolling. Attached is the fiddle http://jsfiddle.net/xF8hZ/344/ . When scrolling the fixedheader width doesn't align w...

meego cannot play mp3 file

I tried to implement SoundEffect from QtMobilityKit in QML to play music file in Meego Harmattan. I found that it can only play .wav file. is there any possible way to play .mp3 file in meego? This on...

相关问题

相关文章

热门文章

推荐文章

相关标签

推荐问答