import Command
The import command converts a format-specific snapshot file into a Mauro JSON model file.
Synopsis
MauroImportExport.Cli import FORMAT INPUT OUT-MODEL-JSON
[--param KEY=VALUE]... [--store-key KEY] [--overwrite]
[--show-params] [--verbose] [--log-file FILE] [--log-level LEVEL]
Description
The import command reads a snapshot file in the specified format and converts it to a Mauro JSON model. The imported model is:
- Written to the specified output JSON file
- Stored in the in-memory model store for subsequent use
- Validated against the Mauro model schema
The command supports parameterised import behaviour through the --param option, allowing customisation of how the source format is interpreted.
Arguments
- FORMAT
- Format identifier for the input file (e.g., skos, xmi, jsonschema). Use list-formats to see available importers.
- INPUT
- Path to the input to import. The input can be:
- Single file - Supported by all importers. Provide the path to a single snapshot file.
- Directory - Supported by multi-file importers (RDFS, JSON Schema Set, Mermaid). The command processes all files in the directory matching the format's supported extensions.
- ZIP archive - Supported by multi-file importers. The command extracts and processes all files with supported extensions from the archive.
- OUT-MODEL-JSON
- Path where the output Mauro JSON model file will be written.
Options
- --param KEY=VALUE
- Specify an importer parameter. Can be repeated for multiple parameters. Use import FORMAT --show-params to see available parameters.
- --store-key KEY
- Specify a key for storing the imported model in memory. Use "auto" or omit for automatic key generation.
- --overwrite
- Overwrite the output file if it exists, and overwrite any existing model with the same store key.
- --show-params
- Display available parameters for the importer without performing import. INPUT and OUT-MODEL-JSON arguments are not required when using this option.
- --verbose
- Enable verbose output showing detailed progress and diagnostic information.
- --log-file FILE
- Path to log file
- --log-level LEVEL
- Minimum logging level
- --help
- Display help information for the import command and exit
Exit Status
| Code | Description |
|---|---|
| 0 | Success - model imported and written |
| 1 | Import failed (invalid file, format error, validation error) |
| 130 | Operation cancelled |
Examples
The following examples illustrate the use of the import command
Import SKOS Vocabulary
MauroImportExport.Cli import skos vocabulary.ttl model.json
Import with Custom Store Key
MauroImportExport.Cli import skos vocabulary.ttl model.json --store-key vocab1 --overwrite
Import with Parameters
MauroImportExport.Cli import xmi model.xmi output.json --param namespace=http://example.org --verbose
Show Available Parameters
MauroImportExport.Cli import jsonschema --show-params
Import from Directory
MauroImportExport.Cli import rdfs ontologies/ model.json --overwrite
Imports all RDFS ontology files (.ttl, .rdf, .owl, .n3) from the directory.
Import from ZIP Archive
MauroImportExport.Cli import json-schema schemas.zip model.json --overwrite
Imports all JSON Schema files from the ZIP archive.
Model Validation
After import, the model is validated against the Mauro schema. Validation errors are displayed but do not prevent the model from being written to file. The model must pass validation before it can be uploaded to a Mauro Data Mapper endpoint.
In-Memory Store
Imported models are stored in memory using either:
- An automatically generated key (default)
- A user-specified key via --store-key
Stored models can be accessed by subsequent export commands using the --input-key option. Use list-models to view stored models.
Multi-File Import
Some importers support importing multiple files in a single operation:
- RDFS importer - Imports multiple ontology files and creates semantic links for cross-file references
- JSON Schema Set importer - Imports multiple JSON Schema files and resolves cross-schema references
- Mermaid importer - Imports multiple diagram files with optional merging into a single model
When importing from a directory or ZIP archive, files are processed in alphabetical order. Cross-references between files are automatically resolved and preserved as semantic links in the output model.
Single-file importers (JSON, SKOS, XMI, FHIR, OAS) only accept single file inputs. If you provide a directory or ZIP archive, the import will fail.
Notes
The INPUT and OUT-MODEL-JSON arguments are required unless --show-params is specified.
Use --verbose to see detailed import progress, which files are being processed, and any warnings about the source data.
When importing from directories or ZIP archives, only files with extensions supported by the format are processed. Other files are silently ignored.