query-fe8f3fe87e312b278524c7c236643cab
Commons Creator page without Commons category SELECT ?item ?itemLabel ?creatorLabel (SUBSTR(?name, 10 ) AS ?category) WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nl,fr,de,en,es,it". } ?item wdt:P1472 ?creator; wdt:P31 wd:Q5, ?instance. { ?article schema:about ?item; schema:name ?name; schema:isPartOf https://commons.wikimedia.org/. } FILTER(CONTAINS(STR(?article), "/Category:")) MINUS { ?item wdt:P373 ?commonscat. } }
Use at
- https://query.wikidata.org/sparql
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#>
# Commons Creator page without Commons category
SELECT ?item ?itemLabel ?creatorLabel (SUBSTR(?name, 10 ) AS ?category) WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nl,fr,de,en,es,it". }
?item wdt:P1472 ?creator;
wdt:P31 wd:Q5, ?instance.
{
?article schema:about ?item;
schema:name ?name;
schema:isPartOf <https://commons.wikimedia.org/>.
}
FILTER(CONTAINS(STR(?article), "/Category:"))
MINUS { ?item wdt:P373 ?commonscat. }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?article")
v7("?category")
v6("?commonscat")
v3("?creator")
v4("?instance")
v2("?item"):::projected
v5("?name"):::projected
c12([https://commons.wikimedia.org/]):::iri
c3(["bd:serviceParam"]):::iri
c8(["wd:Q5"]):::iri
c5(["#91;AUTO_LANGUAGE#93;,nl,fr,de,en,es,it"]):::literal
f0[["contains(str(?article),'/Category:')"]]
f0 --> v1
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end
v2 --"wdt:P1472"--> v3
v2 --"wdt:P31"--> c8
v2 --"wdt:P31"--> v4
v1 --"schema:about"--> v2
v1 --"schema:name"--> v5
v1 --"schema:isPartOf"--> c12
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v2 --"wdt:P373"--> v6
end
bind2[/"substring(?name,'10^^xsd:integer')"/]
v5 --o bind2
bind2 --as--o v7