Does this work?
MATCH (u:user)-[i:INTEREST]->(t)
WHERE NOT u-[:RELEVANCE]->()-[:ISABOUT]->t
REMOVE i.neg, i.pos
SET i.explicit = 1
题
I have two collections, one containing nodes, and another containing rels and nodes (see http://console.neo4j.org/?id=ijoqaa)
What I try to achieve is to update the rel properties , depending on the whether a node in one collection is also present in the other. The code below illustrates this (hopefully), although it's not valid cypher.
FOREACH (iterm in iterms|
CASE
WHEN NOT (iterm[1] IN iaterms) THEN
REMOVE iterms[0].pos,iterms[0].neg
SET iterm[0].explicit=1
END
)
Question: what is the way to do this in cypher ?
解决方案 2
Does this work?
MATCH (u:user)-[i:INTEREST]->(t)
WHERE NOT u-[:RELEVANCE]->()-[:ISABOUT]->t
REMOVE i.neg, i.pos
SET i.explicit = 1
其他提示
Looking at what you have at the console, I think your query could be quite simple. There's no need to iterate with a foreach
construction.
MATCH (u:user)-[r:RELEVANCE]->()-[ia:ISABOUT]->(t:term)
WITH u, collect(t) AS terms
MATCH (u)-[i:INTEREST]->(t2:term)
WHERE NONE(t IN terms WHERE t = t2)
REMOVE i.pos, i.neg
SET i.explicit = 1