TaxoDros / TaxoDros.github.io

TaxoDros - The database on Taxonomy of Drosophilidae. Compiled by Gerhard Bächli, Universität Zürich-Irchel, Institut für Evolutionsbiologie und Umweltforschung, Zürich, Switzerland. https://orcid.org/0000-0002-8402-176X
1 stars 0 forks source link

unclear how to add domain specific keywords to Zenodo metadata #18

Closed jhpoelen closed 4 months ago

jhpoelen commented 4 months ago

related to #5

@slint @myrmoteras - I am attempting to add dwc:kingdom etc. fields to deposit metadata records.

I tried

  "metadata": {
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "taxodros-dros5",
    "keywords": [
      "Biodiversity",
      "Taxonomy",
      "fruit flies",
      "flies",
      "terrestrial"
    ],
    "custom": {
      "custom-metadata-community": {
        "kingdom": {
          "scheme": "http://rs.tdwg.org/dwc/terms/kingdom",
          "uri": "https://en.wikipedia.org/wiki/Animalia",
          "value": "Animalia"
        },
        "phylum": {
          "scheme": "http://rs.tdwg.org/dwc/terms/phylum",
          "uri": "https://en.wikipedia.org/wiki/Arthropoda",
          "value": "Arthropoda"
        },
        "class": {
          "scheme": "http://rs.tdwg.org/dwc/terms/class",
          "uri": "https://en.wikipedia.org/wiki/Insecta",
          "value": "Insecta"
        },
        "order": {
          "scheme": "http://rs.tdwg.org/dwc/terms/order",
          "uri": "https://en.wikipedia.org/wiki/Diptera",
          "value": "Diptera"
        }
      }
    },

but Zenodo is not eating it and producing 500 error.

Removing the custom fields, but keeping the keywords work ok.

Would you happen to have an example of custom keyword submission . I dug around for quite awhile on GitHub / docs, but somehow was unable to find an example.

jhpoelen commented 4 months ago

@gsautter - would you happen to have some examples on how to encode dwc custom fields in Zenodo metadata? For some reason, the associated Zenodo metadata produced by the Zenodo API cannot be used to submit metadata to update deposits.

For example:

curl "https://zenodo.org/api/records/10727949"\
 | jq .metadata.custom

yields:

{
  "dwc:family": [
    "Solariellidae"
  ],
  "dwc:genus": [
    "Bathymophila"
  ],
  "dwc:kingdom": [
    "Animalia"
  ],
  "dwc:order": [
    "Trochida"
  ],
  "dwc:phylum": [
    "Mollusca"
  ],
  "dwc:scientificNameAuthorship": [
    "Dall"
  ],
  "dwc:taxonRank": [
    "genus"
  ],
  "openbiodiv:TaxonomicConceptLabel": [
    "Bathymophila Dall, 1881 sec. Herbert, 2024"
  ]
}

and shows up under the "biodiversity" section on the rendered webpage at https://zenodo.org/records/10727949 (see screenshot)

image

However, when I try to add the "custom" tag under metadata with the same values. . . the deposit is rejected by Zenodo.

@gsautter @slint How should I format a zenodo metadata json to include the informative custom dwc tags?

slint commented 4 months ago

@jhpoelen can you share the 500 error body you're getting? The payload for custom fields looks like:

curl -X POST "$BASE_URL/api/deposit/depositions" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ACCESS_TOKEN" \
    --data @- << EOF
{
    "metadata": {
        ...
        "custom": {
            "dwc:family": ["Felidae"],
            "dwc:genus": ["Felis"],
            "dwc:collectionCode": ["FSJK", "NHMUK", "NM"]
        }
    }
}
EOF

So similar to what you see coming back form the API. I suspect that you're getting some other type of error which we're not handling correctly (does removing the "custom" key give back a good response?. just read again through the issue, it doesn't indeed).


Also, I wouldn't see the Lycophron documentation as a reference, since we're using it right now as an opportunity to update inputs based on the post-migration schema.

jhpoelen commented 4 months ago

@slint thanks for your prompt reply. It appears I was dealing with a gremlin https://en.wikipedia.org/wiki/Gremlin, because my current sandbox integration test does appear to populate the biodiversity data fields.

I was able to upload metadata - https://github.com/bio-guoda/preston/blob/2554fecd89fb4945a29825ece7ade845c8ce1db0/preston-zenodo/src/test/resources/bio/guoda/preston/zenodo/zenodo-metadata-with-keywords.json

to produce the following draft sandbox deposit (see screenshot)

Screenshot from 2024-02-29 09-28-31

jhpoelen commented 4 months ago

I now see the errors in my ways, and should be blaming those poor Gremlins. . .

I was providing:

"custom": [ { "dwc:kingdom": ["Animalia"] }, { ... ]

instead of the expected:

"custom": { "dwc:kingdom": ["Animalia"], ... }

Thanks for your guidance and patience.

jhpoelen commented 4 months ago

Note that I was able to successfully upload a sandbox deposit that includes keywords as well as biodiversity domain specific dwc fields.

see https://sandbox.zenodo.org/records/32041

and attached screenshot.

image

image

@slint @myrmoteras thanks for your patience.