Add multiple values to a property

I am trying to add multiple values to a property, like a list kind of solution. The eventual aim of this endeavour is to be able to search the values for the property 'Synoniem' separately, so that if a search query finds one word in the list (and not all per se) returns the node that is attached to the property.

I have tried this:

//Import data directly into Neo4j 1.01
MERGE (:Onderneming {Naam:"De Haspel", Contactpersoon:"Kees van Dis"})
MERGE (:Onderneming {Naam:"ProPlant", Contactpersoon:"Annechien de Rooij"})
MERGE (:Onderneming {Naam:"Heerlijk Land", Contactpersoon:"Maarten Bril"})
MERGE (:Onderneming {Naam:"Bloemenboter", Contactpersoon:"Patty Broek"})
MERGE (:Kernactiviteit {Kernactiviteit:"Agro-ecologie", Synoniem:"Agro-forestry", Synoniem:"Agroecologie"})

And also this doesn't work:

//Import data directly into Neo4j 1.01
MERGE (:Onderneming {Naam:"De Haspel", Contactpersoon:"Kees van Dis"})
MERGE (:Onderneming {Naam:"ProPlant", Contactpersoon:"Annechien de Rooij"})
MERGE (:Onderneming {Naam:"Heerlijk Land", Contactpersoon:"Maarten Bril"})
MERGE (:Onderneming {Naam:"Bloemenboter", Contactpersoon:"Patty Broek"})
MERGE (:Kernactiviteit {Kernactiviteit:"Agro-ecologie", Synoniem:"Agro-forestry", "Agroecologie"})

Any smart words of advice?

Try this:

Add multiple values as a list:
MERGE (a:Kernactiviteit {Kernactiviteit:"Agro-ecologie", Synoniem:["Agro-forestry", "Agroecologie"]})

MATCH (c) where exists (c.Synoniem)
RETURN c
1 Like

@ameyasoft, you are right about the first part of the query, that is adding all Synoniems as properties to nodes with a .

But then for the second part, its is not my purpose to return all nodes that have a Synoniem property. It is my purpose to return all nodes with a specific Synoniem property. So, I want Neo4j to treat the values of Synoniem as separately searchable variables.

In addition to you coding, I have tried these, without luck:

MATCH (n:Onderneming) WHERE n.Synoniem="Agroecologie" RETURN n;

MATCH (n:Onderneming) WHERE n.Synoniem CONTAINS "Agroecologie" RETURN n;

Any suggestions?

Try this:

MATCH (n:Onderneming) WHERE  "Agroecologie" IN n.Synoniem 
RETURN n;

Thank you, that was it :)