Guys,
I have the following query:
MATCH
(c:City {normalized_name: pLiveAddrCity}),
(:TenantMAS {name: pTenantName})<-[:as_seen_by]-(la:LocalAgent {id: pAgentId})
MERGE
(new_addr:Address {
street_name: pLiveAddrStreetName,
number: pLiveAddrNumber,
neighborhood: pLiveAddrNeighborhood,
cep: pLiveAddrPostalCode
})-[:belongs_to]->(c)
ON CREATE SET
new_addr.latitude = pLiveAddrLatitude,
new_addr.longitude = pLiveAddrLongitude
WITH
la,
new_addr
OPTIONAL MATCH
(la)-[rel_loc:is_located_at]->(:Address)
WITH
la,
new_addr,
rel_loc
CALL apoc.do.when(
rel_loc IS NULL,
'MERGE (agent)-[:is_located_at]->(toNode)',
'CALL apoc.refactor.to(rel_to_change, toNode) YIELD input, output, error RETURN error',
{agent: la, rel_to_change: rel_loc, toNode: new_addr}
) YIELD value
RETURN
new_addr
I am having a hard time trying to draw the graph after refactoring it connected with the parts that are were not refactored.
Is there a way of achieving this?
Please allow me a second question: where can I find documentation of what I should expect to find in the output of each APOC call? I know how to check the API with the apoc.help
, but sometimes I don't know what to expect on a value
or output
return...
Thanks in advance,