How to import data into neo4j (neo4j-community-2.0.0) in windows 7?

China☆狼群 提交于 2019-12-13 05:59:02

问题


I got the below link to do this but the problem is that it's for linux users !!!

http://blog.neo4j.org/2013/03/importing-data-into-neo4j-spreadsheet.html

Please help me to get this done on windows ? Thanks in advance.

I am new to neo4j and got only a little hands on experience on java.


I added neo4jtools to my neo4j server from the below link

https://github.com/jexp/neo4j-shell-tools

then I follow this command to import few data to a graph database

neo4jshell -path C:\Program Files\neo4j-community-2.0.0\data\test5.db -config C:\Program Files\neo4j-community-2.0.0\conf\neo4j.properties -file C:\Users\admin\Downloads\import.txt

and I get a message like this on the command prompt

> Transaction started
> +-------------------+ | No data returned. |
> +-------------------+ Nodes created: 20 Properties set: 60 3586 ms Transaction committed Transaction started ERROR (-v for expanded
> information):
>         MissingIndexException: Index `node_auto_index` does not exist

my import.txt file contents are these

BEGIN

create ({id:'1', name:'Amada Emory', type:'Female'})
create ({id:'2', name:'Rana Seely', type:'Female'})
create ({id:'3', name:'Detra Thatcher', type:'Female'})
create ({id:'4', name:'Melda Reza', type:'Female'})
create ({id:'5', name:'Shana Willems', type:'Female'})
create ({id:'6', name:'Sharonda Peele', type:'Female'})
create ({id:'7', name:'Dagny Agee', type:'Female'})
create ({id:'8', name:'Tisa Woodman', type:'Female'})
create ({id:'9', name:'Shelba Mutchler', type:'Female'})
create ({id:'10', name:'Anderson Spagnola', type:'Male'})
create ({id:'11', name:'Pamala Forward', type:'Female'})
create ({id:'12', name:'Melva Fairchild', type:'Female'})
create ({id:'13', name:'Antione Selman', type:'Male'})
create ({id:'14', name:'Carmelia Cali', type:'Female'})
create ({id:'15', name:'Fairy Daughtery', type:'Female'})
create ({id:'16', name:'Stefany Mcamis', type:'Female'})
create ({id:'17', name:'Kermit Meaney', type:'Male'})
create ({id:'18', name:'Williemae Dossantos', type:'Female'})
create ({id:'19', name:'Marth Sparling', type:'Female'})
create ({id:'20', name:'Jarvis Noland', type:'Male'});

COMMIT

BEGIN

start n1=node:node_auto_index(id='1'),n2=node:node_auto_index(id='11') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='1'),n2=node:node_auto_index(id='12') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='1'),n2=node:node_auto_index(id='13') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='2'),n2=node:node_auto_index(id='14') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='2'),n2=node:node_auto_index(id='15') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='2'),n2=node:node_auto_index(id='16') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='3'),n2=node:node_auto_index(id='17') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='3'),n2=node:node_auto_index(id='18') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='3'),n2=node:node_auto_index(id='19') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='10'),n2=node:node_auto_index(id='20') create n1-[:FATHER_OF]->n2;
start n1=node:node_auto_index(id='14'),n2=node:node_auto_index(id='1') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='11'),n2=node:node_auto_index(id='2') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='11'),n2=node:node_auto_index(id='3') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='12'),n2=node:node_auto_index(id='4') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='12'),n2=node:node_auto_index(id='5') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='12'),n2=node:node_auto_index(id='6') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='17'),n2=node:node_auto_index(id='7') create n1-[:FATHER_OF]->n2;
start n1=node:node_auto_index(id='13'),n2=node:node_auto_index(id='8') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='13'),n2=node:node_auto_index(id='9') create n1-[:MOTHER_OF]->n2;
start n1=node:node_auto_index(id='20'),n2=node:node_auto_index(id='1') create n1-[:FATHER_OF]->n2;

COMMIT

EXIT

And I can see lot of thing are created inside the test5.db folder,

but when I go to my browser console I cant see any nodes there ?

Is there anything more to do ? Am on the right way ? Please help me to move on !!!

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

My ne04j.properties contents are

# Default values for the low-level graph engine
#neostore.nodestore.db.mapped_memory=25M
#neostore.relationshipstore.db.mapped_memory=50M
#neostore.propertystore.db.mapped_memory=90M
#neostore.propertystore.db.strings.mapped_memory=130M
#neostore.propertystore.db.arrays.mapped_memory=130M

# Enable this to be able to upgrade a store from an older version
#allow_store_upgrade=true

# Enable this to specify a parser other than the default one.
#cypher_parser_version=2.0

# Keep logical logs, helps debugging but uses more disk space, enabled for
# legacy reasons To limit space needed to store historical logs use values such
# as: "7 days" or "100M size" instead of "true" keep_logical_logs=true

# Autoindexing

# Enable auto-indexing for nodes, default is false node_auto_indexing=true

# The node property keys to be auto-indexed, if enabled
#node_keys_indexable=name,age node_keys_indexable=id,name,type


# Enable auto-indexing for relationships, default is false relationship_auto_indexing=true

# The relationship property keys to be auto-indexed, if enabled
#relationship_keys_indexable=name,age relationship_keys_indexable=id,name,type,age

# location of the database directory  org.neo4j.server.database.location=data/test5.db

and neo4j-server.properties are here

################################################################
# Neo4j configuration
#
################################################################

#***************************************************************
# Server configuration
#***************************************************************

# location of the database directory  org.neo4j.server.database.location=data/test7.db

# Let the webserver only listen on the specified IP. Default is localhost (only
# accept local connections). Uncomment to allow any connection. Please see the
# security section in the neo4j manual before modifying this.
#org.neo4j.server.webserver.address=0.0.0.0

#
# HTTP Connector
#

# http port (for all data, administrative, and UI access) org.neo4j.server.webserver.port=7474

#
# HTTPS Connector
#

# Turn https-support on/off org.neo4j.server.webserver.https.enabled=true

# https port (for all data, administrative, and UI access) org.neo4j.server.webserver.https.port=7473

# Certificate location (auto generated if the file does not exist) org.neo4j.server.webserver.https.cert.location=conf/ssl/snakeoil.cert

# Private key location (auto generated if the file does not exist) org.neo4j.server.webserver.https.key.location=conf/ssl/snakeoil.key

# Internally generated keystore (don't try to put your own
# keystore there, it will get deleted when the server starts) org.neo4j.server.webserver.https.keystore.location=data/keystore

#*****************************************************************
# Administration client configuration
#*****************************************************************

# location of the servers round-robin database directory. Possible values:
# - absolute path like /var/rrd
# - path relative to the server working directory like data/rrd
# - commented out, will default to the database data directory. org.neo4j.server.webadmin.rrdb.location=data/rrd

# REST endpoint for the data API
# Note the / in the end is mandatory org.neo4j.server.webadmin.data.uri=/db/data/

# REST endpoint of the administration API (used by Webadmin) org.neo4j.server.webadmin.management.uri=/db/manage/

# Low-level graph engine tuning file org.neo4j.server.db.tuning.properties=conf/neo4j.properties

# The console services to be enabled org.neo4j.server.manage.console_engines=shell


# Comma separated list of JAX-RS packages containing JAX-RS resources, one
# package name for each mountpoint. The listed package names will be loaded
# under the mountpoints specified. Uncomment this line to mount the
# org.neo4j.examples.server.unmanaged.HelloWorldResource.java from
# neo4j-examples under /examples/unmanaged, resulting in a final URL of
# `http://localhost:7474/examples/unmanaged/helloworld/{nodeId}`
#org.neo4j.server.thirdparty_jaxrs_classes=org.neo4j.examples.server.unmanaged=/examples/unmanaged


#*****************************************************************
# HTTP logging configuration
#*****************************************************************

# HTTP logging is disabled. HTTP logging can be enabled by setting this
# property to 'true'. org.neo4j.server.http.log.enabled=false

# Logging policy file that governs how HTTP log output is presented and
# archived. Note: changing the rollover and retention policy is sensible, but
# changing the output format is less so, since it is configured to use the
# ubiquitous common log format org.neo4j.server.http.log.config=conf/neo4j-http-logging.xml

回答1:


What does your config look like?

Do you have auto-indexing enabled like this:

# Autoindexing

# Enable auto-indexing for nodes, default is false
node_auto_indexing=true

# The node property keys to be auto-indexed, if enabled
node_keys_indexable=id,name,type

Remove the hashes and make sure that the id property is listed. You might or might not add the name and type properties for index lookups as well.

Also you don't see anything in your browser because you created data/test5.db but the server is by default looking for data/graph.db.

  1. So either use this directory.
  2. Or start the server, and then leave off the -path parameter and the shell will connect to your running server.



回答2:


your final goal is to import the sheet.So follow the steps given in link provided by you and put the cypher queries in a file.Then use java code to read file(BufferReader) and run the cypher queries using ExecutionEngine.

While copying queries don't forget to put any separator which will recognize the start and end of cypher queries.Run queries in loop.




回答3:


If you are looking to import data from other source into Neo4j, you can use ETL Software like Talend. Here is a step by step post shows how to that in a simple way: Import Data into Neo4j directly using Talend. It shows how to import data from MS SQL Sever but you can easily change the source



来源:https://stackoverflow.com/questions/20986962/how-to-import-data-into-neo4j-neo4j-community-2-0-0-in-windows-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!