Class IllFormedDateCorrector

java.lang.Object
org.eclipse.epsilon.rdf.emf.IllFormedDateCorrector

public class IllFormedDateCorrector extends Object

Corrects ill-formed xsd:dateTime, xsd:dateTimeStamp and xsd:date literals into valid ones, by adding or removing components as needed. For instance, "2026-09-10"^^xsd:dateTime is corrected to "2026-09-10T00:00:00"^^xsd:dateTime.

Missing time components default to zero, missing timezones are only added for xsd:dateTimeStamp (as UTC), and month/day/hour/minute/second values are zero-padded. Literals which cannot be corrected are left as is.

  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.jena.rdf.model.Literal
    correct(org.apache.jena.rdf.model.Literal l)
    Returns a corrected version of the literal if it is an ill-formed date/time literal that can be corrected, or null otherwise.
    static int
    correct(org.apache.jena.rdf.model.Model model)
    Replaces all the ill-formed date/time literals in the model with corrected versions, where possible.
    static String
    correctLexicalForm(String lexicalForm, org.apache.jena.datatypes.RDFDatatype dt)
    Returns a valid lexical form for the given datatype from a possibly ill-formed one, or null if it cannot be corrected.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • correct

      public static int correct(org.apache.jena.rdf.model.Model model)
      Replaces all the ill-formed date/time literals in the model with corrected versions, where possible.
      Returns:
      Number of corrected literals.
    • correct

      public static org.apache.jena.rdf.model.Literal correct(org.apache.jena.rdf.model.Literal l)
      Returns a corrected version of the literal if it is an ill-formed date/time literal that can be corrected, or null otherwise.
    • correctLexicalForm

      public static String correctLexicalForm(String lexicalForm, org.apache.jena.datatypes.RDFDatatype dt)
      Returns a valid lexical form for the given datatype from a possibly ill-formed one, or null if it cannot be corrected.