Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-25-2021 11:17 AM
I have a lot of nodes which have a name property.
The name is something comma separated, because it contains synonyms.
So, I decided to try to set the name as a list instead of a single string.
a specific query
match (n:AppellationNew {uuid: "c38e2d52-ebd0-48f3-80d4-e57635e36070"}) return n
returns the following value if shown as a Text, where the name is clearly a List:
{"name":["Asolo Montello","Montello Asolo","Montello","Colli Asolani"]│
│,"uuid":"c38e2d52-ebd0-48f3-80d4-e57635e36070"}
But the same query, if shown as a graph, return a node with the following attributes:
**<id>:** 3526 **name:**Asolo Montello,Montello Asolo,Montello,Colli Asolani **uuid:** c38e2d52-ebd0-48f3-80d4-e57635e36070
Where the name is espressed as a single string with comma separated values.
The name property is indexed and unique with
create constraint on (n:AppellationNew) assert n.uuid is unique
create constraint on (n:AppellationNew) assert n.name is unique
Now, if I try to query that node
match (n:AppellationNew ) WHERE n.name CONTAINS "Asolo" return n
it returns nothing.
So, I have the following questions:
Thank you
Solved! Go to Solution.
07-25-2021 11:46 AM
Hello @p.dipietro
If you only want to check one name:
MATCH (n:AppellationNew )
WHERE "Asolo" IN n.name
RETURN n
If you want to check several names, have a look at predicate functions:
MATCH (n:AppellationNew )
WHERE all(name IN ["Asolo Montello", "Montello Asolo"] WHERE name IN n.name)
RETURN n
Can't help you for the question related to how lists are indexed.
Regards,
Cobra
07-25-2021 11:46 AM
Hello @p.dipietro
If you only want to check one name:
MATCH (n:AppellationNew )
WHERE "Asolo" IN n.name
RETURN n
If you want to check several names, have a look at predicate functions:
MATCH (n:AppellationNew )
WHERE all(name IN ["Asolo Montello", "Montello Asolo"] WHERE name IN n.name)
RETURN n
Can't help you for the question related to how lists are indexed.
Regards,
Cobra
07-25-2021 12:45 PM
Hi @Cobra
Thank you for your answer. It solved a lot of problems.
But what if I want to use pattern matching?
Something like
MATCH (n:AppellationNew )
WHERE "Asolo" =~ '(?i)' + n.name + '*.'
RETURN n
Do you think it would be possible'
All the sessions of the conference are now available online