Hello,
I build a very simple graph having different type of nodes and just one type of relationship, named MAPPING1TO1; so, each couple of nodes share the same type of relationship. This relationship (named EventTag) has just one property: an array. In particular, the array might have just one of the following forms:
[1] (a_1,b_1), ..., (a_n, b_n)
[2] c_1, c_2, ..., c_m
where a_i, b_i and c_i can be any integer number.
I would write a query in Cypher that returns all the couples of nodes sharing a relationship that satisfy the following condition: there exists inside the array EventTag an element equal to x, given in input.
I have written the following query to solve this problem:
WITH "912" AS event
MATCH (a)-[r]->(b)
WHERE SINGLE(item in r.EventoTag WHERE SUBSTRING(item,0,4) CONTAINS event)
RETURN p
The SUBSTRING part is the way to check if there is the item of interest inside the array.
Anyways, I don't understand why this query dosen't solve the problem; the result is the following:
The relationships that I haven't highlighted are good, i.e. it's right they are part of the result, but the highlighted relationship dosen't, why it's taken in the result? If you look the EventTag properties, you can see there isn't an item containing the substring 912, the item I'm looking for.
Do you have any idea? Thank you very much.