convert Command

The convert command performs a one-step import and export operation, converting directly between two formats without creating an intermediate JSON file.

Synopsis

MauroImportExport.Cli convert IN-FORMAT OUT-FORMAT INPUT OUT
                         [--param KEY=VALUE]... [--in-param KEY=VALUE]... 
                         [--out-param KEY=VALUE]... [--store-key KEY] [--overwrite] [--zip]
                         [--show-importer-params] [--show-exporter-params] [--verbose]
                         [--log-file FILE] [--log-level LEVEL]

Description

The convert command combines import and export operations into a single step. It:

  1. Imports the INPUT file using the IN-FORMAT importer
  2. Optionally stores the intermediate model in memory
  3. Exports the model using the OUT-FORMAT exporter to OUT destination

This is more efficient than running separate import and export commands and avoids creating intermediate JSON files.

Arguments

IN-FORMAT
Source format identifier (e.g., skos, xmi, jsonschema)
OUT-FORMAT
Target format identifier (e.g., dita, json, mermaid)
INPUT
Input file, directory, or ZIP archive in the source format
OUT
Output destination (file, directory, or ZIP path)

Options

--param KEY=VALUE
Parameter applied to both importer and exporter (shared parameter). Repeatable.
--in-param KEY=VALUE
Parameter applied only to the importer. Overrides shared --param. Repeatable.
--out-param KEY=VALUE
Parameter applied only to the exporter. Overrides shared --param. Repeatable.
--store-key KEY
Store the intermediate imported model in memory with specified key. Use "auto" for automatic key generation.
--overwrite
Overwrite existing output and/or store key
--zip
Package multi-file output as ZIP archive
--show-importer-params
Display parameters for the importer without performing conversion. INPUT and OUT not required.
--show-exporter-params
Display parameters for the exporter without performing conversion. INPUT and OUT not required.
--verbose
Show detailed progress for both import and export stages
--log-file FILE
Path to log file
--log-level LEVEL
Minimum logging level
--help
Display help information for the convert command and exit

Exit Status

Code Description
0 Success - conversion completed
1 Conversion failed (import or export error)
130 Operation cancelled

Parameter Precedence

When the same parameter key is specified multiple times, the priority is (highest to lowest):

  1. Format-specific parameter (--in-param or --out-param)
  2. Shared parameter (--param)
  3. Default value from parameter definition

Examples

The following examples illustrate the use of the convert command:

Convert SKOS to Mermaid

Convert a SKOS vocabulary to Mermaid diagram format.

MauroImportExport.Cli convert skos mermaid vocabulary.ttl diagram.mmd

Convert with Shared Parameters

Use shared parameters that apply to both importer and exporter.

MauroImportExport.Cli convert rdfs skos ontology.ttl vocab.ttl \
    --param baseIri=https://example.org/

Convert with Format-Specific Parameters

Use format-specific parameters to customise importer and exporter behaviour separately.

MauroImportExport.Cli convert json dita model.json documentation \
    --in-param schemaVersion=1.0 \
    --out-param dita.generateMaps=true \
    --out-param dita.topicsDir=topics \
    --overwrite

Convert and Store Intermediate Model

Convert between formats while storing the intermediate model in memory for reuse.

MauroImportExport.Cli convert skos svg-diagrams vocab.ttl diagrams.zip \
    --store-key vocab1 \
    --zip \
    --overwrite

Show Importer and Exporter Parameters

Display available parameters for both importer and exporter without performing conversion.

MauroImportExport.Cli convert jsonschema dita --show-importer-params --show-exporter-params

Use Cases

The convert command is particularly useful for:

  • Batch format conversions in scripts
  • CI/CD pipeline transformations
  • Generating multiple output formats from a single source
  • Testing format handlers

Notes

Important:

Both IN-FORMAT and OUT-FORMAT must be valid. Use list-formats to verify availability.

Tip:

Use --verbose to see progress for both the import and export stages.

Note:

The intermediate model is validated after import. Validation warnings are displayed but don't prevent export.