describo / crate-builder-component

A VueJS UI component to build an RO-Crate
MIT License
6 stars 3 forks source link

Profile inconsistencies with overriden values #62

Closed beepsoft closed 10 months ago

beepsoft commented 10 months ago

I have created a use case for this issue in the development app here:

https://github.com/dsd-sztaki-hu/crate-builder-component/tree/file-profile-problem

Use the "Single file" crate and the "A profile for single-file.json test".

Here's the problem I found. I have this crate with a single File:

{
  "@context": [
    "https://w3id.org/ro/crate/1.1/context",
    {
      "@vocab": "http://schema.org/"
    },
    {
      "txc": {
        "@id": "http://purl.archive.org/textcommons/terms#"
      }
    },
    {
      "@base": null
    }
  ],
  "@graph": [
    {
      "@id": "ro-crate-metadata.json",
      "@type": "CreativeWork",
      "conformsTo": {
        "@id": "https://w3id.org/ro/crate/1.1"
      },
      "about": {
        "@id": "./"
      }
    },
    {
      "@id": "./",
      "@type": [
        "Dataset"
      ],
      "name": "./",
      "hasPart": {
        "@id": "Some file"
      }
    },
    {
      "@id": "Some file",
      "@type": [
        "File"
      ],
      "name": "Some file",
      "@reverse": {
        "hasPart": {
          "@id": "./"
        }
      }
    }
  ]
}

I try to use it with this profile:

{
    "metadata": {
        "name": "A profile for single-file.json test",
        "description": "",
        "version": 0.1,
        "warnMissingProperty": true
    },
    "classes": {
        "Dataset": {
            "definition": "override",
            "subClassOf": [],
            "inputs": [
                {
                    "id": "https://schema.org/text",
                    "name": "text",
                    "label": "text",
                    "help": "help message",
                    "required": true,
                    "multiple": true,
                    "type": ["Text"]
                },
                {
                    "name": "encodingFormat",
                    "label": "Encoding format from profile in Dataset",
                    "help": "Encoding format help from profile",
                    "type": [
                        "URL",
                        "Text"
                    ],
                    "required": true,
                    "multiple": false
                }
            ]
        },
        "File":{
            "definition": "override",
            "subClassOf": [],
            "inputs": [
                {
                    "name": "contentSize",
                    "label": "Content size from profile",
                    "help": "Content size help from profile",
                    "type": [
                        "Text"
                    ],
                    "required": true,
                    "multiple": false
                },
                {
                    "name": "encodingFormat",
                    "label": "Encoding format from profile in File",
                    "help": "Encoding format help from profile",
                    "type": [
                        "URL",
                        "Text"
                    ],
                    "required": true,
                    "multiple": false
                },
                {
                    "name": "description",
                    "label": "Description from profile",
                    "help": "Description help from profile",
                    "type": [
                        "Text"
                    ],
                    "required": false,
                    "multiple": false
                },
                {
                    "id":"http://nonschema.org/randomValue",
                    "name": "nonSchemaDotOrgValue",
                    "label": "Non schema dot org value",
                    "help": "Non schema dot org value help",
                    "type": [
                        "Text"
                    ],
                    "required": true,
                    "multiple": true
                }
            ]
        }
    }
}

Both the Dataset and the File class has encodingFormat property with the same input definition.

Now, when I try to edit this crate with this profile I can see an input for "encodingFormat" appear in the Dataset,

image

but not in File:

image

encodingFormat is part of schema.org. I also added contentSize and description to File class and I could override contentSize and have an input for it, but not for description just like with encodingFormat.

If I add an explicit schema.org id to the input definition, then it appears:

                {
                    "id": "http://schema.org/encodingFormat",
                    "name": "encodingFormat",
                    "label": "Encoding format from profile in File",
                    "help": "Encoding format help from profile",
                    "type": [
                        "URL",
                        "Text"
                    ],
                    "required": true,
                    "multiple": false
                },

How do you think this supposed to work?

I tested this with 0.38.3 but this behavior also appears in 0.37.2.

marcolarosa commented 10 months ago

That has to be a bug. I will look into it. All of the properties in a profile should be visible regardless of whether they overlap with an existing schema.org definition.

marcolarosa commented 10 months ago

Ok. Having a look at this some more it's not a bug but the behaviour is odd and misleading.

Describo doesn't automatically verify definitions in the profile against schema.org in order to fill in missing info for fields that are defined there. Without the id the profile is invalid and describo removes it. You can check profiles at https://describo.github.io/profiles/ and see that it reports the missing id as an error. If you add id's to all of the entries in your profile you will see that the profile validates.

The design idea is that profiles are things that are written by metadata experts, verified and then made available to the user community. So, describo assumes that the profile is correct and complete and defines exactly what the author wants the user to be able to do. By not providing an id, describo can't handle that entry. It won't try to fill in missing information from schema.org which I think would complicate things unnecessarily and lead to potentially unexpected behaviour.

beepsoft commented 10 months ago

Ok, it is completely fine to expect a completely authored profile with id-s. I just thought you do some magic about schema.org definitions and that's why schema.org symbols work without id-s - sometimes, at least.