query-fdc9908b326fa48e043f66850dbe1b53

rq turtle/ttl

foto su commons per elementi WLM su wikidata (elementi di WLM che hanno una categoria connessa in Commons ma nessuna P18, e per cui almeno un'immagine in Commons riporta lo stesso ID WLM) SELECT DISTINCT ?item ?imagelink WHERE { ?item wdt:P17 wd:Q38 . ?item wdt:P2186 ?wlmid . ?item wdt:P373 ?commons . MINUS { ?item wdt:P18 ?image } . BIND(CONCAT('"Wiki Loves Monuments Italia" insource:', ?wlmid) AS ?needle ) . SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "commons.wikimedia.org" . bd:serviceParam wikibase:api "Search" . bd:serviceParam mwapi:srnamespace "6" . bd:serviceParam mwapi:srsearch ?needle . bd:serviceParam mwapi:srlimit "1" . ?image wikibase:apiOutput mwapi:title . } BIND(IRI(CONCAT('https://commons.wikimedia.org/wiki/', ?image)) AS ?imagelink ) . } LIMIT 100

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#foto su commons per elementi WLM su wikidata (elementi di WLM che hanno una categoria connessa in Commons ma nessuna P18, e per cui almeno un'immagine in Commons riporta lo stesso ID WLM)
SELECT DISTINCT ?item ?imagelink WHERE {
  ?item wdt:P17 wd:Q38 .
  ?item wdt:P2186 ?wlmid .
  ?item wdt:P373 ?commons .
  MINUS { ?item wdt:P18 ?image } .
  BIND(CONCAT('"Wiki Loves Monuments Italia" insource:', ?wlmid) AS ?needle ) .
  SERVICE wikibase:mwapi {
      bd:serviceParam wikibase:endpoint "commons.wikimedia.org" .
      bd:serviceParam wikibase:api "Search" .
      bd:serviceParam mwapi:srnamespace "6" .
      bd:serviceParam mwapi:srsearch ?needle .
      bd:serviceParam mwapi:srlimit "1" .
      ?image wikibase:apiOutput mwapi:title .
    }
  BIND(IRI(CONCAT('https://commons.wikimedia.org/wiki/', ?image)) AS ?imagelink ) .
}
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?commons") v4("?image") v6("?imagelink"):::projected v1("?item"):::projected v5("?needle") v2("?wlmid") c2(["wd:Q38"]):::iri c16(["1"]):::literal c7(["bd:serviceParam"]):::iri c13(["6"]):::literal c11(["Search"]):::literal c18(["mwapi:title"]):::iri c9(["commons.wikimedia.org"]):::literal v1 --"wdt:P17"--> c2 v1 --"wdt:P2186"--> v2 v1 --"wdt:P373"--> v3 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v1 --"wdt:P18"--> v4 end bind1[/"concat('"Wiki Loves Monuments Italia" insource:',?wlmid)"/] v2 --o bind1 bind1 --as--o v5 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c7 --"mwapi:endpoint"--> c9 c7 --"mwapi:api"--> c11 c7 --"mwapi:srnamespace"--> c13 c7 --"mwapi:srsearch"--> v5 c7 --"mwapi:srlimit"--> c16 v4 --"mwapi:apiOutput"--> c18 end bind2[/"concat('https://commons.wikimedia.org/wiki/',?image)"/] v4 --o bind2 bind2 --as--o v6