cffconvert icon indicating copy to clipboard operation
cffconvert copied to clipboard

Invalid codemeta affiliation key

Open vuillaut opened this issue 2 years ago • 1 comments

The converted codemeta includes an affiliation key legalName which is not valid in the codemeta schema if trying to validate using their online validator: Unknown field "legalName" in "affiliation"

I used CITATION.cff from this repo to test:

cffconvert -u https://raw.githubusercontent.com/citation-file-format/cff-converter-python/main/CITATION.cff -f codemeta -o codemeta_cff.json

vuillaut avatar Mar 16 '22 13:03 vuillaut

Current json, causing the issue:

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "author": [
    {
      "@id": "https://orcid.org/0000-0002-7064-4069",
      "@type": "Person",
      "affiliation": {
        "@type": "Organization",
        "legalName": "Netherlands eScience Center"
      },
      "familyName": "Spaaks",
      "givenName": "Jurriaan H."
    }
],
"codeRepository": "https://github.com/citation-file-format/cff-converter-python",
  "datePublished": "2021-09-22",
  "description": "Command line program to validate and convert CITATION.cff files.",
  "identifier": "https://doi.org/10.5281/zenodo.1162057",
  "license": "https://spdx.org/licenses/Apache-2.0",
  "name": "cffconvert",
  "url": "https://github.com/citation-file-format/cff-converter-python",
  "version": "2.0.0"

The schema should either

  1. use name in the organization instead of legalName
{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "author": [
    {
      "@id": "https://orcid.org/0000-0002-7064-4069",
      "@type": "Person",
      "affiliation": {
        "@type": "Organization",
        "name": "Netherlands eScience Center"
      },
      "familyName": "Spaaks",
      "givenName": "Jurriaan H."
    }
],
"codeRepository": "https://github.com/citation-file-format/cff-converter-python",
  "datePublished": "2021-09-22",
  "description": "Command line program to validate and convert CITATION.cff files.",
  "identifier": "https://doi.org/10.5281/zenodo.1162057",
  "license": "https://spdx.org/licenses/Apache-2.0",
  "name": "cffconvert",
  "url": "https://github.com/citation-file-format/cff-converter-python",
  "version": "2.0.0"
  1. add "http://schema.org/" in the @context (legalName being a valid key in the schema.org context)
{
  "@context": ["https://doi.org/10.5063/schema/codemeta-2.0", "http://schema.org/"],
  "@type": "SoftwareSourceCode",
  "author": [
    {
      "@id": "https://orcid.org/0000-0002-7064-4069",
      "@type": "Person",
      "affiliation": {
        "@type": "Organization",
        "legalName": "Netherlands eScience Center"
      },
      "familyName": "Spaaks",
      "givenName": "Jurriaan H."
    }
],
"codeRepository": "https://github.com/citation-file-format/cff-converter-python",
  "datePublished": "2021-09-22",
  "description": "Command line program to validate and convert CITATION.cff files.",
  "identifier": "https://doi.org/10.5281/zenodo.1162057",
  "license": "https://spdx.org/licenses/Apache-2.0",
  "name": "cffconvert",
  "url": "https://github.com/citation-file-format/cff-converter-python",
  "version": "2.0.0"

vuillaut avatar Mar 16 '22 14:03 vuillaut

Hi @vuillaut

Thanks for reporting this issue, and sorry I didnt respond earlier. I'm not sure what's going on with the generator/validator form, but when I put in either of the snippets from your bullet points 1 and 2 (and add a trailing }), neither works, even though they should both be valid IMO (granted I'm no JSONLD expert).

If I just take the first snippet, add a trailing } and change the context to point to https://schema.org, it does seem to be OK according to https://validator.schema.org/. If I then try to use https://doi.org/10.5063/schema/codemeta-2.0 as a context, https://validator.schema.org/ says it doesn't support remote context fetching. If I try to use https://raw.githubusercontent.com/codemeta/codemeta/2.0/codemeta.jsonld directly, same deal (as expected). However if I paste the contents of https://raw.githubusercontent.com/codemeta/codemeta/2.0/codemeta.jsonld as a local context, then try to validate it, it's all good. I think that means the syntax is OK, for either schema.org or codemeta.

For the record here is that file:

{
  "@context": {
      "type": "@type",
      "id": "@id",
      "schema":"http://schema.org/",
      "codemeta": "https://codemeta.github.io/terms/",
      "Organization": {"@id": "schema:Organization"},
      "Person": {"@id": "schema:Person"},
      "SoftwareSourceCode": {"@id": "schema:SoftwareSourceCode"},
      "SoftwareApplication": {"@id": "schema:SoftwareApplication"},
      "Text": {"@id": "schema:Text"},
      "URL": {"@id": "schema:URL"},
      "address": { "@id": "schema:address"},
      "affiliation": { "@id": "schema:affiliation"},
      "applicationCategory": { "@id": "schema:applicationCategory", "@type": "@id"},
      "applicationSubCategory": { "@id": "schema:applicationSubCategory", "@type": "@id"},
      "citation": { "@id": "schema:citation"},
      "codeRepository": { "@id": "schema:codeRepository", "@type": "@id"},
      "contributor": { "@id": "schema:contributor"},
      "copyrightHolder": { "@id": "schema:copyrightHolder"},
      "copyrightYear": { "@id": "schema:copyrightYear"},
      "creator": { "@id": "schema:creator"},
      "dateCreated": {"@id": "schema:dateCreated", "@type": "schema:Date" },
      "dateModified":  {"@id": "schema:dateModified", "@type": "schema:Date" },
      "datePublished":  {"@id": "schema:datePublished", "@type": "schema:Date" },
      "description": { "@id": "schema:description"},
      "downloadUrl": { "@id": "schema:downloadUrl", "@type": "@id"},
      "email": { "@id": "schema:email"},
      "editor": { "@id": "schema:editor"},
      "encoding": { "@id": "schema:encoding"},
      "familyName": { "@id": "schema:familyName"},
      "fileFormat": { "@id": "schema:fileFormat", "@type": "@id"},
      "fileSize": { "@id": "schema:fileSize"},
      "funder": { "@id": "schema:funder"},
      "givenName": { "@id": "schema:givenName"},
      "hasPart": { "@id": "schema:hasPart" },
      "identifier": { "@id": "schema:identifier", "@type": "@id"},
      "installUrl": { "@id": "schema:installUrl", "@type": "@id"},
      "isAccessibleForFree": { "@id": "schema:isAccessibleForFree"},
      "isPartOf":  { "@id": "schema:isPartOf"},
      "keywords": { "@id": "schema:keywords"},
      "license": { "@id": "schema:license", "@type": "@id"},
      "memoryRequirements": { "@id": "schema:memoryRequirements", "@type": "@id"},
      "name": { "@id": "schema:name"},
      "operatingSystem": { "@id": "schema:operatingSystem"},
      "permissions": { "@id": "schema:permissions"},
      "position": { "@id": "schema:position"},
      "processorRequirements": { "@id": "schema:processorRequirements"},
      "producer": { "@id": "schema:producer"},
      "programmingLanguage": { "@id": "schema:programmingLanguage"},
      "provider": { "@id": "schema:provider"},
      "publisher": { "@id": "schema:publisher"},
      "relatedLink": { "@id": "schema:relatedLink", "@type": "@id"},
      "releaseNotes": { "@id": "schema:releaseNotes", "@type": "@id"},
      "runtimePlatform": { "@id": "schema:runtimePlatform"},
      "sameAs": { "@id": "schema:sameAs", "@type": "@id"},
      "softwareHelp": { "@id": "schema:softwareHelp"},
      "softwareRequirements": { "@id": "schema:softwareRequirements", "@type": "@id"},
      "softwareVersion": { "@id": "schema:softwareVersion"},
      "sponsor": { "@id": "schema:sponsor"},
      "storageRequirements": { "@id": "schema:storageRequirements", "@type": "@id"},
      "supportingData": { "@id": "schema:supportingData"},
      "targetProduct": { "@id": "schema:targetProduct"},
      "url": { "@id": "schema:url", "@type": "@id"},
      "version": { "@id": "schema:version"},
        
      "author": { "@id": "schema:author", "@container": "@list" },
      
      "softwareSuggestions": { "@id": "codemeta:softwareSuggestions", "@type": "@id"},
      "contIntegration": { "@id": "codemeta:contIntegration", "@type": "@id"},
      "buildInstructions": { "@id": "codemeta:buildInstructions", "@type": "@id"},
      "developmentStatus": { "@id": "codemeta:developmentStatus", "@type": "@id"},
      "embargoDate": { "@id":"codemeta:embargoDate", "@type": "schema:Date" },
      "funding": { "@id": "codemeta:funding" },
      "readme": { "@id":"codemeta:readme", "@type": "@id" },
      "issueTracker": { "@id":"codemeta:issueTracker", "@type": "@id" },
      "referencePublication": { "@id": "codemeta:referencePublication", "@type": "@id"},
      "maintainer": { "@id": "codemeta:maintainer" }
  },
  "@type": "SoftwareSourceCode",
  "author": [
    {
      "@id": "https://orcid.org/0000-0002-7064-4069",
      "@type": "Person",
      "affiliation": {
        "@type": "Organization",
        "legalName": "Netherlands eScience Center"
      },
      "familyName": "Spaaks",
      "givenName": "Jurriaan H."
    }
],
"codeRepository": "https://github.com/citation-file-format/cff-converter-python",
  "datePublished": "2021-09-22",
  "description": "Command line program to validate and convert CITATION.cff files.",
  "identifier": "https://doi.org/10.5281/zenodo.1162057",
  "license": "https://spdx.org/licenses/Apache-2.0",
  "name": "cffconvert",
  "url": "https://github.com/citation-file-format/cff-converter-python",
  "version": "2.0.0"}

So, I'm not really sure what to make of this, maybe it's a problem with the generator/validator?

(after more digging)

I think it might be because the codemeta validator implements its own checking, and for Organizations such as affiliation, it does not recognize the legalName key:

https://github.com/codemeta/codemeta-generator/blob/58080681f7d11957a9e3befceea6f071fdf7b9dd/js/validation/things.js#L295-L309

It looks like something else is going wrong as well though, because your name code snippet from bullet point 1 should work according to organizationFieldValidators from the link above. I can only make affiliation work if I use name instead of legalName AND move affiliation below the other keys within a given author.

For now, I'm just gonna leave this alone, feel free to reopen the issue if you feel there's more to it.

Best regards, Jurriaan

jspaaks avatar Jul 11 '23 16:07 jspaaks