XSDDuration dur2 = (XSDDuration)d2.getValue() ;
assertEquals("duration compare order", 1, dur2.compare(dur1)) ;
// dateTime
l1 = m.createTypedLiteral("1999-05-31T02:09:32Z", XSDDatatype.XSDdateTime);
XSDDateTime xdt = (XSDDateTime)l1.getValue();
assertEquals("dateTime data type", XSDDatatype.XSDdateTime, l1.getDatatype());
assertEquals("dateTime java type", XSDDateTime.class, l1.getValue().getClass());
assertEquals("dateTime value", 1999, xdt.getYears());
assertEquals("dateTime value", 5, xdt.getMonths());
assertEquals("dateTime value", 31, xdt.getDays());
assertEquals("dateTime value", 2, xdt.getHours());
assertEquals("dateTime value", 9, xdt.getMinutes());
assertEquals("dateTime value", 32, xdt.getFullSeconds());
assertEquals("serialization", "1999-05-31T02:09:32Z", l1.getValue().toString());
Calendar cal = xdt.asCalendar();
Calendar testCal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
testCal.set(1999, 4, 31, 2, 9, 32);
/*
assertEquals("calendar value", cal.get(Calendar.YEAR), testCal.get(Calendar.YEAR) );
assertEquals("calendar value", cal.get(Calendar.MONTH), testCal.get(Calendar.MONTH) );
assertEquals("calendar value", cal.get(Calendar.DATE), testCal.get(Calendar.DATE) );
assertEquals("calendar value", cal.get(Calendar.HOUR), testCal.get(Calendar.HOUR) );
assertEquals("calendar value", cal.get(Calendar.MINUTE), testCal.get(Calendar.MINUTE) );
assertEquals("calendar value", cal.get(Calendar.SECOND), testCal.get(Calendar.SECOND) );
*/
testCal.set(Calendar.MILLISECOND, 0); // ms field can be undefined on Linux
assertEquals("calendar value", cal, testCal);
assertEquals("equality test", l1, m.createTypedLiteral("1999-05-31T02:09:32Z", XSDDatatype.XSDdateTime));
assertTrue("inequality test", l1 != m.createTypedLiteral("1999-04-31T02:09:32Z", XSDDatatype.XSDdateTime));
Calendar testCal2 = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
testCal2.set(1999, 4, 30, 15, 9, 32);
testCal2.set(Calendar.MILLISECOND, 0); // ms field can be undefined on Linux
Literal lc = m.createTypedLiteral(testCal2);
assertEquals("calendar 24 hour test", m.createTypedLiteral("1999-05-30T15:09:32Z", XSDDatatype.XSDdateTime), lc );
assertEquals("calendar value", cal, testCal);
assertEquals("equality test", l1, m.createTypedLiteral("1999-05-31T02:09:32Z", XSDDatatype.XSDdateTime));
Calendar testCal3 = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
testCal3.clear();
testCal3.set(1999, Calendar.JANUARY, 30, 15, 9, 32);
lc = m.createTypedLiteral(testCal3);
assertEquals("1999-01-30T15:09:32Z", lc.getLexicalForm());
String urib="rdf://test.com#";
String uri1=urib+"1";
String urip=urib+"prop";
String testN3 = "<"+uri1+"> <"+urip+"> \""+lc.getLexicalForm()+"\"^^<"+lc.getDatatypeURI()+"> .";
java.io.StringReader sr = new java.io.StringReader(testN3);
m.read(sr, urib, "N3");
assertTrue(m.contains(m.getResource(uri1),m.getProperty(urip)));
Resource r1 = m.getResource(uri1);
Property p = m.getProperty(urip);
XSDDateTime returnedDateTime = (XSDDateTime) r1.getProperty(p).getLiteral().getValue();
assertEquals("deserialized calendar value", testCal3, returnedDateTime.asCalendar());
// dateTime to calendar with milliseconds
Calendar testCal4 = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
testCal4.set(1999, 4, 30, 15, 9, 32);
testCal4.set(Calendar.MILLISECOND, 25);