You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2013/11/13 11:03:20 UTC
svn commit: r1541445 -
/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/XSDFuncOp.java
Author: andy
Date: Wed Nov 13 10:03:20 2013
New Revision: 1541445
URL: http://svn.apache.org/r1541445
Log:
Fix handling of xsd:date when doing an indeterminate comparison (one timezone, one non-timezone).
Modified:
jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/XSDFuncOp.java
Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/XSDFuncOp.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/XSDFuncOp.java?rev=1541445&r1=1541444&r2=1541445&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/XSDFuncOp.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/expr/nodevalue/XSDFuncOp.java Wed Nov 13 10:03:20 2013
@@ -921,7 +921,7 @@ public class XSDFuncOp
if ( x == XSDDateTime.INDETERMINATE )
{
- NodeValue nv3 = fixupDateTime(nv1) ;
+ NodeValue nv3 = ( nv1.isDate()) ? fixupDate(nv1) : fixupDateTime(nv1) ;
if ( nv3 != null )
{
XMLGregorianCalendar dt3 = nv3.getDateTime() ;
@@ -931,7 +931,7 @@ public class XSDFuncOp
return x ;
}
- nv3 = fixupDateTime(nv2) ;
+ nv3 = ( nv2.isDate()) ? fixupDate(nv2) : fixupDateTime(nv2) ;
if ( nv3 != null )
{
XMLGregorianCalendar dt3 = nv3.getDateTime() ;
@@ -944,10 +944,10 @@ public class XSDFuncOp
throw new ARQInternalErrorException("Failed to fixup dateTimes") ;
}
return x ;
-
}
// // This only differs by some "dateTime" => "date"
+// // Comparison is done on the dateTime start point of an xsd:date so this code is not needed.
// private static int compareDateFO(NodeValue nv1, NodeValue nv2)
// {
// XMLGregorianCalendar dt1 = nv1.getDateTime() ;
@@ -981,6 +981,14 @@ public class XSDFuncOp
// return x ;
// }
+ private static NodeValue fixupDateOrDateTime(NodeValue nv) {
+ if ( nv.isDateTime() )
+ return fixupDateTime(nv);
+ if ( nv.isDate() )
+ return fixupDate(nv);
+ throw new ARQInternalErrorException("Attempt to fixupDateOrDateTime on "+nv);
+ }
+
private static NodeValue fixupDateTime(NodeValue nv)
{
DateTimeStruct dts = DateTimeStruct.parseDateTime(nv.asNode().getLiteralLexicalForm()) ;