query-4e0a7714559591fd607f548567c6a7a7

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 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 .

FILTER BOUND(?enarticle) # Safeguard to not get a timeout from unbound items when using ?enarticle below

MINUS {
# en.Wikipedia articles in Category:Wikipedia articles with IEU identifiers SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint ?project; # Set the project here wikibase:api "Generator"; mwapi:generator "categorymembers"; # Selects the content from a category mwapi:gcmtitle "Category:Wikipedia articles with IEU identifiers";. # Specifies the category ?enarticle wikibase:apiOutputItem mwapi:item. } }

# 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) .

SERVICE wikibase:label { bd:serviceParam wikibase:language "en,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 {

  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 .

  FILTER BOUND(?enarticle) # Safeguard to not get a timeout from unbound items when using ?enarticle below

  MINUS {    
    # en.Wikipedia articles in Category:Wikipedia articles with IEU identifiers
    SERVICE wikibase:mwapi {
      bd:serviceParam wikibase:endpoint ?project;     # Set the project here
                      wikibase:api "Generator";
                      mwapi:generator "categorymembers";        # Selects the content from a category
                      mwapi:gcmtitle "Category:Wikipedia articles with IEU identifiers";.    # Specifies the category
      ?enarticle wikibase:apiOutputItem mwapi:item.
    }
  } 

  # 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) .

  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en"  }

}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?IEU_ID") v8("?IEU_link"):::projected v1("?enarticle"):::projected v7("?enname") v6("?formatterurl") v4("?item"):::projected v2("?lang") v3("?project") c19(["mwapi:item"]):::iri c22(["en,en"]):::literal c15(["categorymembers"]):::literal c17(["Category:Wikipedia articles with IEU identifiers"]):::literal c7([https://en.wikipedia.org/]):::iri c10(["bd:serviceParam"]):::iri c2(["wd:P9070"]):::iri c13(["Generator"]):::literal f0[["bound(?enarticle)"]] f0 --> v1 bind1[/"'en'"/] bind1 --as--o v2 bind2[/"concat(?lang,'.wikipedia.org')"/] v2 --o bind2 bind2 --as--o v3 v4 --"wdt:P9070"--> v5 c2 --"wdt:P1630"--> v6 v1 --"schema:about"--> v4 v1 --"schema:inLanguage"--> v2 v1 --"schema:isPartOf"--> c7 v1 --"schema:name"--> v7 subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c10 --"mwapi:endpoint"--> v3 c10 --"mwapi:api"--> c13 c10 --"mwapi:generator"--> c15 c10 --"mwapi:gcmtitle"--> c17 v1 --"mwapi:apiOutputItem"--> c19 end end bind4[/"replace(replace(?IEU_ID,'\','%5C','q'),'^(.+)$',replace(?formatterurl,'\','%5C','q'))"/] v5 --o bind4 v6 --o bind4 bind4 --as--o v8 subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c10 --"mwapi:language"--> c22 end