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

Fields with JsonldPredicate ID "@type" are not resolved to rdf:type in RDF #277

Open
stmbaier opened this issue Jan 19, 2024 · 1 comment

Comments

@stmbaier
Copy link

In the CWL schema definition files (like CommandLineTool.yml, Process.yml, etc.) multiple times fields are declared as having the predicate ID rdf:type like so:

fields:
    - name: class
      jsonldPredicate:
        "_id": "@type"
        "_type": "@vocab"

For CWL files, which are instances of the CWL schema, this works totally fine and leads to the desired instance-of relation in RDF, e.g. class: CommandLineTool in CWL YAML gets transformed to a cwl:CommandLineTool in RDF.

But if the CWL schema itself is transformed to RDF with SALAD and the metaschema.yml the ID of JsonldPredicate object of the field is tranformed to sld:_id <file:///LOCAL/PATH/TO/CWL-SCHEMA-DIRECTORY/@type>, which is clearly ill-formed and should instead also lead to rdf:type.
According to the SALAD schema definition the _id of JsonldPredicate is resolved according to vocabulary resolution, which starts with link resolution. And as the link resolution rules do not state any special cases for URIs starting with @ the interpretation as relative reference seems legit and leads to the ill-formed predicate IRI.
So in my eyes the CWL schema files must not use '@type' for _id of JsonldPredicates, but instead should use rdf:type (+ rdf namespace definition).

Is this analysis correct and its a bug or have I missed anything from the definitions?

@tetron
Copy link
Member

tetron commented Jan 19, 2024

I think this is right, it isn't being handled correctly.

One way to fix this in the metaschema would be to introduce some new enum types. This would introduce @type, @id and @vocab into the vocabulary.

eg

        type: enum
        name: JsonldPredicateIdEnum
        symbols:
          - "sld:@type"

        type: enum
        name: JsonldPredicateTypeEnum
        symbols:
          - "sld:@id"
          - "sld:@vocab"

And then

- name: JsonldPredicate
  type: record
  doc: |
    Attached to a record field to define how the parent record field is handled for
    URI resolution and JSON-LD context generation.
  fields:
    - name: _id
      type: ["null", JsonldPredicateIdEnum, string]
      jsonldPredicate:
        _id: sld:_id
        _type: "@id"
        identity: true
      doc: |
        The predicate URI that this field corresponds to.
        Corresponds to JSON-LD `@id` directive.
    - name: _type
      type: ["null", JsonldPredicateTypeEnum, string]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants