CWL User Guide 17: Metadata and Authorship をやってみた

# CWL User Guide 17: Metadata and Authorship

[Metadata](http://www.commonwl.org/user_guide/17-metadata/)

今回は、メタデータと Authorshipについて書かれています

また、今回は、実行形式のファイルが２つあります。が、実行したというステップではないです。
最後の方に、`schema-salad-tool` での実行について書いてあったので、実行してみました。
２つとも、ながいエラーメッセージのようなものがみえていますが、`valid` であると出力されていました。

Key Points より
* CWLでは、メタデータを与えることができます。
* また、開発者は、正しい citation を与えるために、最低限の、 authorship に関する情報を提供することが望まれます。

# この回にでてくる主なキーワード

* $namespaces

# CWLファイル1、metadata_example2.cwl

```metadata_example2.cwl
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool

label: An example tool demonstrating metadata.
doc: Note that this is an example and the metadata is not necessarily consistent.

inputs:
  aligned_sequences:
    type: File
    label: Aligned sequences in BAM format
    format: edam:format_2572
    inputBinding:
      position: 1

baseCommand: [ wc, -l ]

stdout: output.txt

outputs:
  report:
    type: stdout
    format: edam:format_1964
    label: A text file that contains a line count

s:author:
  - class: s:Person
    s:identifier: https://orcid.org/0000-0002-6130-1021
    s:email: mailto:dyuen@oicr.on.ca
    s:name: Denis Yuen

s:contributor:
  - class: s:Person
    s:identifier: http://orcid.org/0000-0002-7681-6415
    s:email: mailto:briandoconnor@gmail.com
    s:name: Brian O'Connor

s:citation: https://dx.doi.org/10.6084/m9.figshare.3115156.v2
s:codeRepository: https://github.com/common-workflow-language/common-workflow-language
s:dateCreated: "2016-12-13"
s:license: https://www.apache.org/licenses/LICENSE-2.0

$namespaces:
  s: https://schema.org/
  edam: http://edamontology.org/

$schemas:
 - https://schema.org/docs/schema_org_rdfa.html
 - http://edamontology.org/EDAM_1.18.owl
```


## schema-salad-tool 実行方法

自分は schema-salad-tool を以下のようにしていれました。

```
pip install schema_salad --user
```

その場合の実行方法はこうなります。
インストール方法によっては、第１引数のパスが違う可能性があります。

```
schema-salad-tool ~/.local/lib/python2.7/site-packages/schema_salad/tests/test_schema/CommonWorkflowLanguage.yml metadata_example2.cwl
```

## schema-salad-tool 実行結果

```console
$ schema-salad-tool ~/.local/lib/python2.7/site-packages/schema_salad/tests/test_schema/CommonWorkflowLanguage.yml metadata_example2.cwl
/home/vagrant/.local/bin/schema-salad-tool Current version: 2.6.20171116190026
No handlers could be found for logger "rdflib.term"
/home/vagrant/.local/lib/python2.7/site-packages/rdflib/plugins/parsers/structureddata.py:30: UserWarning: html5lib not found! RDFa and Microdata parsers will not be available.
  'parsers will not be available.')
Could not load extension schema https://schema.org/docs/schema_org_rdfa.html: html5lib is not installed, cannot use RDFa and Microdata parsers.
metadata_example2.cwl:2:1: unrecognized extension field `https://schema.org/author`.  Did you include a $schemas section?
metadata_example2.cwl:2:1: unrecognized extension field `https://schema.org/contributor`.  Did you include a $schemas section?
metadata_example2.cwl:2:1: unrecognized extension field `https://schema.org/citation`.  Did you include a $schemas section?
metadata_example2.cwl:2:1: unrecognized extension field `https://schema.org/codeRepository`.  Did you include a $schemas section?
metadata_example2.cwl:2:1: unrecognized extension field `https://schema.org/dateCreated`.  Did you include a $schemas section?
metadata_example2.cwl:2:1: unrecognized extension field `https://schema.org/license`.  Did you include a $schemas section?
Document `metadata_example2.cwl` is valid
```

```console
$ schema-salad-tool ~/.local/lib/python2.7/site-packages/schema_salad/tests/test_schema/CommonWorkflowLanguage.yml metadata_example3.cwl
/home/vagrant/.local/bin/schema-salad-tool Current version: 2.6.20171116190026
No handlers could be found for logger "rdflib.term"
/home/vagrant/.local/lib/python2.7/site-packages/rdflib/plugins/parsers/structureddata.py:30: UserWarning: html5lib not found! RDFa and Microdata parsers will not be available.
  'parsers will not be available.')
Could not load extension schema https://schema.org/docs/schema_org_rdfa.html: html5lib is not installed, cannot use RDFa and Microdata parsers.
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/author`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/contributor`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/citation`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/codeRepository`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/dateCreated`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/license`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/keywords`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/programmingLanguage`.  Did you include a $schemas section?
Document `metadata_example3.cwl` is valid
```

## CWLファイル2, metadata_example3.cwl

```metadata_example3.cwl
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool

label: An example tool demonstrating metadata.
doc: Note that this is an example and the metadata is not necessarily consistent.

hints:
  ResourceRequirement:
    coresMin: 4

inputs:
  aligned_sequences:
    type: File
    label: Aligned sequences in BAM format
    format: edam:format_2572
    inputBinding:
      position: 1

baseCommand: [ wc, -l ]

stdout: output.txt

outputs:
  report:
    type: stdout
    format: edam:format_1964
    label: A text file that contains a line count

s:author:
  - class: s:Person
    s:identifier: https://orcid.org/0000-0002-6130-1021
    s:email: mailto:dyuen@oicr.on.ca
    s:name: Denis Yuen

s:contributor:
  - class: s:Person
    s:identifier: http://orcid.org/0000-0002-7681-6415
    s:email: mailto:briandoconnor@gmail.com
    s:name: Brian O'Connor

s:citation: https://dx.doi.org/10.6084/m9.figshare.3115156.v2
s:codeRepository: https://github.com/common-workflow-language/common-workflow-language
s:dateCreated: "2016-12-13"
s:license: https://www.apache.org/licenses/LICENSE-2.0

s:keywords: edam:topic_0091 , edam:topic_0622
s:programmingLanguage: C

$namespaces:
 s: https://schema.org/
 edam: https://edamontology.org/

$schemas:
 - https://schema.org/docs/schema_org_rdfa.html
 - http://edamontology.org/EDAM_1.18.owl
```

## schema-salad-tool の実行方法

```
schema-salad-tool ~/.local/lib/python2.7/site-packages/schema_salad/tests/test_schema/CommonWorkflowLanguage.yml metadata_example3.cwl
```

## schema-salad-tool の実行結果

```console
$ schema-salad-tool ~/.local/lib/python2.7/site-packages/schema_salad/tests/test_schema/CommonWorkflowLanguage.yml metadata_example3.cwl
/home/vagrant/.local/bin/schema-salad-tool Current version: 2.6.20171116190026
No handlers could be found for logger "rdflib.term"
/home/vagrant/.local/lib/python2.7/site-packages/rdflib/plugins/parsers/structureddata.py:30: UserWarning: html5lib not found! RDFa and Microdata parsers will not be available.
  'parsers will not be available.')
Could not load extension schema https://schema.org/docs/schema_org_rdfa.html: html5lib is not installed, cannot use RDFa and Microdata parsers.
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/author`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/contributor`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/citation`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/codeRepository`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/dateCreated`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/license`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/keywords`.  Did you include a $schemas section?
metadata_example3.cwl:2:1: unrecognized extension field `https://schema.org/programmingLanguage`.  Did you include a $schemas section?
Document `metadata_example3.cwl` is valid
```

# 今回使ったファイル

[cwl\_user\_guide\_work/17\-metadata at master · manabuishii/cwl\_user\_guide\_work](https://github.com/manabuishii/cwl_user_guide_work/tree/master/17-metadata)