query-2da750f7927da09bfdf637362cbfe727

rq turtle/ttl

Items with Internet Encyclopedia of Ukraine ID but no IEU identifier in en.Wikipedia SELECT DISTINCT ?item ?itemLabel ?itemDescription ?IEU_link ?enarticle with { select ?item ?IEU_link ?enarticle WHERE { BIND('en' AS ?lang). BIND(CONCAT(?lang, '.wikipedia.org') AS ?project). ?item wdt:P9070 ?IEU_ID . # item’s IEU ID wd:P9070 wdt:P1630 ?formatterurl . # get its formatter ?enarticle schema:about ?item ; schema:inLanguage ?lang ; schema:isPartOf https://en.wikipedia.org/ ; schema:name ?enname . # derive the IEU URL BIND(IRI(REPLACE( REPLACE(?IEU_ID, '\', '%5C', 'q'), # percent-encode backslash '^(.+)$', REPLACE(?formatterurl, '\', '%5C', 'q') # percent-encode backslash )) AS ?IEU_link) .
} } as %i where { include %i filter not exists {select ?item where {
# en.Wikipedia articles in Category:Wikipedia articles with IEU identifiers SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "en.wikipedia.org"; wikibase:api "Generator"; mwapi:generator "categorymembers"; mwapi:gcmtitle "Category:Wikipedia articles with IEU identifiers" ; mwapi:gcmprop "ids|title|type"; mwapi:gcmlimit "max". # out ?item wikibase:apiOutputItem mwapi:item. } } } FILTER BOUND(?item) # Safeguard to not get a timeout from unbound items SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } }

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#>
# Items with Internet Encyclopedia of Ukraine ID but no IEU identifier in en.Wikipedia
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?IEU_link ?enarticle  where
{
   { select ?item ?IEU_link ?enarticle WHERE {
  BIND('en' AS ?lang).
  BIND(CONCAT(?lang, '.wikipedia.org') AS ?project).
  ?item wdt:P9070 ?IEU_ID . # item’s IEU ID
  wd:P9070 wdt:P1630 ?formatterurl . # get its formatter
  ?enarticle schema:about ?item ; 
             schema:inLanguage ?lang ; 
             schema:isPartOf <https://en.wikipedia.org/> ; 
             schema:name ?enname .
  # derive the IEU URL
  BIND(IRI(REPLACE( 
    REPLACE(?IEU_ID, '\\', '%5C', 'q'), # percent-encode backslash
    '^(.+)$', 
    REPLACE(?formatterurl, '\\', '%5C', 'q') # percent-encode backslash
  )) AS ?IEU_link) .  
} }  filter not exists  {select ?item where {    
    # en.Wikipedia articles in Category:Wikipedia articles with IEU identifiers
    SERVICE wikibase:mwapi {
     bd:serviceParam wikibase:endpoint "en.wikipedia.org";
                     wikibase:api "Generator";
                     mwapi:generator "categorymembers";
                     mwapi:gcmtitle "Category:Wikipedia articles with IEU identifiers" ;
                     mwapi:gcmprop "ids|title|type";
                     mwapi:gcmlimit "max".
     # out
     ?item wikibase:apiOutputItem mwapi:item.
    }
 } }
  FILTER BOUND(?item) # Safeguard to not get a timeout from unbound items 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en"  }
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?IEU_ID") v8("?IEU_link"):::projected v6("?enarticle"):::projected v7("?enname") v5("?formatterurl") v1("?item"):::projected v2("?lang") v3("?project") c16(["mwapi:item"]):::iri c10(["Category:Wikipedia articles with IEU identifiers"]):::literal c4(["en.wikipedia.org"]):::literal c23([https://en.wikipedia.org/]):::iri c2(["bd:serviceParam"]):::iri c18(["wd:P9070"]):::iri c14(["max"]):::literal c27(["en"]):::literal c8(["categorymembers"]):::literal c12(["ids|title|type"]):::literal c6(["Generator"]):::literal f0[["bound(?item)"]] f0 --> v1 f1[["not "]] subgraph f1e0["Exists Clause"] subgraph e0s1["http://wikiba.se/ontology#mwapi"] style e0s1 stroke-width:4px; e0c2 --"mwapi:endpoint"--> e0c4 e0c2 --"mwapi:api"--> e0c6 e0c2 --"mwapi:generator"--> e0c8 e0c2 --"mwapi:gcmtitle"--> e0c10 e0c2 --"mwapi:gcmprop"--> e0c12 e0c2 --"mwapi:gcmlimit"--> e0c14 e0v1 --"mwapi:apiOutputItem"--> e0c16 end e0v1("?item"):::projected e0c16(["mwapi:item"]):::iri e0c14(["max"]):::literal e0c8(["categorymembers"]):::literal e0c10(["Category:Wikipedia articles with IEU identifiers"]):::literal e0c4(["en.wikipedia.org"]):::literal e0c2(["bd:serviceParam"]):::iri e0c12(["ids|title|type"]):::literal e0c6(["Generator"]):::literal end f1--EXISTS--> f1e0 f1 --> c1 f1 --> c2 f1 --> c3 f1 --> c4 f1 --> c5 f1 --> c6 f1 --> c7 f1 --> c8 f1 --> c9 f1 --> c10 f1 --> c11 f1 --> c12 f1 --> c13 f1 --> c14 f1 --> v1 f1 --> c15 f1 --> c16 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c2 --"mwapi:endpoint"--> c4 c2 --"mwapi:api"--> c6 c2 --"mwapi:generator"--> c8 c2 --"mwapi:gcmtitle"--> c10 c2 --"mwapi:gcmprop"--> c12 c2 --"mwapi:gcmlimit"--> c14 v1 --"mwapi:apiOutputItem"--> c16 end bind2[/"'en'"/] bind2 --as--o v2 bind3[/"concat(?lang,'.wikipedia.org')"/] v2 --o bind3 bind3 --as--o v3 v1 --"wdt:P9070"--> v4 c18 --"wdt:P1630"--> v5 v6 --"schema:about"--> v1 v6 --"schema:inLanguage"--> v2 v6 --"schema:isPartOf"--> c23 v6 --"schema:name"--> v7 bind4[/"replace(replace(?IEU_ID,'\','%5C','q'),'^(.+)$',replace(?formatterurl,'\','%5C','q'))"/] v4 --o bind4 v5 --o bind4 bind4 --as--o v8 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c2 --"mwapi:language"--> c27 end