query-63e8da6274e0148bc9b88764a962fe81
find items in a Wikipedia (sub-)category (and its subcategories) which do not have P31 or P279. MathematicsWikipedia category I want to find all pages in the
Use at
- https://query.wikidata.org/sparql
PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel WHERE {
# MINUS { ?item (wdt:P31|wdt:P279) [] } . #shows only items without P31 or P279
# [] schema:about ?itemĀ ; schema:isPartOf <https://en.wikipedia.org/> . #shows only items without P31 or P279
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:endpoint "en.wikipedia.org";
wikibase:api "Generator";
mwapi:generator "categorymembers";
mwapi:gcmtitle "Category:Mathematics";
mwapi:gcmprop "ids|title|type";
mwapi:gcmlimit "max".
?item wikibase:apiOutputItem mwapi:item.
}
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;
v1("?item"):::projected
c16(["mwapi:item"]):::iri
c14(["max"]):::literal
c19(["en"]):::literal
c8(["categorymembers"]):::literal
c10(["Category:Mathematics"]):::literal
c4(["en.wikipedia.org"]):::literal
c2(["bd:serviceParam"]):::iri
c12(["ids|title|type"]):::literal
c6(["Generator"]):::literal
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
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c2 --"mwapi:language"--> c19
end