Logo
  • Introduction

Supported conversions

  • Essential Input Parameters
  • Array Inputs
  • Inclusive and Exclusive Inputs
  • Exclusive Input Parameters with Expressions
  • Document graph
    • 1. Parsing
  • More examples
    • Complex CWL types
    • Imported CWL types
    • String formats
    • JSON Schema generation
  • Transpiler-Mate plugin
  • API doc
CWL to OGC
  • Supported conversions
  • Document graph
  • Edit on transpiler-mate/cwl2ogc

Document graph¶

Document graph refers to the 2.4 Document graph paragraph of the 2. Document model chapter of the Semantic Annotations for Linked Avro Data (SALAD).

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_documents = load_cwl_from_location(
    "https://raw.githubusercontent.com/eoap/application-package-patterns/refs/heads/main/cwl-workflow/test-primitives.cwl"
)
cwl_converters = [
    BaseCWLtypes2OGCConverter(cwl_document) for cwl_document in cwl_documents
]
from cwl_loader import load_cwl_from_location from cwl2ogc import BaseCWLtypes2OGCConverter cwl_documents = load_cwl_from_location( "https://raw.githubusercontent.com/eoap/application-package-patterns/refs/heads/main/cwl-workflow/test-primitives.cwl" ) cwl_converters = [ BaseCWLtypes2OGCConverter(cwl_document) for cwl_document in cwl_documents ]
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 2
      1 from cwl_loader import load_cwl_from_location
----> 2 from cwl2ogc import BaseCWLtypes2OGCConverter
      3 
      4 cwl_documents = load_cwl_from_location(
      5     "https://raw.githubusercontent.com/eoap/application-package-patterns/refs/heads/main/cwl-workflow/test-primitives.cwl"

ModuleNotFoundError: No module named 'cwl2ogc'

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!
from IPython.display import display, Markdown
import sys

for i, cwl_converter in enumerate(cwl_converters):
    index = i + 1
    display(Markdown(f"## 2.{index}. `{cwl_converter.cwl.id}` Inputs:"))
    cwl_converter.dump_inputs(stream=sys.stdout, pretty_print=True)
    display(Markdown("---"))
from IPython.display import display, Markdown import sys for i, cwl_converter in enumerate(cwl_converters): index = i + 1 display(Markdown(f"## 2.{index}. `{cwl_converter.cwl.id}` Inputs:")) cwl_converter.dump_inputs(stream=sys.stdout, pretty_print=True) display(Markdown("---"))
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[2], line 4
      1 from IPython.display import display, Markdown
      2 import sys
      3 
----> 4 for i, cwl_converter in enumerate(cwl_converters):
      5     index = i + 1
      6     display(Markdown(f"## 2.{index}. `{cwl_converter.cwl.id}` Inputs:"))
      7     cwl_converter.dump_inputs(stream=sys.stdout, pretty_print=True)

NameError: name 'cwl_converters' 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!
for i, cwl_converter in enumerate(cwl_converters):
    index = i + 1
    display(Markdown(f"## 3.{index}. `{cwl_converter.cwl.id}` Outputs:"))
    cwl_converter.dump_outputs(stream=sys.stdout, pretty_print=True)
    display(Markdown("---"))
for i, cwl_converter in enumerate(cwl_converters): index = i + 1 display(Markdown(f"## 3.{index}. `{cwl_converter.cwl.id}` Outputs:")) cwl_converter.dump_outputs(stream=sys.stdout, pretty_print=True) display(Markdown("---"))
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 for i, cwl_converter in enumerate(cwl_converters):
      2     index = i + 1
      3     display(Markdown(f"## 3.{index}. `{cwl_converter.cwl.id}` Outputs:"))
      4     cwl_converter.dump_outputs(stream=sys.stdout, pretty_print=True)

NameError: name 'cwl_converters' 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 »