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

Principle:AKSW RDFUnit Data Source Abstraction

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

Overview

Architectural pattern that abstracts the physical location and access method of RDF data behind a uniform interface, enabling validation to run against SPARQL endpoints, RDF dumps, or in-memory models without changing test logic.

Description

Data Source Abstraction decouples RDFUnit's test execution from the specifics of how RDF data is stored and accessed. The core abstraction is the TestSource interface, which provides a `QueryExecutionFactory` that test executors use to run SPARQL queries. Concrete implementations include:

  • DumpTestSource: Reads an RDF dump file into an in-memory Jena model. Suitable for small-to-medium datasets or offline validation.
  • DatasetTestSource: Loads an RDF dataset (named graphs) into an in-memory Jena dataset.
  • EndpointTestSource: Connects to a remote SPARQL endpoint with support for authentication, graph selection, query delay, caching, pagination, and result limits.

Similarly, SchemaSource abstracts schema access, with factory methods that can resolve schemas from file, URI, cache, or classpath resources. The RdfReader interface provides a uniform read abstraction, with implementations for stream, dereference, model, and composite reading strategies.

This abstraction ensures that the same test suite can be executed against any data source type—switching from a dump file to a live SPARQL endpoint requires only changing the TestSource builder configuration, not the test cases themselves.

Usage

Use this principle when you need to validate RDF data in different deployment scenarios: offline dumps, live SPARQL endpoints, or in-memory models. The builder pattern (`TestSourceBuilder`) provides a fluent API to configure the source type, querying parameters, and schema references.

Theoretical Basis

The abstraction hierarchy:

# Abstract type hierarchy
TestSource:
    + getExecutionFactory() -> QueryExecutionFactory
    + getReferencesSchemata() -> Collection[SchemaSource]

DumpTestSource(TestSource):    # in-memory model from dump file
DatasetTestSource(TestSource): # in-memory dataset with named graphs
EndpointTestSource(TestSource): # remote SPARQL endpoint

SchemaSource:
    + getModel() -> Model
    + getUri() -> String

The `QueryExecutionFactory` is the key unifying interface: all test execution uses it to create `QueryExecution` objects, regardless of whether the underlying data is a local model or a remote endpoint.

Related Pages

Implemented By

Uses Heuristics

Page Connections

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