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.

Modify value in Bloom Search

andy_hegedus
Graph Fellow

Hi,

I have a Bloom query that is generally working, but not quite. The target property is used to modify the display property of nodes in the Bloom display. A value of 1 color codes the node to the target company and 0 is meant for other companies. However sometimes other company is actually the same as

The problem with the code here is that if (c:company) is the same as (A:company) I would like the b.target set to 1.

Match p=(A:company{name:$target})<-[:Assigned_to]-(t:patent)<-[:Cites]-(b:patent)-[:Assigned_to]->(c:company)
set t.target =1
set b.target = 0
Return p

I am trying to use the apoc.do.when as a solution:

Match p=(A:company{name:$target})<-[:Assigned_to]-(t:patent)<-[:Cites]-(b:patent)-[:Assigned_to]->(c:company)
set t.target =1
with p,b,c
Call apoc.do.when(c.name=$target,
'Set b.target=1',
'Set b.target=0') Yield value
Return p

But I am getting an error regarding not recognizing the b variable.

Alternative solutions?
Andy

1 REPLY 1

You need to pass {b:b} as parameters to do.when

but easier to just do: set b.target = case when c.name=$target then 1 else 0 end

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online