I used the neosemantics plugin to import all instances of cities located in Italy. I also imported all instances of points of interest located in Italy. Now, I want to add a relationship to show which points of interest are in which cities.
To do this, I'm trying to iterate through all the City nodes and for each node, use its uri to find all the points of interest in that city. This is the query I tested in https://query.wikidata.org/ using the uri for Florence (wd:Q2044)
SELECT DISTINCT ?attraction ?attractionLabel ?streetAddress ?country
WHERE {
?attraction (wdt:P31/wdt:P279*) wd:Q570116;
rdfs:label ?attractionLabel.
?attraction wdt:P131 wd:Q2044 .
FILTER(LANG(?attractionLabel) = "en")
}
I'm having trouble converting this to Cypher in neo4J Desktop. I tried converting ?attraction wdt:P131 wd:Q2044
to filter (?attraction wdt:P131 c.uri)
, but it's returning 0 triples. Has anyone who's done this before give me some pointers?
MATCH (c:City)
WITH ' PREFIX sch: <http://schema.org/>
CONSTRUCT{ ?item a sch:City;
sch:attraction ?attraction.
?attraction a sch:Attraction;
sch:city ?item. }
WHERE { ?attraction (wdt:P31/wdt:P279*) wd:Q960648 .
filter (?attraction wdt:P131 c.uri)
?attraction rdfs:label ?attractionName .
filter(lang(?attractionName) = "en")
} ' AS sparql CALL n10s.rdf.import.fetch(
"https://query.wikidata.org/sparql?query=" +
apoc.text.urlencode(sparql),"JSON-LD",
{ headerParams: { Accept: "application/ld+json"} ,
handleVocabUris: "IGNORE"})
YIELD terminationStatus, triplesLoaded
RETURN terminationStatus, triplesLoaded