I need to import dbpedia into neo4j. I download the dbpedia from here: http://wiki.dbpedia.org/Downloads37 Any idea?
相关问题
- Getting list of persons using SPARQL dbpedia
- Can I parameterize labels and properties on CREATE
- run neo4j with docker-compose - neo4j not accessib
- How to create multiple nodes with cypher in neo4j
- Order by relationship properties neo4j
相关文章
- Neo4j DATE Data Types
- The difference between blank nodes and variables i
- How can I get the number of nodes of a Neo4j graph
- What is the fully qualified path of the Neo4j data
- Neo4j in Azure mobile services
- NoClassDefFoundError when executing a Neo4j Cypher
- java.lang.ClassNotFoundException Every time I chan
- Spring data neo4j aspectJ setup error
I am currently doing the same thing. I found that the biggest problem for this is the indexing so the best solution is to write a java program that extracts the statements with md5 hashes into a triple file like follows: subjectHash \t predicateHash \t objectHash \t subject \t predicate \t object \n.
In another file you will need to store the nodes (aka subjects and objects of statements): nodeHash \t nodeValue
The code for this procedure can be downloaded from my github: https://github.com/eschleining/DbPediaImport.git
Compile it with mvn package and it creates a jar file in target that takes the gzipped dbpedia files as arguments. If you only have the bz2 files you can transform them like follows:
for i in *.bz2 ; do bzcat "$i" | gzip > "${i%.bz2}.gz"; done &
Now run:
java -jar ConcurrentDataTableWriter-0.0.1-SNAPSHOT.jar yourdbpediaFolder/*.gz
Then you sort the newly created files manually with the sort utility of linux:
gunzip -c nodes.gz | sort -k2 -u | gzip > nodes_unique.gz
And the triples file:
gunzip -c triples.gz | sort -k1,3,2 -u | gzip > triples_unique.gz
Now you can compile the batch inserter of my repo with maven3 (mvn package) and run it in the same directory as the nodes_unique.gz and triples_unique.gz files it creates a Neo4J database directory named "DbpediaNe04J" (mind the typo "0 instead of o).
I found this to be the fastest way since it only looks up an index once for each subject/object pair in a triple.
Feel free to add datatype nodes as properties and so on. I currently have implemented each triple as a relationship between two nodes.
You might get some help from this blog post: http://blog.acaro.org/entry/dbpedia4neo
This user has written a script for it:
https://github.com/knutwalker/dbpedia-neo4j