Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-29-2020 05:06 AM
I'm trying to run this query, which is based on the sample code given on the docs for degree centrality
CALL gds.alpha.degree.write({
nodeQuery: 'MATCH (n:USER)-[:COLLECTED_AT_STEP]->(:STEP {step_val:1}) RETURN id(n) as id',
relationshipQuery:'MATCH (u1:USER)-[:FOLLOWS]->(u2:USER) RETURN id(u1) AS source, id(u2) AS target',
writeProperty:'in_degree'
})
I'm receiving the following error
Failed to invoke procedure 'gds.alpha.degree.write' : Caused by: java.lang.IllegalStateException: Failed to load relationship with unknown target-node id 1.
I've run both the nodeQuery
and the relationshipQuery
independently and both resolve fine, so I'm at a bit of a loss as to what is the issue. Many thanks for any advice!
Solved! Go to Solution.
07-31-2020 10:04 AM
I believe the error is indicating that the relationshipQuery returned a node that is not present in the nodeQuery results, right?
You'll notice that in the example they are sending in literally every node for nodeQuery
MATCH (u:User) RETURN id(u) AS id
I don't imagine you have to do that, but it does appear that all the nodes referenced in the relationship query must need to be present in nodeQuery, if I read the error text correctly.
Failed to load relationship with unknown target-node id 1
07-31-2020 10:04 AM
I believe the error is indicating that the relationshipQuery returned a node that is not present in the nodeQuery results, right?
You'll notice that in the example they are sending in literally every node for nodeQuery
MATCH (u:User) RETURN id(u) AS id
I don't imagine you have to do that, but it does appear that all the nodes referenced in the relationship query must need to be present in nodeQuery, if I read the error text correctly.
Failed to load relationship with unknown target-node id 1
08-02-2020 12:35 PM
Ah! OK I get it. I was thinking of the node query as a filter, i.e. First select the nodes that the relationship query will then use, whereas actually I should be doing that filtering stage in the relationship query itself.
Thanks this was very helpful!
08-03-2020 02:49 AM
You can set validateRelationships:false
to have it ignore missing relationships.
See the syntax section here - https://neo4j.com/docs/graph-data-science/current/management-ops/cypher-projection/#cypher-projectio...
All the sessions of the conference are now available online