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 ShaclResultStatement Evaluate

From Leeroopedia
Knowledge Sources
Domains Testing, JUnit, SHACL
Last Updated 2026-10-16 00:00 GMT

Overview

Concrete JUnit Statement that executes SHACL Lite validation against a test input model and asserts no violations from the input data.

Description

The ShaclResultStatement extends JUnit's `Statement` class to provide the actual assertion logic for JUnit-integrated RDFUnit validation. When `evaluate()` is called:

1. It delegates to `RdfUnitJunitStatusTestExecutor.runTest()` which executes the test case as a SHACL Lite (SELECT) query against the test input model. 2. It filters results: only violations where the failing node is actually part of the input model (as subject or object) are kept. This prevents false positives from schema-level annotations. 3. If any violations remain, it fails the assertion with a detailed message listing the failing nodes.

The `nodeIsPartOfInputModel()` check tests whether the failing resource appears as a subject (with any predicate/object) or as an object (with any subject/predicate) in the input model.

Usage

  • JUnit test execution:*** Created internally by `RdfUnitJunitRunner.runChild()` for each test case. Not intended for direct use.

Code Reference

Source Location

  • Repository: AKSW/RDFUnit
  • File: rdfunit-junit/src/main/java/org/aksw/rdfunit/junit/ShaclResultStatement.java

Signature

class ShaclResultStatement extends Statement {

    private final RdfUnitJunitStatusTestExecutor rdfUnitJunitStatusTestExecutor;
    private final RdfUnitJunitTestCase testCase;

    ShaclResultStatement(RdfUnitJunitStatusTestExecutor rdfUnitJunitStatusTestExecutor,
        RdfUnitJunitTestCase testCase);

    @Override
    public void evaluate();

    private boolean nodeIsPartOfInputModel(ShaclLiteTestCaseResult r);
}

Import

// Internal class, not directly importable. Used by RdfUnitJunitRunner.

I/O Contract

Inputs

Name Type Required Description
rdfUnitJunitStatusTestExecutor RdfUnitJunitStatusTestExecutor Yes Executes the SHACL Lite test
testCase RdfUnitJunitTestCase Yes /// Test case with input model and schema

Outputs

Name Type Description
evaluate() void /// Asserts no violations; throws AssertionError on failure

Usage Examples

Used by RdfUnitJunitRunner (internal)

// This is how RdfUnitJunitRunner uses it internally:
// (Not for direct use by application code)

@Override
protected void runChild(RdfUnitJunitTestCase child, RunNotifier notifier) {
    if (isIgnored(child)) {
        notifier.fireTestIgnored(describeChild(child));
    } else {
        this.runLeaf(
            new ShaclResultStatement(rdfUnitJunitStatusTestExecutor, child),
            describeChild(child),
            notifier
        );
    }
}

Related Pages

Implements Principle

Requires Environment

Uses Heuristics

Page Connections

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