query-6d81d50ce61294e1fb7fa1886e56b73d

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 ?monmnt ?placedesc ?statloc ?articleDE WHERE { 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  {?monmnt wdt:P1435 wd:Q10729054} UNION {?monmnt wdt:P1435 wd:Q10729125}.
  ?monmnt wdt:P1435 ?listAB.
  ?monmnt wdt:P131 ?towndesc. #wd:Q68816359.
  ##FILTER (?towndesc=wd:Q207679).#Clacks wd:Q207268, Stirling Q182923
  optional {?monmnt wdt:P18 ?gotimg.}.
  ?monmnt wdt:P31 ?placedesc.
  ?monmnt wdt:P625 ?statloc.
  ?sitelink schema:about ?monmnt .
  FILTER NOT EXISTS {
    ?article schema:about ?monmnt .
    ?article schema:isPartOf <https://en.wikipedia.org/> . #Targeting Wikipedia language where subjects has no article.
  }
  OPTIONAL {?articleDE schema:about ?monmnt . ?articleDE schema:isPartOf <https://de.wikipedia.org/> .}.
  BIND (IF(?listAB = wd:Q10729054, IF (BOUND(?gotimg), IF (BOUND(?articleDE),"Category A with image and article on DE but not EN", "Category A with image"), "Category A without image"), "Category B") AS ?mapcolour).

}
ORDER BY ?towndescLabel ?monmntLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?article") v11("?articleDE"):::projected v7("?gotimg") v13("?layer") v5("?listAB") v12("?mapcolour"):::projected v4("?monmnt"):::projected v2("?monmntLabel"):::projected v8("?placedesc"):::projected v10("?sitelink") v9("?statloc"):::projected v6("?towndesc") v1("?towndescLabel"):::projected c15([https://de.wikipedia.org/]):::iri c9(["wd:Q10729054"]):::iri c3([https://en.wikipedia.org/]):::iri c5(["bd:serviceParam"]):::iri c10(["wd:Q10729125"]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"schema:about"--> e0v2 e0v1 --"schema:isPartOf"--> e0c3 e0v1("?article"):::projected e0v2("?monmnt"):::projected e0c3([https://en.wikipedia.org/]):::iri end f0--EXISTS--> f0e0 f0 --> v3 f0 --> c1 f0 --> v4 f0 --> c2 f0 --> c3 v3 --"schema:about"--> v4 v3 --"schema:isPartOf"--> c3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P1435"--> c10 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v4 --"wdt:P1435"--> c9 end union0r <== or ==> union0l end 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"--> c15 end bind1[/"if(?listAB = 'wd:Q10729054',if(bound(?gotimg),if(bound(?articleDE),'Category A with image and article on DE but not EN','Category A with image'),'Category A without image'),'Category B')"/] v5 --o bind1 v7 --o bind1 v11 --o bind1 bind1 --as--o v12 bind2[/"?mapcolour"/] v12 --o bind2 bind2 --as--o v13