cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Using parameters in calling properties

depire
Node Clone

Hello everyone,

I have the following data.
merge (a:LEU {LEID: "A"})
merge (b:LEU {LEID: "B"})
merge (c:LEU {LEID: "C"})
merge (a)-[:CONTROLS {date:date('2010-01-01')}]->(b)
merge (a)-[:CONTROLS {date:date('2011-01-01')}]->(c)

I create the property "cluster_2010" cluster by using:
CALL algo.unionFind('MATCH (p:LEU) RETURN id(p) as id', 'MATCH (p:LEU)-[l:CONTROLS]->(c:LEU) WHERE l.start = date("2010-01-01") RETURN id(p) as source, id(c) as target', { graph:"cypher", write:true, writeProperty: 'cluster_2010', concurrency:1})
YIELD nodes, setCount, loadMillis, computeMillis, writeMillis

I do it for 2011.

I would like to enter cypher code using parameter "year";
I would like to write like:
:param year => 2010
MATCH (p:LEU) WHERE p.cluster_$year = 0 RETURN p

It seems that it is not authorized.
Have you some idea to solve this problem ?
The goal is to use the following code:
CALL algo.unionFind('MATCH (p:LEU) RETURN id(p) as id', 'MATCH (p:LEU)-[l:CONTROLS]->(c:LEU) WHERE l.start = date({year:$year, month:1, day:1}) RETURN id(p) as source, id(c) as target', { graph:"cypher", write:true, writeProperty: "cluster_$year", concurrency:1})
YIELD nodes, setCount, loadMillis, computeMillis, writeMillis

Thanks.
Alexandre

1 REPLY 1

intouch_vivek
Graph Steward

If you are facing problem in passing parameter to the algo
then try below query

CALL algo.wcc('MATCH (p:LEU) RETURN id(p) as id', 'MATCH (p:LEU)-[l:CONTROLS]->(c:LEU) WHERE l.date = date({year:$year, month:1, day:1}) RETURN id(p) as source, id(c) as target', { graph:"cypher", write:true, writeProperty: "cluster_$year", concurrency:1,params:{year:$year}})
YIELD nodes, setCount, loadMillis, computeMillis, writeMillis