2014-01-08 103 views
0

我得到了下面的鏈接來做到這一點,但問題是,它是爲Linux用戶!如何在windows 7中將數據導入neo4j(neo4j-community-2.0.0)?

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

請幫我得到這個在Windows上做了什麼?提前致謝。

我是neo4j的新手,在java上只有一點點經驗。


我加neo4jtools到我的Neo4j服務器從下面的鏈接

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

然後我按照這個命令將一些數據導入到圖形數據庫

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 

和我在命令提示符下這樣的消息

> 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 

我IMPORT.TXT文件的內容是這些

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 

而且我可以看到很多東西都在test5.db文件夾內創建,

,但是當我去我的瀏覽器控制檯,我不能看到任何那裏的節點?

還有什麼更多的事情要做?在正確的方式嗎?請幫我繼續前進!

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

我ne04j.properties內容

# 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 

和neo4j-server.properties在這裏

################################################################ 
# 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

您刪除了'#'以啓用自動索引,但是您也刪除了換行符,因此'node_auto_indexing = true'沒有在其上自己的路線。把它放在自己的路線上。然後刪除'node_keys_indexable'前面的##並選擇索引哪些鍵。只要讓你的配置看起來像來自Michaels答案的片段。 – jjaderberg

回答

2

您的最終目標是導入工作表。請按照您提供的鏈接中提供的步驟操作,並將密碼查詢置於文件中。然後使用java代碼讀取文件(BufferReader)a nd使用ExecutionEngine運行密碼查詢。

雖然複製查詢不會忘記將任何分隔符,它將識別密碼查詢的開始和結束。在循環中運行查詢。

+0

我已經更新了我的問題@Punendu,可否請您提供任何鏈接? – Gopipuli

+1

由於您的錯誤表示您尚未啓用自動索引,請首先通過更改conf/neo4j.properties啓用該功能。 – dev

+0

#Autoindexing #爲節點啓用自動索引,默認爲false node_auto_indexing = true這是放在我的屬性文件中@Purnendu – Gopipuli

3

你的配置是什麼樣的?

你有這樣啓用自動索引:

# 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 

取出哈希,並確保該id屬性被列出。您可能也可能不會爲索引查找添加nametype屬性。

此外,由於您創建了data/test5.db,所以您在瀏覽器中看不到任何內容,但服務器默認爲尋找data/graph.db

  1. 所以要麼使用這個目錄。
  2. 或者啓動服務器,然後關閉-path參數,並且shell將連接到正在運行的服務器。
+0

它已在neo4j.properties文件中啓用我還添加了數據庫目錄的一行#位置 org.neo4j.server.database.location = data/test5.db這也包含在neo4j-server中。屬性文件。所以,當我打開瀏覽器,我可以讀取數據庫 地點的位置: C:\ Program Files文件\的Neo4j社區-2.0.0 \ DATA \ test5.db 尺寸: 141.87昆明植物研究所@邁克爾飢餓 – Gopipuli

1

如果您希望將來自其他源的數據導入Neo4j,那麼可以使用像Talend這樣的ETL軟件。 這裏是一步一步的帖子顯示如何以一種簡單的方式: Import Data into Neo4j directly using Talend。 它顯示瞭如何從MS SQL Sever導入數據,但您可以輕鬆更改源代碼