query-14e195810f01df9fbed3b7f36f968cb6

rq turtle/ttl

Liste des petits monuments ayant un lien vers des catégories de Commons (soit un lien de site ou P373) SELECT ?item ?comm ?p373 ?cat WHERE { ?item wdt:P131* wd:Q1891. # ... municipality ...

optional {?comm schema:about ?item ; schema:isPartOf https://commons.wikimedia.org/ .} BIND(replace(wikibase:decodeUri(SUBSTR(STR(?comm), 45)),"_"," ") AS ?comm_decode) optional {?item wdt:P373 ?p373 .}

bind(COALESCE(?comm_decode, ?p373) as ?cat) . VALUES ?trida { wd:Q1746392 wd:Q108325 wd:Q4989906 wd:Q10861631 wd:Q15077340 wd:Q1516537 wd:Q47008262 wd:Q179700} # chapel, small monument, memorial, belltower, memorial monument, technical monument, group of small monuments ?item wdt:P31/wdt:P279* ?trida. # small monument }

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/>
#Liste des petits monuments ayant un lien vers des catégories de Commons (soit un lien de site ou P373)
SELECT ?item ?comm ?p373 ?cat WHERE {
  ?item wdt:P131* wd:Q1891.                               # ... municipality ...

  optional {?comm schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .}
  BIND(replace(wikibase:decodeUri(SUBSTR(STR(?comm), 45)),"_"," ") AS ?comm_decode)
   optional {?item wdt:P373 ?p373 .}

 bind(COALESCE(?comm_decode, ?p373) as ?cat) .
 VALUES ?trida { wd:Q1746392 wd:Q108325 wd:Q4989906 wd:Q10861631 wd:Q15077340 wd:Q1516537 wd:Q47008262 wd:Q179700}     # chapel, small monument, memorial, belltower, memorial monument, technical monument,  group of small monuments 
 ?item wdt:P31/wdt:P279* ?trida.                  #  small monument
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?cat"):::projected v2("?comm"):::projected v3("?comm_decode") v1("?item"):::projected v4("?p373"):::projected v6("?trida") a1((" ")) c5([https://commons.wikimedia.org/]):::iri c2(["wd:Q1891"]):::iri v1 --"wdt:P131"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."schema:about".-> v1 v2 --"schema:isPartOf"--> c5 end bind0[/"replace(http://wikiba.se/ontology#decodeUri(substring(str(?comm),'45^^xsd:integer')),'_',' ')"/] v2 --o bind0 bind0 --as--o v3 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P373".-> v4 end bind1[/"?comm_decode?p373"/] v3 --o bind1 v4 --o bind1 bind1 --as--o v5 bind2[/VALUES ?trida/] bind2-->v6 bind20(["wd:Q1746392"]) bind20 --> bind2 bind21(["wd:Q108325"]) bind21 --> bind2 bind22(["wd:Q4989906"]) bind22 --> bind2 bind23(["wd:Q10861631"]) bind23 --> bind2 bind24(["wd:Q15077340"]) bind24 --> bind2 bind25(["wd:Q1516537"]) bind25 --> bind2 bind26(["wd:Q47008262"]) bind26 --> bind2 bind27(["wd:Q179700"]) bind27 --> bind2 v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> v6