从CSV导入数据到Neo4j

[复制链接]
查看11 | 回复2 | 2014-2-19 11:55:14 | 显示全部楼层 |阅读模式
Graph data comes in different formats, and sometimes it's a combination of two or more formats. It is very important to learn about the various ways to import data, which is in different formats into Neo4j. In this recipe, you will learn how to import data present in the CSV file format into the Neo4j graph database server. A sample CSV file is shown as follows:


neo1.jpg (7.98 KB, 下载次数: 20)
下载附件
2015-8-10 23:49 上传


回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
Getting ready
To get started with this recipe, install Neo4j by using the steps from the earlier recipes of this chapter.
How to do it...
There are several methods that you can use to import data which is in the CSV format or Excel into Neo4j, which are described in the sections that follow.
Using a batch importer
There is excellent tool written by Michael Hunger, which can be cloned from https://github.com/jexp/batch-import.
The CSV file has to be converted into the format specified in the readme file. The tool is very flexible in terms of the number of properties and the types of each property. The nodes and relationships can be within the same file or within multiple files. The example file format is present in the sample directory. To run the tool, use the following command:$ wget https://dl.dropboxusercontent.com/u/14493611/batch_importer_22.zip$ unzip batch_importer_22.zip# Download sample nodes.csv and rels.csv from the github repo under sample$ import.sh test.db nodes.csv rels.csv$ cp test.db ${NEO4J_ROOT}/data/graph.db复制代码
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
Each parameter in the command has been fully explained in the readme file.
Note
The batch import tool also supports a parallel batch inserter, which can speed up the process of importing data from a large number of nodes and relationships.
Benchmark figures claimed by the batch importer tool are 2 billion nodes and 20 billion relationships in 11 hours (500K elements/second).
This is claimed over the EC2 high I/O instance.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行