Strabon

changeset 1410:2a7de8a1a022

support also geof:convexHull in grounded expressions evaluated in the SELECT clause
author Babis Nikolaou <charnik@di.uoa.gr>
date Sun Sep 21 19:21:57 2014 +0300 (2014-09-21)
parents f8639ac53007
children 137486888a68
files evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SPARQL11Tests.java
line diff
     1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java	Sun Sep 21 19:02:29 2014 +0300
     1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java	Sun Sep 21 19:21:57 2014 +0300
     1.3 @@ -701,24 +701,15 @@
     1.4  	}
     1.5  
     1.6  	public static StrabonPolyhedron buffer(StrabonPolyhedron A, double B) throws Exception {
     1.7 -		StrabonPolyhedron poly = new StrabonPolyhedron(A.getGeometryDatatype());
     1.8 -		poly.geometry = A.geometry.buffer(B);
     1.9 -
    1.10 -		return poly;
    1.11 +		return new StrabonPolyhedron(A.geometry.buffer(B), A.getGeometry().getSRID(), A.getGeometryDatatype());
    1.12  	}
    1.13  
    1.14  	public static StrabonPolyhedron envelope(StrabonPolyhedron A) throws Exception {
    1.15 -		StrabonPolyhedron poly = new StrabonPolyhedron(A.getGeometryDatatype());
    1.16 -		poly.geometry = A.geometry.getEnvelope();
    1.17 -
    1.18 -		return poly;
    1.19 +		return new StrabonPolyhedron(A.geometry.getEnvelope(), A.getGeometry().getSRID(), A.getGeometryDatatype());
    1.20  	}
    1.21  
    1.22  	public static StrabonPolyhedron convexHull(StrabonPolyhedron A) throws Exception {
    1.23 -		StrabonPolyhedron poly = new StrabonPolyhedron(A.getGeometryDatatype());
    1.24 -		poly.geometry = A.geometry.convexHull();
    1.25 -
    1.26 -		return poly;
    1.27 +		return new StrabonPolyhedron(A.getGeometry().convexHull(), A.getGeometry().getSRID(), A.getGeometryDatatype());
    1.28  	}
    1.29  
    1.30  	public static StrabonPolyhedron boundary(StrabonPolyhedron A) throws Exception {
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Sun Sep 21 19:02:29 2014 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Sun Sep 21 19:21:57 2014 +0300
     2.3 @@ -52,6 +52,7 @@
     2.4  import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc;
     2.5  import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron;
     2.6  import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper;
     2.7 +import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlConvexHullFunc;
     2.8  import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.property.GeoSparqlGetSRIDFunc;
     2.9  import org.openrdf.query.algebra.evaluation.function.spatial.postgis.construct.Centroid;
    2.10  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc;
    2.11 @@ -527,7 +528,8 @@
    2.12  		{
    2.13  			return StrabonPolyhedron.envelope(leftArg);
    2.14  		}
    2.15 -		else if(function.getURI().equals(GeoConstants.stSPARQLconvexHull))
    2.16 +		else if(function.getURI().equals(GeoConstants.stSPARQLconvexHull) ||
    2.17 +				function instanceof GeoSparqlConvexHullFunc)
    2.18  		{
    2.19  			return StrabonPolyhedron.convexHull(leftArg);
    2.20  		}
     3.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SPARQL11Tests.java	Sun Sep 21 19:02:29 2014 +0300
     3.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SPARQL11Tests.java	Sun Sep 21 19:21:57 2014 +0300
     3.3 @@ -15,6 +15,7 @@
     3.4  import java.io.IOException;
     3.5  import java.util.ArrayList;
     3.6  
     3.7 +import org.junit.BeforeClass;
     3.8  import org.junit.Test;
     3.9  import org.openrdf.model.vocabulary.RDF;
    3.10  import org.openrdf.model.vocabulary.XMLSchema;
    3.11 @@ -23,7 +24,6 @@
    3.12  import org.openrdf.query.TupleQueryResultHandlerException;
    3.13  import org.openrdf.repository.RepositoryException;
    3.14  
    3.15 -
    3.16  public class SPARQL11Tests {
    3.17  	public static Strabon strabon;
    3.18  
    3.19 @@ -49,14 +49,12 @@
    3.20  		"PREFIX dc11: <"+DC11_NS+"> \n";
    3.21  	
    3.22  //	@BeforeClass
    3.23 -//	public static void initialize() throws SQLException, ClassNotFoundException
    3.24 +//	public static void initialize() throws Exception
    3.25  //	{
    3.26 -//		strabon = new Strabon("sparql11-tests","postgres","p1r3as", 5432, "localhost", true);
    3.27 +//		strabon = new eu.earthobservatory.runtime.postgis.Strabon("test", "postgres", "postgres", 5432, "localhost", true);
    3.28  //
    3.29  //	}
    3.30  
    3.31 -
    3.32 -	
    3.33  	@Test
    3.34  	public void testRetrieveEveryEntry() throws MalformedQueryException, RepositoryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
    3.35  	{