Use parameters in query Cypher

Hi, I'm using these three parameters (strings) in this Cypher query. It runs everything correctly, without finding any errors, but the relationship I want to create with the LINE_ID MERGE does not appear on the Neo4j Browser. Can anyone explain to me why?

when I call the parameters in the WHERE condition it doesn't create the relations anymore

yes, I checked because I re-executed the query without calling the parameters and, on the browser, the relationships appear

It would not create the relationship if any of the nodes f, f1, or l is not matched. Did you verify each is present in the database?

how are you verifying the absence of the relationship in the browser?

How did you create the three nodes? Were they imported? What type is the ‘id’ field for each node- string or integer?

The reason I asked about 'how they were imported' is because all properties are imported as strings by default; therefore, if you had numbers in your file they will be string properties instead of numbers. This is a typical source of errors when querying the data later. In your case, you are probably passing the parameters as integers. If my assertions is true, then you will not get a match since the node property is a string and the parameter is a number. You can test this by wrapping each parameter in a toString() function call and see if it works.

You can remediate the data with the following query:

match(n) where n:Fermata or n:Linea
set n.id = toInteger(n.id)

The situation is avoided during import by using the toInteger() for the columns that represent numbers.

If what I described as the problem with the integer versus string issue is not the cause, then run the following query and let's review the output. We are looking to see if some of the nodes do not match with the parameters passed.

optional match (l:Linea{id:$linea})
optional match (f:Fermata{id:$stop})
optional match (f1:Fermata{id:$stop1})
with $linea as linea, l.id as linea_id, $stop as stop, f.id as f_id, $stop1 as stop1, f1.id as f1_id
where linea_id is null or f_id is null or f1_id is null
return *