query-b319aa033aeeb0677b885c15f8583f85

rq turtle/ttl

Selects all human who died in 1948 and shows

their paintings that are part of a collection (with possible coordinates) as well as the possible placement with country and possible image

SELECT ?deathdate ?person ?personLabel ?painting ?paintingLabel ?image ?coll ?collLabel ?collcoord ?collcountryLabel ?placeLabel ?placecountryLabel WHERE { VALUES ?year { 1948 } # add more years like VALUES ?year { 1948 1949 } ?person wdt:P31 wd:Q5. ?person p:P570/psv:P570 [wikibase:timeValue ?tv; wikibase:timePrecision ?tp] . FILTER(year(?tv)=?year)

truncate the display of dates given with year och month precision

BIND(IF(?tp=9,substr(?tv,1,4),IF(?tp=10,substr(str(?tv),1,7),substr(str(?tv),1,10))) AS ?deathdate) ?painting wdt:P170 ?person . ?painting wdt:P195 ?coll . OPTIONAL { ?painting wdt:P18 ?image }

FILTER(!BOUND(?image)) # uncommment this if only paintings without image are wanted

OPTIONAL { ?coll wdt:P625 ?collcoord } OPTIONAL { ?coll wdt:P17 ?collcountry } OPTIONAL { ?coll wdt:P276 ?place . OPTIONAL { ?place wdt:P17 ?placecountry } } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,nl,pl,ca". } } ORDER BY ?tv ?personLabel ?paintingLabel

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Selects all human who died in 1948 and shows 
#their paintings that are part of a collection (with possible coordinates) as well as the possible placement with country and possible image 
SELECT ?deathdate ?person ?personLabel ?painting ?paintingLabel ?image ?coll ?collLabel ?collcoord ?collcountryLabel ?placeLabel ?placecountryLabel WHERE {
  VALUES ?year { 1948 }  # add more years like VALUES ?year { 1948 1949 }
  ?person wdt:P31 wd:Q5.
  ?person p:P570/psv:P570 [wikibase:timeValue ?tv; wikibase:timePrecision ?tp] .
  FILTER(year(?tv)=?year)
#truncate the display of dates given with year och month precision
  BIND(IF(?tp=9,substr(?tv,1,4),IF(?tp=10,substr(str(?tv),1,7),substr(str(?tv),1,10))) AS ?deathdate)
  ?painting wdt:P170 ?person .
  ?painting wdt:P195 ?coll .
  OPTIONAL { ?painting wdt:P18 ?image }
#  FILTER(!BOUND(?image))  # uncommment this if only paintings without image are wanted
  OPTIONAL { ?coll wdt:P625 ?collcoord }
  OPTIONAL { ?coll wdt:P17 ?collcountry }
  OPTIONAL { ?coll wdt:P276 ?place . OPTIONAL { ?place wdt:P17 ?placecountry } }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,nl,pl,ca". }
}
ORDER BY ?tv ?personLabel ?paintingLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?coll"):::projected v11("?collcoord"):::projected v12("?collcountry") v7("?deathdate"):::projected v10("?image"):::projected v8("?painting"):::projected v3("?paintingLabel"):::projected v5("?person"):::projected v2("?personLabel"):::projected v13("?place") v14("?placecountry") v6("?tp") v1("?tv") v5("?year") a2((" ")) a1((" ")) c16(["#91;AUTO_LANGUAGE#93;,en,nl,pl,ca"]):::literal c14(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri f0[["year-from-dateTime(?tv) = ?year"]] f0 --> v1 f0 --> v5 bind1[/VALUES ?year/] bind1-->v5 bind10(["1948^^xsd:integer"]) bind10 --> bind1 v5 --"p:direct/P31"--> c2 a1 --"wikibase:timeValue"--> v1 a1 --"wikibase:timePrecision"--> v6 v5 --"p:P570"--> a2 a2 --"p:statement/value/P570"--> a1 bind2[/"if(?tp = '9^^xsd:integer',substring(?tv,'1^^xsd:integer','4^^xsd:integer'),if(?tp = '10^^xsd:integer',substring(str(?tv),'1^^xsd:integer','7^^xsd:integer'),substring(str(?tv),'1^^xsd:integer','10^^xsd:integer')))"/] v6 --o bind2 v1 --o bind2 bind2 --as--o v7 v8 --"p:direct/P170"--> v5 v8 --"p:direct/P195"--> v9 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v8 -."p:direct/P18".-> v10 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v9 -."p:direct/P625".-> v11 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v9 -."p:direct/P17".-> v12 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v9 -."p:direct/P276".-> v13 subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v13 -."p:direct/P17".-> v14 end end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c14 --"wikibase:language"--> c16 end