Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Neo4j/REST并发问题_Neo4j_Cypher - Fatal编程技术网

Neo4j/REST并发问题

Neo4j/REST并发问题,neo4j,cypher,Neo4j,Cypher,因此,我尝试使用新的merge语法来减少确保两个节点存在并链接它们所需的操作量。基本思路如下: merge (first:Label{key:'value'}) merge (second:Label{key:'value'}) create unique first-[:rel]->second set first.prop="x" set second.prop="y" 在1.9 systax中,至少需要3次调用API,以确保每个节点首先存在,并在第三个请求中链接它们(并设置属性)

因此,我尝试使用新的merge语法来减少确保两个节点存在并链接它们所需的操作量。基本思路如下:

merge (first:Label{key:'value'})
merge (second:Label{key:'value'})
create unique first-[:rel]->second
set first.prop="x"
set second.prop="y"
在1.9 systax中,至少需要3次调用API,以确保每个节点首先存在,并在第三个请求中链接它们(并设置属性)

看起来我的批处理(充满了这些请求)工作正常,但也抛出了一些异常(有时是不可预测的)。我的日志是这样写的:

de.ibm.ica.tripletstore.TripletWriterCypher2.process(TripletWriterCypher2.java:161) - FATAL [15:48:58,954] [ {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'John Doe'}) merge (y:`occupation`{`key`:'Developer'})  create unique x-[r:`works as`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Occupation'  return x.key, y.key, type(r)"
  },
  "id" : 0
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'John Doe'}) merge (y:`organization`{`key`:'IBM'})  create unique x-[r:`works for`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`country`='United States ' SET y.`industry`='Software & Services ' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Company'  return x.key, y.key, type(r)"
  },
  "id" : 1
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Ginny Rometty'}) merge (y:`organization`{`key`:'IBM'})  create unique x-[r:`works for`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`country`='United States ' SET y.`industry`='Software & Services ' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Company'  return x.key, y.key, type(r)"
  },
  "id" : 2
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Ginny Rometty'}) merge (y:`occupation`{`key`:'CEO'})  create unique x-[r:`works as`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Occupation'  return x.key, y.key, type(r)"
  },
  "id" : 3
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Simon Sample'}) merge (y:`occupation`{`key`:'CTP'})  create unique x-[r:`works as`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Occupation'  return x.key, y.key, type(r)"
  },
  "id" : 4
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Simon Sample'}) merge (y:`organization`{`key`:'IBM'})  create unique x-[r:`works for`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`country`='United States ' SET y.`industry`='Software & Services ' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Company'  return x.key, y.key, type(r)"
  },
  "id" : 5
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'John Doe'}) merge (y:`person`{`key`:'Sally Sample'})  create unique x-[r:`coworker of`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Person'  return x.key, y.key, type(r)"
  },
  "id" : 6
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Sam Sampleman'}) merge (y:`person`{`key`:'John Doe'})  create unique x-[r:`coworker of`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Person'  return x.key, y.key, type(r)"
  },
  "id" : 7
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Johnny English'}) merge (y:`person`{`key`:'Sam Sampleman'})  create unique x-[r:`coworker of`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Person'  return x.key, y.key, type(r)"
  },
  "id" : 8
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Johnny English'}) merge (y:`occupation`{`key`:'CTP'})  create unique x-[r:`works as`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Occupation'  return x.key, y.key, type(r)"
  },
  "id" : 9
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Larry Page'}) merge (y:`organization`{`key`:'Google'})  create unique x-[r:`works for`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`country`='United States ' SET y.`industry`='Software & Services ' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Company'  return x.key, y.key, type(r)"
  },
  "id" : 10
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Larry Page'}) merge (y:`occupation`{`key`:'CEO'})  create unique x-[r:`works as`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Occupation'  return x.key, y.key, type(r)"
  },
  "id" : 11
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Mark Elliot Zuckerberg'}) merge (y:`organization`{`key`:'Facebook'})  create unique x-[r:`works for`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`country`=null SET y.`industry`=null SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Company'  return x.key, y.key, type(r)"
  },
  "id" : 12
}, {
  "method" : "POST",
  "to" : "/cypher",
  "body" : {
    "query" : "CYPHER 2.0 merge (x:`person`{`key`:'Mark Elliot Zuckerberg'}) merge (y:`occupation`{`key`:'CEO'})  create unique x-[r:`works as`]-y with x, y, r SET x.`annotation`='com.ibm.ica.tutorial.anno.en.Person' SET y.`annotation`='com.ibm.ica.tutorial.anno.en.Occupation'  return x.key, y.key, type(r)"
  },
  "id" : 13
} ]
de.ibm.ica.tripletstore.TripletWriterCypher2.process(TripletWriterCypher2.java:168) - ERROR [15:48:58,961] java.lang.Exception: Bad response code. 
{
  "message" : "{\r\n  \"message\" : \"If you create multiple elements, you can only create one of each.\",\r\n  \"exception\" : \"ParameterWrongTypeException\",\r\n  \"fullname\" : \"org.neo4j.cypher.ParameterWrongTypeException\",\r\n  \"stacktrace\" : [ \"org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$exec$1.apply(ExecuteUpdateCommandsPipe.scala:59)\", \"org.neo4j.cypher.internal.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$pipes$ExecuteUpdateCommandsPipe$$exec$1.apply(ExecuteUpdateCommandsPipe.scala:59)\", \"org.neo4j.cypher.internal.helpers.CollectionSupport$$anon$1.next(CollectionSupport.scala:47)\", \"scala.collection.Iterator$$anon$13.next(Iterator.scala:372)\", \"scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)\", \"scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)\", \"scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)\", \"scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)\", \"scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)\", \"scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)\", \"org.neo4j.cypher.internal.ClosingIterator$$anonfun$next$1.apply(ClosingIterator.scala:45)\", \"org.neo4j.cypher.internal.ClosingIterator.failIfThrows(ClosingIterator.scala:84)\", \"org.neo4j.cypher.internal.ClosingIterator.next(ClosingIterator.scala:43)\", \"scala.collection.Iterator$class.foreach(Iterator.scala:727)\", \"org.neo4j.cypher.internal.ClosingIterator.foreach(ClosingIterator.scala:31)\", \"scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)\", \"scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:178)\", \"scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:45)\", \"scala.collection.TraversableOnce$class.to(TraversableOnce.scala:259)\", \"org.neo4j.cypher.internal.ClosingIterator.to(ClosingIterator.scala:31)\", \"scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:243)\", \"org.neo4j.cypher.internal.ClosingIterator.toList(ClosingIterator.scala:31)\", \"org.neo4j.cypher.EagerPipeExecutionResult.<init>(EagerPipeExecutionResult.scala:32)\", \"org.neo4j.cypher.internal.executionplan.ExecutionPlanBuilder$$anonfun$5.apply(ExecutionPlanBuilder.scala:133)\", \"org.neo4j.cypher.internal.executionplan.ExecutionPlanBuilder$$anonfun$5.apply(ExecutionPlanBuilder.scala:131)\", \"org.neo4j.cypher.internal.executionplan.ExecutionPlanBuilder$$anon$1.execute(ExecutionPlanBuilder.scala:48)\", \"org.neo4j.cypher.ExecutionEngine$$anonfun$execute$1.apply(ExecutionEngine.scala:70)\", \"org.neo4j.cypher.ExecutionEngine$$anonfun$execute$1.apply(ExecutionEngine.scala:69)\", \"org.neo4j.cypher.ExecutionEngine.prepare(ExecutionEngine.scala:131)\", \"org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:69)\", \"org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:84)\", \"org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:79)\", \"org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:94)\", \"java.lang.reflect.Method.invoke(Unknown Source)\", \"org.neo4j.server.web.Jetty6WebServer.invokeDirectly(Jetty6WebServer.java:294)\", \"org.neo4j.server.rest.batch.NonStreamingBatchOperations.invoke(NonStreamingBatchOperations.java:55)\", \"org.neo4j.server.rest.batch.BatchOperations.performRequest(BatchOperations.java:188)\", \"org.neo4j.server.rest.batch.BatchOperations.parseAndPerform(BatchOperations.java:159)\", \"org.neo4j.server.rest.batch.NonStreamingBatchOperations.performBatchJobs(NonStreamingBatchOperations.java:48)\", \"org.neo4j.server.rest.web.BatchOperationService.batchProcess(BatchOperationService.java:117)\", \"org.neo4j.server.rest.web.BatchOperationService.performBatchOperations(BatchOperationService.java:71)\", \"java.lang.reflect.Method.invoke(Unknown Source)\" ]\r\n}",
  "exception" : "BatchOperationFailedException",
  "fullname" : "org.neo4j.server.rest.domain.BatchOperationFailedException",
  "stacktrace" : [ "org.neo4j.server.rest.batch.NonStreamingBatchOperations.invoke(NonStreamingBatchOperations.java:63)", "org.neo4j.server.rest.batch.BatchOperations.performRequest(BatchOperations.java:188)", "org.neo4j.server.rest.batch.BatchOperations.parseAndPerform(BatchOperations.java:159)", "org.neo4j.server.rest.batch.NonStreamingBatchOperations.performBatchJobs(NonStreamingBatchOperations.java:48)", "org.neo4j.server.rest.web.BatchOperationService.batchProcess(BatchOperationService.java:117)", "org.neo4j.server.rest.web.BatchOperationService.performBatchOperations(BatchOperationService.java:71)", "java.lang.reflect.Method.invoke(Unknown Source)" ]
}
de.ibm.ica.tripletstore.TripleNetWriterCypher2.process(TripleNetWriterCypher2.java:161)-致命[15:48:58954]{
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`John Doe`})合并(y:`ocations`{`key`:`Developer`})创建唯一的x-[r:`works as`]-y与x,y,r集合x.`annotation`='com.ibm.ica.tutorial.anno.en.person'集合y.`annotation`='com.ibm.ica.tutorial.anno.en.ocations'返回x.key,y.key,type(r)”
},
“id”:0
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`John Doe'})合并(y:`organization`{`key`:`IBM'})创建唯一的x-[r:`works for`]-y带x,y,r集合x.`annotation`='com.ibm.ica.tutorial.anno.en.Person'集合y.`country`='United y.`industry`='Software&Services'集合y.`annotation`='com.ibm.ica.tutorial.anno.en.Company'返回x.key,y.key,type(r)'
},
“id”:1
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`Ginny Rometty'})合并(y:`organization`{`key`:`IBM'})创建唯一的x-[r:`works for`]-y带x,y,r集合x.`annotation`='com.ibm.ica.tutorial.anno.en.Person'集合y.`country`='United y.`industry`='Software&Services'集合y.`annotation`='com.ibm.ica.tutorial.anno.en.Company'返回x.key,y.key,type(r)'
},
“id”:2
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`Ginny Rometty`})合并(y:`occupation`{`key`:`CEO`})创建唯一的x-[r:`作为`]-y与x,y,r集合x.`annotation`='com.ibm.ica.tutorial.anno.en.person'集合y.`annotation`='com.ibm.ica.tutorial.anno.en.ocations'返回x.key,y.key,键入(r)”
},
“id”:3
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`Simon Sample`})合并(y:`ocations`{`key`:`CTP`})创建唯一的x-[r:`works as`]-y与x,y,r集x.`annotation`='com.ibm.ica.tutorial.anno.en.person'集y.`annotation`='com.ibm.ica.tutorial.anno.en.ocations'返回x.key,y.key,type(r)”
},
“id”:4
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`Simon Sample`})合并(y:`organization`{`key`:`IBM`})创建唯一的x-[r:`works for`]-y带x,y,r集合x.`annotation`='com.ibm.ica.tutorial.anno.en.Person'集合y.`country`='United y.`industry`='Software&Services'集合y.`annotation`='com.ibm.ica.tutorial.anno.en.Company'返回x.key,y.key,type(r)'
},
“id”:5
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`John Doe`})合并(y:`person`{`key`:`Sally Sample`})创建唯一的x-[r:`coworker of`]-y和x,y,r集x.`annotation`='com.ibm.ica.tutorial.anno.en.person'集y.`annotation`='com.ibm.ica.tutorial.anno.en.person'返回x.key,y.key,type(r)”
},
“id”:6
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`Sam Sampleman`})合并(y:`person`{`key`:`John Doe`})创建唯一的x-[r:`coworker of`]-y和x,y,r集x.`annotation`='com.ibm.ica.tutorial.anno.en.person'返回x.key,y.key,type(r)”
},
“id”:7
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0 merge(x:`person`{`key`:`Johnny English'})merge(y:`person`{`key`:`Sam Sampleman'})创建唯一的x-[r:`cower of`]-y和x,y,r集合x.`annotation`='com.ibm.ica.tutorial.anno.en.person'返回x.key,y.key,type(r)”
},
“id”:8
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`Johnny English`})合并(y:`occupation`{`key`:`CTP`})创建唯一的x-[r:`works as`]-y与x,y,r集合x.`annotation`='com.ibm.ica.tutorial.anno.en.person'集合y.`annotation`='com.ibm.ica.tutorial.anno.en.ocations'返回x.key,y.key,type(r)”
},
“id”:9
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`Larry Page'})合并(y:`organization`{`key`:`Google'})创建唯一的x-[r:`works for`]-y带x,y,r集合x.`annotation`='com.ibm.ica.tutorial.anno.en.Person'集合y.`country`='United y.`industry`='Software&Services'集合y.`annotation`='com.ibm.ica.tutorial.anno.en.Company'返回x.key,y.key,type(r)'
},
“身份证”:10
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`Larry Page`})合并(y:`ocations`{`key`:`CEO`})创建唯一的x-[r:`works as`]-y与x,y,r集合x.`annotation`='com.ibm.ica.tutorial.anno.en.person'集合y.`annotation`='com.ibm.ica.tutorial.anno.en.ocations'返回x.key,y.key,type(r)”
},
“身份证”:11
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:`Mark Elliot Zuckerberg`})合并(y:`organization`{`key`:`Facebook`})创建唯一的x-[r:`works for`]-y和x,y,r集合x.`annotation`='com.ibm.ica.tutorial.anno.en.person'SET y.`country`=空集合y.`industry`=空集合y.`annotation`='com.ibm.ica.tutorial.anno.en.Company'返回x.key,y.key,键入(r) "
},
“身份证”:12
}, {
“方法”:“发布”,
“致”:“/cypher”,
“正文”:{
“查询”:“CYPHER 2.0合并(x:`person`{`key`:'Mar