query-c7711d1cb4bb4b7f4e3a08c1dfb28c6d

rq turtle/ttl

Category A listed buildingsLacking images in a place; filter (inactivated) example is Perth.

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT DISTINCT (?mapcolour AS ?layer) ?towndescLabel ?monmntLabel ?placedesc ?statloc ?article ?gotimg WHERE { 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  {
   SELECT DISTINCT ?townrand ?tmpmon ?monmntrand  WHERE { 
   ?tmpmon wdt:P1435 wd:Q10729054.
   ?tmpmon wdt:P131 ?townrand. 
   BIND(SHA256(CONCAT(STR(RAND()), STR(?tmpmon))) AS ?monmntrand) .
   }
   ORDER BY ?monmntrand
   LIMIT 1
   }
  {?monmnt wdt:P131 ?townrand; wdt:P1435 wd:Q10729054.}
  ?monmnt wdt:P1435 ?listAB.
  ?monmnt wdt:P131 ?towndesc. 
  #FILTER (?towndesc=?townrand).
  optional {?monmnt wdt:P18 ?gotimg.}.
  ?monmnt wdt:P31 ?placedesc.
  ?monmnt wdt:P625 ?statloc.
  ?sitelink schema:about ?monmnt .
  OPTIONAL {?articleEN schema:about ?monmnt . ?articleEN schema:isPartOf <https://en.wikipedia.org/> .}.
  OPTIONAL {?articleDE schema:about ?monmnt . ?articleDE schema:isPartOf <https://de.wikipedia.org/> .}.
  BIND (IF (BOUND(?articleEN), ?articleEN, (IF (BOUND(?articleDE), ?articleDE,?null))) AS ?article).
  BIND (IF (BOUND(?gotimg), IF (BOUND(?article),"Category A with image and article", "Category A with image"), "Category A without image") AS ?mapcolour).
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v13("?article"):::projected v12("?articleDE") v11("?articleEN") v7("?gotimg"):::projected v15("?layer") v5("?listAB") v14("?mapcolour"):::projected v4("?monmnt") v4("?monmntrand") v8("?placedesc"):::projected v10("?sitelink") v9("?statloc"):::projected v2("?tmpmon") v6("?towndesc") v3("?townrand") c14([https://de.wikipedia.org/]):::iri c6(["wd:Q10729054"]):::iri c13([https://en.wikipedia.org/]):::iri c2(["bd:serviceParam"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v2 --"wdt:P1435"--> c6 v2 --"wdt:P131"--> v3 bind0[/"SHA256(concat(str(RAND()),str(?tmpmon)))"/] v2 --o bind0 bind0 --as--o v4 v4 --"wdt:P131"--> v3 v4 --"wdt:P1435"--> c6 v4 --"wdt:P1435"--> v5 v4 --"wdt:P131"--> v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P18".-> v7 end v4 --"wdt:P31"--> v8 v4 --"wdt:P625"--> v9 v10 --"schema:about"--> v4 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v11 -."schema:about".-> v4 v11 --"schema:isPartOf"--> c13 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v12 -."schema:about".-> v4 v12 --"schema:isPartOf"--> c14 end bind1[/"if(bound(?articleEN),?articleEN,if(bound(?articleDE),?articleDE,?null))"/] v11 --o bind1 v12 --o bind1 null --o bind1 bind1 --as--o v13 bind2[/"if(bound(?gotimg),if(bound(?article),'Category A with image and article','Category A with image'),'Category A without image')"/] v7 --o bind2 v13 --o bind2 bind2 --as--o v14 bind3[/"?mapcolour"/] v14 --o bind3 bind3 --as--o v15