forked from linkedgeodesy/myfirstqgisplugin
-
Notifications
You must be signed in to change notification settings - Fork 6
Sample SPARQL queries
Timo edited this page Oct 17, 2022
·
1 revision
This page shows sample queries which can be used with their respective SPARQL endpoints in the plugin:
SELECT ?label ?geo ?item WHERE {
?item wdt:P31 wd:Q1248784; #Airport
?range wd:Q183; #Germany
wdt:P625 ?geo;
rdfs:label ?label.
FILTER((LANG(?label)) = "en")
}
SELECT ?label ?geo ?item ?country ?labelC WHERE {
?item wdt:P31 wd:Q1248784;
?range ?country;
wdt:P625 ?geo;
rdfs:label ?label.
?country rdfs:label ?labelC.
FILTER((LANG(?label)) = "en")
FILTER((LANG(?labelC)) = "en")
FILTER(?country IN(wd:Q183, wd:Q142, wd:Q145, wd:Q27, wd:Q29, wd:Q38, wd:Q35, wd:Q34, wd:Q20, wd:Q33, wd:Q45, wd:Q189))
}
SELECT ?label ?geo ?item WHERE {
?item ((wdt:P31*)/(wdt:P279*)) wd:Q16917; #Hospital
wdt:P625 ?geo;
rdfs:label ?label.
FILTER((LANG(?label)) = "en")
}
SELECT ?label ?geo ?item WHERE {
?item wdt:P31 wd:Q839954; #archaeologicalSite
(wdt:P31/(wdt:P279*)) wd:Q23413; #Castle
wdt:P625 ?geo;
rdfs:label ?label.
FILTER((LANG(?label)) = "en")
}
SELECT ?label ?geo ?item WHERE {
?item wdt:P31 wd:Q2016147; #Ogam Stone
wdt:P361 wd:Q67978809;
wdt:P195 ?collection.
OPTIONAL { ?item wdt:P625 ?geo. }
OPTIONAL {
?item rdfs:label ?label.
FILTER((LANG(?label)) = "en")
}
OPTIONAL {
?collection rdfs:label ?collectionLabel.
FILTER((LANG(?collectionLabel)) = "en")
}
}
SELECT ?uri ?label ?easting ?northing
WHERE {
?uri
gaz:featureType gaz:RomanAntiquity;
rdfs:label ?label;
spatial:easting ?easting;
spatial:northing ?northing;
}
SELECT ?uri ?label ?easting ?northing
WHERE {
?uri
gaz:featureType gaz:Antiquity;
rdfs:label ?label;
spatial:easting ?easting;
spatial:northing ?northing;
}
SELECT ?mint ?label ?lat ?long WHERE {
?loc geo:lat ?lat ;
geo:long ?long .
?mint geo:location ?loc ;
skos:prefLabel ?label ;
a nmo:Mint
FILTER langMatches (lang(?label), 'en')
}
SELECT ?pp ?label ?lat ?long WHERE {
?loc geo:lat ?lat ;
geo:long ?long .
?pp geo:location ?loc ;
skos:prefLabel ?label ;
a kon:ProductionPlace
FILTER langMatches (lang(?label), 'en')
}
SELECT ?item ?label ?geo
FROM <http://linkedgeodata.org> {
?item
a lgdo:Restaurant ;
rdfs:label ?label ;
geom:geometry [
ogc:asWKT ?geo
] .
Filter (
bif:st_intersects (?geo, bif:st_point (8.274167,49.998889),0.5)
) .
}
SELECT ?item ?label ?geo
FROM <http://linkedgeodata.org> {
?item
a lgdo:Amenity ;
rdfs:label ?label ;
geom:geometry [
ogc:asWKT ?geo
] .
Filter (
bif:st_intersects (?geo, bif:st_point (-8.491873,51.893497),1.0)
) .
}
SELECT ?lat ?lon ?location WHERE {
?location geo:lat ?lat .
?location geo:long ?lon .
}
LIMIT 10
SELECT ?lat ?lon ?location WHERE {
?location geo:lat ?lat .
?location geo:long ?lon .
}
LIMIT 10
SELECT ?item ?label ?geo WHERE {
?item a <http://www.opengis.net/ont/geosparql#Feature>.
?item rdfs:label ?label.
FILTER (lang(?label) = 'en')
?item ogc:hasGeometry [
ogc:asWKT ?geo
] .
}
LIMIT 10