Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-11-2022 09:35 AM
Hi guys,
I'm getting this error on my neo4j-desktop 1.4.15 for neo4j version 4.4.5
A bug has occurred in the morsel runtime: The target morsel cannot hold the data to copy.
And this is the query i'm doing
12-11-2022 11:33 AM
'jj' and 'gg' are not defined. Are these supposed to be 'bmxh' and 'cmrh'? If so, I think this simplified query should result in the same result. Maybe it avoids the error.
CALL {
MATCH (qlwe:Fan)-[mmkt:BORN_ON_MONTH]->(xbqe:Month)
WHERE xbqe.name = '01'
RETURN COLLECT(apoc.map.merge({id: ID(qlwe)}, qlwe)) AS xodv
}
CALL {
MATCH (zdfy:Fan)-[bdkl:BORN_ON_DAY]->(krcq:Day)
WHERE krcq.name = '20'
RETURN COLLECT(apoc.map.merge({id: ID(zdfy)}, zdfy)) AS zqqz
}
UNWIND apoc.coll.intersection(xodv,zqqz) AS result
RETURN result
UNION
CALL {
MATCH (zazq:Player)-[eize:BORN_ON_MONTH]->(xmwc:Month)
WHERE xmwc.name = '01'
RETURN COLLECT(apoc.map.merge({id: ID(zazq)}, zazq)) AS oemm
}
CALL {
MATCH (ceah:Player)-[yqgt:BORN_ON_DAY]->(ychy:Day)
WHERE ychy.name = '20'
RETURN COLLECT(apoc.map.merge({id: ID(ceah)}, ceah)) AS eqci
}
UNWIND apoc.coll.intersection(eqci,oemm) AS result
RETURN result
12-12-2022 02:48 AM
Just a note on the apoc.merge.map usages. The function takes two maps as its parameters, but in all four uses the second parameter being passed is a node. I think the second parameter should be properties(node) instead, as properties will return a map of the node’s properties.
You can also get the same result directly with map projection, eliminating the need for apoc.map.merge. Collect the following instead, where ‘x’ represents the node variable. This will create a map with all the node’s properties and its id.
x{.*, id: id(x)}
https://neo4j.com/docs/cypher-manual/current/syntax/maps/#cypher-map-projection
12-12-2022 08:46 AM
Just thinking, this should give you the same results and may be more efficient. It calculates the intersection of a list of nodes instead of a list of maps.
CALL {
MATCH (qlwe:Fan)-[mmkt:BORN_ON_MONTH]->(xbqe:Month)
WHERE xbqe.name = '01'
RETURN COLLECT(qlwe) AS xodv
}
CALL {
MATCH (zdfy:Fan)-[bdkl:BORN_ON_DAY]->(krcq:Day)
WHERE krcq.name = '20'
RETURN COLLECT(zdfy) AS zqqz
}
UNWIND apoc.coll.intersection(xodv, zqqz) AS x
RETURN x{.*, id: id(x)} as result
UNION
CALL {
MATCH (zazq:Player)-[eize:BORN_ON_MONTH]->(xmwc:Month)
WHERE xmwc.name = '01'
RETURN COLLECT(zazq) AS oemm
}
CALL {
MATCH (ceah:Player)-[yqgt:BORN_ON_DAY]->(ychy:Day)
WHERE ychy.name = '20'
RETURN COLLECT(ceah) AS eqci
}
UNWIND apoc.coll.intersection(eqci, oemm) AS x
RETURN x{.*, id: id(x)} as result
12-12-2022 09:01 AM
Sorry, last refactor. It looks like the logic is finding the set of 'Fan' nodes that have both a specific relationship to a 'Month' node and a 'Day' node. This is implemented by finding both set of 'Fan' nodes and calculating the intersection, which represents the set of nodes in both sets. This logic can be replaced by finding the set of 'Fan' nodes that have a path to both the specific 'Month' node and the specific 'Day' node. That is what the logic does in the below query.
The same is true for the 'Player' nodes.
MATCH (fan:Fan)
WHERE EXISTS {
MATCH (fan)-[:BORN_ON_MONTH]->(xbqe:Month)
WHERE xbqe.name = '01'
}
AND EXISTS {
MATCH (fan)-[:BORN_ON_DAY]->(krcq:Day)
WHERE krcq.name = '20'
}
RETURN fan{.*, id: id(fan)} as result
UNION
MATCH (player:Player)
WHERE EXISTS {
MATCH (player)-[:BORN_ON_MONTH]->(xmwc:Month)
WHERE xmwc.name = '01'
}
AND EXISTS {
MATCH (player)-[:BORN_ON_DAY]->(ychy:Day)
WHERE ychy.name = '20'
}
RETURN player{.*, id: id(player)} as result
All the sessions of the conference are now available online