throws Exception
{
String NS = "http://example.org/rdf/";
int OFFSET = TimeZone.getDefault().getOffset(new Date(2007, Calendar.NOVEMBER, 6).getTime()) / 1000 / 60;
String SELECT_BY_DATE = "SELECT ?s ?d WHERE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> ?d . FILTER (?d <= ?date) }";
DatatypeFactory data = DatatypeFactory.newInstance();
for (int i = 1; i < 5; i++) {
URI uri = vf.createURI(NS, "date" + i);
XMLGregorianCalendar xcal = data.newXMLGregorianCalendar();
xcal.setYear(2000);
xcal.setMonth(11);
xcal.setDay(i * 2);
testCon.add(uri, RDF.VALUE, vf.createLiteral(xcal));
URI uriz = vf.createURI(NS, "dateZ" + i);
xcal = data.newXMLGregorianCalendar();
xcal.setYear(2007);
xcal.setMonth(11);
xcal.setDay(i * 2);
xcal.setTimezone(OFFSET);
testCon.add(uriz, RDF.VALUE, vf.createLiteral(xcal));
}
XMLGregorianCalendar xcal = data.newXMLGregorianCalendar();
xcal.setYear(2007);
xcal.setMonth(11);
xcal.setDay(6);
xcal.setTimezone(OFFSET);
TupleQuery query = testCon.prepareTupleQuery(QueryLanguage.SPARQL, SELECT_BY_DATE);