Hi
I am ingesting some data that contains an array:
{Name: Javi, Cities_visited: [Madrid, London, Paris], Type: Travels}
I have another set of data related to the city:
{Name: London, Country: UK, Type: Places}
{Name: Madrid, Country: Spain, Type: Places}
{Name: Paris, Country: France, Type: Places}
I want to create a relation between both types of data, something like this:
MATCH (Places), (Travels)
WHERE a.Name = m.Cities_visited
CREATE(m)-[:VISITED]->(a)
RETURN a, m
However, since Cities_visited is an array, that condition can't be matched
Is there any way to create a relation if an item exists in an array, it is, name exists in Cities_visited?
Thanks
You should be able to do it by using:
MATCH (Places), (Travels)
WHERE a.Name IN m.Cities_visited
CREATE(m)-[:VISITED]->(a)
RETURN a, m
Thx! It will do it
Also, instead of having a list of cities, If I want to have a map in the array, for example cities_visited: [city: London, year: 2021}], would it be possible? I donβt think you can ingest an array of maps
Thanks
As you said, that currently isn't possible due to current restrictions on property types. We can use arrays of simple values for properties, but we can't have an array of maps.
You could convert the map structure into a JSON string and store that (so it becomes a list of strings), but to explore it as a structure you would need to project the JSON string out and convert it back to a map structure.