Class SchematronTests

java.lang.Object
org.opengis.cite.iso19136.data.DataFixture
org.opengis.cite.iso19136.data.SchematronTests

public class SchematronTests extends DataFixture
Verifies that a GML instance document adheres to the constraints defined in Schematron schemas. An application-specific schema may be associated with the instance document by either of the following means:
  1. Specify the schema location using the xml-model processing instruction, where the value of the "schematypens" data item is the name of the Schematron namespace (see sample listing below).
  2. Specify the schema location as the value of the sch test run argument;

Using the xml-model PI to refer to a Schematron schema

 
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml-model href="http://example.org/constraints.sch"
             schematypens="http://purl.oclc.org/dsdl/schematron"
             phase="#ALL"?>
 
 
The processing instruction takes precedence if multiple schema references are found.

Sources

  • Constructor Details

    • SchematronTests

      public SchematronTests()
  • Method Details

    • createSchematronValidator

      @BeforeClass public void createSchematronValidator(org.testng.ITestContext testContext)
      Attempts to construct a Schematron validator from a schema reference given in (a) the GML data file, or (b) a test run argument (in the ISuite context).
      Parameters:
      testContext - The test set context.
    • checkGMLSchematronConstraints

      public void checkGMLSchematronConstraints()
      [Test] Verifies that a GML instance satisfies the additional Schematron constraints specified in ISO 19136.

      Sources

    • checkForDeprecatedGMLElements

      public void checkForDeprecatedGMLElements()
      [Test] Checks for the presence of any deprecated GML elements. A warning is issued for each occurrence.
      See Also:
      • "ISO 19136, Annex I: Backwards compatibility with earlier versions of GML"
    • checkSchematronConstraints

      public void checkSchematronConstraints()
      [Test] Validates a GML document against a set of Schematron constraints associated with it using either the xml-model processing instruction or the sch test run argument.
    • isSchematronReference

      boolean isSchematronReference(Map<String,String> piData)
      Indicates whether or not the given PI data includes a Schematron schema reference.
      Parameters:
      piData - A Map containing PI data (pseudo-attributes).
      Returns:
      true if the "schematypens" pseudo-attribute has the value "http://purl.oclc.org/dsdl/schematron"; false otherwise;
    • getXmlModelPIData

      Map<String,String> getXmlModelPIData(File dataFile)
      Extracts the data items from the xml-model processing instruction. The PI must appear before the document element.
      Parameters:
      dataFile - A File containing the GML instance.
      Returns:
      A Map containing the supplied pseudo-attributes, or null if the PI is not present.