query-ce1bfb66bb4a271f15965271f8c9b86b

rq turtle/ttl

Verify categories across languages 09:45, 6 February 2020 (UTC)) talk (Luckyz in italian wikipedia. Thanks --w:it:Categoria:Vincitori di medaglia d'oro olimpica per l'Austria is not in the corresponding category it:w:Julia Dujmovits on english wikipedia and the corresponding page en:w:Category:Olympic gold medalists for Austria has category en:w:Julia DujmovitsI'm wondering if there's a way to verify if a page in a category and the corresponding page on a different wikipedia is in the corresponding category. Example given: If 01:33, 7 February 2020 (UTC)) talk (Dipsacus fullonum on enwiki but not itwiki, or inverse. It is a first attempt, and I am sure it can be done better. --(Q7893678)Category:Olympic gold medalists for Austria : Here is code that lists items in the category Luckyz@ 21:45, 6 February 2020 (UTC)) talk (Dipsacus fullonum. I will have to study this more before trying to do this, but maybe others can help. --mw:Wikidata Query Service/User Manual/MWAPIUpdate: My answer may be wrong as you can in fact call the MediaWiki API of all Wikipedias as a service from the Wikidata Query Service. See 11:40, 6 February 2020 (UTC)) talk (Dipsacus fullonumYes, but not with SPARQL queries. I have done checks like that using database dumps from the Wikipedias and Wikidata, but I don't have the setup to do this at the momonet. --

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (SUM(?in_en) AS ?Enlish_category) (SUM(?in_it) AS ?Italian_category)
WHERE
{
  VALUES ?category { wd:Q7893678 }
  [] schema:about ?category; schema:isPartOf <https://en.wikipedia.org/>; schema:name ?cat_title_en.
  [] schema:about ?category; schema:isPartOf <https://it.wikipedia.org/>; schema:name ?cat_title_it.
  {
    SERVICE wikibase:mwapi
    {
      bd:serviceParam wikibase:api "Generator".
      bd:serviceParam wikibase:endpoint "en.wikipedia.org".
      bd:serviceParam mwapi:gcmtitle ?cat_title_en.
      bd:serviceParam mwapi:generator "categorymembers".
      bd:serviceParam mwapi:gcmprop "ids".
      bd:serviceParam mwapi:gcmlimit "max".
      ?item wikibase:apiOutputItem mwapi:item.
    }
    VALUES ?in_en { 1 } 
  }
  UNION
  {
    SERVICE wikibase:mwapi
    {
      bd:serviceParam wikibase:api "Generator".
      bd:serviceParam wikibase:endpoint "it.wikipedia.org".
      bd:serviceParam mwapi:gcmtitle ?cat_title_it.
      bd:serviceParam mwapi:generator "categorymembers".
      bd:serviceParam mwapi:gcmprop "ids".
      bd:serviceParam mwapi:gcmlimit "max".
      ?item wikibase:apiOutputItem mwapi:item.
    }
    VALUES ?in_it { 1 } 
   }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel
HAVING (?Enlish_category = 0 || ?Italian_category = 0)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v9("?Enlish_category") v9("?Italian_category") v4("?cat_title_en") v5("?cat_title_it") v3("?category") v7("?in_en"):::projected v8("?in_it"):::projected v6("?item"):::projected a1((" ")) a2((" ")) c21(["mwapi:item"]):::iri c6([https://it.wikipedia.org/]):::iri c22(["it.wikipedia.org"]):::literal c4([https://en.wikipedia.org/]):::iri c12(["en.wikipedia.org"]):::literal c8(["bd:serviceParam"]):::iri c19(["max"]):::literal c15(["categorymembers"]):::literal c17(["ids"]):::literal c25(["#91;AUTO_LANGUAGE#93;,en"]):::literal c10(["Generator"]):::literal f0[["(?Enlish_category = '0^^xsd:integer' || ?Italian_category = '0^^xsd:integer')"]] f0 --> v9 f0 --> v9 bind1[/VALUES ?category/] bind1-->v3 bind10(["wd:Q7893678"]) bind10 --> bind1 a1 --"schema:about"--> v3 a1 --"schema:isPartOf"--> c4 a1 --"schema:name"--> v4 a2 --"schema:about"--> v3 a2 --"schema:isPartOf"--> c6 a2 --"schema:name"--> v5 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c8 --"mwapi:api"--> c10 c8 --"mwapi:endpoint"--> c22 c8 --"mwapi:gcmtitle"--> v5 c8 --"mwapi:generator"--> c15 c8 --"mwapi:gcmprop"--> c17 c8 --"mwapi:gcmlimit"--> c19 v6 --"mwapi:apiOutputItem"--> c21 end bind2[/VALUES ?in_it/] bind2-->v8 bind20(["1^^xsd:integer"]) bind20 --> bind2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c8 --"mwapi:api"--> c10 c8 --"mwapi:endpoint"--> c12 c8 --"mwapi:gcmtitle"--> v4 c8 --"mwapi:generator"--> c15 c8 --"mwapi:gcmprop"--> c17 c8 --"mwapi:gcmlimit"--> c19 v6 --"mwapi:apiOutputItem"--> c21 end bind3[/VALUES ?in_en/] bind3-->v7 bind30(["1^^xsd:integer"]) bind30 --> bind3 end union0r <== or ==> union0l end subgraph s2["http://wikiba.se/ontology#label"] style s2 stroke-width:4px; c8 --"mwapi:language"--> c25 end bind6[/"sum(?in_en)"/] v7 --o bind6 bind6 --as--o v9 bind7[/"sum(?in_it)"/] v8 --o bind7 bind7 --as--o v9