# RsDA Stats
This page provides sparql queries based on the list of items in [the RsDA Inventory](/inventory/descriptions/).
This is the list of items copied from the top page of the RsDA Inventory. {{wdListLength}} items in total.
## Classes
At the launch of the RsDA project, we expected to gather information of databases. However, toward questions like "How about digital collection?" or "How about web portals which stores information of tons of databases?", we had to answer "Any of those resources are important". Therefore, we hold instances of many classes. In some cases, one instance is of multiple classes. For example, [The Himalayan Database](https://www.wikidata.org/wiki/Q30672038) is a database and book with CD-ROM, which contains the source file of the database, simultaneously.
```sparql
SELECT distinct (group_concat(distinct ?class; separator=" , ") as ?classURL) ?classLabel (COUNT(?classLabel) AS ?count)
WHERE
{
values ?item {{wd_list}}
?item wdt:P31 ?class.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} group by ?classLabel order by desc(?count)
```
## Properties
Properties also vary. For a specific purpose, we have to aggregate some of the properties. For example, for mapping items, both [country](https://www.wikidata.org/wiki/Property:P17) and [narrative location](https://www.wikidata.org/wiki/Property:P840) can be [schema:spatialCoverage](https://schema.org/spatialCoverage) information.
```sparql
SELECT distinct (group_concat(distinct ?p; separator=" , ") as ?pURL) ?propertyLabel (COUNT(?propertyLabel) AS ?count)
WHERE
{
values ?item {{wd_list}}
?item ?p ?o.
?property wikibase:directClaim ?p.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} group by ?propertyLabel order by desc(?count)
```
To find "rich" items, the query below may help you. I don't know why, but the wikibase:label mechanism doesn't function in this query. Therefore I directly get labels using rdfs:label property and filter them.
```sparql
SELECT distinct ?item (group_concat(distinct ?propertyLabel; separator=" , ") as ?propertyLabels) (COUNT(distinct ?p) AS ?count)
WHERE
{
values ?item {wd:Q108030019 wd:Q3800495 wd:Q107340913 wd:Q108130792 wd:Q30672038 wd:Q108146556 wd:Q108157752 wd:Q108179950 wd:Q108198293 wd:Q107025883 wd:Q63354555 wd:Q107308167 wd:Q107010764 wd:Q28163705 wd:Q107862914 wd:Q107340934 wd:Q108254493 wd:Q108254690 wd:Q108367309 wd:Q108402248 wd:Q108402776 wd:Q108418523 wd:Q108456702 wd:Q108470751 wd:Q108596852 wd:Q109821893 wd:Q17022254 wd:Q110633921 wd:Q110633929 wd:Q110633949 wd:Q110619223 wd:Q110624613 wd:Q110624635 wd:Q110624726 wd:Q110624744 wd:Q110624760 wd:Q110626557 wd:Q110626593 wd:Q110626653 wd:Q110626714 wd:Q110632150 wd:Q110632162 wd:Q110632173 wd:Q110632189 wd:Q110495122 wd:Q110495170 wd:Q110512991 wd:Q110590018 wd:Q110591574 wd:Q110591820 wd:Q110591834 wd:Q110591873 wd:Q110591970 wd:Q110591989 wd:Q110592021 wd:Q110651914 wd:Q110651940 wd:Q110651952 wd:Q110651966 wd:Q110594694 wd:Q110597589 wd:Q110597878 wd:Q110729547 wd:Q110730028 wd:Q110730162 wd:Q110739982 wd:Q110740067 wd:Q16196790 wd:Q97033976 wd:Q97131149 wd:Q110382435 wd:Q110381934 wd:Q108857961 wd:Q110495043 wd:Q110219826 wd:Q110219746 wd:Q110207844 wd:Q110197410 wd:Q110197170 wd:Q110196982 wd:Q110192377 wd:Q58926304 wd:Q110192346 wd:Q110192244 wd:Q110098063 wd:Q110095738 wd:Q110095506 wd:Q110090853 wd:Q110877549 wd:Q18609226 wd:Q111179349 wd:Q111178144 wd:Q7169704 wd:Q111288019 wd:Q111288153 wd:Q111288350 wd:Q75453257 wd:Q50811148 wd:Q111288529 wd:Q111288583 wd:Q111291388 wd:Q111293039 wd:Q111295857 wd:Q111325931 wd:Q111326237 wd:Q111326253 wd:Q111326283 wd:Q111327046 wd:Q111327196 wd:Q112262309}
?item ?p ?o.
?property wikibase:directClaim ?p;
rdfs:label ?propertyLabel.
FILTER((LANG(?propertyLabel)) = "en")
#SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} group by ?item order by desc(?count)
```
## Qualifiers
There are only limited numbers of qualifiers often used in Wikidata. For data in RsDA, `language of work or name` (P407) and `of` (P642) are often used. Language qualifier is used for describe language of website or original book.
```sparql
SELECT distinct (group_concat(distinct ?pp; separator=" , ") as ?pURL) ?statementPropertyLabel (COUNT(?statementPropertyLabel) AS ?count)
WHERE
{
values ?item {{wd_list}}.
?item ?p ?o.
?property wikibase:claim ?p.
?o ?pp ?po.
?statementProperty wikibase:qualifier ?pp.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } # Helps get the label in your language, if not, then en language
} group by ?statementPropertyLabel order by desc(?count)
```
`of` qualifier is a bit complicated qualifier. Explanation of the qualifier says "The English word `of` has many different meanings and other languages like Chinese often don't have words that directly correspond to to the English meaning. In most cases it's desirable to use more specific properties than this".
The query below reveals the objects of the `of` qualifier of instances of
http://www.wikidata.org/entity/Q8513
database
http://www.wikidata.org/entity/Q212805
digital library
http://www.wikidata.org/entity/Q1172284
data set
http://www.wikidata.org/entity/Q1225034
virtual museum
http://www.wikidata.org/entity/Q9388534
archival collection
http://www.wikidata.org/entity/Q1988927
digital catalog
http://www.wikidata.org/entity/Q60474998
digital collection
Media type (such as photograph, newspaper and magazine) of each is a typical value of `of`.
```sparql
SELECT distinct (group_concat(distinct ?of_what; separator=" , ") as ?of_what_url) ?of_whatLabel (COUNT(?of_whatLabel) AS ?count)
WHERE
{
values ?itemClass {wd:Q1225034 wd:Q8513 wd:Q212805 wd:Q60474998 wd:Q1988927 wd:Q1172284 wd:Q9388534}
?item p:P31 ?wds.
?wds ps:P31 ?itemClass ;
pq:P642 ?of_what.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} group by ?of_whatLabel order by desc(?count)
```
## Properties to describe people
The properties [creator](https://www.wikidata.org/wiki/Property:P170) and [collection creator](https://www.wikidata.org/wiki/Property:P6241) are the most common property related to human objects. A fieldwork archive can be not only the information source of the target location but also of the fieldworker. However, the facile use of [main subject](https://www.wikidata.org/wiki/Property:P921) should be avoided because that is so subjective, and we can find such items by queries like below.
```sparql
SELECT distinct ?item ?itemLabel ?personLabel ?propertyLabel
WHERE
{
values ?item {{wd_list}}
?item ?p ?person.
?person wdt:P31 wd:Q5.
?property wikibase:directClaim ?p.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by ?property
```