codemeta/codemeta-generator

Cannot add a role to a contributor

Closed this issue · 7 comments

When adding a role to a contributor (not an author), I get the error Unknown field "contributor" in "contributor".

cc @hjonin

It is linked to the latest modification; we have to add a contributor property to the roleFieldValidators. However, it means that it does not check if the role is associated to an author (in which case it should be schema:author to be validated) or a contributor (then contributor). Is it still OK with you?

good catch, thanks.

we should check the properties match eventually, but for now let's only change it so it passes. Could you do it?

Adding a reply to this. Should the correct syntax be the following in this instance?

 "author": [
        {
            "id": "_:author_1",
            "type": "Person",
            "givenName": "test"
        },
        {
            "type": "schema:Role",
            "schema:author": "_:author_1",
            "schema:roleName": "test",
            "schema:startDate": "2024-08-15"
        }
    ],
    "contributor": [
        {
            "id": "_:contributor_1",
            "type": "Person",
            "givenName": "Test 2"
        },
        {
            "type": "schema:Role",
            "schema:contributor": "_:contributor_1",
            "schema:roleName": "Test3"
        }
    ]

contributor instead of schema:contributor, but that's correct too

@progval so both are valid?

 "contributor": [
        {
            "id": "_:contributor_1",
            "type": "Person",
            "givenName": "Test 2"
        },
        {
            "type": "schema:Role",
            "schema:contributor": "_:contributor_1",
            "schema:roleName": "Test3"
        }
    ],

 "contributor": [
        {
            "id": "_:contributor_1",
            "type": "Person",
            "givenName": "Test 2"
        },
        {
            "type": "schema:Role",
            "contributor": "_:contributor_1",
            "schema:roleName": "Test3"
        }
    ]

yes, both are semantically equivalent

yes, both are semantically equivalent

Gotcha. It's just that the validator was failing on them. I guess we shall need to wait for an update to the generator