cwl-v1.2
cwl-v1.2 copied to clipboard
Fields with JsonldPredicate ID "@type" are not resolved to rdf:type in RDF
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?
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]