query-cff738e6128f972d3615ec7e90db1d49

rq turtle/ttl

select Australian women have an enwiki article with an image

but have no image on wikidata

SELECT ?item ?itemLabel ?article ?sitelink WHERE { { ?item wdt:P21 wd:Q6581072. # is a women ?item wdt:P27 wd:Q408. # Is Australian ?sitelink ^schema:name ?article . ?article schema:about ?item ; schema:isPartOf https://en.wikipedia.org/ . } MINUS { ?item wdt:P18 ?image.} { SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Search" . bd:serviceParam wikibase:endpoint "en.wikipedia.org" . bd:serviceParam mwapi:srnamespace "0" . bd:serviceParam mwapi:srlimit "max" . bd:serviceParam mwapi:srwhat "text" . bd:serviceParam mwapi:srsearch 'insource:"image = "' . ?title wikibase:apiOutput mwapi:title . } BIND (STRLANG(?title, "en") as ?sitelink) } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } 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 schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# select Australian women have an enwiki article with an image
# but have no image on wikidata
SELECT ?item ?itemLabel  ?article ?sitelink
WHERE 
{
  {
    ?item wdt:P21 wd:Q6581072. # is a women
    ?item wdt:P27 wd:Q408.     # Is Australian
    ?sitelink ^schema:name ?article .
    ?article schema:about ?item ;
             schema:isPartOf <https://en.wikipedia.org/> .
  }
MINUS    { ?item wdt:P18 ?image.}
  {
    SERVICE wikibase:mwapi
    {
      bd:serviceParam wikibase:api "Search" .
      bd:serviceParam wikibase:endpoint "en.wikipedia.org" .
      bd:serviceParam mwapi:srnamespace "0" .
      bd:serviceParam mwapi:srlimit "max" .
      bd:serviceParam mwapi:srwhat "text" .
      bd:serviceParam mwapi:srsearch 'insource:"image = "' .
      ?title wikibase:apiOutput mwapi:title .
    }
    BIND (STRLANG(?title, "en") as ?sitelink)
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?article"):::projected v4("?image") v1("?item"):::projected v6("?sitelink"):::projected v5("?title") c4(["wd:Q408"]):::iri c2(["wd:Q6581072"]):::iri c8([https://en.wikipedia.org/]):::iri c15(["en.wikipedia.org"]):::literal c11(["bd:serviceParam"]):::iri c13(["Search"]):::literal c21(["text"]):::literal c23(["insource:"image = ""]):::literal c19(["max"]):::literal c17(["0"]):::literal c28(["#91;AUTO_LANGUAGE#93;,en"]):::literal c25(["mwapi:title"]):::iri v1 --"wdt:P21"--> c2 v1 --"wdt:P27"--> c4 v2 --"schema:name"--> v6 v2 --"schema:about"--> v1 v2 --"schema:isPartOf"--> c8 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v1 --"wdt:P18"--> v4 end subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c11 --"mwapi:api"--> c13 c11 --"mwapi:endpoint"--> c15 c11 --"mwapi:srnamespace"--> c17 c11 --"mwapi:srlimit"--> c19 c11 --"mwapi:srwhat"--> c21 c11 --"mwapi:srsearch"--> c23 v5 --"mwapi:apiOutput"--> c25 end bind1[/"STRLANG(?title,'en')"/] v5 --o bind1 bind1 --as--o v6 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c11 --"mwapi:language"--> c28 end