Skip to content

Commit f732bfe

Browse files
committed
vocabulary: document
1 parent 80009d9 commit f732bfe

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

docs/develop/make_it_your_own.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,46 @@ Inside the `page_body` block you can restructure the page as you want! You can c
149149
Since we modified `invenio.cfg`, we need to re-start the server to see our changes take effect.
150150

151151

152-
## Use a custom controlled vocabulary
152+
## Define a custom controlled vocabulary
153+
154+
InvenioRDM deals with many controlled vocabularies. And since agreeing on standard
155+
vocabularies is notoriously difficult, InvenioRDM allows you to use the controlled
156+
vocabularies **you** want. Here we show how to customize your resource types vocabulary,
157+
but the same approach holds true for any other vocabulary.
158+
159+
We start by copying [the default resource types vocabulary file](https://github.com/inveniosoftware/invenio-rdm-records/raw/master/invenio_rdm_records/vocabularies/resource_types.csv)
160+
and modifying it with our own vocabulary entries. Make sure to keep the same headers!
161+
162+
!!! info "Use the hierarchy to your advantage"
163+
You will notice the hierarchy in the default file. It reduces repetition and makes sections visually clear. You can use that pattern for your own entries too.
164+
165+
Save this file in the `app_data/vocabularies/` folder. We call ours `resource_types.csv`. Very original!
166+
Then edit `invenio.cfg` to tell InvenioRDM to use this file.
167+
168+
```python
169+
# imports at the top...
170+
from os.path import abspath, dirname, join
171+
172+
# ...
173+
174+
# At the bottom
175+
# Our custom Vocabularies
176+
RDM_RECORDS_CUSTOM_VOCABULARIES = {
177+
'resource_types': join(
178+
dirname(abspath(__file__)),
179+
'app_data', 'vocabularies', 'resource_types.csv')
180+
}
181+
```
182+
183+
!!! info "Other vocabularies"
184+
See the [Vocabulary source code](https://github.com/inveniosoftware/invenio-rdm-records/blob/master/invenio_rdm_records/vocabularies/__init__.py)
185+
in invenio-rdm-records to know the keys for the other vocabularies.
186+
187+
Restart your server and your vocabulary will now be used for resource types!
153188

154189

155190
## Extend the metadata
191+
TODO
156192

157193

158194
## Change permissions

0 commit comments

Comments
 (0)