-
Notifications
You must be signed in to change notification settings - Fork 4
/
musicapi.qmd
140 lines (71 loc) · 9.87 KB
/
musicapi.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Variables in Music Databases {#sec-musicapi .appendix}
We use two information models:
- SDMX for statistical concepts
- DDI for the documentation of microdata
When repeatedly querying a music API, such as the Spotify API, we carry out an automated survey in which the respondent is not a human but a machine. Sending the same query to a well-designed API will yield a comparable answer to our question sent to the same API yesterday or tomorrow.
There are still many similarities with survey harmonisation: you would usually like to combine the data from the API with other data sources, in which case you still have to harmonise the concepts, the labelling, the translations, and the coding of your responses (processed in a dataset into variables.)
The previous Appendix introduces the key concepts and practices of survey harmonisation. When working with APIs, you do not need to harmonise question texts in human languages, because you harmonise them in a marchine-readable query language (for example, in SQL or SPARQL.) The rest of the data harmonisation workflow is the same.
## String versus item
- [Slovakia (Q79)](https://reprexbase.eu/demowiki/index.php?title=Item:Q79) is a well-defined node in our Wikibase graph.
- `Slovakia` as a string is not well-defined; it can only be understood if we add `"Slovakia"@en` a reference to the natural language of the string.
Whenever possible, we want to refer to well-defined nodes in the knowledge graph. For example, our entry [Slovakia (Q79)](https://reprexbase.eu/demowiki/index.php?title=Item:Q79) states that it is equivalent with [Slovakia (Q214) on Wikidata](https://www.wikidata.org/wiki/Q214), and Wikidata connects plenty of metadata to this concept: the geographical boundaries, the fact that it is an independent state since 1993, it predecessors, capital, etc.
Our aim is to have a rich and standardised description to each variable, and as much as possible, to very constant (or attribute.) _Katarína Kubošiová_ is a Slovak singer-songwriter, also known as _Katarzia_. To avoid any ambigouity with other people potentially called _Katarína Kubošiová_ or _Katarzia_, we would like to refer to her with a globally unique identifier. Her ISNI identifier (ISNI: ) is [isni: 0000000467220673](
https://isni.org/isni/0000000467220673), which identifies her with global clarity.
The metadata enrichment is possible to make data points into nodes. For example, if we conceptualise `Slovakia` into a node, than we can connect to this node sound recordings (regardless if they have a Slovak or English-language title) if they were registered with the Slovak national ISRC registrant's `SK` prefix. We can connect `Katarína Kubošiová`, `Katarzia`, `SK`, `Slovakia` in a graph to the concept of _Slovakia_ with less or more clarity; in this case, for example, defining that a sound recording was registered in Slovakia, or the artist known as _Katarzia_ was born in Slovakia or sung in the Slovak language.
### 1. Access Wikibase
Login in with you account to Wikibase.
### 2. Create a New Item
Go to `Special Pages`
![](png/question_to_wikibase/wikidata_specialPages_2x1.png){fig-align="center"}
Scroll down and select: `Create a New Item`
![](png/question_to_wikibase/wikibase_addNewItem_2x1.png){fig-align="center"}
Fill the form with the item's data:
- Language - Choose the language (en)
- Label - Give a short name for the node, for example, _Katarína Kubošiová_
- Description - Enter the item description, for example _Singer-songwriter born in the Slovak Republic_
- Aliases - you can add _Katarzia_ or any other known names here.
![](png/question_to_wikibase/wikibase_createNewItem_2x1.png){fig-align="center"}
Click `Create`.
The item now is created on Wikibase. For each concept that you want to use in your research, its documentation should be present. For key persons, names, musical works, it is also advisable to have an item defined.
![](png/question_to_wikibase/example_question_2x1.png){fig-align="center"}
::: callout-note
Note: The system assigns a unique ID to every entry. For example, in our system, the ID of _Ján Levoslav Bella_ (Slovak conductor, composer and educator), aslo known under the alias with no Slovak special characters as _Jan Levoslav Bella_ is [Q93](https://reprexbase.eu/demowiki/index.php?title=Item:Q93). With Q93 you cannot make the mistake of confusing the fact that _Ján Levoslav Bella_ is the same person as _Jan Levoslav Bella_.
:::
### 3. Add Metadata Statements
You need to add further metadata statements to the question bank item. Metadata is a statement about the data. We are adding standard, basic statements in subject, predicate, and object (triplet) format to each question bank item.
#### Variable Representation
DDI has standard variable representation definitions. When a questionnaire will be filled out in a raw dataset, or data will be systematically queried from and API, each response will be translated into a variable. We need to define how we want to represent those answers in the resulting output dataset. (See [DDI 3.3 (2020) documentation - Variable Value Representation and Question Response Domain](https://ddi-lifecycle-documentation.readthedocs.io/en/latest/TechnicalGuide/Value%20Representation%20and%20Response%20Domain.html))
Using statements you can define the representation of the variables. You can choose from the following categories:
- [x] category representation base type: if the answers are categories (for example: `[ ] Female`, `[ ] Male`, `[ ] Prefer not to say`)
- [x] category representation base type with a **scale**: if the answers are categories and follow a scale (for example: `[] Very important`, `[ ] Fairly important`, `[ ] Not very important`, `[ ] Not at all important`. )
- [x] ranking representation base type: the respondant must rank the answer options, like 1st, 2nd, 3rd, etc.
- [x] numeric variable representation base type: the answer should be a number, for example, the age of the respondant as an integer number or a postal code in a country where postal codes contain only numeric digits, f.e., `1051`.
- [x] textual variable representation base type: the answer should be some text, for example, and open answer, or a geographical location typed as a simple text, for example, `Bratislava`.
![](png/question_to_wikibase/VariableRepresentation_6x4.png){fig-align="center"}
#### Define the source study
::: callout-tip
For further details, please check the [disco:Study](https://rdf-vocabulary.ddialliance.org/discovery.html#study) class.
:::
With the [study (DDI) P270](https://reprexbase.eu/demowiki/index.php?title=Property:P270) property you must link as a statement the *study* where you found the concept definition. If it was a formal ontology, or Wikibase, use different properties (see below).
![](png/question_to_wikibase/statement_study_2x1.png){fig-align="center"}
An example for a study: [Eurobarometer 88.1 (2017) Q139](https://reprexbase.eu/demowiki/index.php?title=Item:Q139)
::: callout-note
Note: If the study is not yet in Wikibase, you can create an entry for it using the `Create a New Item` function.
:::
#### Add related concept
Where are the related concepts coming from?
1. The best case is that you use a widely accepted conceptualisation (ontology item) of your domain. For example, we took the [duration (Q132)](https://reprexbase.eu/demowiki/index.php?title=Item:Q132) concept from the Music Ontology. You can connect statements of equivalence to a well-defined ontology via [equivalent class (P69) ](https://reprexbase.eu/demowiki/index.php?title=Property:P69). In other words, our Q149 entity is equivalent to Music Ontology's `duration` (in short: `mo:duration`.)
2. If there are no accepted ontologies or you are uncertain, it is a very good practice to use a concept definition from Wikidata. Even in the case of an ontological definition, adding the Wikidata QID is a great idea because Wikidata connects equivalent definitions across various domains' ontologies. You can make a statement about an equivalent Wikidata URI (for an item) by [Wikibase URI (P73)](https://reprexbase.eu/demowiki/index.php?title=Property:P73). See, for example [duration (Q132)](https://reprexbase.eu/demowiki/index.php?title=Item:Q132), [Wikibase URI (P73)](https://reprexbase.eu/demowiki/index.php?title=Property:P73), [https://www.wikidata.org/wiki/Q16038819](https://www.wikidahttps://www.wikidata.org/wiki/Q16038819), meaning that our `plastic` definition is equivalent to the Wikidata definition of `plastic` (which has a QID of `Q16038819` on Wikidata, and it received the QID of `Q132` on our Wikibase instance.)
3. You can create your definition if you are still looking for a suitable definition in an accepted ontology or on Wikidata. For this, you should create a definition in Wikibase (as a new item.) See, for example, [model question (Q126)](https://reprexbase.eu/demowiki/index.php?title=Item:Q126), which is our own proprietary definition until we find a more consensual one.
### Add national langugage translations to your concept
On Wikibase you can add different language versions to the same question.
To do so, go to `Special Pages`
![](png/question_to_wikibase/wikidata_specialPages_2x1.png){fig-align="center"}
Scroll down and select: `Set Item/Property Description`
![](png/question_to_wikibase/SpecialPages_Set_ItemProperty_Description_2x1.png){fig-align="center"}
Fill the form:
- ID - The QiD of the question (for example, if you want to add a Dutch description to _Ján Levoslav Bella_, i.e., Slovak conductor, composer and educator, you must reference [Q93](https://reprexbase.eu/demowiki/index.php?title=Item:Q93).
- Language code - the new language you want to input the question, in this case, `nl`.
- Description - Write a short definition (up to 250 characters) in the new language.
![](png/question_to_wikibase/Set_IetmProperty_Description_2x1.png){fig-align="center"} Select "Set Description".
The entry is now updated with another language label or description.