query-be5fe47535847d0563b21d1ff697dbd5

rq turtle/ttl

wikidata items with 2011 village/census town codes and having images but not captions in Telugu SELECT DISTINCT ?item ?page_titleTE WHERE { hint:Query hint:optimizer "None". Values ?iteminstance { wd:Q56436498 }.
?item (wdt:P131*) wd:Q1159; wdt:P131 ?mandal; (wdt:P31) ?item_instance; wdt:P5578 ?2011censuscode. OPTIONAL { ?item wdt:P625 ?wdloc. } OPTIONAL { ?item wdt:P18 ?prefimgfilename. } OPTIONAL { ?item p:P18 ?imgst. ?imgst ps:P18 ?imgfilename; pq:P2096 ?imglegend. FILTER((LANG(?imglegend)) = "te") } ?tewikilink schema:about ?item; schema:isPartOf https://te.wikipedia.org/; schema:name ?page_titleTE. SERVICE wikibase:label { bd:serviceParam wikibase:language "te". } FILTER((?2011censuscode > "579012") && (?2011censuscode < "597114")) FILTER(BOUND(?prefimgfilename)) FILTER(!(BOUND(?imglegend))) } ORDER BY (?page_titleTE)

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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#wikidata items with 2011 village/census town codes and having images but not captions in Telugu
SELECT DISTINCT ?item ?page_titleTE WHERE {

  Values ?iteminstance {
    wd:Q56436498
  }.    
  ?item (wdt:P131*) wd:Q1159;
    wdt:P131 ?mandal;
    (wdt:P31) ?item_instance;
    wdt:P5578 ?2011censuscode.
  OPTIONAL { ?item wdt:P625 ?wdloc. }
  OPTIONAL { ?item wdt:P18 ?prefimgfilename. }
  OPTIONAL {
    ?item p:P18 ?imgst.
    ?imgst ps:P18 ?imgfilename;
      pq:P2096 ?imglegend.
    FILTER((LANG(?imglegend)) = "te")
  }
  ?tewikilink schema:about ?item;
    schema:isPartOf <https://te.wikipedia.org/>;
    schema:name ?page_titleTE.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "te". }
  FILTER((?2011censuscode > "579012") && (?2011censuscode < "597114"))
  FILTER(BOUND(?prefimgfilename))
  FILTER(!(BOUND(?imglegend)))
}
ORDER BY (?page_titleTE)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?2011censuscode") v11("?imgfilename") v2("?imglegend") v10("?imgst") v6("?item"):::projected v8("?item_instance") v5("?iteminstance") v7("?mandal") v1("?page_titleTE"):::projected v3("?prefimgfilename") v12("?tewikilink") v9("?wdloc") c15([https://te.wikipedia.org/]):::iri c3(["te"]):::literal c18(["bd:serviceParam"]):::iri c5(["wd:Q1159"]):::iri f0[["not bound(?imglegend)"]] f0 --> v2 f1[["bound(?prefimgfilename)"]] f1 --> v3 f2[["?2011censuscode > '579012'?2011censuscode < '597114'"]] f2 --> v4 bind3[/VALUES ?iteminstance/] bind3-->v5 bind30(["wd:Q56436498"]) bind30 --> bind3 v6 --"p:direct/P131"--> c5 v6 --"p:direct/P131"--> v7 v6 --"p:direct/P31"--> v8 v6 --"p:direct/P5578"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:direct/P625".-> v9 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:direct/P18".-> v3 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:P18".-> v10 v10 --"p:statement/P18"--> v11 v10 --"p:qualifier/P2096"--> v2 end v12 --"schema:about"--> v6 v12 --"schema:isPartOf"--> c15 v12 --"schema:name"--> v1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c18 --"wikibase:language"--> c3 end