Skip to content
Gustavo Publio edited this page Sep 27, 2017 · 6 revisions

RDFUnit as a Library

A simple way to use RDFUnit in you code is the following:

First, generate your test cases based on a schema and get a TestSuite

TestSuite testSuite = new RDFUnitTestSuiteGenerator.Builder()
   .addSchemaURI("skos", "http://www.w3.org/2004/02/skos/core#")
   .addSchemaURI("foaf", "http://xmlns.com/foaf/0.1/")
   .build().getTestSuite()

this will generate all the necessary TestCases for the schemas we provide and return a TestSuite. You can use OWL, SHACL, RS & DSP constraints here.

Then, you can use the testSuite with the static functions of RDFUnitStaticValidator and get back a TestExecution to see the results.

the rdfunit-examples module contains some sample code you can use

Modules:

  • rdfunit-core provides the core RDFUnit functionality
  • rdfunit-model (in progress) interfaces & classes for RDFUnit / SHACL constructs
  • rdfunit-validate wrapper module used to provide CLI support and a simple web service interface
  • rdfunit-junit provides a custom RDFUnit-JUnit runner that can ease RDF unit testing
  • rdfunit-webdemo is the code used to create http://rdfunit.aksw.org/demo/
  • rdfunit-manual-tests contains community-provided tests cases that can be reused for specific ontologies / datasets. For example it provides SKOS tests, not defined in the SKOS rdfs definitions.