ontoportal-lirmm / ontologies_linked_data

Models and serializers for ontologies and related artifacts backed by 4store
Other
0 stars 6 forks source link

Support Multilingual: Read one language from request parameter #63

Closed syphax-bouazzouni closed 9 months ago

syphax-bouazzouni commented 1 year ago

Use case

INRAETHES has two languages French and English We will use as use cas in INRAETHES the concept https://stageportal.lirmm.fr/ontologies/INRAETHES?p=classes&conceptid=http%3A%2F%2Fopendata.inrae.fr%2FthesaurusINRAE%2Fc_2ecd2d30
What we have in the data

<rdf:Description rdf:about="http://opendata.inrae.fr/thesaurusINRAE/c_2ecd2d30">
  <rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>
  <skos:inScheme rdf:resource="http://opendata.inrae.fr/thesaurusINRAE/thesaurusINRAE"/>
  <skos:inScheme rdf:resource="http://opendata.inrae.fr/thesaurusINRAE/mt_98"/>
  <skos:topConceptOf rdf:resource="http://opendata.inrae.fr/thesaurusINRAE/mt_98"/>
  <skos:broader rdf:resource="http://opendata.inrae.fr/thesaurusINRAE/d_1102"/>
  <dct:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2022-09-09T10:11:21</dct:created>
  <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2022-09-09T10:14:13</dct:modified>

  # prefLabel
  <skos:prefLabel xml:lang="fr">absorptiométrie biphotonique à rayons X</skos:prefLabel>
  <skos:prefLabel xml:lang="en">dual x-ray absorptiometry</skos:prefLabel>

  # Synonyms
  <skos:altLabel xml:lang="fr">ostéodensitométrie</skos:altLabel>
  <skos:altLabel xml:lang="fr">densitométrie minérale osseuse</skos:altLabel>
  <skos:altLabel xml:lang="en">DXA</skos:altLabel>
  <skos:altLabel xml:lang="en">dual-energy x-ray absorptiometry</skos:altLabel>
  <skos:altLabel xml:lang="en">osteodensitometry</skos:altLabel>
  <skos:altLabel xml:lang="en">bone densitometry</skos:altLabel>
  <skos:altLabel xml:lang="en">DEXA</skos:altLabel>
</rdf:Description>

What we show currently in the API From https://data.stageportal.lirmm.fr/ontologies/INRAETHES/classes/http%3A%2F%2Fopendata.inrae.fr%2FthesaurusINRAE%2Fc_2ecd2d30

"prefLabel": "dual x-ray absorptiometry",
"synonym": [
        "dual-energy x-ray absorptiometry",
        "osteodensitometry",
        "DXA",
        "bone densitometry",
        "DEXA"
]

What we have in the triple store From https://data.stageportal.lirmm.fr/ontologies/INRAETHES/classes/http%3A%2F%2Fopendata.inrae.fr%2FthesaurusINRAE%2Fc_2ecd2d30?display=properties

"properties": {
    "http://www.w3.org/2004/02/skos/core#prefLabel": [
        "absorptiométrie biphotonique à rayons X",
        "dual x-ray absorptiometry"
    ],
        "http://www.w3.org/2004/02/skos/core#altLabel": [
        "dual-energy x-ray absorptiometry",
        "osteodensitometry",
        "DXA",
        "bone densitometry",
        "DEXA",
        "densitométrie minérale osseuse",
        "ostéodensitométrie"
    ],
    "http://www.w3.org/2004/02/skos/core#topConceptOf": [
        "http://opendata.inrae.fr/thesaurusINRAE/mt_98"
    ],
    "http://www.w3.org/2004/02/skos/core#inScheme": [
        "http://opendata.inrae.fr/thesaurusINRAE/mt_98",
        "http://opendata.inrae.fr/thesaurusINRAE/thesaurusINRAE"
    ],
    "http://purl.org/dc/terms/created": [
        "2022-09-09T10:11:21"
    ],
    "http://www.w3.org/2004/02/skos/core#broader": [
        "http://opendata.inrae.fr/thesaurusINRAE/d_1102"
    ],
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
        "http://www.w3.org/2004/02/skos/core#Concept",
        "http://www.w3.org/2002/07/owl#NamedIndividual"
    ],
    "http://purl.org/dc/terms/modified": [
        "2022-09-09T10:14:13"
    ]
},

The target state (phase one)

1- Default portal language (done) :

From https://data.stageportal.lirmm.fr/ontologies/INRAETHES/classes/http%3A%2F%2Fopendata.inrae.fr%2FthesaurusINRAE%2Fc_2ecd2d30 We show the prefLabel and synonyms of the default portal language (english), as already done now

2- Add request language parameter:

If we call this https://data.stageportal.lirmm.fr/ontologies/INRAETHES/classes/http%3A%2F%2Fopendata.inrae.fr%2FthesaurusINRAE%2Fc_2ecd2d30?lang=fr

we should display this in the API


"prefLabel": "absorptiométrie biphotonique à rayons X",
"synonym": [
        "densitométrie minérale osseuse",
        "ostéodensitométrie"
]

If we call this https://data.stageportal.lirmm.fr/ontologies/INRAETHES/classes/http%3A%2F%2Fopendata.inrae.fr%2FthesaurusINRAE%2Fc_2ecd2d30?lang=en

we should display this in the API (current default)

"prefLabel": "dual x-ray absorptiometry",
"synonym": [
        "dual-energy x-ray absorptiometry",
        "osteodensitometry",
        "DXA",
        "bone densitometry",
        "DEXA"
]

TODO

syphax-bouazzouni commented 1 year ago

as reference an example of a JSON-LD

image
syphax-bouazzouni commented 1 year ago

Deployed in testportal

syphax-bouazzouni commented 9 months ago

Deployed in production in https://github.com/ontoportal-lirmm/bioportal_web_ui/pull/240