JMESPath for label required for multilingual vocabulary

Created on 25 December 2024, 26 days ago

Problem/Motivation

I'd like to use the Nomenclature Vocabulary's API and its results looks like this (abbreviated):

[
    {
        "altLabel": [
            {
                "literalForm": {
                    "language": "en",
                    "value": "tea towel"
                }
            },
            {
                "literalForm": {
                    "language": "en",
                    "value": "flour sack towel"
                }
            }
        ],
        "definition": [
            {
                "literalForm": {
                    "language": "en",
                    "value": "A rectangular piece of fabric, often in cotton or linen. Used in the kitchen to dry dishes and cutlery after having been washed.  Used also at tea time to keep the tea warm, prevent drips and protect the hands from burning."
                }
            },
            {
                "literalForm": {
                    "language": "fr",
                    "value": "Pièce de tissu rectangulaire, souvent en coton ou en lin. Utilisée dans la cuisine, sert à essuyer la vaisselle et la coutellerie après leur nettoyage. Sert également à l'heure du thé pour garder le thé chaud, pour prévenir des écoulements et pour protéger les mains de brûlure."
                }
            }
        ],
        "deprecated": false,
        "id": "8967",
        "mainEntityOfPage": "https://page.nomenclature.info/parcourir-browse.app?id=8967",
        "prefLabel": [
            {
                "literalForm": {
                    "language": "en",
                    "value": "dish towel"
                }
            },
            {
                "literalForm": {
                    "language": "es",
                    "value": "toallas de cocina"
                }
            },
            {
                "literalForm": {
                    "language": "fr",
                    "value": "torchon à vaisselle"
                }
            },
            {
                "literalForm": {
                    "language": "fr-CA",
                    "value": "linge à vaisselle"
                }
            }
        ],
        "resourceType": [
            "http://www.w3.org/2004/02/skos/core#Concept",
            "http://schema.org/CreativeWork",
            "http://www.cidoc-crm.org/cidoc-crm/E55_Type"
        ],
        "self": "https://nomenclature.info/api/v1/concepts/8967",
        "uri": "https://nomenclature.info/nom/8967"
    }
]

The problems I immediately encountered are:

* To extract the label relative to the result record, I need to enter a JMESPath (i.e. prefLabel[?literalForm.language=='en'].literalForm.value | [0]) but the interface only allows me to enter a simple json key.
* The form interface only allows 50 characters and my JMESPath is longer than that.
* It seems that having a Result path of the empty string '' does not work, despite the docs saying it should.

Steps to reproduce

* Add a vocabulary such as Nomenclature that has multilingual prefLabels. Try to set up a path to extract the label!

Proposed resolution

* MR forthcoming

Remaining tasks

Worth a different ticket, it would be nice to make a multilingual taxonomy term entry from the languages available.

User interface changes

changing the max length of the "label" and "uri" fields to longer than 50 chars

API changes

none

Data model changes

none

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada rosiel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024