query-0e270d0c89a814b2bd8dbe3ac8062477
Query:Here's an example of the SPARQL query I've been using:
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
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#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?itemLabel ?image ?instanceOfTypeLabel ?location ?inception ?adminEntityLabel ?historicCountyLabel WHERE {
?item p:P1435 ?statement.
?statement ps:P1435/(wdt:P279*) wd:{heritage_id}.
?item wdt:P18 ?image.
?item wdt:P31 ?instanceOfType.
?instanceOfType rdfs:label ?instanceOfTypeLabel FILTER(LANG(?instanceOfTypeLabel) = "en").
?item wdt:P625 ?location.
OPTIONAL { ?item wdt:P571 ?inception. }
OPTIONAL {
?item wdt:P131 ?adminEntity.
?adminEntity rdfs:label ?adminEntityLabel FILTER(LANG(?adminEntityLabel) = "en").
}
OPTIONAL {
?item wdt:P131 ?historicCounty.
?historicCounty rdfs:label ?historicCountyLabel FILTER(LANG(?historicCountyLabel) = "en").
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}