Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AKSW RDFUnit ValidateCommand Call

From Leeroopedia
Knowledge Sources
Domains CLI, Validation, Configuration
Last Updated 2026-10-16 00:00 GMT

Overview

Concrete command-line entry point for validating RDF datasets via the `validate` subcommand, provided by the RDFUnit CLI module.

Description

The ValidateCommand class implements Picocli's `Callable` interface to provide the `validate` CLI subcommand. It declares all validation options as annotated fields and orchestrates the complete validation pipeline in its `call()` method: argument parsing, RDFUnit initialization, schema discovery, test generation, test execution, and result writing. It is the primary user-facing entry point for command-line validation.

Usage

  • CLI validation of an RDF dump: Run `rdfunit validate -d <dataset-uri> -u <dump-file>` to validate a local RDF file.
  • CLI validation of a SPARQL endpoint: Run `rdfunit validate -d <dataset-uri> -e <endpoint-uri>` to validate against a live endpoint.
  • Custom output format: Add `-o turtle` to produce Turtle RDF output instead of HTML.
  • SHACL result level: Add `-r shacl` for detailed SHACL validation results with individual violation nodes.

Code Reference

Source Location

  • Repository: AKSW/RDFUnit
  • File: rdfunit-validate/src/main/java/org/aksw/rdfunit/validate/cli/ValidateCommand.java

Signature

@Command(name = "validate", description = "Validate a dataset",
    mixinStandardHelpOptions = true)
public class ValidateCommand implements Callable {

    // Dataset options
    @Option(names = {"-d", "--dataset-uri"}, required = true)
    String datasetURI;

    @ArgGroup(exclusive = true)
    DatasetOptions datasetOptions;  // endpoint or dereference URI

    // Schema options
    @Option(names = {"-s", "--schemas"}, split = ",")
    Collection<String> schemaUriPrefixes;
    @Option(names = {"-v", "--no-LOV"})
    boolean noLOV = false;
    @Option(names = {"-i", "--imports"})
    boolean imports = false;
    @Option(names = {"-x", "--exclude"}, split = ",")
    Collection<String> excluded;

    // Output options
    @Option(names = {"-o", "--output-format"}, defaultValue = "html")
    String outputFormat;
    @Option(names = {"-r", "--result-level"}, defaultValue = "aggregate")
    String resultLevel;

    // Test generation options
    @Option(names = {"-C", "--no-test-cache"})
    boolean noTestCache = false;
    @Option(names = {"-M", "--no-manual-tests"})
    boolean noManualTests = false;
    @Option(names = {"-A", "--no-auto-tests"})
    boolean noAutoTests = false;

    // Query options
    @Option(names = {"-T", "--query-cache-ttl"}, defaultValue = "1440")
    int queryCacheTTL;
    @Option(names = {"-D", "--query-delay"}, defaultValue = "0")
    long queryDelay;
    @Option(names = {"-L", "--query-limit"}, defaultValue = "0")
    int queryLimit;
    @Option(names = {"-P", "--query-pagination"}, defaultValue = "0")
    long queryPagination;

    // Other
    @Option(names = {"-c", "--test-coverage"})
    boolean testCoverage = false;
    @Option(names = {"-f", "--data-folder"}, defaultValue = "./data/")
    private String dataFolder;

    @Override
    public Object call() throws Exception { ... }

    private RDFUnitConfiguration getConfigurationFromArguments() throws ParameterException { ... }
}

Import

import org.aksw.rdfunit.validate.cli.ValidateCommand;
// CLI entry: org.aksw.rdfunit.validate.cli.CLI

I/O Contract

Inputs

Name Type Required Description
datasetURI String Yes The dataset URI to validate
datasetOptions DatasetOptions No Endpoint URI + auth, or custom dereference URI
schemaUriPrefixes Collection<String> No Schema prefixes (comma-separated); auto-discovered if omitted
outputFormat String No Output format: html, turtle, n3, ntriples, json-ld, rdf-json, rdfxml, junitxml (default: html)
resultLevel String No Result granularity: status, aggregate, shacl-lite, shacl (default: aggregate)
noTestCache boolean No If true, regenerate cached tests (default: false)
noManualTests boolean No If true, skip manual test cases (default: false)
noAutoTests boolean No If true, skip auto-generated tests (default: false)
dataFolder String No Data folder for caches and results (default: ./data/)

Outputs

Name Type Description
call() returns Object Always null; side effect is result files written to disk
result files Files Written to `{dataFolder}/results/{prefix}.{executionType}.{format}`

Usage Examples

Validate a SPARQL Endpoint

# Validate a DBpedia endpoint with auto-discovered schemas
java -jar rdfunit-validate.jar validate \
    -d "http://dbpedia.org" \
    -e "http://dbpedia.org/sparql" \
    -o turtle \
    -r shacl

Validate an RDF Dump with Explicit Schemas

# Validate a local dump file against SKOS and FOAF schemas
java -jar rdfunit-validate.jar validate \
    -d "http://example.org/dataset" \
    -u "/path/to/dump.ttl" \
    -s "skos,foaf" \
    -o html \
    -r shacl-lite

Validate with Endpoint Authentication

# Validate a protected endpoint with basic auth
java -jar rdfunit-validate.jar validate \
    -d "http://example.org/dataset" \
    -e "http://example.org/sparql" \
    -eu "user" -ep "password" \
    -v \
    -s "skos"

Related Pages

Implements Principle

Requires Environment

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment