Added the cvoc-interface.js file to the application resources#60
Merged
janvanmansum merged 2 commits intoDANS-KNAW:external-cvocfrom Mar 23, 2021
Merged
Added the cvoc-interface.js file to the application resources#60janvanmansum merged 2 commits intoDANS-KNAW:external-cvocfrom
janvanmansum merged 2 commits intoDANS-KNAW:external-cvocfrom
Conversation
PaulBoon
pushed a commit
to PaulBoon/dataverse
that referenced
this pull request
May 19, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
How to test this
psql dvndb -f cv-update.sqlWarning: dvndb is postgresql database, it can be different in your installation.
cv-update.sql.zip
See: http://guides.dataverse.org/en/latest/admin/metadatacustomization.html for an explanation of the steps to perform.
cvocdemo.tsv.zip
The configuration is in a json file (cvoc-conf.json)
Run the following command to load the config into Dataverse
curl -H "Content-Type: application/json" -X PUT -d @cvoc-conf.json http://localhost:8080/api/admin/settings/:CVocConfcvoc-conf.json.zip
You can change the config and reload it to try different settings. For instance using only the unesco vocabulary with
"vocabs":["unesco"],instead of"vocabs":["unesco","stw","agrovoc"],.The Dataset creation form will now contain this extra block.

Below some screenshots that show what it looks like in different settings.
Without external cvoc enabled on it.
With one vocab (unesco)

With several vocabs

Description of the configuration settings
vocab-name
Name of the compound metadata field (Need to check usage in the code)
cvoc-url
URL of the external vocabulary service that will provide the terms and URI's in the autocomplete
Must now be a SKOSMOS service, because that API is the only one supported by the cvoc-interface.js code; see "js-url" property.
language
Specifies the language for the terms (prefLabel in SKOS) to be retrieved.
By default it's using the language of the server (calling BundleUtil.getDefaultLocale().getLanguage())
js-url
This is the URL that the AJAX code will use to do the requests. It can be an external service, but a simple javascript 'wrapper' around the SKOSMOS API is now being used.
Default is the application resource at: /resources/js/cvoc-interface.js
protocol
Note that only "skosmos" is supported in the cvoc-interface.js. The default is also "skosmos".
vocab-uri
The URI of the vocab, this is now only a single value but should be an array corresponding with the "vocabs" array. (Note that it is an URL we want to put in that input field)
term-parent-uri
The URI of the 'parent' concept acting as a filter for the terms to be retrieved allowing only narrower terms. This enables us to use a 'branch' of a large vocabulary without constructing separate vocabularies for subsets.
vocabs
The list of vocabularies. This should be the 'identifying' names in SKOSMOS.
vocab-codes
The input field names as specified in the metadata block. The order of the fields must be; vocabulary, term, termURI, VocabularyURI.
minChars
Number of characters that must be typed in the 'term' field for the AJAX 'search' request to be sent. Use this with large vocabularies and set it to more characters (1 is usually enough) if the server does not respond fast enough. When it is 0 (default), the complete list will dropdown when the up or down arrow keys are typed.
readonly
Specify if the URL fields should be readonly. Also the vocabulary field is readonly when there is only one vocab configured. The default is false, allowing to type anything into the fields.
hideReadonlyUrls
When in 'readonly' the URL fields are now also hidden on the form. This makes the form more compact and simpler. The default is false, showing all the fields.