query-b7d70216dff7efebaf61cb223aea7fbd
Ashmolean items associated with a given person or location
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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?prop ?item ?itemLabel ?inventory (GROUP_CONCAT(?typeLabel; separator=", ") AS ?types) ?from (YEAR(?latest) AS ?to) ?precision WHERE {
?item p:P195 [ps:P195 wd:Q636400; pq:P217 ?inventory].
?item ?prop wd:Q48129717; wdt:P31 ?type.
OPTIONAL {?item p:P571 [pq:P1319 ?earliest; pq:P1326 ?latest] }
OPTIONAL {?item p:P571/psv:P571 [ wikibase:timePrecision ?precision; wikibase:timeValue ?year ] }
BIND(IF (BOUND(?earliest), YEAR(?earliest), YEAR(?year)) AS ?from)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
?item rdfs:label ?itemLabel. ?type rdfs:label ?typeLabel }
} GROUP BY ?prop ?item ?itemLabel ?inventory ?from ?latest ?precision
ORDER BY DESC(?prop) ?from ?to
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?earliest")
v11("?from"):::projected
v4("?inventory"):::projected
v5("?item"):::projected
v11("?itemLabel"):::projected
v8("?latest"):::projected
v9("?precision"):::projected
v1("?prop"):::projected
v14("?to")
v6("?type")
v12("?typeLabel"):::projected
v13("?types")
v10("?year")
a1((" "))
a2((" "))
a4((" "))
a3((" "))
c5(["wd:Q48129717"]):::iri
c14(["bd:serviceParam"]):::iri
c2(["wd:Q636400"]):::iri
c16(["#91;AUTO_LANGUAGE#93;,en"]):::literal
a1 --"p:statement/P195"--> c2
a1 --"p:qualifier/P217"--> v4
v5 --"p:P195"--> a1
v5 -->v1--> c5
v5 --"p:direct/P31"--> v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
a2 -."p:qualifier/P1319".-> v7
a2 --"p:qualifier/P1326"--> v8
v5 --"p:P571"--> a2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
a3 -."wikibase:timePrecision".-> v9
a3 --"wikibase:timeValue"--> v10
v5 --"p:P571"--> a4
a4 --"p:statement/value/P571"--> a3
end
bind0[/"if(bound(?earliest),year-from-dateTime(?earliest),year-from-dateTime(?year))"/]
v7 --o bind0
v10 --o bind0
bind0 --as--o v11
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
v5 --"rdfs:label"--> v11
v6 --"rdfs:label"--> v12
end
bind2[/"?typeLabel"/]
v12 --o bind2
bind2 --as--o v13
bind3[/"year-from-dateTime(?latest)"/]
v8 --o bind3
bind3 --as--o v14