Add missing changes for catching non-artwork.

This commit is contained in:
Edward Betts 2019-12-31 09:01:20 +00:00
parent 63392b63bf
commit 63f8d0f580
2 changed files with 10 additions and 0 deletions

View file

@ -202,3 +202,9 @@ def quote_list(l):
def url_list(l):
no_dups = list(dict.fromkeys(l)) # remove duplicates
return ' '.join(f'(<{s}>)' for s in no_dups)
def is_artificial_physical_object(qid):
bindings = run_from_template_with_cache('query/item_type.sparql', qid=qid)
types = {row_id(row, field='item') for row in bindings}
# Q8205328 == artificial physical object
return 8205328 in types

View file

@ -0,0 +1,4 @@
select ?item ?itemLabel {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
wd:{{ qid }} wdt:P31/wdt:P279* ?item .
}