Description
The Schematron Validation Plugin ( plugin-schematron-validation
bundle) provides a pre-ingest interceptor that validates the incoming request against a Schematron ruleset (or rule sets). If the request has warnings or errors based on the Schematron validation, the request is marked as invalid and a SOAP fault is returned with details on the exact reason why the request was invalid. This bundle has the following characteristics:
- It provides the Schematron engine, meaning it provides the infrastructure to load, parse, and apply Schematron rule sets.
- It does not contain any Schematron ruleset(s) - those must be installed (as features) separately.
The Schematron validation bundle works with Schematron rule set bundles to obtain the rules for validation. The Schematron validation bundle and the Schematron rule set bundle are uninstalled by default. More information about Schematron in general can be found at http://www.schematron.com.
Understanding Schematron
Schematron is a language for making assertions about the presence or absence of patterns in XML documents. It is not a replacement for XML Schema (XSD) validation. Rather, it is used in conjunction with many grammar-based structure-validation languages, such as XSD.
Schematron is an ISO standard: ISO/IEC 19757-3:2006 Information technology -- Document Schema Definition Language (DSDL) -- Part 3: Rule-based validation -- Schematron
Schematron assertions are based on 2 simple actions:
- First, find context nodes in the document (typically an element) based on XPath criteria.
- Then, check to see if some other XPath expressions are true, for each of the nodes returned in the first step.
Schematron assertions (or rules) are defined in a .sch
file by convention, which is an XML file conforming to Schematron's rules for defining assertions. This file is referred to as a "Schematron ruleset." These rules are contained in one .sch
file, or a hierarchy of .sch
files(plugin-ddms-schematron-validation
). But there is ultimately one .sch
file that includes or uses all of the other .sch
files. This one .sch
file is the "ruleset" used by the
DDF
Schematron Validation Service.Schematron also includes SVRL (Schematron Validation Report Language) report generation, which is in XML format. This report includes the results of all of the Schematron rulesets' assertions, classifying them as warnings or errors (based on the ruleset).
DDF
implements Schematron as a Pre-Ingest Plugin, running the Schematron ruleset(s) against each catalog entry in each create and update ingest request thatDDF
receives. TheDDF
Schematron Validation Pre-Ingest Plugin consists of 2 components: the Schematron "engine" and the client ruleset bundle(s). Each are described below.Schematron Validation Plugin
The Schematron Validation Service is in a single OSGi bundle named plugin-schematron-validation
. This bundle includes all of the code to implement:
- Loading and pre-compilation of the client ruleset bundle
- Executing the ruleset against ingest requests
- Generating the SVRL report. From this report, the Schematron Validation Service determines if errors and/or warnings were detected during validation. If errors or warnings exist, then validation fails and the ingest request is rejected. A SOAP fault is then returned to the client, including details on why the request is invalid.
The client's ruleset bundle determines what rules generate warnings and what rules generate errors. The Schematron Validation Service provides a configuration option (accessible via the Web Console's Configuration page) to suppress warnings. When this option is set, if only warnings are detected during Schematron validation, then the request is considered valid. By default, this suppress warnings option is unset (hence warnings result in invalid requests by default).
Validation is executed per catalog entry in the ingest request. Note that if multiple catalog entries are in the request, Schematron validation stops once a catalog entry is determined to be invalid. For example, if ten catalog entries are in a singe create ingest request and entry #4 is invalid, entries 5 through 10 will not even be validated. Schematron returns an invalid status after entry #4 is validated.
Note that if only the Schematron Validation Service is installed, no Schematron validation occurs. This is because the Schematron Validation Service has no ruleset to validate the request against - it only provides the framework for Schematron rulesets to be applied to ingest requests. At least one (or more) client ruleset bundle must also be installed.
Schematron Client "Ruleset" Bundle(s)
A client must deploy at least one (or more) Schematron ruleset bundles before Schematron validation occurs.
The Schematron ruleset bundle consists of 3 required items:
- the
.sch
ruleset file defining the Schematron applied rules - a bundle wiring specification file (e.g., Blueprint, Spring DM, Declarative Services, etc.) specifying the
.sch
file used and associating the ruleset to the Schematron Validation Service - an OSGi metatype XML file that specifies the configurable options for the Schematron Validation Service (namely the suppress warnings option)
The diagram below illustrates how these Schematron components interact:
Installing and Uninstalling
The Schematron Validation Library can be installed and uninstalled using the normal processes described in the Configuration section to install and uninstall the feature.
Configuration
There are no configuration options for this application.