query-daa05ac801574a8688ff8a5d0c063617
Things connected to Oxford collection items
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 (SUBSTR(STR(?thing),32) AS ?q) (SUBSTR(STR(?prop),37) as ?p) (SUBSTR(STR(?item),32) AS ?itemq) ?itemLabel ?fullwork (SUBSTR(STR(?coll),32) as ?collq) ?inventory ?url (GROUP_CONCAT(SUBSTR(STR(?artist),32);separator=" ") AS ?artists)
(GROUP_CONCAT(?typeLabel; separator=", ") AS ?types) ?from (YEAR(?latest) AS ?to) ?precision WHERE {
VALUES ?coll {wd:Q636400 wd:Q82133 wd:Q1456119 wd:Q6941088} # Ashmolean, Bodleian, PRM, MHS
?item p:P195 [ps:P195 ?coll; pq:P217 ?inventory].
VALUES ?prop {wdt:P180 wdt:P170 wdt:P1774 wdt:P138} # depicted, creator, school of, named after
?item ?prop ?thing; wdt:P31 ?type.
OPTIONAL {?item wdt:P973 ?url FILTER(CONTAINS(STR(?url), ".ox.ac.uk")|| CONTAINS(STR(?url), "ashmolean.org") )}
OPTIONAL {?item wdt:P953 ?fullwork FILTER(CONTAINS(STR(?fullwork), ".ox.ac.uk") || CONTAINS(STR(?fullwork), "ashmolean.org") )}
FILTER (BOUND(?fullwork) || BOUND(?url) )
OPTIONAL {?item wdt:P170 ?artist}
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 "en" .
?item rdfs:label ?itemLabel. ?type rdfs:label ?typeLabel }
} GROUP BY ?thing ?prop ?item ?itemLabel ?fullwork ?inventory ?url ?coll ?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;
v11("?artist"):::projected
v22("?artists")
v6("?coll"):::projected
v21("?collq")
v12("?earliest")
v16("?from"):::projected
v4("?fullwork"):::projected
v7("?inventory"):::projected
v8("?item"):::projected
v16("?itemLabel"):::projected
v20("?itemq")
v13("?latest"):::projected
v19("?p")
v14("?precision"):::projected
v9("?prop"):::projected
v18("?q")
v9("?thing"):::projected
v24("?to")
v10("?type")
v17("?typeLabel"):::projected
v23("?types")
v5("?url"):::projected
v15("?year")
a1((" "))
a2((" "))
a4((" "))
a3((" "))
c19(["en"]):::literal
c17(["bd:serviceParam"]):::iri
f0[["(bound(?fullwork) || bound(?url))"]]
f0 --> v4
f0 --> v5
bind1[/VALUES ?coll/]
bind1-->v6
bind10(["wd:Q636400"])
bind10 --> bind1
bind11(["wd:Q82133"])
bind11 --> bind1
bind12(["wd:Q1456119"])
bind12 --> bind1
bind13(["wd:Q6941088"])
bind13 --> bind1
a1 --"p:statement/P195"--> v6
a1 --"p:qualifier/P217"--> v7
v8 --"p:P195"--> a1
bind2[/VALUES ?prop/]
bind2-->v9
bind20(["p:direct/P180"])
bind20 --> bind2
bind21(["p:direct/P170"])
bind21 --> bind2
bind22(["p:direct/P1774"])
bind22 --> bind2
bind23(["p:direct/P138"])
bind23 --> bind2
v8 -->v9--> v9
v8 --"p:direct/P31"--> v10
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:direct/P973".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:direct/P953".-> v4
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:direct/P170".-> v11
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
a2 -."p:qualifier/P1319".-> v12
a2 --"p:qualifier/P1326"--> v13
v8 --"p:P571"--> a2
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
a3 -."wikibase:timePrecision".-> v14
a3 --"wikibase:timeValue"--> v15
v8 --"p:P571"--> a4
a4 --"p:statement/value/P571"--> a3
end
bind3[/"if(bound(?earliest),year-from-dateTime(?earliest),year-from-dateTime(?year))"/]
v12 --o bind3
v15 --o bind3
bind3 --as--o v16
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c17 --"wikibase:language"--> c19
v8 --"rdfs:label"--> v16
v10 --"rdfs:label"--> v17
end
bind6[/"substring(str(?thing),'32^^xsd:integer')"/]
v9 --o bind6
bind6 --as--o v18
bind7[/"substring(str(?prop),'37^^xsd:integer')"/]
v9 --o bind7
bind7 --as--o v19
bind8[/"substring(str(?item),'32^^xsd:integer')"/]
v8 --o bind8
bind8 --as--o v20
bind9[/"substring(str(?coll),'32^^xsd:integer')"/]
v6 --o bind9
bind9 --as--o v21
bind10[/"substring(str(?artist),'32^^xsd:integer')"/]
v11 --o bind10
bind10 --as--o v22
bind11[/"?typeLabel"/]
v17 --o bind11
bind11 --as--o v23
bind12[/"year-from-dateTime(?latest)"/]
v13 --o bind12
bind12 --as--o v24