Wikidata:WikiProject 20th Century Press Archives/Tools & Tasks/Subject Category checks
Incomplete subject category items
editItems with PM20 subject code (P8484), which are not an instance of PM20 subject category (Q92707903)
editselect distinct ?item ?itemLabel
where {
?item wdt:P8484 ?subjectCode .
filter( not exists {
?item wdt:P31 wd:Q92707903 .
})
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Instances of PM20 subject category (Q92707903) without PM20 subject code (P8484)
editselect distinct ?item ?itemLabel
where {
?item wdt:P31 wd:Q92707903 .
filter( not exists {
?item wdt:P8484 ?subjectCode .
})
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
"Suspect" subject category items
editpm20 subject category items with more than one "instance of" statements
editselect ?item ?itemLabel
where {
?item wdt:P31 wd:Q92707903 ;
wdt:P31 ?otherClass .
filter(?otherClass != wd:Q92707903)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
pm20 subject category labels starting with lowercase letter
editselect distinct ?item ?itemLabel
where {
?item wdt:P31 wd:Q92707903 .
?item rdfs:label ?label .
filter(lang(?label) = 'en')
filter(regex(substr(?label,1,1), '[a-z]'))
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Check WD ./. PM20 endpoint
editAll PM20 subject categories with folders, which have no WD item with according subject code
editPREFIX zbwext: <http://zbw.eu/namespaces/zbw-extensions/>#
select distinct ?notation ?subject
where {
service <http://zbw.eu/beta/sparql/pm20/query> {
select distinct ?notation ?subject
where {
?subject skos:notation ?notation .
filter(exists {
?pm20 a zbwext:SubjectFolder ;
zbwext:subject ?subject .
})
}
}
bind(replace(?notation, ' ', '_') as ?subjectCode)
#
filter(not exists {
?item wdt:P8484 ?subjectCode .
})
}
WD subject codes which have no match in PM20 endpoint
editselect distinct ?item ?itemLabel ?subjectCode ?notation
where {
?item wdt:P8484 ?subjectCode .
bind(replace(?subjectCode, '_', ' ') as ?notation)
optional {
service <http://zbw.eu/beta/sparql/pm20/query> {
select distinct ?notation ?subject
where {
# it is not reqiered that according subject category has folders!
# (may be empty level in the hierarchy)
?subject skos:notation ?notation .
}
}
}
filter(!bound(?subject))
#
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
order by ?notation
PM20 folders linking to subjects which are not PM20 Subject Categories
editThe following query uses these:
- Properties: instance of (P31) , PM20 folder ID (P4293) , main subject (P921)
select distinct ?item ?itemLabel where { ?item wdt:P31 wd:Q91257459 ; wdt:P4293 ?pm20Id ; wdt:P921 ?subject . filter(not exists { ?subject wdt:P31 wd:Q92707903 . }) SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } } order by ?subject