I have an interesting error
I am creating
(A)<-(Main Node)->(link)->(value or reference)
When I execute this query:
UNWIND $links AS linkData
UNWIND COALESCE(linkData.references, []) AS refData
CALL apoc.cypher.run('MATCH (ref:`' + refData.label + '` {code: theCode}) RETURN ref', { theCode: refData.code })
YIELD value AS r
RETURN r
I get the right result (the references), but when I execute it as part of the entire iteration:
// several other queries (some with optional matches, all works fine)
WITH A, l, linkData
CALL {
WITH A, l, linkData
UNWIND COALESCE(linkData.references, []) AS refData
CALL apoc.cypher.run('MATCH (ref:`' + refData.label + '` {code: theCode}) RETURN ref', { theCode: refData.code })
YIELD value AS r
MERGE (l)-[valu:value]->(r)
ON CREATE
SET valu.created = timestamp(),
valu.updated = timestamp()
ON MATCH
SET valu.updated = timestamp()
}
I get the error from the subject.
:params {
"node": {
"id": "123",
"properties": {
"name": "Main Node",
"category": "CategoryA",
"createdAt": "2025-03-10"
},
"parentId": "54:6b65977c-9dd8-4989-80f4-225b96258645:12750"
},
"links": [
{
"id": "link1",
"properties": {
"createdAt": "2025-03-10",
"status": "active"
},
"type": {
"name": "timeRange"
},
"values": [
{
"content": "ValueA1",
"properties": {
"format": "text",
"size": 1024
}
},
{
"content": "ValueA2",
"properties": {
"format": "xml",
"size": 2048
}
}
],
"references": []
},
{
"id": "link5",
"properties": {
"createdAt": "2025-03-10",
"status": "active"
},
"type": {
"name": "isAccessServiceOf"
},
"values": [
{
"content": "ValueB1",
"properties": {
"format": "jpg",
"size": 1024
}
},
{
"content": "ValueB2",
"properties": {
"format": "rdf",
"size": 2048
}
}
]
},
{
"id": "link6",
"properties": {
"createdAt": "2025-03-10",
"status": "active"
},
"type": {
"name": "theme"
},
"references": [
{
"label": "type_iso3166",
"code" : "AF"
},
{
"label": "type_iso3166",
"code" : "NA"
}
]
}
]
}