It appears that jena does not handle dates that are in the range 00 to 999.  
When it generates the lexical form, it fails to pad the year to 4 digits, which 
leads to RDF parse problems.

This test, run against jena 1.7.3

       public void testTwoDigitYear() {
              Calendar cal = Calendar.getInstance();
              cal.set(Calendar.YEAR, 77);
              cal.set(Calendar.MONTH, 11);
              cal.set(Calendar.DATE, 25);
              XSDDateTime xdt = new XSDDateTime(cal);

        LiteralLabel ll = LiteralLabelFactory.create(xdt, "", 
XSDDatatype.XSDdateTime);
              System.out.println("Note that the year has only two digits: 
literal is "+ ll);
        assertTrue(ll.isWellFormed());
       }

produces

Note that the year has only two digits: literal is 
77-12-25T21:32:55.66Z^^http://www.w3.org/2001/XMLSchema#dateTime

and then the assertion fails.

My guess is that the root cause is that the toString method of XSDDateTime 
begins

 public String toString() {
        StringBuffer buff = new StringBuffer();
        if ((mask & YEAR_MASK) != 0) {
            buff.append(data[CY]);
        } else {
            buff.append("-");
        }

and doesn't pad the data[CY] to four digits.
Michael Altmann

Reply via email to