query-505a01418d4e3d9dac648c3abb72d151

rq turtle/ttl

TODO

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 ?article_en ?category_en ?article_it ?category_it
{
  {
    SELECT ?item (COUNT(?in_en) AS ?category_en) (COUNT(?in_it) AS ?category_it)
    WHERE
    {
      VALUES ?category { wd:Q7893678 }
      {
        [] schema:about ?category; schema:isPartOf <https://en.wikipedia.org/>; schema:name ?cat_title_en.
        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 { true } 
      }
      UNION
      {
        [] 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 "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 { true } 
      }
    }
    GROUP BY ?item
    HAVING (?category_en = 0 || ?category_it = 0)
  }
  # ?article_en schema:about ?item; schema:isPartOf <https://en.wikipedia.org/>. 
  # ?article_it schema:about ?item; schema:isPartOf <https://it.wikipedia.org/>. 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

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