query-83a8cc9c63c5211eaaed187526edfeb2

rq turtle/ttl

10:59, 27 November 2020 (UTC) Jura --- Both approaches combined:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT
  ?value 
  ?depicted ?depictedLabel 
  ?item ?itemLabel ?itemDescription
  (YEAR(?y) as ?year)
  ?img
WHERE
{

  { ?item wdt:P1257 ?value . 
   FILTER( strstarts(?value, "71A3") )
   OPTIONAL { ?depicted wdt:P1256 ?value } 
  }
  UNION
  { ?item wdt:P180 ?depicted . 
   FILTER( strstarts(?value, "71A3") )
   ?depicted wdt:P1256 ?value 
  }
  OPTIONAL { ?item wdt:P571 ?y }
  OPTIONAL { ?item wdt:P18 ?img } 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de,en" . }
}
ORDER BY ?value ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?depicted"):::projected v6("?img"):::projected v3("?item"):::projected v2("?itemLabel"):::projected v1("?value"):::projected v5("?y"):::projected v7("?year") c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,de,en"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["starts-with(?value,'71A3')"]] f0 --> v1 v3 --"wdt:P180"--> v4 v4 --"wdt:P1256"--> v1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f1[["starts-with(?value,'71A3')"]] f1 --> v1 v3 --"wdt:P1257"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P1256".-> v1 end end union0r <== or ==> union0l end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P571".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."wdt:P18".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end bind2[/"year-from-dateTime(?y)"/] v5 --o bind2 bind2 --as--o v7