These are the two JSON-files which are used to create a relationship:
- Event-Dataset on historical exhibitions: (Entries with id, title and attributte)
categorized by subjects (0..1) and referenced by an attributte-table (ex: entries of id )
An excerpt from the data set:
{
"id": 19669,
"title": {
"en": "Peter Brüning, Paris, Galerie Arnaud"
},
"attrs": {
"by_category": {
"0": [
9280
],
"1": [
15814,
13569
]
}
}
},
{
"id": 19812,
"title": {
"en": "14 mal 14 - Junge deutsche Künstler, Baden-Baden, Staatliche Kunsthalle"
},
"attrs": {
"by_category": {
"0": [
11044
],
"1": [
15814
]
}
}
}
- A table with entries of cities in which an entry is constructed as follows:
{
"id": 9280,
"kind_id": 43,
"klass_id": 6,
"category_id": 0,
"name": {
"en": "Paris"
}
}
The idea behind this is to create a relationship between the data set and the table of cities,
(event)-[r:located_IN]->(city)
More precisely it should create a relationship between an event and a city, if a specific ID from the table of cities correlates with a specific ID of the event data set.
z.B. iD: 9280 (Paris) -> attrs.by_category["0"]
My assumption is, that this could be solved by using a WHERE-Clause. At the moment, I do not know how to implement this idea, though. However, I have started working on the following query:
Many Thanks!
CALL apoc.load.json("file:///test_1.json") YIELD value
UNWIND value AS r
WITH r, r.attrs.by_category["0"] as item
MATCH (e:event {id: r.id,
name: r.title.en);
WITH *
CALL apoc.load.json("file:///Cities.json") YIELD value
UNWIND value as r
WITH item, r
MATCH (c:city {id:r.id, name:r.name});
WHERE id IN item
MERGE (e)-[r:located_IN]->(c)