Logo
  • Home

Tutorials

  • Overview
  • Your first conversion
  • Essential Input Parameters
  • Array Inputs
  • Inclusive and Exclusive Inputs
    • 1. Parsing
  • Exclusive Input Parameters with Expressions
  • Document graph
  • Complex CWL types
  • Imported CWL types
  • String formats
  • JSON Schema generation

How-to guides

  • Convert with the plugin
  • Generate and validate JSON Schema

Reference

  • Python API
  • Plugin CLI and output

Explanation

  • Conversion model
CWL to OGC
  • Tutorials
  • Inclusive and Exclusive Inputs
  • Edit on transpiler-mate/cwl2ogc

Inclusive and Exclusive Inputs¶

Inclusive and Exclusive Inputs refers to the 2.4.3. Inclusive and Exclusive Inputs paragraph of the 2.4. Inputs chapter of the Common Workflow Language User Guide.

It shows also how the library is able to handle and convert record types.

1. Parsing¶

In this sample we'll show the access from a remote public URL.

In [1]:
Copied!
from cwl_loader import load_cwl_from_location
from cwl2ogc import BaseCWLtypes2OGCConverter

cwl_document = load_cwl_from_location(
    "https://raw.githubusercontent.com/transpiler-mate/cwl2ogc/refs/heads/develop/tests/artifacts/cwl-types/record.cwl"
)
cwl_converter = BaseCWLtypes2OGCConverter(cwl_document)
from cwl_loader import load_cwl_from_location from cwl2ogc import BaseCWLtypes2OGCConverter cwl_document = load_cwl_from_location( "https://raw.githubusercontent.com/transpiler-mate/cwl2ogc/refs/heads/develop/tests/artifacts/cwl-types/record.cwl" ) cwl_converter = BaseCWLtypes2OGCConverter(cwl_document)
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 from cwl_loader import load_cwl_from_location
      2 from cwl2ogc import BaseCWLtypes2OGCConverter
      3 
      4 cwl_document = load_cwl_from_location(

ModuleNotFoundError: No module named 'cwl_loader'

2. Inputs conversion¶

Once the document is parsed, invoke the cwl2ogc APIs to convert the CWL inputs to the OGC JSON format:

In [2]:
Copied!
import sys

cwl_converter.dump_inputs(stream=sys.stdout, pretty_print=True)
import sys cwl_converter.dump_inputs(stream=sys.stdout, pretty_print=True)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[2], line 3
      1 import sys
      2 
----> 3 cwl_converter.dump_inputs(stream=sys.stdout, pretty_print=True)

NameError: name 'cwl_converter' is not defined

3. Outputs conversion¶

Users can reuse the BaseCWLtypes2OGCConverter instance to convert the CWL outputs to the OGC JSON format:

In [3]:
Copied!
cwl_converter.dump_outputs(stream=sys.stdout, pretty_print=True)
cwl_converter.dump_outputs(stream=sys.stdout, pretty_print=True)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 cwl_converter.dump_outputs(stream=sys.stdout, pretty_print=True)

NameError: name 'cwl_converter' is not defined
Previous Next

Apache License, Version 2.0

Built with MkDocs using a theme provided by Read the Docs.
transpiler-mate/cwl2ogc « Previous Next »