Principle:AKSW RDFUnit CLI Validation Configuration
| Knowledge Sources | |
|---|---|
| Domains | CLI, Validation, Configuration |
| Last Updated | 2026-10-16 00:00 GMT |
Overview
Design pattern for translating command-line arguments into a richly-typed configuration object that governs all aspects of an RDF validation run, from data source selection to result output format.
Description
CLI Validation Configuration is the principle of using a declarative CLI framework (Picocli) to parse command-line options into a `RDFUnitConfiguration` object that serves as the single source of truth for a validation run. The `ValidateCommand` class uses Picocli annotations (`@Option`, `@ArgGroup`) to declare all available parameters, and its `call()` method orchestrates the full validation pipeline:
1. Parse CLI arguments into annotated fields. 2. Build a `RDFUnitConfiguration` from those fields (dataset URI, endpoint/dump options, schema prefixes, output format, execution type, caching, query limits). 3. Initialize RDFUnit, discover schemas, generate tests, execute tests, and write results.
The configuration object encapsulates all validation parameters: data source (endpoint URI, dump URI, authentication), schema management (explicit prefixes, LOV discovery, owl:imports augmentation, exclusions), test generation (auto/manual/cache toggles), execution (result level: status/aggregate/shacl-lite/shacl), query optimization (TTL, delay, limit, pagination), and output (format, data folder, coverage).
The design separates argument parsing (`ValidateCommand` fields) from configuration building (`RDFUnitConfiguration` construction) from pipeline execution (`call()` method), making the CLI a thin orchestration layer.
Usage
Use this principle when you need to validate RDF datasets via the command line, in scripts, or in CI/CD pipelines. The CLI provides the full power of RDFUnit with sensible defaults (HTML output, aggregate results, LOV discovery enabled, caching enabled).
Theoretical Basis
The configuration flow follows a builder-to-pipeline pattern:
# Abstract algorithm
class ValidateCommand:
@Option("-d", required=True)
dataset_uri: str
@Option("-s", split=",")
schema_prefixes: Collection[str]
@Option("-o", default="html")
output_format: str
def call(self):
# 1. Build configuration from CLI args
config = build_configuration(self)
# 2. Initialize RDFUnit
rdfunit = RDFUnit.createWithOwlAndShacl()
rdfunit.init()
# 3. Get dataset source from config
dataset = config.get_test_source()
# 4. Generate test suite
test_suite = generate_tests(dataset, rdfunit.auto_generators)
# 5. Execute
executor = TestExecutorFactory.create(config.execution_type)
executor.execute(dataset, test_suite)
# 6. Write results
write_results(config.output_formats, executor.results)