Parameterization of cypher

Hello

I have two URLs pointing to different files . i parameteized them in below

:params {
mirror_filelocation: "https://file1",
car_filelocation: "https://ile2",
}

now i want to call below code segment for each of them .
I want to call below twice, one with each of the parameters.

instead of hard coding of the name of parameter name that i did in below , what is alternative way i can parametrize code in below that I can invoke it with different parameter names
or may be:
how can i convert below as procedure or function with a parameter that i can pass above two parameters during the call?

CALL apoc.load.xml ($mirror_filelocation, '')
YIELD value
UNWIND value._children AS plmxml
return plmxml._type

define parameters:

:params {
    urls: {
        mirror_filelocation: "https://file1",
        car_filelocation: "https://ile2",
    }
}
unwind keys($urls) as key
CALL apoc.load.xml ($urls[key], '')
YIELD value
UNWIND value._children AS plmxml
return plmxml._type
1 Like