Strabon

changeset 817:2151e610123d temporals

removing hardcoded strings for temporal datatype
author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr>
date Wed Dec 19 17:43:33 2012 +0200 (2012-12-19)
parents e42e4beeabb7
children 63cfdc8ef2d8
files evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/GeoConstants.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/TemporalConstants.java generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java generaldb/src/main/java/org/openrdf/sail/generaldb/model/XMLGSDatatypeUtil.java runtime/src/main/java/eu/earthobservatory/runtime/generaldb/NQuadsParser.java runtime/src/main/java/eu/earthobservatory/runtime/generaldb/QuadRDFHandler.java runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java
line diff
     1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/GeoConstants.java	Wed Dec 19 17:23:11 2012 +0200
     1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/GeoConstants.java	Wed Dec 19 17:43:33 2012 +0200
     1.3 @@ -43,7 +43,6 @@
     1.4  	 * in the model stRDF and query language stSPARQL
     1.5  	 */
     1.6  	public static final String GML						= stRDF + "GML";
     1.7 -	public static final String PERIOD                = stRDF + "validTime";
     1.8  
     1.9  	/**
    1.10  	 * 
     2.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/TemporalConstants.java	Wed Dec 19 17:23:11 2012 +0200
     2.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/temporal/stsparql/relation/TemporalConstants.java	Wed Dec 19 17:43:33 2012 +0200
     2.3 @@ -17,6 +17,8 @@
     2.4   */
     2.5  public class TemporalConstants extends GeoConstants {
     2.6  	
     2.7 +	public static final String PERIOD                = stRDF + "validTime";
     2.8 +	
     2.9  	//Temporal Relationships
    2.10  	public static final String periodContains= stRDF+ "PeriodContains";
    2.11  
     3.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java	Wed Dec 19 17:23:11 2012 +0200
     3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java	Wed Dec 19 17:43:33 2012 +0200
     3.3 @@ -29,6 +29,7 @@
     3.4   * Converts a {@link ResultSet} into a {@link BindingSet} in an iteration.
     3.5   * 
     3.6   * @author Manos Karpathiotakis <mk@di.uoa.gr>
     3.7 + * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> (added suport for temporal variables)
     3.8   * 
     3.9   */
    3.10  public abstract class GeneralDBBindingIteration extends RdbmIterationBase<BindingSet, QueryEvaluationException> {
     4.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/model/XMLGSDatatypeUtil.java	Wed Dec 19 17:23:11 2012 +0200
     4.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/model/XMLGSDatatypeUtil.java	Wed Dec 19 17:43:33 2012 +0200
     4.3 @@ -18,6 +18,7 @@
     4.4  
     4.5  import org.openrdf.sail.generaldb.model.GeneralDBPolyhedron;
     4.6  import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants;
     4.7 +import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalConstants;
     4.8  
     4.9  
    4.10  
    4.11 @@ -128,7 +129,7 @@
    4.12  			return false;
    4.13  		}
    4.14  	
    4.15 -		return GeoConstants.PERIOD.equals(datatype.stringValue());
    4.16 +		return TemporalConstants.PERIOD.equals(datatype.stringValue());
    4.17  	}
    4.18  	
    4.19  	/**
     5.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/NQuadsParser.java	Wed Dec 19 17:23:11 2012 +0200
     5.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/NQuadsParser.java	Wed Dec 19 17:43:33 2012 +0200
     5.3 @@ -2,6 +2,7 @@
     5.4  
     5.5  import org.openrdf.model.Resource;
     5.6  import org.openrdf.model.Statement;
     5.7 +import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalConstants;
     5.8  import org.openrdf.rio.RDFFormat;
     5.9  import org.openrdf.rio.RDFHandlerException;
    5.10  import org.openrdf.rio.RDFParseException;
    5.11 @@ -201,12 +202,12 @@
    5.12  
    5.13      public Resource createValidTimeURI(String sb) throws ParseException, RDFParseException
    5.14      {
    5.15 -    	String strdf = "http://strdf.di.uoa.gr/ontology#validTime";
    5.16 +    	String strdf = TemporalConstants.PERIOD;
    5.17      	String period = "http://strdf.di.uoa.gr/ontology#period";
    5.18      	validTimeLiteral=sb;
    5.19      	int i2=0; 
    5.20      	
    5.21 -    	if(sb.toString().contains("^^<http://strdf.di.uoa.gr/ontology#validTime>")||
    5.22 +    	if(sb.toString().contains("^^"+TemporalConstants.PERIOD)||
    5.23      			sb.toString().contains("^^<http://strdf.di.uoa.gr/ontology#period>"))
    5.24       	{	
    5.25      	
     6.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/QuadRDFHandler.java	Wed Dec 19 17:23:11 2012 +0200
     6.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/QuadRDFHandler.java	Wed Dec 19 17:43:33 2012 +0200
     6.3 @@ -20,6 +20,7 @@
     6.4  //import org.junit.Assert;
     6.5  import org.openrdf.model.Resource;
     6.6  import org.openrdf.model.Statement;
     6.7 +import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalConstants;
     6.8  //import org.openrdf.model.URI;
     6.9  import org.openrdf.rio.RDFHandlerException;
    6.10  import org.openrdf.rio.RDFParseException;
    6.11 @@ -48,8 +49,7 @@
    6.12  	        
    6.13  	        @Override
    6.14  	        public void handleStatement(Statement st) {
    6.15 -	            //super.handleStatement(st);
    6.16 -	            if(st.getContext().toString().contains("^^<http://strdf.di.uoa.gr/ontology#validTime>")||
    6.17 +	            if(st.getContext().toString().contains("^^"+TemporalConstants.PERIOD)||
    6.18  	        			st.toString().contains("^^<http://strdf.di.uoa.gr/ontology#period>"))
    6.19  	         	{	
    6.20  	         	    NQuadsParser parser = new NQuadsParser();
    6.21 @@ -60,9 +60,8 @@
    6.22  						 {
    6.23  							 int i = context.indexOf('"')+1;
    6.24  							 int j = context.lastIndexOf('"');
    6.25 -							 validPeriod = "\"[" + context.substring(i,j)+","+context.substring(i,j) + "]\"^^<http://strdf.di.uoa.gr/ontology#validTime>"; 
    6.26 -							 //validPeriod = "\"[" + context.substring(i,j)+","+context.substring(i,j) + "]\"^^<http://strdf.di.uoa.gr/ontology#validTime>";
    6.27 -							// validPeriod = context.replace("]",","+context.substring(i, j)+"]");
    6.28 +							 validPeriod = "\"[" + context.substring(i,j)+","+context.substring(i,j) + "]\"^^"+TemporalConstants.PERIOD; 
    6.29 +
    6.30  						 }
    6.31  					 Resource graph = parser.createValidTimeURI(validPeriod);
    6.32  					 
    6.33 @@ -70,7 +69,6 @@
    6.34  					 if (!triples.toString().contains(triple))
    6.35  					 {
    6.36  						 triples.append(triple);
    6.37 -//						 System.out.println("TRIPLE:"+triple);
    6.38  
    6.39  					 }
    6.40  					
     7.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Wed Dec 19 17:23:11 2012 +0200
     7.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Wed Dec 19 17:43:33 2012 +0200
     7.3 @@ -43,6 +43,7 @@
     7.4  import org.openrdf.query.TupleQueryResultHandlerException;
     7.5  import org.openrdf.query.Update;
     7.6  import org.openrdf.query.UpdateExecutionException;
     7.7 +import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalConstants;
     7.8  import org.openrdf.query.resultio.Format;
     7.9  import org.openrdf.query.resultio.TupleQueryResultWriter;
    7.10  import org.openrdf.query.resultio.stSPARQLQueryResultWriterFactory;
    7.11 @@ -500,7 +501,7 @@
    7.12  					 {
    7.13  						 int i = cont.indexOf('"')+1;
    7.14  						 int j = cont.lastIndexOf('"');
    7.15 -						 validPeriod = "\"[" + cont.substring(i,j) + "," + cont.substring(i,j) + "]\"^^<http://strdf.di.uoa.gr/ontology#validTime>"; 
    7.16 +						 validPeriod = "\"[" + cont.substring(i,j) + "," + cont.substring(i,j) + "]\"^^"+TemporalConstants.PERIOD; 
    7.17  						 //validPeriod = cont.replace("]",","+cont.substring(i, j)+"]");
    7.18  						 
    7.19  					 }
    7.20 @@ -570,7 +571,7 @@
    7.21  				 {
    7.22  					 int i = cont.indexOf('"')+1;
    7.23  					 int j = cont.lastIndexOf('"');
    7.24 -					 validPeriod = "\"[" + cont.substring(i,j) + "," + cont.substring(i,j) + "]\"^^<http://strdf.di.uoa.gr/ontology#validTime>"; 
    7.25 +					 validPeriod = "\"[" + cont.substring(i,j) + "," + cont.substring(i,j) + "]\"^^"+TemporalConstants.PERIOD; 
    7.26  					 //validPeriod = cont.replace("]",","+cont.substring(i, j)+"]");
    7.27  					 
    7.28  				 }