在VB.NET中使用节点标签的Neo4j批量插入

时间:2015-01-03 04:16:13

标签: neo4j batch-processing

我有一个现有数据库,其节点标记为“人员”,并且发布此批量插入工作(例如,节点显示属性),但不将该节点标记为“人员”

[{"method":"POST","to":"/node","body":{"RN":"2","fullname":"Herman Allen Slumpff","surname":"Slumpff", 
"name":"Herman Allen","sex":"M","union_id":"309","mn":"1","bd":"19161207","dd":"19901127", 
"bp_id":"56","dp_id":"4441"},"ID":0}]

实际上,我可以迭代许多节点并使用此方法快速插入它们。但是,它们是无标签的笔记。

Neo4j文档建议下面的请求应该有效,但它没有:

[{"method":"POST","to":"/node","body":{"RN":"2","fullname":"Herman Allen Slumpff", 
"surname":"Slumpff","name":"Herman Allen","sex":"M","union_id":"309","mn":"1","bd":"19161207","dd":"19901127", 
"bp_id":"56","dp_id":"4441","ID":0},{"method":"POST","to":"{0}/labels","body":"Person"}]

我正在使用Neo4j 2.1.6。也许有版本问题?

WebException错误:远程服务器返回错误:(500)内部服务器错误。

7

{
  "message" : "Unexpected character ('{' (code 123)): was expecting double-quote to start field name\n  
  at [Source: org.eclipse.jetty.server.HttpConnection$Input@1ffc119{HttpChannelOverHttp@1de8fe8 
  {r=2,a=DISPATCHED,uri=/db/data/batch},HttpConnection@b9f35c{FILLING},g=HttpGenerator{s=START}, 
   p=HttpParser{s=END,280 of 280}}; line: 1, column: 230]",
  "exception" : "JsonParseException",
  "fullname" : "org.codehaus.jackson.JsonParseException",
  "stacktrace" : [ "org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)", 
  "org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)", 
  "org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:442)",   
  "org.codehaus.jackson.impl.Utf8StreamParser._handleUnusualFieldName(Utf8StreamParser.java:1537)",   
  "org.codehaus.jackson.impl.Utf8StreamParser._parseFieldName(Utf8StreamParser.java:1227)",   
  "org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:495)", 
  "org.neo4j.server.rest.batch.BatchOperations.parseAndPerform(BatchOperations.java:152)", 
  "org.neo4j.server.rest.batch.NonStreamingBatchOperations.performBatchJobs(NonStreamingBatchOperations.java:49)", 
  "org.neo4j.server.rest.web.BatchOperationService.batchProcess(BatchOperationService.java:128)", 
  "org.neo4j.server.rest.web.BatchOperationService.performBatchOperations(BatchOperationService.java:77)", 
  "java.lang.reflect.Method.invoke(Unknown Source)", 
  "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)", 
  "java.lang.Thread.run(Unknown Source)" ]
}

谢谢!

戴夫

1 个答案:

答案 0 :(得分:0)

您可能不小心将"id":0从node-property-body外部移到了node属性体内?然后{0}不能再引用作业ID 0。

[{"method":"POST","to":"/node",
  "body":{"RN":"2","fullname":"Herman Allen Slumpff","surname":"Slumpff","name":"Herman Allen", 
  "sex":"M","union_id":"309","mn":"1","bd":"19161207","dd":"19901127","bp_id":"56","dp_id":"4441"},
  "id":0},
 {"method":"POST","to":"{0}/labels","body":"Person"}]

请尝试以确保。