common-workflow-language / cwltool

Common Workflow Language reference implementation
https://www.commonwl.org
Apache License 2.0
324 stars 225 forks source link

Wrong rdfs namespace in cwltool --print-rdf #427

Open stain opened 7 years ago

stain commented 7 years ago

Expected Behavior

cwltool --print-rdf should use conventional valid namespaces where they exist.

Actual Behavior

Wrong prefix for the rdfs namespace, seems to be caused by <rdfs:comment> being interpreted as an URI instead of a qname mapped to the rdfs namespace http://www.w3.org/2000/01/rdf-schema#

@prefix ns1: <rdfs:> .

Workflow Code

https://rawgit.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl

Full Traceback

 cwltool --print-rdf  https://rawgit.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl
@prefix SoftwareRequirement: <https://w3id.org/cwl/cwl#SoftwareRequirement/> .
@prefix Workflow: <https://w3id.org/cwl/cwl#Workflow/> .
@prefix cwl: <https://w3id.org/cwl/cwl#> .
@prefix ns1: <rdfs:> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
..
<https://rawgit.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0/62398b9b-8399-4f05-87e7-7abc669d9c0d/message> cwl:default "Hello World" ;
    cwl:inputBinding [ CommandLineBinding:position 1 ],
        [ CommandLineBinding:position 1 ] ;
    sld:type xsd:string ;
    ns1:comment "The message to print" .

Your Environment

stain commented 7 years ago

Could it be because Process.yml and Workflow.yml schemas uses:

- name: SchemaBase
  type: record
  abstract: true
  fields:
    - name: label
      type:
        - "null"
        - string
      jsonldPredicate: "rdfs:label"
      doc: "A short, human-readable label of this object."

yet does not declare rdfs as a namespace?

$namespaces:
  cwl: "https://w3id.org/cwl/cwl#"
  sld: "https://w3id.org/cwl/salad#"
tetron commented 7 years ago

I think that might be it.

MarkRobbo commented 7 years ago

Solved by common-workflow-language/common-workflow-language#461 hopefully

mr-c commented 7 years ago

@MarkRobbo Yes, I'll make the PR to update the git sub-tree next

mr-c commented 7 years ago

@MarkRobbo I made a new release of cwltool: v1.0.20170622090721 -- please re-open if that doesn't work for you!

MarkRobbo commented 7 years ago

@mr-c Thanks a lot!

MarkRobbo commented 7 years ago

Although the namespace is now present, so still is the incorrect one under "ns1" and that is the one being used.

@prefix CommandLineBinding: <https://w3id.org/cwl/cwl#CommandLineBinding/> .
@prefix CommandLineTool: <https://w3id.org/cwl/cwl#CommandLineTool/> .
@prefix CommandOutputBinding: <https://w3id.org/cwl/cwl#CommandOutputBinding/> .
@prefix Dirent: <https://w3id.org/cwl/cwl#Dirent/> .
@prefix DockerRequirement: <https://w3id.org/cwl/cwl#DockerRequirement/> .
@prefix EnvVarRequirement: <https://w3id.org/cwl/cwl#EnvVarRequirement/> .
@prefix EnvironmentDef: <https://w3id.org/cwl/cwl#EnvironmentDef/> .
@prefix ExpressionTool: <https://w3id.org/cwl/cwl#ExpressionTool/> .
@prefix File: <https://w3id.org/cwl/cwl#File/> .
@prefix InlineJavascriptRequirement: <https://w3id.org/cwl/cwl#InlineJavascriptRequirement/> .
@prefix LinkMergeMethod: <https://w3id.org/cwl/cwl#LinkMergeMethod/> .
@prefix Parameter: <https://w3id.org/cwl/cwl#Parameter/> .
@prefix ResourceRequirement: <https://w3id.org/cwl/cwl#ResourceRequirement/> .
@prefix ScatterMethod: <https://w3id.org/cwl/cwl#ScatterMethod/> .
@prefix SchemaDefRequirement: <https://w3id.org/cwl/cwl#SchemaDefRequirement/> .
@prefix SoftwarePackage: <https://w3id.org/cwl/cwl#SoftwarePackage/> .
@prefix SoftwareRequirement: <https://w3id.org/cwl/cwl#SoftwareRequirement/> .
@prefix Workflow: <https://w3id.org/cwl/cwl#Workflow/> .
@prefix cwl: <https://w3id.org/cwl/cwl#> .
@prefix ns1: <rdfs:> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sld: <https://w3id.org/cwl/salad#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl> a cwl:Workflow ;
    Workflow:steps <https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0> ;
    cwl:cwlVersion cwl:v1.0 ;
    cwl:outputs <https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#response> ;
    ns1:comment "Outputs a message using echo" ;
    ns1:label "Hello World" .

<https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#response> cwl:outputSource <https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0/response> ;
    sld:type cwl:File .

<https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0> cwl:out <https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0/response> ;
    cwl:run <https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0/9b29e671-b1ba-4ff4-99e7-1cadf44ee363> .

<https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0/9b29e671-b1ba-4ff4-99e7-1cadf44ee363> a cwl:CommandLineTool ;
    cwl:baseCommand ( "echo" ),
        ( "echo" ) ;
    cwl:inputs <https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0/9b29e671-b1ba-4ff4-99e7-1cadf44ee363/message> ;
    cwl:outputs <https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0/9b29e671-b1ba-4ff4-99e7-1cadf44ee363/response> ;
    cwl:stdout "response.txt" .

<https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0/9b29e671-b1ba-4ff4-99e7-1cadf44ee363/message> cwl:default "Hello World" ;
    cwl:inputBinding [ CommandLineBinding:position 1 ],
        [ CommandLineBinding:position 1 ] ;
    sld:type xsd:string ;
    ns1:comment "The message to print" .

<https://raw.githubusercontent.com/common-workflow-language/workflows/master/workflows/hello/hello.cwl#step0/9b29e671-b1ba-4ff4-99e7-1cadf44ee363/response> cwl:outputBinding [ CommandOutputBinding:glob "response.txt" ],
        [ CommandOutputBinding:glob "response.txt" ] ;
    sld:type cwl:File .
mr-c commented 7 years ago

@MarkRobbo Ah, I thought you had tested the other fix :-P

mr-c commented 7 years ago

FYI: rdfs:comment occurs in the jsonldPredicate.id field of DocType of the schema_salad metaschema.yml and likewise for the RecordField in metaschema_base.yml:

The jsonldPredicate.id field is defined as

The predicate URI that this field corresponds to. Corresponds to JSON-LD @id directive

Does this information get us closer to a fix?

mr-c commented 7 years ago

https://github.com/common-workflow-language/schema_salad/blob/master/schema_salad/metaschema/metaschema.yml#L67