A small update on this: based on some off-list feedback, I replaced
the way I exclude disambiguation pages and the like from the
autocomplete list. The autocomplete widget now performs two queries: a
MediaWiki API (wbsearchentities) query, and a follow-up WDQS SPARQL
query to exclude disambiguation pages, Wikinews articles, and other
content that folks are most likely not interested in reviewing.
I didn't find a good example for this in the examples directory, so I
figured folks might find the query I'm using useful. Before I add it
to the examples, please let me know if you see obvious ways in which
it can be improved.
Here's an example query:
# For a list of items, exclude the ones that have "instance of" set to
# one from a given set of excluded classes
SELECT DISTINCT ?item WHERE {
?item ?property ?value
# Excluded classes: disambiguation pages, Wikinews articles, etc.
MINUS { ?item wdt:P31 wd:Q4167410 }
MINUS { ?item wdt:P31 wd:Q17633526 }
MINUS { ?item wdt:P31 wd:Q11266439 }
MINUS { ?item wdt:P31 wd:Q4167836 }
MINUS { ?item wdt:P31 wd:Q14204246 }
# Set of items to check against the above exclusion list
# wd:Q355362 is a disambiguation page and will therefore not be in
# the result set
VALUES ?item { wd:Q23548 wd:Q355362 wd:Q1824521 wd:Q309751 wd:Q6952373 }
}