Strabon

changeset 1113:a3b6378fa394

added st_makeline ext. function ot GeneralDBNumericExprFactory as well
author Babis Nikolaou <charnik@di.uoa.gr>
date Sat Apr 27 12:32:51 2013 +0300 (2013-04-27)
parents d6d815e1dbb6
children bba55f126513
files generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoDifference.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoDifference.java	Sat Apr 27 03:53:29 2013 +0300
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoDifference.java	Sat Apr 27 12:32:51 2013 +0300
     1.3 @@ -1,7 +1,11 @@
     1.4 -/*
     1.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008.
     1.6 - *
     1.7 - * Licensed under the Aduna BSD-style license.
     1.8 +/**
     1.9 + * This Source Code Form is subject to the terms of the Mozilla Public
    1.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this
    1.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    1.12 + * 
    1.13 + * Copyright (C) 2012, 2013, Pyravlos Team
    1.14 + * 
    1.15 + * http://www.strabon.di.uoa.gr/
    1.16   */
    1.17  package org.openrdf.sail.generaldb.algebra;
    1.18  
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java	Sat Apr 27 03:53:29 2013 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java	Sat Apr 27 12:32:51 2013 +0300
     2.3 @@ -7,12 +7,12 @@
     2.4  
     2.5  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.asText;
     2.6  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.dimension;
     2.7 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.extDiffDateTime;
     2.8  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoArea;
     2.9  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoBoundary;
    2.10  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoBuffer;
    2.11  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoConvexHull;
    2.12  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoDifference;
    2.13 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.extDiffDateTime;
    2.14  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoDistance;
    2.15  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoEnvelope;
    2.16  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoIntersection;
    2.17 @@ -26,6 +26,8 @@
    2.18  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.srid;
    2.19  import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.unsupported;
    2.20  
    2.21 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.st_MakeLine;
    2.22 +
    2.23  import org.openrdf.model.Literal;
    2.24  import org.openrdf.model.URI;
    2.25  import org.openrdf.model.Value;
    2.26 @@ -64,6 +66,7 @@
    2.27  import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException;
    2.28  
    2.29  import eu.earthobservatory.constants.GeoConstants;
    2.30 +import eu.earthobservatory.vocabulary.PostGIS;
    2.31  
    2.32  /**
    2.33   * Creates an SQL expression of a literal's numeric value.
    2.34 @@ -95,15 +98,11 @@
    2.35  	}
    2.36  
    2.37  	public void setUrisPeek(GeneralDBURIExprFactory labelsPeek) {
    2.38 -		this.urisPeek = urisPeek;
    2.39 +		this.urisPeek = labelsPeek;
    2.40  	}
    2.41 -	/**
    2.42 -	 * 
    2.43 -	 */
    2.44  
    2.45 -	public GeneralDBSqlExpr createNumericExpr(ValueExpr expr)
    2.46 -			throws UnsupportedRdbmsOperatorException
    2.47 -			{
    2.48 +	public GeneralDBSqlExpr createNumericExpr(ValueExpr expr) throws UnsupportedRdbmsOperatorException
    2.49 +	{
    2.50  		result = null;
    2.51  		if (expr == null)
    2.52  			return new GeneralDBSqlNull();
    2.53 @@ -111,7 +110,7 @@
    2.54  		if (result == null)
    2.55  			return new GeneralDBSqlNull();
    2.56  		return result;
    2.57 -			}
    2.58 +	}
    2.59  
    2.60  	@Override
    2.61  	public void meet(Datatype node) {
    2.62 @@ -126,7 +125,7 @@
    2.63  			}
    2.64  
    2.65  	/**
    2.66 -	 * XXX changes here to enable more complicated metric expressions
    2.67 +	 * changes here to enable more complicated metric expressions
    2.68  	 */
    2.69  	@Override
    2.70  	public void meet(MathExpr node)
    2.71 @@ -260,7 +259,6 @@
    2.72  	 * @author George Garbis <ggarbis@di.uoa.gr>
    2.73  	 * 
    2.74  	 */
    2.75 -
    2.76  	public GeneralDBSqlExpr dateTimeFunction(FunctionCall functionCall) throws UnsupportedRdbmsOperatorException
    2.77  	{
    2.78  		Function function = FunctionRegistry.getInstance().get(functionCall.getURI());
    2.79 @@ -271,8 +269,6 @@
    2.80  		
    2.81  		return null;
    2.82  	}
    2.83 -
    2.84 -	
    2.85  	/***/
    2.86  	
    2.87  	public GeneralDBSqlExpr spatialFunction(FunctionCall functionCall) throws UnsupportedRdbmsOperatorException
    2.88 @@ -357,14 +353,13 @@
    2.89  	 * @author George Garbis <ggarbis@di.uoa.gr>
    2.90  	 * 
    2.91  	 */
    2.92 -	
    2.93  	GeneralDBSqlExpr dateTimeMetricFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException
    2.94  	{
    2.95  		GeneralDBSqlExpr leftArg = null;
    2.96  		GeneralDBSqlExpr rightArg = null;
    2.97  
    2.98 -		ValueExpr left = functionCall.getArgs().get(0);
    2.99 -		ValueExpr right = functionCall.getArgs().get(1);
   2.100 +		//ValueExpr left = functionCall.getArgs().get(0);
   2.101 +		//ValueExpr right = functionCall.getArgs().get(1);
   2.102  
   2.103  		// TODO ti bazw edw??
   2.104  		leftArg = null;
   2.105 @@ -373,7 +368,6 @@
   2.106  		return dateTimeMetricPicker(function, leftArg, rightArg);
   2.107  
   2.108  	}
   2.109 -		
   2.110  	/***/
   2.111  	
   2.112  	GeneralDBSqlExpr spatialMetricFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException
   2.113 @@ -471,7 +465,7 @@
   2.114  		{
   2.115  			return geoSymDifference(leftArg, rightArg);
   2.116  		}
   2.117 -		//XXX GeoSPARQL - Non topological - except distance		
   2.118 +		// GeoSPARQL - Non topological - except distance		
   2.119  		else if(function.getURI().equals(GeoConstants.geoSparqlConvexHull))
   2.120  		{
   2.121  			return geoConvexHull(leftArg);
   2.122 @@ -504,6 +498,12 @@
   2.123  		{
   2.124  			return geoBuffer(leftArg,rightArg, thirdArg);
   2.125  		}
   2.126 +		/** PostGIS construct functions */
   2.127 +		else if(function.getURI().equals(PostGIS.ST_MAKELINE))
   2.128 +		{
   2.129 +			return st_MakeLine(leftArg, rightArg);
   2.130 +		}
   2.131 +		/** PostGIS construct functions */
   2.132  		//Should never reach this place
   2.133  		return null;
   2.134  	}