Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: codemetapy incorrectly expands a url into a nested Person inside of a Person #46

Closed
apirogov opened this issue Aug 8, 2023 · 2 comments
Assignees
Labels
bug Something isn't working ready Done/implemented, but release still pending

Comments

@apirogov
Copy link

apirogov commented Aug 8, 2023

Inputs:

package.json:

{
  "name": "somesy",
  "version": "0.1.0",
  "description": "A cli tool for synchronizing CITATION.CFF with project files.",
  "keywords": [
    "metadata",
    "FAIR"
  ],
  "license": "MIT",
  "repository": {
    "type": "git",
    "url": "https://github.com/Materials-Data-Science-and-Informatics/somesy"
  },
  "homepage": "https://materials-data-science-and-informatics.github.io/somesy",
  "author": {
    "name": "Mustafa Soylu",
    "email": "m.soylu@fz-juelich.de",
    "url": "https://orcid.org/0000-0003-2637-0432"
  },
  "contributors": [
    {
      "name": "Mustafa Soylu",
      "email": "m.soylu@fz-juelich.de",
      "url": "https://orcid.org/0000-0003-2637-0432"
    },
    {
      "name": "Anton Pirogov",
      "email": "a.pirogov@fz-juelich.de",
      "url": "https://orcid.org/0000-0002-5077-7497"
    },
    {
      "name": "Jens Br\u00f6der",
      "email": "j.broeder@fz-juelich.de",
      "url": "https://orcid.org/0000-0001-7939-226X"
    }
  ],
  "main": "index.js",
  "scripts": {
    "test": "echo \"No tests available\""
  },
  "dependencies": {
    "lodash": "^4.17.21",
    "axios": "^0.21.1"
  },
  "devDependencies": {
    "jest": "^27.0.6"
  }
}

extra_codemeta.json:

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "author": [
    {
      "@id": "https://orcid.org/0000-0003-2637-0432",
      "@type": "Person",
      "familyName": "Soylu",
      "givenName": "Mustafa"
    },
    {
      "@id": "https://orcid.org/0000-0002-5077-7497",
      "@type": "Person",
      "familyName": "Pirogov",
      "givenName": "Anton"
    }
  ],
  "codeRepository": "https://github.com/Materials-Data-Science-and-Informatics/somesy",
  "description": "A cli tool for synchronizing CITATION.CFF with project files.",
  "keywords": [
    "metadata",
    "FAIR"
  ],
  "license": "https://spdx.org/licenses/MIT",
  "name": "somesy",
  "url": "https://materials-data-science-and-informatics.github.io/somesy",
  "version": "0.1.0"
}

Output (codemetapy package.json extra_codemeta.json):

[...]
    "contributor": [
        {
            "@type": "Person",
            "email": "m.soylu@fz-juelich.de",
            "familyName": "Soylu",
            "givenName": "Mustafa",
            "url": {
                "@id": "https://orcid.org/0000-0003-2637-0432",
                "@type": "Person",
                "familyName": "Soylu",
                "givenName": "Mustafa"
            }
        },
        {
            "@type": "Person",
            "email": "a.pirogov@fz-juelich.de",
            "familyName": "Pirogov",
            "givenName": "Anton"
        },
        {
            "@type": "Person",
            "email": "j.broeder@fz-juelich.de",
            "familyName": "Bröder",
            "givenName": "Jens"
        }
    ],
[...]

The fact that the Orcid / URL field vanishes for other contributors I reported in #45

but the other independent problem is that apparently something in the merge goes wrong - the url is expanded into another person object, leading to this weird and incorrect nested Person entry.

Expected: The url is not expanded into a nested Person. Either map it to @id, or keep it as url (because url could also be a homepage, and that is a bad @id if you merge from different sources could cause problems assuming that url is a good Person @id, unless its an ORCID), I don't know, but it should remain a string.

@proycon
Copy link
Owner

proycon commented Sep 13, 2023

Ouch, this is indeed problematic. Codemetapy is a bit eager to turn strings
into resource references if there is such @id in the graph. It's a bit hacky
but it removes a certain class of errors. This however is a clear case where it
goes wrong. I'll probably exempt the url property (and some more like it)
from this behaviour so that it will solve at least this case.

@proycon proycon added the bug Something isn't working label Sep 13, 2023
@proycon proycon self-assigned this Sep 13, 2023
proycon added a commit that referenced this issue Sep 13, 2023
… exempt certain properties like 'url' from this behaviour #46
@proycon proycon added the ready Done/implemented, but release still pending label Sep 13, 2023
@proycon
Copy link
Owner

proycon commented Sep 18, 2023

Fixed and released now

@proycon proycon closed this as completed Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready Done/implemented, but release still pending
Projects
None yet
Development

No branches or pull requests

2 participants