在新的数据库neo4j(2.0.1)第一次运行此查询时,我得到一个带有NotFoundException的400在第5关系生气。从技术上讲,所有这些关系类型都是新的,因为它是第一个命中db的查询。这不会破坏我的应用程序,但只是好奇我是否在这里使用一种糟糕的技术。它与WITH子句有关吗?
// Match possible mutual friend pattern
"MATCH (user:User {userId:{userId}})-[:FRIEND]-(mutualFriend:User)-[:FRIEND]-(possibleFriend:User) " +
"WHERE NOT (user)-[:FRIEND]-(possibleFriend) " +
"AND NOT (user)-[:FRIEND_INVITATION]-(possibleFriend) " +
"WITH user, possibleFriend, count(mutualFriend) AS mutuals " +
// Create suggestion from user to suggested friend
"MERGE (user)-[suggestion1:FRIEND_SUGGESTION]->(possibleFriend) " +
"ON CREATE SET suggestion1.mutual=mutuals, suggestion1.ignore=false, suggestion1.facebook=false " +
"ON MATCH SET suggestion1.mutual=mutuals " +
// Create suggestion in opposite direction too
"MERGE (user)<-[suggestion2:FRIEND_SUGGESTION]-(possibleFriend) " +
"ON CREATE SET suggestion2.mutual=mutuals, suggestion2.ignore=false, suggestion2.facebook=false " +
"ON MATCH SET suggestion2.mutual=mutuals " +
// Return total number of suggestions created or updated
"RETURN count(suggestion1) + (suggestion1) AS total";
以下是neo4j的回复:
{
"message" : "Relationship 5 not found",
"exception" : "NotFoundException",
"fullname" : "org.neo4j.graphdb.NotFoundException",
"stacktrace" : [ "org.neo4j.kernel.impl.core.NodeManager.getRelationshipForProxy(NodeManager.java:547)", "org.neo4j.kernel.impl.api.state.OldTxStateBridgeImpl.deleteRelationship(OldTxStateBridgeImpl.java:144)", "org.neo4j.kernel.impl.api.state.TxStateImpl.relationshipDoDelete(TxStateImpl.java:264)", "org.neo4j.kernel.impl.api.StateHandlingStatementOperations.relationshipDelete(StateHandlingStatementOperations.java:104)", "org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.relationshipDelete(ConstraintEnforcingEntityOperations.java:147)", "org.neo4j.kernel.impl.api.LockingStatementOperations.relationshipDelete(LockingStatementOperations.java:203)", "org.neo4j.kernel.impl.api.OperationsFacade.relationshipDelete(OperationsFacade.java:443)", "org.neo4j.cypher.internal.spi.v2_0.TransactionBoundExecutionContext$RelationshipOperations.delete(TransactionBoundExecutionContext.scala:171)", "org.neo4j.cypher.internal.spi.v2_0.TransactionBoundExecutionContext$RelationshipOperations.delete(TransactionBoundExecutionContext.scala:169)", "org.neo4j.cypher.internal.compiler.v2_0.spi.DelegatingOperations.delete(DelegatingQueryContext.scala:92)", "org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.org$neo4j$cypher$internal$compiler$v2_0$spi$ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$super$delete(ExceptionTranslatingQueryContext.scala:118)", "org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$delete$1.apply$mcV$sp(ExceptionTranslatingQueryContext.scala:118)", "org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$delete$1.apply(ExceptionTranslatingQueryContext.scala:118)", "org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$delete$1.apply(ExceptionTranslatingQueryContext.scala:118)", "org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext.org$neo4j$cypher$internal$compiler$v2_0$spi$ExceptionTranslatingQueryContext$$translateException(ExceptionTranslatingQueryContext.scala:149)", "org.neo4j.cypher.internal.compiler.v2_0.spi.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.delete(ExceptionTranslatingQueryContext.scala:118)", "org.neo4j.cypher.internal.compiler.v2_0.spi.UpdateCountingQueryContext$CountingOps.delete(UpdateCountingQueryContext.scala:118)", "org.neo4j.cypher.internal.compiler.v2_0.mutation.DeleteEntityAction.org$neo4j$cypher$internal$compiler$v2_0$mutation$DeleteEntityAction$$delete(DeleteEntityAction.scala:53)", "org.neo4j.cypher.internal.compiler.v2_0.mutation.DeleteEntityAction.exec(DeleteEntityAction.scala:37)", "org.neo4j.cypher.internal.compiler.v2_0.pipes.ExecuteUpdateCommandsPipe.org$neo4j$cypher$internal$compiler$v2_0$pipes$ExecuteUpdateCommandsPipe$$exec(ExecuteUpdateCommandsPipe.scala:56)", "org.neo4j.cypher.internal.compiler.v2_0.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$compiler$v2_0$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands$1$$anonfun$apply$2.apply(ExecuteUpdateCommandsPipe.scala:45)", "org.neo4j.cypher.internal.compiler.v2_0.pipes.ExecuteUpdateCommandsPipe$$anonfun$org$neo4j$cypher$internal$compiler$v2_0$pipes$ExecuteUpdateCommandsPipe$$executeMutationCommands$1$$anonfun$apply$2.apply(ExecuteUpdateCommandsPipe.scala:45)", "scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)", "scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)", "org.neo4j.cypher.internal.compiler.v2_0.pipes.EmptyResultPipe.internalCreateResults(EmptyResultPipe.scala:28)", "org.neo4j.cypher.internal.compiler.v2_0.pipes.PipeWithSource.createResults(Pipe.scala:71)", "org.neo4j.cypher.internal.compiler.v2_0.executionplan.ExecutionPlanBuilder.org$neo4j$cypher$internal$compiler$v2_0$executionplan$ExecutionPlanBuilder$$prepareStateAndResult(ExecutionPlanBuilder.scala:149)", "org.neo4j.cypher.internal.compiler.v2_0.executionplan.ExecutionPlanBuilder$$anonfun$3.apply(ExecutionPlanBuilder.scala:136)", "org.neo4j.cypher.internal.compiler.v2_0.executionplan.ExecutionPlanBuilder$$anonfun$3.apply(ExecutionPlanBuilder.scala:135)", "org.neo4j.cypher.internal.compiler.v2_0.executionplan.ExecutionPlanBuilder$$anon$6.execute(ExecutionPlanBuilder.scala:50)", "org.neo4j.cypher.internal.ExecutionPlanWrapperForV2_0.execute(CypherCompiler.scala:93)", "org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:61)", "org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:65)", "org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:78)", "org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:100)", "java.lang.reflect.Method.invoke(Method.java:606)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)", "java.lang.Thread.run(Thread.java:744)" ]
}