User:Akbarali/Most used properties in direct claims, qualifiers and references
Frequency table of uses of properties in direct claims, qualifiers and references and its values in a given language
editThe following query has been prepared by User:Rdrg109. Following query will help to find the missing lables and descriptions of ml language.
?countInQualifiers
. ml
(language code for Malayalam) was used as the language code and schema:description
as the predicate. Both values were set in named subquery %4
?countInReferences
. ko
(language code for Korean) was used as the language code and schema:description
as the predicate. Both values were set in named subquery %4
Someone asked me if I could add a condition to the query so that it shows those properties that have description in English, but don't have a description in a given language.
I thought that the query would be more useful if it included all the properties in the results and show a column that show
or Yes
when a property has a description in that language or not. Thus, it would be possible to sort the table by any column and at the same time see if the property has description in that language.
No
For setting the language that this query will search for missing values (e.g. missing labels, or missing descriptions), you need to edit the named subquery
. The line that needs to be edited is the one that have the %4
statement. In that line, change the string with the language code of the language you are interested in (e.g. FILTER
for Spanish, "es"
for Korean, "ko"
for Quechua, etc.)
"qu"
There are two main modifications that can be done to the query for making the results more useful
- Note that the query could be reused for listing properties that might be missing a label (i.e.
, descriptions (i.e.rdfs:label
), aliases (i.e.schema:description
or even properties (e.g. Wikidata usage instructions (P2559)) in a given language. To do this, just change the predicate that is used in theskos:altLabel
statement in the named subqueryOPTIONAL
.%4
- Don't show the column
. You might want to do this if you are only interested in knowing whether a property has a description in a given language or not, so having the descriptions in the result of the query is not that useful.?value
NOTE: This query shows inaccurate information for some properties due to a bug. I already reported it in T323423.
SELECT
?property
?propertyLabel
?value
?valueExists
?countInDirectClaims
?countInQualifiers
?countInReferences
WITH {
SELECT DISTINCT ?property {
?property wikibase:propertyType [].
}
} AS %a
WITH {
SELECT ?wdt (COUNT(*) AS ?count) {
[] ?wdt [].
}
GROUP BY ?wdt
} AS %0
WITH {
SELECT ?property (?count AS ?countInDirectClaims) {
INCLUDE %0.
?property wikibase:directClaim ?wdt.
}
} AS %1
WITH {
SELECT ?property (?count AS ?countInQualifiers) {
INCLUDE %0.
?property wikibase:qualifier ?wdt.
}
} AS %2
WITH {
SELECT ?property (?count AS ?countInReferences) {
INCLUDE %0.
?property wikibase:reference ?wdt.
}
} AS %3
WITH {
SELECT * {
INCLUDE %a.
OPTIONAL{INCLUDE %1}
OPTIONAL{INCLUDE %2}
OPTIONAL{INCLUDE %3}
OPTIONAL {
?property schema:description ?value
FILTER(LANG(?value) = "ml").
}
BIND(IF(BOUND(?value), "Yes", "No") AS ?valueExists).
}
} AS %4
WITH {
SELECT * {
INCLUDE %4.
BIND(IF(BOUND(?countInDirectClaims), ?countInDirectClaims, 0) AS ?countInDirectClaims)
BIND(IF(BOUND(?countInQualifiers), ?countInQualifiers, 0) AS ?countInQualifiers)
BIND(IF(BOUND(?countInReferences), ?countInReferences, 0) AS ?countInReferences)
}
} AS %5
{
INCLUDE %5.
SERVICE wikibase:label {bd:serviceParam wikibase:language "en"}.
}