query-931a6334d09a4747d8318a18c2719e4d
CategoriesFor every article in category_en find article which isn't in category_it
Use at
- https://query.wikidata.org/sparql
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
WITH
{
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|