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 TestExecutionWriter Write

From Leeroopedia
Knowledge Sources
Domains Semantic_Web, Serialization, RDF
Last Updated 2026-10-16 00:00 GMT

Overview

Concrete writer that serializes a TestExecution result object into a Jena Model using RDFUnit, SHACL, and PROV vocabularies.

Description

The TestExecutionWriter implements `ElementWriter` to convert an in-memory `TestExecution` object into RDF triples in a Jena `Model`. The resulting model uses three vocabularies:

  • PROV: The execution is typed as `prov:Activity` with `startedAtTime`, `endedAtTime`, `wasStartedBy`, and `wasAssociatedWith` (schema URIs).
  • RDFUNITv: The execution is typed as `rutt:TestExecution` with execution type, source, test counts (run, succeeded, failed, timeout, error), and total individual errors.
  • SHACL: The execution is typed as `sh:ValidationReport` with `sh:conforms` (boolean) and `sh:result` links to individual `ValidationResult` resources.

Each `TestCaseResult` is written via `TestCaseResultWriter` and linked from the execution resource via `sh:result`.

Usage

  • CLI result writing: Used by `ValidateCommand.call()` to populate a Jena model before format-specific serialization.
  • Programmatic access: Can be used standalone to serialize validation results into any Jena model for custom processing.

Code Reference

Source Location

  • Repository: AKSW/RDFUnit
  • File: rdfunit-model/src/main/java/org/aksw/rdfunit/model/writers/results/TestExecutionWriter.java

Signature

public final class TestExecutionWriter implements ElementWriter {

    private final TestExecution testExecution;

    public static TestExecutionWriter create(TestExecution testExecution);

    @Override
    public Resource write(Model model);
}

Import

import org.aksw.rdfunit.model.writers.results.TestExecutionWriter;

I/O Contract

Inputs

Name Type Required Description
testExecution TestExecution Yes The execution results to serialize
model Model Yes Target Jena model to write triples into

Outputs

Name Type Description
write() returns Resource The resource representing the TestExecution in the model

Usage Examples

Serialize Results to RDF Model

import org.aksw.rdfunit.model.writers.results.TestExecutionWriter;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;

// After validation, serialize results
Model model = ModelFactory.createDefaultModel();
TestExecutionWriter.create(testExecution).write(model);

// model now contains the full validation report as RDF
// Can be serialized to any format (Turtle, RDF/XML, etc.)
model.write(System.out, "TURTLE");

Write Results to File

// Write to Turtle file
Model model = ModelFactory.createDefaultModel();
TestExecutionWriter.create(testExecution).write(model);

try (FileOutputStream out = new FileOutputStream("results.ttl")) {
    model.write(out, "TURTLE");
}

Related Pages

Implements Principle

Requires Environment

Page Connections

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