17944: Updates config knobs and documentation.
[arvados.git] / doc / admin / metadata-vocabulary.html.textile.liquid
1 ---
2 layout: default
3 navsection: admin
4 title: Metadata vocabulary
5 ...
6
7 {% comment %}
8 Copyright (C) The Arvados Authors. All rights reserved.
9
10 SPDX-License-Identifier: CC-BY-SA-3.0
11 {% endcomment %}
12
13 Many Arvados objects (like collections and projects) can store metadata as properties that in turn can be used in searches allowing a flexible way of organizing data inside the system.
14
15 Arvados enables the site administrator to set up a formal metadata vocabulary definition so that users can select from predefined key/value pairs of properties, offering the possibility to add different terms for the same concept on clients' UI such as workbench2.
16
17 The Controller service loads and caches the configured vocabulary file in memory at startup time, exporting it on a particular endpoint. From time to time, it'll check for updates in the local copy and refresh its cache if validation passes.
18
19 h2. Configuration
20
21 The site administrator should place the JSON vocabulary file on the same host as the controller service and set up the config file as follows:
22
23 <notextile>
24 <pre><code>Cluster:
25   zzzzz:
26     API:
27       VocabularyPath: <span class="userinput">/etc/arvados/vocabulary.json</span>
28 </code></pre>
29 </notextile>
30
31 h2. Vocabulary definition format
32
33 The JSON file describes the available keys and values and if the user is allowed to enter free text not defined by the vocabulary.
34
35 Keys and values are indexed by identifiers so that the concept of a term is preserved even if vocabulary labels are changed.
36
37 The following is an example of a vocabulary definition:
38
39 {% codeblock as json %}
40 {% include 'metadata_vocabulary_example' %}
41 {% endcodeblock %}
42
43 If the @strict_tags@ flag at the root level is @true@, it will restrict the users from saving property keys other than the ones defined in the vocabulary. This restriction is enforced at the backend level to ensure consistency across different clients.
44
45 Inside the @tags@ member, IDs are defined (@IDTAGANIMALS@, @IDTAGCOMMENT@, @IDTAGIMPORTANCES@) and can have any format that the current application requires. Every key will declare at least a @labels@ list with zero or more label objects.
46
47 The @strict@ flag inside a tag definition operates the same as the @strict_tags@ root member, but at the individual tag level. When @strict@ is @true@, a tag’s value options are limited to those defined by the vocabulary.
48
49 The @values@ member is optional and is used to define valid key/label pairs when applicable. In the example above, @IDTAGCOMMENT@ allows open-ended text by only defining the tag's ID and labels and leaving out @values@.
50
51 When any key or value has more than one label option, Workbench2's user interface will allow the user to select any of the options. But because only the IDs are saved in the system, when the property is displayed in the user interface, the label shown will be the first of each group defined in the vocabulary file. For example, the user could select the property key @Species@ and @Homo sapiens@ as its value, but the user interface will display it as @Animal: Human@ because those labels are the first in the vocabulary definition.
52
53 Internally, Workbench2 uses the IDs to do property based searches, so if the user searches by @Animal: Human@ or @Species: Homo sapiens@, both will return the same results.
54
55 h2. Properties migration
56
57 After installing the new vocabulary definition, it may be necessary to migrate preexisting properties that were set up using literal strings. This can be a big task depending on the number of properties on the vocabulary and the amount of collections and projects on the cluster.
58
59 To help with this task we provide below a migration example script that accepts the new vocabulary definition file as an input, and uses the @ARVADOS_API_TOKEN@ and @ARVADOS_API_HOST@ environment variables to connect to the cluster, search for every collection and group that has properties with labels defined on the vocabulary file, and migrates them to the corresponding identifiers.
60
61 This script will not run if the vocabulary file has duplicated labels for different keys or for different values inside a key, this is a failsafe mechanism to avoid migration errors.
62
63 Please take into account that this script requires admin credentials. It also offers a @--dry-run@ flag that will report what changes are required without applying them, so it can be reviewed by an administrator.
64
65 Also, take into consideration that this example script does case-sensitive matching on labels.
66
67 {% codeblock as python %}
68 {% include 'vocabulary_migrate_py' %}
69 {% endcodeblock %}