Skip to content

Added the cvoc-interface.js file to the application resources#60

Merged
janvanmansum merged 2 commits intoDANS-KNAW:external-cvocfrom
PaulBoon:FixInterfaceJs
Mar 23, 2021
Merged

Added the cvoc-interface.js file to the application resources#60
janvanmansum merged 2 commits intoDANS-KNAW:external-cvocfrom
PaulBoon:FixInterfaceJs

Conversation

@PaulBoon
Copy link
Copy Markdown

@PaulBoon PaulBoon commented Mar 23, 2021

How to test this

  • Clone, built and deploy this war file
  • Apply sql statements to update Dataverse database:
    psql dvndb -f cv-update.sql
    Warning: dvndb is postgresql database, it can be different in your installation.
    cv-update.sql.zip
  • Add this custom metadata block (cvocdemo.tsv) to Dataverse
    See: http://guides.dataverse.org/en/latest/admin/metadatacustomization.html for an explanation of the steps to perform.
    cvocdemo.tsv.zip
  • Enable the 'cvocDemo Metadata' Metadata Block for the dataverse where you are creating the dataset to test with
  • Configure Dataverse to use the external-cvoc feature on the metdata block.
    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/:CVocConf
    cvoc-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.
Screenshot cvocDome-empty

With one vocab (unesco)
Screenshot cvocDemo-one-vocab

With several vocabs
Screenshot cvocDemo-multi-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.

@janvanmansum janvanmansum merged commit 5d78401 into DANS-KNAW:external-cvoc Mar 23, 2021
PaulBoon pushed a commit to PaulBoon/dataverse that referenced this pull request May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants