cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Gds.graph.create.cypher : Failed to load a relationship because

Sandip
Node Link

Hi all,
I'm trying to create a subgraph with the following query and getting an error

CALL gds.graph.create.cypher(
    'targets',
    // nodeQuery
    'MATCH (n:Consumer) RETURN id(n) AS id',
    // relationshipQuery
    'MATCH (n:Consumer)-[r:HAS_INTERACTION]->(m) RETURN id(n) AS source, id(m) AS target, type(r) as type',
    {validateRelationships:True})
2021-12-27 17:35:00.631+0000 WARN  Graph creation failed
java.lang.IllegalArgumentException: Failed to load a relationship because its target-node with id 289 is not part of the node query or projection. To ignore the relationship, set the configuration parameter `validateRelationships` to false.
	at org.neo4j.gds.utils.ExceptionUtil.validateNodeIsLoaded(ExceptionUtil.java:146) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.utils.ExceptionUtil.validateTargetNodeIsLoaded(ExceptionUtil.java:136) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.core.loading.RelationshipRowVisitor.readTargetId(RelationshipRowVisitor.java:195) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.core.loading.RelationshipRowVisitor.visit(RelationshipRowVisitor.java:145) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.core.loading.RelationshipRowVisitor.visit(RelationshipRowVisitor.java:139) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.cypher.internal.javacompat.ResultSubscriber.onRecordCompleted(ResultSubscriber.java:122) ~[neo4j-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.codegen.OperatorTaskPipeline0_66.compiledOperate(Unknown Source) ~[?:?]
	at org.neo4j.cypher.internal.runtime.pipelined.operators.CompiledTask.operateWithProfile(OperatorCodeGenBaseTemplates.scala:451) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.pipelined.PipelineTask.executeOperators(PipelineTask.scala:62) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.pipelined.PipelineTask.executeWorkUnit(PipelineTask.scala:51) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.pipelined.Worker.executeTask(Worker.scala:144) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.pipelined.Worker.workOnQuery(Worker.scala:97) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.pipelined.execution.CallingThreadExecutingQuery.request(CallingThreadExecutingQuery.scala:40) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.PipelinedRuntimeResult.request(PipelinedRuntime.scala:502) ~[neo4j-enterprise-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.result.StandardInternalExecutionResult.request(StandardInternalExecutionResult.scala:90) ~[neo4j-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.result.ClosingExecutionResult.request(ClosingExecutionResult.scala:144) ~[neo4j-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.javacompat.ResultSubscriber.fetchResults(ResultSubscriber.java:362) ~[neo4j-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.javacompat.ResultSubscriber.acceptFromSubscriber(ResultSubscriber.java:447) ~[neo4j-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.javacompat.ResultSubscriber.accept(ResultSubscriber.java:287) ~[neo4j-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.gds.core.loading.CypherRelationshipLoader.loadSingleBatch(CypherRelationshipLoader.java:185) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.core.loading.CypherRecordLoader.load(CypherRecordLoader.java:73) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.core.loading.CypherFactory.loadRelationships(CypherFactory.java:225) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.core.loading.CypherFactory.lambda$build$1(CypherFactory.java:154) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.transaction.TransactionContext.apply(TransactionContext.java:108) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.core.loading.CypherFactory.build(CypherFactory.java:135) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.core.GraphLoader.graphStore(GraphLoader.java:47) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.catalog.GraphCreateProc.createGraph(GraphCreateProc.java:277) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.catalog.GraphCreateProc.lambda$createCypher$1(GraphCreateProc.java:145) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.BaseProc.runWithExceptionLogging(BaseProc.java:186) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.gds.catalog.GraphCreateProc.createCypher(GraphCreateProc.java:143) ~[neo4j-graph-data-science-1.8.1.jar:?]
	at org.neo4j.kernel.impl.proc.GeneratedProcedure_cypher1069831078072300.apply(Unknown Source) ~[?:?]
	at org.neo4j.procedure.impl.ProcedureRegistry.callProcedure(ProcedureRegistry.java:235) ~[neo4j-procedure-4.4.0.jar:4.4.0]
	at org.neo4j.procedure.impl.GlobalProceduresRegistry.callProcedure(GlobalProceduresRegistry.java:352) ~[neo4j-procedure-4.4.0.jar:4.4.0]
	at org.neo4j.kernel.impl.newapi.AllStoreHolder.callProcedure(AllStoreHolder.java:1092) ~[neo4j-kernel-4.4.0.jar:4.4.0]
	at org.neo4j.kernel.impl.newapi.AllStoreHolder.procedureCallRead(AllStoreHolder.java:1004) ~[neo4j-kernel-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.interpreted.CallSupport$.$anonfun$callReadOnlyProcedure$1(CallSupport.scala:47) ~[neo4j-cypher-interpreted-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.interpreted.CallSupport$.callProcedure(CallSupport.scala:70) ~[neo4j-cypher-interpreted-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.interpreted.CallSupport$.callReadOnlyProcedure(CallSupport.scala:47) ~[neo4j-cypher-interpreted-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.interpreted.TransactionBoundReadQueryContext.callReadOnlyProcedure(TransactionBoundQueryContext.scala:1134) ~[neo4j-cypher-interpreted-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.planning.ExceptionTranslatingReadQueryContext.callReadOnlyProcedure(ExceptionTranslatingQueryContext.scala:226) ~[neo4j-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.LazyReadOnlyCallMode$.callProcedure(ProcedureCallMode.scala:50) ~[neo4j-cypher-runtime-util-4.4.0.jar:4.4.0]
	at org.neo4j.codegen.OperatorTaskPipeline0_64.compiledOperate(Unknown Source) ~[?:?]
	at org.neo4j.cypher.internal.runtime.pipelined.operators.CompiledTask.operateWithProfile(OperatorCodeGenBaseTemplates.scala:451) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.pipelined.PipelineTask.executeOperators(PipelineTask.scala:62) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.pipelined.PipelineTask.executeWorkUnit(PipelineTask.scala:51) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.pipelined.Worker.executeTask(Worker.scala:144) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.pipelined.Worker.workOnQuery(Worker.scala:97) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.runtime.pipelined.execution.CallingThreadExecutingQuery.request(CallingThreadExecutingQuery.scala:40) ~[neo4j-cypher-pipelined-runtime-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.PipelinedRuntimeResult.request(PipelinedRuntime.scala:502) ~[neo4j-enterprise-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.result.StandardInternalExecutionResult.request(StandardInternalExecutionResult.scala:90) ~[neo4j-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.cypher.internal.result.ClosingExecutionResult.request(ClosingExecutionResult.scala:144) ~[neo4j-cypher-4.4.0.jar:4.4.0]
	at org.neo4j.fabric.stream.QuerySubject$BasicQuerySubject$1.doRequest(QuerySubject.java:184) ~[neo4j-fabric-4.4.0.jar:4.4.0]
	at org.neo4j.fabric.stream.QuerySubject$BasicQuerySubject$1.request(QuerySubject.java:167) ~[neo4j-fabric-4.4.0.jar:4.4.0]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.request(FluxPeek.java:138) ~[reactor-core-3.4.11.jar:3.4.11]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.request(FluxPeek.java:138) ~[reactor-core-3.4.11.jar:3.4.11]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.request(FluxPeek.java:138) ~[reactor-core-3.4.11.jar:3.4.11]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.request(FluxPeek.java:138) ~[reactor-core-3.4.11.jar:3.4.11]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.request(FluxPeek.java:138) ~[reactor-core-3.4.11.jar:3.4.11]
	at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.request(Operators.java:2158) ~[reactor-core-3.4.11.jar:3.4.11]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.request(FluxPeek.java:138) ~[reactor-core-3.4.11.jar:3.4.11]
	at reactor.core.publisher.StrictSubscriber.request(StrictSubscriber.java:138) ~[reactor-core-3.4.11.jar:3.4.11]
	at org.neo4j.fabric.stream.Rx2SyncStream$RecordSubscriber.request(Rx2SyncStream.java:129) ~[neo4j-fabric-4.4.0.jar:4.4.0]
	at org.neo4j.fabric.stream.Rx2SyncStream.maybeRequest(Rx2SyncStream.java:91) ~[neo4j-fabric-4.4.0.jar:4.4.0]
	at org.neo4j.fabric.stream.Rx2SyncStream.readRecord(Rx2SyncStream.java:50) ~[neo4j-fabric-4.4.0.jar:4.4.0]
	at org.neo4j.fabric.bolt.BoltQueryExecutionImpl$QueryExecutionImpl.request(BoltQueryExecutionImpl.java:179) ~[neo4j-fabric-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.AbstractCypherAdapterStream.handleRecords(AbstractCypherAdapterStream.java:105) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.v3.messaging.ResultHandler.onPullRecords(ResultHandler.java:41) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.v4.messaging.PullResultConsumer.consume(PullResultConsumer.java:42) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.statemachine.impl.TransactionStateMachine$State.consumeResult(TransactionStateMachine.java:507) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.statemachine.impl.TransactionStateMachine$State$2.streamResult(TransactionStateMachine.java:351) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.statemachine.impl.TransactionStateMachine.streamResult(TransactionStateMachine.java:99) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.transaction.StatementProcessorTxManager.streamResults(StatementProcessorTxManager.java:249) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.transaction.StatementProcessorTxManager.pullData(StatementProcessorTxManager.java:111) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.v4.runtime.InTransactionState.processStreamPullResultMessage(InTransactionState.java:78) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.v4.runtime.AbstractStreamingState.processUnsafe(AbstractStreamingState.java:51) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.v4.runtime.InTransactionState.processUnsafe(InTransactionState.java:64) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.v3.runtime.FailSafeBoltStateMachineState.process(FailSafeBoltStateMachineState.java:48) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.statemachine.impl.AbstractBoltStateMachine.nextState(AbstractBoltStateMachine.java:154) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.statemachine.impl.AbstractBoltStateMachine.process(AbstractBoltStateMachine.java:102) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.messaging.BoltRequestMessageReader.lambda$doRead$1(BoltRequestMessageReader.java:93) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.DefaultBoltConnection.lambda$enqueue$0(DefaultBoltConnection.java:156) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatchInternal(DefaultBoltConnection.java:252) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:187) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:177) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.scheduling.ExecutorBoltScheduler.executeBatch(ExecutorBoltScheduler.java:257) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at org.neo4j.bolt.runtime.scheduling.ExecutorBoltScheduler.lambda$scheduleBatchOrHandleError$3(ExecutorBoltScheduler.java:240) ~[neo4j-bolt-4.4.0.jar:4.4.0]
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.69.Final.jar:4.1.69.Final]
	at java.lang.Thread.run(Thread.java:834) [?:?]
6 REPLIES 6

Sandip
Node Link

Neo4j Desktop
Database Version: 4.4.0
Graph Data Science Library Version: 1.8.1

Sandip
Node Link

Solved.

CALL gds.graph.create.cypher(
    "myGraph",
    "MATCH (n) WHERE n:Consumer OR n:Target RETURN id(n) AS id, labels(n) AS labels",
    "MATCH (a:Consumer)-[]->()-[:HAS_TARGET]->(b:Target) return id(a) AS source, id(b) AS target",
    {validateRelationships: TRUE})

How you solve the issue can you please let me know

@rishab , the above problem was, that the relationships contain nodes that were not part of the nodeQuery.
So their fix was to also include the Target nodes in the nodeQuery (see the diff between their solution and initial query).

Thanks for the quick reply.

Actually I am facing below error in ldbc interactive benchmark, Any help will be really appreciated.

error:   ERROR: Error encountered
LdbcQuery14{person1IdQ14StartNode=32985348892426, person2IdQ14EndNode=35184372147781}
org.neo4j.driver.exceptions.ClientException: Failed to invoke procedure `gds.shortestPath.dijkstra.stream`: Caused by: java.lang.IllegalArgumentException: Failed to load a relationship because its source-node with id 72641772 is not part of the node query or projection. To ignore the relationship, set the configuration parameter `validateRelationships` to false.
at org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:144)
at org.neo4j.driver.internal.InternalResult.blockingGet(InternalResult.java:122)
at org.neo4j.driver.internal.InternalResult.list(InternalResult.java:99)
at org.ldbcouncil.snb.impls.workloads.cypher.operationhandlers.CypherListOperationHandler.executeOperation(CypherListOperationHandler.java:42)
at org.ldbcouncil.snb.impls.workloads.cypher.operationhandlers.CypherListOperationHandler.executeOperation(CypherListOperationHandler.java:20)
at org.ldbcouncil.snb.driver.OperationHandlerRunnableContext.run(OperationHandlerRunnableContext.java:142)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

 

Can you share your node and relationship query? (or alternatively just the whole procedure call)