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:
- Imports the INPUT file using the IN-FORMAT importer
- Optionally stores the intermediate model in memory
- 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
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):
- Format-specific parameter (--in-param or --out-param)
- Shared parameter (--param)
- Default value from parameter definition
Convert SKOS to Mermaid
MauroImportExport.Cli convert skos mermaid vocabulary.ttl diagram.mmd
Convert with Shared Parameters
MauroImportExport.Cli convert rdfs skos ontology.ttl vocab.ttl \
--param baseIri=https://example.org/
Convert with Format-Specific Parameters
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
MauroImportExport.Cli convert skos svg-diagrams vocab.ttl diagrams.zip \
--store-key vocab1 \
--zip \
--overwrite
Show Importer and Exporter Parameters
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
Both IN-FORMAT and OUT-FORMAT must be valid. Use list-formats to verify availability.
Use --verbose to see progress for both the import and export stages.
The intermediate model is validated after import. Validation warnings are displayed but don't prevent export.