query-b9428ab9589178d8cdbbff735e4a2e39
TODO
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?itemLabel
(sample(?image_) as ?image)
(group_concat(distinct ?instanceOfTypeLabel_;separator="; " ) as ?instanceOfTypeLabel)
?location
?inception
(group_concat(distinct ?adminEntityLabel_;separator="; " ) as ?adminEntityLabel)
?historicCountyLabel WHERE {
?item wdt:P1435 wd:Q10729142. # <<<<<< Obvs, change this for each heritage type
?item wdt:P18 ?image_.
?item wdt:P31 ?instanceOfType.
?item wdt:P625 ?location.
OPTIONAL { ?item wdt:P571 ?inception . }
OPTIONAL { ?item wdt:P131 ?adminEntity . }
OPTIONAL { ?item wdt:P7959 ?historicCounty . }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".
?item rdfs:label ?itemLabel .
?instanceOfType rdfs:label ?instanceOfTypeLabel_ .
?adminEntity rdfs:label ?adminEntityLabel_ .
?historicCounty rdfs:label ?historicCountyLabel .}
} group by ?itemLabel ?location ?inception ?historicCountyLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?adminEntity")
v14("?adminEntityLabel")
v10("?adminEntityLabel_"):::projected
v7("?historicCounty")
v11("?historicCountyLabel"):::projected
v12("?image")
v2("?image_"):::projected
v5("?inception"):::projected
v3("?instanceOfType")
v13("?instanceOfTypeLabel")
v9("?instanceOfTypeLabel_"):::projected
v1("?item")
v8("?itemLabel"):::projected
v4("?location"):::projected
c2(["wd:Q10729142"]):::iri
c12(["en"]):::literal
c10(["bd:serviceParam"]):::iri
v1 --"wdt:P1435"--> c2
v1 --"wdt:P18"--> v2
v1 --"wdt:P31"--> v3
v1 --"wdt:P625"--> v4
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P571".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P131".-> v6
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P7959".-> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
v1 --"rdfs:label"--> v8
v3 --"rdfs:label"--> v9
v6 --"rdfs:label"--> v10
v7 --"rdfs:label"--> v11
end
bind3[/"sample(?image_)"/]
v2 --o bind3
bind3 --as--o v12
bind4[/"?instanceOfTypeLabel_"/]
v9 --o bind4
bind4 --as--o v13
bind5[/"?adminEntityLabel_"/]
v10 --o bind5
bind5 --as--o v14