query-fe774b8a83fa1b862145213f3a9c1bfa

rq turtle/ttl

Revenue village in tewiki for updating with Infobox India AP Village SELECT DISTINCT ?village ?page_titleTE WHERE { hint:Query hint:optimizer "None". { ?village (wdt:P131) wd:Q1159; wdt:P131 ?mandal; (wdt:P31/(wdt:P279)) wd:Q56061; wdt:P5578 ?2011censuscode. OPTIONAL { ?village wdt:P18 ?prefimgfilename. } OPTIONAL { ?village p:P18 ?imgst. ?imgst ps:P18 ?imgfilename; pq:P2096 ?imglegend. FILTER((LANG(?imglegend)) = "te") } ?tewikilink schema:about ?village; 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)))
} MINUS { SELECT ?village WHERE { SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator". bd:serviceParam wikibase:endpoint "te.wikipedia.org". bd:serviceParam mwapi:generator "transcludedin". bd:serviceParam mwapi:titles "Template:Infobox India AP Village". ?village wikibase:apiOutputItem mwapi:item. } } LIMIT 2000 }
} ORDER BY (?page_titleTE)

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 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#>
#Revenue village in tewiki for updating with Infobox India AP Village
SELECT DISTINCT ?village ?page_titleTE   WHERE {

  {
  ?village (wdt:P131*) wd:Q1159;
    wdt:P131 ?mandal;
    (wdt:P31/(wdt:P279*)) wd:Q56061;
    wdt:P5578 ?2011censuscode.
  OPTIONAL { ?village wdt:P18 ?prefimgfilename. }
  OPTIONAL {
    ?village p:P18 ?imgst.
    ?imgst ps:P18 ?imgfilename;
      pq:P2096 ?imglegend.
    FILTER((LANG(?imglegend)) = "te")
  }
  ?tewikilink schema:about ?village;
    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)))      
  } MINUS 
  {
    SELECT ?village  WHERE {
     SERVICE wikibase:mwapi {
          bd:serviceParam wikibase:api "Generator".
          bd:serviceParam wikibase:endpoint "te.wikipedia.org".
          bd:serviceParam mwapi:generator "transcludedin".
          bd:serviceParam mwapi:titles  "Template:Infobox India AP Village".
          ?village wikibase:apiOutputItem mwapi:item.
      }
   } LIMIT 2000
  }  
}
ORDER BY  (?page_titleTE)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?2011censuscode") v8("?imgfilename") v2("?imglegend") v7("?imgst") v6("?mandal") v1("?page_titleTE"):::projected v3("?prefimgfilename") v9("?tewikilink") v5("?village"):::projected a1((" ")) c31(["mwapi:item"]):::iri c16([https://te.wikipedia.org/]):::iri c19(["bd:serviceParam"]):::iri c27(["transcludedin"]):::literal c8(["wd:Q56061"]):::iri c3(["te"]):::literal c29(["Template:Infobox India AP Village"]):::literal c5(["wd:Q1159"]):::iri c23(["Generator"]):::literal c25(["te.wikipedia.org"]):::literal f0[["not bound(?imglegend)"]] f0 --> v2 f1[["bound(?prefimgfilename)"]] f1 --> v3 f2[["?2011censuscode > '579012'?2011censuscode < '597114'"]] f2 --> v4 v5 --"p:direct/P131"--> c5 v5 --"p:direct/P131"--> v6 v5 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c8 v5 --"p:direct/P5578"--> v4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:direct/P18".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:P18".-> v7 v7 --"p:statement/P18"--> v8 v7 --"p:qualifier/P2096"--> v2 end v9 --"schema:about"--> v5 v9 --"schema:isPartOf"--> c16 v9 --"schema:name"--> v1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c19 --"mwapi:language"--> c3 end subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; subgraph s2["http://wikiba.se/ontology#mwapi"] style s2 stroke-width:4px; c19 --"mwapi:api"--> c23 c19 --"mwapi:endpoint"--> c25 c19 --"mwapi:generator"--> c27 c19 --"mwapi:titles"--> c29 v5 --"mwapi:apiOutputItem"--> c31 end end