euroargodev / argopy

A python library for Argo data beginners and experts
https://argopy.readthedocs.io
European Union Public License 1.2
189 stars 41 forks source link

Content response from NERC Vocabulary Server seems change that makes ArgoNVSReferenceTables fail #377

Closed gmaze closed 3 months ago

gmaze commented 3 months ago

Discussed in https://github.com/euroargodev/argopy/discussions/376

Originally posted by **cywhale** August 8, 2024 ``` from argopy import ArgoNVSReferenceTables R = ArgoNVSReferenceTables() print(R) # got R.search('sensor') ``` DataNotFound: "['https://vocab.nerc.ac.uk/collection/R01/current/?_profile=nvs&_mediatype=application/ld+json', 'https://vocab.nerc.ac.uk/collection/RR2/current/?_profile=nvs&_mediatype=application/ld+json', #..skip... 'https://vocab.nerc.ac.uk/collection/R40/current/?_profile=nvs&_mediatype=application/ld+json']" If I use browser to open each of the URL in the elements of this array, it seems some of the URLs got lost, e.g. https://vocab.nerc.ac.uk/collection/R29/current/?_profile=nvs&_mediatype=application/ld+json But some of them are still alive, e.g. https://vocab.nerc.ac.uk/collection/R13/current/?_profile=nvs&_mediatype=application/ld+json However, even I just read the R13 table by: ``` R.tbl('R13') ``` Got KeyError: 'altLabel' It seems the JSON structure of the reponse changes: ``` { "@graph": [ { "@id": "http://vocab.nerc.ac.uk/collection/R40/current/PI0107/", "pav:authoredOn": "2023-06-22 12:58:04.0", "pav:hasCurrentVersion": { "@id": "http://vocab.nerc.ac.uk/collection/R40/current/PI0107/1/" }, "dce:identifier": "SDN:R40::PI0107", "pav:version": "1", "skos:notation": "SDN:R40::PI0107", "skos:altLabel": "Juliet HERMES", "dc:date": "2023-06-22 12:58:04.0", "owl:versionInfo": "1", "skos:prefLabel": { "@language": "en", "@value": "Juliet HERMES" }, //skip..... } ``` Only 'skos:altLabel' exist. I'm not familiar with `argopy` usage, but it could work when I last used it two months ago. I found no discussions/issuses here or in https://github.com/nvs-vocabs/ArgoVocabs so I'm not sure what's the possible cause for this problem.
gmaze commented 3 months ago

Indeed, it seems that the NVS server has changed the ld+json output format convention !

Past convention was reporting something like this for a "concept"

{
    "@id" : "http://vocab.nerc.ac.uk/collection/R01/current/BTRAJ/",
    "@type" : "skos:Concept",
    "identifier" : "SDN:R01::BTRAJ",
    "date" : "2020-04-04 15:05:33.0",
    "dc:identifier" : "SDN:R01::BTRAJ",
    "authoredOn" : "2020-04-04 15:05:33.0",
    "hasCurrentVersion" : "http://vocab.nerc.ac.uk/collection/R01/current/BTRAJ/1/",
    "version" : "1",
    "inDataset" : "http://vocab.nerc.ac.uk/.well-known/void",
    "deprecated" : "false",
    "versionInfo" : "1",
    "altLabel" : "BTRAJ",
    "definition" : {
      "@language" : "en",
      "@value" : "Argo float trajectory file containing CTD pressure data and data from one or more biogeochemical (BGC) parameters (dissolved oxygen, nitrate, pH, chlorophyll-a, particle backscatter, irradiance)."
    },
    "notation" : "SDN:R01::BTRAJ",
    "note" : {
      "@language" : "en",
      "@value" : "accepted"
    },
    "prefLabel" : {
      "@language" : "en",
      "@value" : "B-Argo trajectory"
    }

while the new, current, server returns:

    {
      "@id": "http://vocab.nerc.ac.uk/collection/R01/current/BTRAJ/",
      "pav:authoredOn": "2020-04-04 15:05:33.0",
      "pav:hasCurrentVersion": {
        "@id": "http://vocab.nerc.ac.uk/collection/R01/current/BTRAJ/1/"
      },
      "dce:identifier": "SDN:R01::BTRAJ",
      "pav:version": "1",
      "skos:notation": "SDN:R01::BTRAJ",
      "skos:altLabel": "BTRAJ",
      "dc:date": "2020-04-04 15:05:33.0",
      "owl:versionInfo": "1",
      "skos:prefLabel": {
        "@language": "en",
        "@value": "B-Argo trajectory"
      },
      "dc:identifier": "SDN:R01::BTRAJ",
      "skos:note": {
        "@language": "en",
        "@value": "accepted"
      },
      "owl:deprecated": "false",
      "void:inDataset": {
        "@id": "http://vocab.nerc.ac.uk/.well-known/void"
      },
      "skos:definition": {
        "@language": "en",
        "@value": "Argo float trajectory file containing CTD pressure data and data from one or more biogeochemical (BGC) parameters (dissolved oxygen, nitrate, pH, chlorophyll-a, particle backscatter, irradiance)."
      },
      "@type": "skos:Concept"
    },

All entries now have a preffix like pav:, dce:, skos:, dc:,owl: and void:

gmaze commented 3 months ago

Reported on NVS repo here: https://github.com/nvs-vocabs/ArgoVocabs/issues/91