query-078f41726c5ef90b7f4f7c2ee7658a6d
Measures of item quality (query is too long for URL shortener). I need to be able to query the quality of items. I'm thinking of things like: https://www.wikidata.org/wiki/User:Stuartyeates/InterestingPeopleQueryI am contemplating conducting a study where I improve a randomised selection of wikidata items and compare their quality down the track with un-improved items. I already have a draft query capturing the kinds of people I'm interested in at What proportion of statements in an item have a non-wiki reference? What proportion of statements in an item have a reference? How many distinct editors have edited an item? How many edits does an item have? When was an item created? How many sitelinks does an item have, at some point previously? How many identifiers does an item have, at some point previously? How many statements does an item have, at some point previously? How many inter-wiki links does an item have, right now? How many identifiers does an item have, right now? How many statements does an item have, right now? 09:45, 30 July 2024 (UTC)) talk (StuartyeatesAre there examples somewhere of this kind of thing? Since I found my own solution:
Use at
- https://query.wikidata.org/sparql
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX prov: <http://www.w3.org/ns/prov#>
SELECT ?item ?statements_with_references ?total_statements ?number_of_references ?number_of_b_relationhsips ?number_of_a_relationhsips ?number_of_b_literals WHERE {
BIND(wd:Q42 AS ?item).
{
SELECT ?item (COUNT(*) AS ?total_statements) WHERE {
?item ?p ?statement.
} GROUP BY ?item
}
{
SELECT ?item (COUNT(*) AS ?statements_with_references) WHERE {
?item ?p ?statement.
?statement prov:wasDerivedFrom ?reference.
} GROUP BY ?item
}
{
SELECT ?item (COUNT(DISTINCT ?reference) AS ?number_of_references) WHERE {
?item ?p ?statement.
FILTER(!isLiteral(?statement)).
?statement prov:wasDerivedFrom ?reference.
} GROUP BY ?item
}
{
SELECT ?item (COUNT(DISTINCT ?statement) AS ?number_of_a_relationhsips) WHERE {
?statement ?p ?item.
FILTER(!isLiteral(?statement)).
} GROUP BY ?item
}
{
SELECT ?item (COUNT(DISTINCT ?statement) AS ?number_of_b_relationhsips) WHERE {
?item ?p ?statement.
FILTER(!isLiteral(?statement)).
} GROUP BY ?item
}
{
SELECT ?item (COUNT(DISTINCT ?statement) AS ?number_of_b_literals) WHERE {
?item ?p ?statement.
FILTER(isLiteral(?statement)).
} GROUP BY ?item
}
}