I have knowledge graph with sf:Point (for example "POINT(51.95656412820512 5.880331774358974)"^^<http://www.opengis.net/ont/geosparql#wktLiteral>
). I want to know which country or administrative region this point is located in (by way of checking wdt:P3896).
I know I can get the map data of a country using a federated query to wikidata:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT * WHERE {
SERVICE <https://query.wikidata.org/sparql> {
?country wdt:P31 wd:Q6256.
?country wdt:P3896 ?boundary .
FILTER(?country = wd:Q55) .
?country rdfs:label ?label .
FILTER(lang(?label)="en") .
}
}
This returns
country | boundary | label |
---|---|---|
wd:Q55 | http://commons.wikimedia.org/data/main/Data:Nederland.map | "Netherlands"@en |
Is it possible to find out using a sparql query whether the given point is within the Netherlands?
There does not seem to be a sparql function to determine whether a point is within a geoshape (wdt:P3896). I could not find any other workable methods for answering such a question with sparql. Could anyone offer me advice?