Strabon

changeset 822:1562eb0afdcb temporals

added "Until Changed support" to the query engine
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Thu Dec 20 14:00:17 2012 +0200 (2012-12-20)
parents 4a67573708da
children a2d313dff1dd
files postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java
line diff
     1.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java	Wed Dec 19 20:18:19 2012 +0200
     1.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java	Thu Dec 20 14:00:17 2012 +0200
     1.3 @@ -78,6 +78,8 @@
     1.4  
     1.5  		SimpleDateFormat postgres = new SimpleDateFormat("yyyy-MM-DD HH:mm:ss");
     1.6  		SimpleDateFormat xsd = new SimpleDateFormat("yyyy-MM-DD'T'HH:mm:ss");
     1.7 +		Calendar now = new GregorianCalendar().getInstance();
     1.8 +		Calendar cal = new GregorianCalendar();
     1.9  		try {
    1.10  			
    1.11  			String newStart = xsd.format(postgres.parse(periods[0])).toString();
    1.12 @@ -89,8 +91,18 @@
    1.13  			}
    1.14  			else
    1.15  			{
    1.16 -				label = temp.replace(periods[0], newStart).replace(periods[1], newEnd);
    1.17 -			    datatype = vf.createURI(TemporalConstants.PERIOD);		
    1.18 +				 now = new GregorianCalendar().getInstance();
    1.19 +				 cal.setTime(postgres.parse(periods[1]));
    1.20 +				 if(cal.after(now))
    1.21 +				 {
    1.22 +						label = temp.replace(periods[0], newStart).replace(periods[1], "UC");
    1.23 +
    1.24 +				 }
    1.25 +				 else
    1.26 +				 {
    1.27 +					 label = temp.replace(periods[0], newStart).replace(periods[1], newEnd); 
    1.28 +				 }
    1.29 +				datatype = vf.createURI(TemporalConstants.PERIOD);		
    1.30  			}			
    1.31  			
    1.32  		} catch (ParseException e) {