Hello there,
I am executing queries which seems to behave weird.
The queries i am executing is this one :
MATCH(nodea0:HypoComplexe:DOPLER:Maquette:ImportXML{id:'62c6df857aeb04026be826069df0faa67236a7d7d10a6b848fc66acf4b7ab7ab'})
CALL apoc.periodic.iterate(
" WITH $matchchilds AS matchchilds UNWIND matchchilds as matchchild RETURN matchchild",
" MATCH(nodeb:Hypothese:DOPLER:Maquette:ImportXML{id:matchchild.params1_id})
MERGE (nodea0)-[rel0:CONTAINS]->(nodeb) ",
{batchSize:1000, parallel:false,params:{matchchilds: $matchchilds}}
)
YIELD batch, operations
RETURN batch ,operations , nodea0
The query runs fine with this output :
[
Record {
keys: [ 'batch', 'operations', 'nodea0' ],
length: 3,
_fields: [
{
total: Integer { low: 6, high: 0 },
committed: Integer { low: 6, high: 0 },
failed: Integer { low: 0, high: 0 },
errors: {}
},
{
total: Integer { low: 5732, high: 0 },
committed: Integer { low: 5732, high: 0 },
failed: Integer { low: 0, high: 0 },
errors: {}
},
Node {
identity: Integer { low: 173480, high: 0 },
labels: [ 'DOPLER', 'Maquette', 'ImportXML', 'HypoComplexe' ],
properties: {
Attr_dtCreation: "'13/10/2022 14:14'",
Attr_description: "''",
nameUser: "''",
Attr_createur: "'gsradm'",
name: "'Etat 9'",
Attr_nom: "'Etat '",
id: '62c6df857aeb04026be826069df0faa67236a7d7d10a6b848fc66acf4b7ab7ab',
Attr_type: "'20'",
Attr_dtModif: "'13/10/2022 14:14'",
Attr_xmlns: "'http://www.*****.com/gsr'",
Attr_xmlns_xsi: "'http://www.w3.org/2001/XMLSchema-instance'"
},
elementId: '4:15b97476-e1db-4513-8d0c-610cb672c8ca:173480'
}
],
_fieldLookup: { batch: 0, operations: 1, nodea0: 2 }
}
]
So nodea0 seems to have been found becaue it is returned in the result. The query has just to MERGE the relation between nodea1 and nodeb list.
nodeb variable is matched through a parameter list with 5732 values.
But in my graph, i am left with an empty node like this linked to each nodeb (it seems that variable nodea1 contains void at execution time) :
Expected output is more like :
I tried many alternatives without success (i didn't get error though) :
- Subquery the apoc procedure with a with clause on nodea0
MATCH(nodea0:HypoComplexe:DOPLER:Maquette:ImportXML{id:'62c6df857aeb04026be826069df0faa67236a7d7d10a6b848fc66acf4b7ab7ab'})
CALL {
WITH nodea0
CALL apoc.periodic.iterate(
" WITH $matchchilds AS matchchilds UNWIND matchchilds as matchchild RETURN matchchild",
" MATCH (nodeb:Hypothese:DOPLER:Maquette:ImportXML{id:matchchild.params1_id})
MERGE (nodea0)-[rel0:CONTAINS]->(nodeb) ",
{batchSize:1000, parallel:false,params:{matchchilds: $matchchilds}}
)
YIELD batch, operations
RETURN batch ,operations
}
RETURN batch,operations, nodea0
- add nodea0 as apoc procedure parameter :
MATCH(nodea0:HypoComplexe:DOPLER:Maquette:ImportXML{id:'62c6df857aeb04026be826069df0faa67236a7d7d10a6b848fc66acf4b7ab7ab'})
CALL {
WITH nodea0
CALL apoc.periodic.iterate(
" WITH $matchchilds AS matchchilds UNWIND matchchilds as matchchild RETURN matchchild",
" MATCH (nodeb:Hypothese:DOPLER:Maquette:ImportXML{id:matchchild.params1_id})
MERGE (nodea0)-[rel0:CONTAINS]->(nodeb) ",
{batchSize:1000, parallel:false,params:{matchchilds: $matchchilds, nodea0:nodea0}}
)
YIELD batch, operations
RETURN batch ,operations
}
RETURN batch,operations, nodea0
What am i doing wrong?
Thank you for your help.