Strabon

changeset 1411:137486888a68

This is a merge commit that addresses the following issues:
a) We are consciously using longitude/latitude semantics for the EPSG:4326 CRS, although this is not what is expected by geographers, who assume a latitude/longitude axis order. Therefore, CRS84 and EPSG:4326 are treated equivalently by Strabon. It is important to mention that EPSG:4326 with a lat/long ordering is not supported in the sense that there is no way to get any geometry in such a CRS (e.g., by using the strdf:transform extension function with the second argument being EPSG:4326). This behaviour had always been what Strabon was following, and was mainly due to the fact that PostGIS assumes a long/lat ordering for EPSG:4326.
b) Fixes various bugs and specifically bugs #32, #69, #71, and #72 (detailed information may be found in earlier commits).
c) It contains a lot of refactoring, especially in StrabonPolyhedron and GeneralDBEvaluation (mostly with respect to evaluating expressions in Java).

This commit is dedicated to Konstantina. Ntina we miss you!
author Babis Nikolaou <charnik@di.uoa.gr>
date Mon Sep 22 12:53:55 2014 +0300 (2014-09-22)
parents 2a7de8a1a022 db18a6676e05
children 8dc244d8f18a
files endpoint-client/pom.xml generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBSpatialFuncInfo.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISEvaluation.java postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java resultio-spatial/sparqlxml/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLResultsXMLWriter.java resultio-spatial/text/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.rq testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.srx testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.srx testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromDBTest.srx testsuite/src/test/resources/geoSPARQL/GeometryLiteralsTest/DefaultCRS.srx
line diff
     1.1 --- a/.hgtags	Sun Sep 21 19:21:57 2014 +0300
     1.2 +++ b/.hgtags	Mon Sep 22 12:53:55 2014 +0300
     1.3 @@ -18,3 +18,4 @@
     1.4  b3e0d7415823df2e814aa6fa45aa13374a81e706 v3.2.7
     1.5  389213ce7843a9c490be447400c1a5c46d44cc96 v3.2.8
     1.6  92b90ac06d39f8fcf76de046f22bb64526d5ff28 v3.2.9
     1.7 +e453684f594f568079ec28733e0a4a6df8be0e37 v3.2.10
     2.1 --- a/ChangeLog	Sun Sep 21 19:21:57 2014 +0300
     2.2 +++ b/ChangeLog	Mon Sep 22 12:53:55 2014 +0300
     2.3 @@ -1,7 +1,27 @@
     2.4 +	* Fixed a bug that would raise an exception for queries involving two
     2.5 +	  UNION graph patterns and a projection to a predicate or a URI in
     2.6 +	  general.
     2.7 +	  (bug #53: http://bug.strabon.di.uoa.gr/ticket/53)
     2.8  
     2.9 +Wed Sep 17 20:14:12 2014   Pyravlos Team
    2.10  
    2.11  	* Version 3.2.10 released.
    2.12  
    2.13 +	* The test suite of Strabon has now reached a mature level. It
    2.14 +	  contains tests for both stSPARQL and GeoSPARQL query languages and
    2.15 +	  most of the compliance tests covered in the specification of
    2.16 +	  GeoSPARQL (well, only those tests for the components that we have
    2.17 +	  chosen to implement). 
    2.18 +
    2.19 +	* The endpoint now parses Accept headers with multiple values and uses
    2.20 +	  the first mimetype corresponding to a valid stSPARQLQueryResultFormat.
    2.21 +	  (bug #64: http://bug.strabon.di.uoa.gr/ticket/64)
    2.22 +
    2.23 +	* The endpoint now registers a handler for SIGTERM signals, so that if
    2.24 +	  it is run from the command-line (endpoint-exec), then the closing of
    2.25 +	  the connection will be ultimately called.
    2.26 +	  (bug #40: http://bug.strabon.di.uoa.gr/ticket/40)
    2.27 +
    2.28  	* Strabon goes debian v1. the endpoint-exec jar is now given in a .deb 
    2.29            format. By dpkg-ing it, one can run a stand alone strabon endpoint
    2.30            locally.
    2.31 @@ -9,11 +29,15 @@
    2.32  
    2.33  	* Fixed a bug in which Strabon hanged when a unary spatial construct 
    2.34  	  had a ternary spatial construct as argument. 
    2.35 -	  (bug #45 http://bug.strabon.di.uoa.gr/ticket/45
    2.36 +	  (bug #45 http://bug.strabon.di.uoa.gr/ticket/45)
    2.37  
    2.38 -	* Altered default SRID to GeoSPARQL SRID: Geometries with wktLiteral 
    2.39 -	  datatype in SPARQL queries were not interpreted in the correct CRS.
    2.40 -	  (bug #44 http://bug.strabon.di.uoa.gr/ticket/44)
    2.41 +	* Fixed a bug according to which spatial functions in ORDER BY were not
    2.42 +	  evaluated at all.
    2.43 +	  (bug #62: http://bug.strabon.di.uoa.gr/ticket/62)
    2.44 +
    2.45 +	* Fixed a bug according to which spatial boolean functions appearing
    2.46 +	  in the SELECT clause were raising a NULL pointer exception.
    2.47 +	  (bug #34: http://bug.strabon.di.uoa.gr/ticket/34)
    2.48  
    2.49  	* Fixed a bug in queries that contain variables that exist inside 
    2.50  	  spatial functions in select and do not exist in the where clause 
    2.51 @@ -34,8 +58,8 @@
    2.52  	  - The DESCRIBE functionality can now be accessed through the menu bar.
    2.53  	
    2.54  	* Fixed a bug where strdf:intersection function did not work as an
    2.55 -	aggregate when used without 'GROUP BY'.
    2.56 -	(bug #46 https://bug.strabon.di.uoa.gr/ticket/46)
    2.57 +	  aggregate when used without 'GROUP BY'.
    2.58 +	  (bug #46 https://bug.strabon.di.uoa.gr/ticket/46)
    2.59  
    2.60  
    2.61  Sat Oct 19 23:37:23 2013   Pyravlos Team
     3.1 --- a/README	Sun Sep 21 19:21:57 2014 +0300
     3.2 +++ b/README	Mon Sep 22 12:53:55 2014 +0300
     3.3 @@ -66,6 +66,12 @@
     3.4  
     3.5  	$ mvn -DskipTests=false clean package
     3.6  
     3.7 +Alternatively, it is possible to run a specific test. Supposing that the name of
     3.8 +the corresponding class is `TestName', then you can run only this
     3.9 +test using the following command:
    3.10 +
    3.11 +	$ mvn test -DfailIfNoTests=false -DskipTests=false -Dtest=TestName
    3.12 +
    3.13  In case of an error during building of Strabon and assuming that the error does
    3.14  not come from the JUnit tests, please have a look at the `Known Issues' section
    3.15  below. If none of the known issues of that section applies, please contact the
     4.1 --- a/endpoint-client/pom.xml	Sun Sep 21 19:21:57 2014 +0300
     4.2 +++ b/endpoint-client/pom.xml	Mon Sep 22 12:53:55 2014 +0300
     4.3 @@ -5,7 +5,7 @@
     4.4  	<parent>
     4.5  		<groupId>eu.earthobservatory</groupId>
     4.6  		<artifactId>strabon</artifactId>
     4.7 -		<version>3.2.10-SNAPSHOT</version>
     4.8 +		<version>3.2.11-SNAPSHOT</version>
     4.9  	</parent>
    4.10  
    4.11  	<artifactId>strabon-endpoint-client</artifactId>
     5.1 --- a/endpoint-exec/pom.xml	Sun Sep 21 19:21:57 2014 +0300
     5.2 +++ b/endpoint-exec/pom.xml	Mon Sep 22 12:53:55 2014 +0300
     5.3 @@ -5,7 +5,7 @@
     5.4  	<parent>
     5.5  		<groupId>eu.earthobservatory</groupId>
     5.6  		<artifactId>strabon</artifactId>
     5.7 -		<version>3.2.10-SNAPSHOT</version>
     5.8 +		<version>3.2.11-SNAPSHOT</version>
     5.9  	</parent>
    5.10  
    5.11  	<artifactId>strabon-endpoint-exec</artifactId>
     6.1 --- a/endpoint/pom.xml	Sun Sep 21 19:21:57 2014 +0300
     6.2 +++ b/endpoint/pom.xml	Mon Sep 22 12:53:55 2014 +0300
     6.3 @@ -4,7 +4,7 @@
     6.4  	<parent>
     6.5  		<groupId>eu.earthobservatory</groupId>
     6.6  		<artifactId>strabon</artifactId>
     6.7 -		<version>3.2.10-SNAPSHOT</version>
     6.8 +		<version>3.2.11-SNAPSHOT</version>
     6.9  	</parent>
    6.10  
    6.11  	<artifactId>strabon-endpoint</artifactId>
     7.1 --- a/evaluation/pom.xml	Sun Sep 21 19:21:57 2014 +0300
     7.2 +++ b/evaluation/pom.xml	Mon Sep 22 12:53:55 2014 +0300
     7.3 @@ -5,7 +5,7 @@
     7.4  	<parent>
     7.5  		<groupId>eu.earthobservatory</groupId>
     7.6  		<artifactId>strabon</artifactId>
     7.7 -		<version>3.2.10-SNAPSHOT</version>
     7.8 +		<version>3.2.11-SNAPSHOT</version>
     7.9  	</parent>
    7.10  
    7.11  	<groupId>org.openrdf.sesame</groupId>
     8.1 --- a/generaldb/pom.xml	Sun Sep 21 19:21:57 2014 +0300
     8.2 +++ b/generaldb/pom.xml	Mon Sep 22 12:53:55 2014 +0300
     8.3 @@ -6,7 +6,7 @@
     8.4  	<parent>
     8.5  		<groupId>eu.earthobservatory</groupId>
     8.6  		<artifactId>strabon</artifactId>
     8.7 -		<version>3.2.10-SNAPSHOT</version>
     8.8 +		<version>3.2.11-SNAPSHOT</version>
     8.9  	</parent>
    8.10    
    8.11  	<groupId>org.openrdf.sesame</groupId>
     9.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBSpatialFuncInfo.java	Sun Sep 21 19:21:57 2014 +0300
     9.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBSpatialFuncInfo.java	Mon Sep 22 12:53:55 2014 +0300
     9.3 @@ -7,6 +7,7 @@
     9.4   * located in select clause. Currently storing info about the name of the field that 
     9.5   * has to be retrieved from the Result Set, as well as the type of the spatial function.
     9.6   * 
     9.7 + * @author Charalampos Nikolaou <charnik@di.uoa.gr>
     9.8   * @author Manos Karpathiotakis <mk@di.uoa.gr>
     9.9   */
    9.10  public class GeneralDBSpatialFuncInfo {
    10.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/UnaryGeneralDBOperator.java	Sun Sep 21 19:21:57 2014 +0300
    10.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/UnaryGeneralDBOperator.java	Mon Sep 22 12:53:55 2014 +0300
    10.3 @@ -9,15 +9,19 @@
    10.4  import org.openrdf.query.algebra.QueryModelVisitor;
    10.5  import org.openrdf.query.algebra.helpers.QueryModelTreePrinter;
    10.6  import org.openrdf.sail.generaldb.optimizers.GeneralDBSqlConstantOptimizer;
    10.7 +import org.slf4j.Logger;
    10.8 +import org.slf4j.LoggerFactory;
    10.9  
   10.10  /**
   10.11   * An SQL operator with one argument.
   10.12   * 
   10.13 + * @author Charalampos Nikolaou <charnik@di.uoa.gr>
   10.14   * @author James Leigh
   10.15 - * 
   10.16   */
   10.17  public abstract class UnaryGeneralDBOperator extends GeneralDBQueryModelNodeBase implements GeneralDBSqlExpr {
   10.18  
   10.19 +	private static Logger logger = LoggerFactory.getLogger(org.openrdf.sail.generaldb.algebra.base.UnaryGeneralDBOperator.class);
   10.20 +
   10.21  	private GeneralDBSqlExpr arg;
   10.22  
   10.23  	public UnaryGeneralDBOperator() {
   10.24 @@ -51,7 +55,10 @@
   10.25  			setArg((GeneralDBSqlExpr)replacement);
   10.26  		}
   10.27  		else {
   10.28 -			super.replaceChildNode(current, replacement);
   10.29 +			if (logger.isWarnEnabled()) {
   10.30 +				logger.warn("[Strabon.GeneralDB] The next call will blow things up. I'll try to suppress it, but notify me in case anything goes wrong.");
   10.31 +			}
   10.32 +			//super.replaceChildNode(current, replacement);
   10.33  		}
   10.34  	}
   10.35  
    11.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Sun Sep 21 19:21:57 2014 +0300
    11.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Mon Sep 22 12:53:55 2014 +0300
    11.3 @@ -55,6 +55,7 @@
    11.4  import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlConvexHullFunc;
    11.5  import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.property.GeoSparqlGetSRIDFunc;
    11.6  import org.openrdf.query.algebra.evaluation.function.spatial.postgis.construct.Centroid;
    11.7 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BoundaryFunc;
    11.8  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc;
    11.9  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.DistanceFunc;
   11.10  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.AsGMLFunc;
   11.11 @@ -156,7 +157,7 @@
   11.12  
   11.13  	protected IdSequence ids;
   11.14  
   11.15 -	protected HashMap<Integer,String> geoNames = new HashMap<Integer,String>();
   11.16 +	protected HashMap<String, Integer> geoNames = new HashMap<String, Integer>();
   11.17  
   11.18  	protected List<GeneralDBSqlExpr> thematicExpressions = new ArrayList<GeneralDBSqlExpr>(5);
   11.19  	
   11.20 @@ -438,7 +439,7 @@
   11.21  				ValueFactory localvf = ValueFactoryImpl.getInstance();
   11.22  				
   11.23  				if (function instanceof GeoSparqlGetSRIDFunc) {
   11.24 -					return localvf.createURI(WKTHelper.getEPSGURI_forSRID(getSRIDFromValue(leftResult)));
   11.25 +					return localvf.createURI(getSRIDFromValue(leftResult));
   11.26  					
   11.27  				} else if (function instanceof SridFunc) {
   11.28  					return localvf.createLiteral(getSRIDFromValue(leftResult));
   11.29 @@ -533,7 +534,7 @@
   11.30  		{
   11.31  			return StrabonPolyhedron.convexHull(leftArg);
   11.32  		}
   11.33 -		else if(function.getURI().equals(GeoConstants.stSPARQLboundary))
   11.34 +		else if(function instanceof BoundaryFunc)
   11.35  		{
   11.36  			return StrabonPolyhedron.boundary(leftArg);
   11.37  		}
   11.38 @@ -705,7 +706,7 @@
   11.39  						//XXX if the variable is actually a GeoVar
   11.40  						if(var.isSpatial())
   11.41  						{
   11.42 -							this.geoNames.put(var.getIndex()+2,var.getName());
   11.43 +							this.geoNames.put(var.getName(), var.getIndex() + 2);
   11.44  							//I am carrying SRID too! Therefore, shifting index one more position
   11.45  							index++;
   11.46  						}
   11.47 @@ -742,12 +743,11 @@
   11.48  		while (it.hasNext()) {
   11.49  			@SuppressWarnings("rawtypes")
   11.50  			Map.Entry pairs = (Map.Entry)it.next();
   11.51 -			//System.out.println(pairs.getKey() + " = " + pairs.getValue());
   11.52 -
   11.53 -			//Trying to fill what's missing
   11.54 +			
   11.55 +			// Trying to fill what's missing
   11.56  			GeneralDBSqlExpr expr = (GeneralDBSqlExpr) pairs.getValue();
   11.57 -			locateColumnVars(expr,qb.getVars());
   11.58 -
   11.59 +			locateColumnVars(expr, qb.getVars());
   11.60 +			
   11.61  			//Assuming thematic aggregates and spatial expressions won't be combined
   11.62  			if(!this.thematicExpressions.contains(expr))
   11.63  			{
   11.64 @@ -770,8 +770,7 @@
   11.65  					
   11.66  				}
   11.67  
   11.68 -				//constructIndexesAndNames.put((String) pairs.getKey(),index++);
   11.69 -				constructIndexesAndNames.put(info,index++);
   11.70 +				constructIndexesAndNames.put(info, index++);
   11.71  				if(increaseIndex)
   11.72  				{
   11.73  					//Increasing index by one more because of SRID!
   11.74 @@ -881,7 +880,7 @@
   11.75  		}
   11.76  		else if(expr instanceof GeneralDBLabelColumn)//ColumnVar at least
   11.77  		{
   11.78 -			String name = ((GeneralDBLabelColumn) expr).getVarName().replace("?spatial","");;
   11.79 +			String name = ((GeneralDBLabelColumn) expr).getVarName().replace("?spatial","");
   11.80  
   11.81  			for(GeneralDBColumnVar reference: allKnown)
   11.82  			{
   11.83 @@ -977,18 +976,61 @@
   11.84  	}
   11.85  
   11.86  	
   11.87 -	public int getSRIDFromValue(Value value) {
   11.88 +	/**
   11.89 +	 * Very customized method for taking the URI corresponding to the SRID of a
   11.90 +	 * {@link Value} that may be one of {@link StrabonPolyhedron}, 
   11.91 +	 * {@link GeneralDBPolyhedron}, or {@link Literal}.
   11.92 +	 * 
   11.93 +	 * The insight is that we would like to return the URI for CRS84 when the
   11.94 +	 * SRID equals {@link GeoConstants.EPSG4326_SRID} and not the URI for 
   11.95 +	 * EPSG:4326. Since, we have such information available, we choose to
   11.96 +	 * do compute it.
   11.97 +	 * 
   11.98 +	 * @param value
   11.99 +	 * @return
  11.100 +	 */
  11.101 +	public String getSRIDFromValue(Value value) {
  11.102 +		boolean iswktLiteral = false;
  11.103 +		int srid = -1;
  11.104 +		
  11.105  		if (value instanceof GeneralDBPolyhedron) {
  11.106 -			return ((GeneralDBPolyhedron) value).getPolyhedron().getGeometry().getSRID();
  11.107 +			StrabonPolyhedron poly = ((GeneralDBPolyhedron) value).getPolyhedron(); 
  11.108 +			srid = poly.getGeometry().getSRID();
  11.109 +			
  11.110 +			if (poly.getGeometryDatatype() == GeometryDatatype.wktLiteral) {
  11.111 +				iswktLiteral = true;
  11.112 +			}
  11.113  			
  11.114  		} else if (value instanceof StrabonPolyhedron) {
  11.115 -			return ((StrabonPolyhedron) value).getGeometry().getSRID();
  11.116 +			StrabonPolyhedron poly = ((StrabonPolyhedron) value); 
  11.117 +			srid = poly.getGeometry().getSRID();
  11.118 +			
  11.119 +			if (poly.getGeometryDatatype() == GeometryDatatype.wktLiteral) {
  11.120 +				iswktLiteral = true;
  11.121 +			}
  11.122  			
  11.123  		} else if (value instanceof Literal) {
  11.124 -			return (new AbstractWKT(((Literal) value).stringValue())).getSRID();
  11.125 +			Literal literal = (Literal) value;
  11.126 +			AbstractWKT wkt;
  11.127  			
  11.128 -		} else { // default error SRID value 
  11.129 -			return -1;
  11.130 +			if (literal.getDatatype() != null) {
  11.131 +				wkt = new AbstractWKT(literal.stringValue(), literal.getDatatype().stringValue());
  11.132 +				
  11.133 +			} else {
  11.134 +				wkt = new AbstractWKT(literal.stringValue());
  11.135 +			}
  11.136 +			 
  11.137 +			srid = wkt.getSRID();
  11.138 +			if (!wkt.isstRDFWKT()) {
  11.139 +				iswktLiteral = true;
  11.140 +			}
  11.141 +		}
  11.142 +		
  11.143 +		if (iswktLiteral && srid == GeoConstants.EPSG4326_SRID) {
  11.144 +			return GeoConstants.CRS84_URI;
  11.145 +			
  11.146 +		} else {
  11.147 +			return WKTHelper.getEPSGURI_forSRID(srid);
  11.148  		}
  11.149  	}
  11.150  	
  11.151 @@ -1010,7 +1052,10 @@
  11.152  				wkt = new AbstractWKT(literal.stringValue(), literal.getDatatype().stringValue());
  11.153  			}
  11.154  			
  11.155 -			return JTSWrapper.getInstance().WKTread(wkt.getWKT());
  11.156 +			Geometry geom = JTSWrapper.getInstance().WKTread(wkt.getWKT());
  11.157 +			geom.setSRID(wkt.getSRID());
  11.158 +			
  11.159 +			return geom;
  11.160  			
  11.161  		} else {
  11.162  			return null;
    12.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Sun Sep 21 19:21:57 2014 +0300
    12.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Mon Sep 22 12:53:55 2014 +0300
    12.3 @@ -778,6 +778,9 @@
    12.4  		else if (expr instanceof GeneralDBSqlGeoBoundary) {
    12.5  			append((GeneralDBSqlGeoBoundary)expr, filter);
    12.6  		}
    12.7 +		else if (expr instanceof GeneralDBSqlST_Centroid) {
    12.8 +			append((GeneralDBSqlST_Centroid)expr, filter);
    12.9 +		}
   12.10  		//Metrics
   12.11  		else if (expr instanceof GeneralDBSqlGeoArea) {
   12.12  			append((GeneralDBSqlGeoArea)expr, filter);
    13.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java	Sun Sep 21 19:21:57 2014 +0300
    13.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java	Mon Sep 22 12:53:55 2014 +0300
    13.3 @@ -7,6 +7,7 @@
    13.4  
    13.5  import java.sql.PreparedStatement;
    13.6  import java.sql.ResultSet;
    13.7 +import java.sql.ResultSetMetaData;
    13.8  import java.sql.SQLException;
    13.9  import java.util.Collection;
   13.10  import java.util.HashMap;
   13.11 @@ -25,6 +26,10 @@
   13.12  import org.openrdf.sail.rdbms.iteration.base.RdbmIterationBase;
   13.13  import org.openrdf.sail.rdbms.model.RdbmsResource;
   13.14  import org.openrdf.sail.rdbms.model.RdbmsValue;
   13.15 +import org.slf4j.Logger;
   13.16 +import org.slf4j.LoggerFactory;
   13.17 +
   13.18 +import eu.earthobservatory.constants.GeoConstants;
   13.19  
   13.20  /**
   13.21   * Converts a {@link ResultSet} into a {@link BindingSet} in an iteration.
   13.22 @@ -34,6 +39,8 @@
   13.23   */
   13.24  public abstract class GeneralDBBindingIteration extends RdbmIterationBase<BindingSet, QueryEvaluationException> {
   13.25  
   13.26 +	private static Logger logger = LoggerFactory.getLogger(org.openrdf.sail.generaldb.iteration.GeneralDBBindingIteration.class);
   13.27 +	
   13.28  	protected BindingSet bindings;
   13.29  
   13.30  	protected Collection<GeneralDBColumnVar> projections;
   13.31 @@ -42,7 +49,7 @@
   13.32  
   13.33  	protected IdSequence ids;
   13.34  
   13.35 -	protected HashMap<Integer,String> geoNames = new HashMap<Integer, String>();
   13.36 +	protected HashMap<String, Integer> geoNames = new HashMap<String, Integer>();
   13.37  
   13.38  	//protected HashMap<String, Integer> sp_ConstructIndexesAndNames = new HashMap<String, Integer>();
   13.39  	protected HashMap<GeneralDBSpatialFuncInfo, Integer> sp_ConstructIndexesAndNames = new HashMap<GeneralDBSpatialFuncInfo, Integer>();
   13.40 @@ -71,11 +78,11 @@
   13.41  		this.sp_ConstructIndexesAndNames = indexesAndNames;
   13.42  	}
   13.43  
   13.44 -	public HashMap<Integer,String> getGeoNames() {
   13.45 +	public HashMap<String, Integer> getGeoNames() {
   13.46  		return geoNames;
   13.47  	}
   13.48  
   13.49 -	public void setGeoNames(HashMap<Integer,String> geoNames) {
   13.50 +	public void setGeoNames(HashMap<String, Integer> geoNames) {
   13.51  		this.geoNames = geoNames;
   13.52  	}
   13.53  
   13.54 @@ -146,30 +153,35 @@
   13.55  			Value value = null;
   13.56  			switch(construct.getType())
   13.57  			{
   13.58 -			case BOOLEAN: 
   13.59 -				value = createBooleanGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.60 -				break;
   13.61 -			case DOUBLE: 
   13.62 -				value = createDoubleGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.63 -				break;
   13.64 -			case INTEGER: 
   13.65 -				value = createIntegerGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.66 -				break;
   13.67 -			case STRING:
   13.68 +				case BOOLEAN: 
   13.69 +					value = createBooleanGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.70 +					break;
   13.71 +				case DOUBLE: 
   13.72 +					value = createDoubleGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.73 +					break;
   13.74 +				case INTEGER: 
   13.75 +					value = createIntegerGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.76 +					break;
   13.77 +				case STRING:
   13.78  					value = createStringGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.79 -				break;
   13.80 -			case WKT: 
   13.81 -				value = createWellKnownTextGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.82 -				break;
   13.83 -			case WKTLITERAL: 
   13.84 -				value = createWellKnownTextLiteralGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.85 -				break;
   13.86 -			case URI:
   13.87 -				value = createURIGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct), construct.isSRIDFunc());				
   13.88 -				break;
   13.89 +					break;
   13.90 +				case WKT: 
   13.91 +					value = createWellKnownTextGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.92 +					break;
   13.93 +				case WKTLITERAL: 
   13.94 +					value = createWellKnownTextLiteralGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
   13.95 +					break;
   13.96 +				case URI:
   13.97 +					value = createURIGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct), construct.isSRIDFunc());				
   13.98 +					break;
   13.99 +				default:
  13.100 +					logger.error("[GeneralDBBindingIteration] Unknown result type for function.");
  13.101 +					break;
  13.102  			}
  13.103 -			//Value value = createGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct));
  13.104 -			result.addBinding(construct.getFieldName(), value);
  13.105 +			
  13.106 +			if (value != null) {
  13.107 +				result.addBinding(construct.getFieldName(), value);
  13.108 +			}
  13.109  		}
  13.110  
  13.111  		return result;
  13.112 @@ -265,14 +277,39 @@
  13.113  	protected RdbmsResource createURIGeoValueForSelectConstructs(ResultSet rs, int index, boolean sridTransform)
  13.114  	throws SQLException
  13.115  	{
  13.116 -		String uri;
  13.117 +		String uri = null;
  13.118  		
  13.119  		if (sridTransform) {
  13.120  			// we have to differentiate here for geoSPARQL's getSRID function, since we need to transform
  13.121  			// the result to a URI
  13.122  			// this is called for GeoSPARQL's getSRID, thus the column would be of type Integer
  13.123  			int srid = rs.getInt(index + 1);
  13.124 -			uri = WKTHelper.getEPSGURI_forSRID(srid);
  13.125 +			
  13.126 +			// NOTICE however, that in case of EPSG:4326 and wktLiterals it would be better to
  13.127 +			// return CRS84. We have already brought that datatype earlier in the expression, so
  13.128 +			// we will try to locate it
  13.129 +			if (srid == GeoConstants.EPSG4326_SRID) {
  13.130 +				// get the alias name for this column
  13.131 +				ResultSetMetaData meta = rs.getMetaData();
  13.132 +				String aliasSRID = meta.getColumnName(index + 1);
  13.133 +	
  13.134 +				// get the index of the column containing the exression for the reference geometry
  13.135 +				Integer indexOfGeometry = geoNames.get(aliasSRID.replace("_srid", ""));
  13.136 +				if (indexOfGeometry != null) { 
  13.137 +					// index + 2 would have the datatype
  13.138 +					String datatype = rs.getString(indexOfGeometry + 2);
  13.139 +					//System.out.println(datatype);
  13.140 +					
  13.141 +					if (GeoConstants.WKTLITERAL.equals(datatype)) {
  13.142 +						uri = GeoConstants.CRS84_URI;
  13.143 +					}
  13.144 +				}
  13.145 +			}
  13.146 +			
  13.147 +			if (uri == null) { // default behavior if we fail to locate or is not
  13.148 +							   // a wktLiteral
  13.149 +				uri = WKTHelper.getEPSGURI_forSRID(srid);
  13.150 +			}
  13.151  			
  13.152  		} else { // we get this as a string first, and then we shall construct the URI
  13.153  			uri = rs.getString(index + 1);
    14.1 --- a/monetdb/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    14.2 +++ b/monetdb/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    14.3 @@ -6,7 +6,7 @@
    14.4  	<parent>
    14.5  		<groupId>eu.earthobservatory</groupId>
    14.6  		<artifactId>strabon</artifactId>
    14.7 -		<version>3.2.10-SNAPSHOT</version>
    14.8 +		<version>3.2.11-SNAPSHOT</version>
    14.9  	</parent>
   14.10    
   14.11  	<groupId>org.openrdf.sesame</groupId>
    15.1 --- a/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    15.2 +++ b/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    15.3 @@ -4,7 +4,7 @@
    15.4  
    15.5  	<groupId>eu.earthobservatory</groupId>
    15.6  	<artifactId>strabon</artifactId>
    15.7 -	<version>3.2.10-SNAPSHOT</version>
    15.8 +	<version>3.2.11-SNAPSHOT</version>
    15.9  	<packaging>pom</packaging>
   15.10  
   15.11  	<parent>
   15.12 @@ -140,7 +140,7 @@
   15.13  	</modules>
   15.14  
   15.15  	<properties>
   15.16 -        <eu.earthobservatory.version>3.2.10-SNAPSHOT</eu.earthobservatory.version>
   15.17 +        <eu.earthobservatory.version>3.2.11-SNAPSHOT</eu.earthobservatory.version>
   15.18  		<sesame.version>2.6.3</sesame.version>
   15.19  		<aduna.appbase.version>3.5.0</aduna.appbase.version>
   15.20  		<!--slf4j.version>1.5.8</slf4j.version-->
    16.1 --- a/postgis/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    16.2 +++ b/postgis/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    16.3 @@ -6,7 +6,7 @@
    16.4  	<parent>
    16.5  		<groupId>eu.earthobservatory</groupId>
    16.6  		<artifactId>strabon</artifactId>
    16.7 -		<version>3.2.10-SNAPSHOT</version>
    16.8 +		<version>3.2.11-SNAPSHOT</version>
    16.9  	</parent>
   16.10    
   16.11  	<groupId>org.openrdf.sesame</groupId>
    17.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISEvaluation.java	Sun Sep 21 19:21:57 2014 +0300
    17.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISEvaluation.java	Mon Sep 22 12:53:55 2014 +0300
    17.3 @@ -73,6 +73,7 @@
    17.4  				if (logger.isDebugEnabled()) {
    17.5  					logger.debug("In PostGIS Evaluation, query is: \n{}", stmt);
    17.6  				}
    17.7 +				//System.out.println(stmt);
    17.8  				GeneralDBBindingIteration result = new PostGISBindingIteration(stmt);
    17.9  				result.setProjections(proj);
   17.10  				result.setBindings(bindings);
    18.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Sun Sep 21 19:21:57 2014 +0300
    18.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Mon Sep 22 12:53:55 2014 +0300
    18.3 @@ -371,6 +371,7 @@
    18.4  		{
    18.5  			query.select();
    18.6  		}
    18.7 +		
    18.8  		if(expr instanceof BinaryGeneralDBOperator)
    18.9  		{
   18.10  			dispatchBinarySqlOperator((BinaryGeneralDBOperator) expr, query.select);
   18.11 @@ -902,21 +903,28 @@
   18.12  					else if(tmp instanceof GeneralDBLabelColumn)
   18.13  					{
   18.14  						//Reached the innermost left var -> need to capture its SRID
   18.15 -						String alias;
   18.16 +						String colRef = null;
   18.17 +						String alias = null;
   18.18  						if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
   18.19  							//Predicates used in triple patterns non-existent in db
   18.20 -							alias="NULL";
   18.21 +							colRef = "NULL";
   18.22  						}
   18.23  						else
   18.24  						{
   18.25  							//Reached the innermost left var -> need to capture its SRID
   18.26  							alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
   18.27 -							alias=alias+".srid";
   18.28 +							colRef = alias + ".srid";
   18.29  						}
   18.30 -						sridExpr = alias;
   18.31 +						sridExpr = colRef;
   18.32  						
   18.33  						filter.append(sridExpr);
   18.34  						filter.closeBracket();
   18.35 +						
   18.36 +						if (alias != null) { // append an alias for the column of the SRID, 
   18.37 +							// replacing the part of the name corresponding to the geo_values table
   18.38 +							filter.as((alias + "_srid").replace("l_", ""));
   18.39 +						}
   18.40 +						
   18.41  						return;
   18.42  					}
   18.43  					else if(tmp instanceof GeneralDBStringValue)
   18.44 @@ -2886,7 +2894,7 @@
   18.45  			throws UnsupportedRdbmsOperatorException
   18.46  			{
   18.47  		filter.openBracket();
   18.48 -		System.out.println(expr.getLeftArg().getClass().getCanonicalName());
   18.49 +		//System.out.println(expr.getLeftArg().getClass().getCanonicalName());
   18.50  		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
   18.51  		if(check1)
   18.52  		{
    19.1 --- a/resultio-spatial/api/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    19.2 +++ b/resultio-spatial/api/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    19.3 @@ -5,7 +5,7 @@
    19.4  	<parent>
    19.5  		<groupId>org.openrdf.sesame</groupId>
    19.6  		<artifactId>sesame-queryresultio-spatial</artifactId>
    19.7 -		<version>3.2.10-SNAPSHOT</version>
    19.8 +		<version>3.2.11-SNAPSHOT</version>
    19.9  	</parent>
   19.10  
   19.11  	<artifactId>sesame-queryresultio-spatial-api</artifactId>
    20.1 --- a/resultio-spatial/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    20.2 +++ b/resultio-spatial/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    20.3 @@ -5,7 +5,7 @@
    20.4  	<parent>
    20.5  		<groupId>eu.earthobservatory</groupId>
    20.6  		<artifactId>strabon</artifactId>
    20.7 -		<version>3.2.10-SNAPSHOT</version>
    20.8 +		<version>3.2.11-SNAPSHOT</version>
    20.9  	</parent>
   20.10  
   20.11  	<groupId>org.openrdf.sesame</groupId>
    21.1 --- a/resultio-spatial/sparqlgeojson/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    21.2 +++ b/resultio-spatial/sparqlgeojson/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    21.3 @@ -5,7 +5,7 @@
    21.4  	<parent>
    21.5  		<groupId>org.openrdf.sesame</groupId>
    21.6  		<artifactId>sesame-queryresultio-spatial</artifactId>
    21.7 -		<version>3.2.10-SNAPSHOT</version>
    21.8 +		<version>3.2.11-SNAPSHOT</version>
    21.9  	</parent>
   21.10  
   21.11  	<artifactId>sesame-queryresultio-spatial-sparqlgeojson</artifactId>
    22.1 --- a/resultio-spatial/sparqlhtml/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    22.2 +++ b/resultio-spatial/sparqlhtml/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    22.3 @@ -5,7 +5,7 @@
    22.4  	<parent>
    22.5  		<groupId>org.openrdf.sesame</groupId>
    22.6  		<artifactId>sesame-queryresultio-spatial</artifactId>
    22.7 -		<version>3.2.10-SNAPSHOT</version>
    22.8 +		<version>3.2.11-SNAPSHOT</version>
    22.9  	</parent>
   22.10  
   22.11  	<artifactId>sesame-queryresultio-spatial-sparqlhtml</artifactId>
    23.1 --- a/resultio-spatial/sparqlkml/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    23.2 +++ b/resultio-spatial/sparqlkml/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    23.3 @@ -5,7 +5,7 @@
    23.4  	<parent>
    23.5  		<groupId>org.openrdf.sesame</groupId>
    23.6  		<artifactId>sesame-queryresultio-spatial</artifactId>
    23.7 -		<version>3.2.10-SNAPSHOT</version>
    23.8 +		<version>3.2.11-SNAPSHOT</version>
    23.9  	</parent>
   23.10  
   23.11  	<artifactId>sesame-queryresultio-spatial-sparqlkml</artifactId>
    24.1 --- a/resultio-spatial/sparqlxml/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    24.2 +++ b/resultio-spatial/sparqlxml/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    24.3 @@ -5,7 +5,7 @@
    24.4  	<parent>
    24.5  		<groupId>org.openrdf.sesame</groupId>
    24.6  		<artifactId>sesame-queryresultio-spatial</artifactId>
    24.7 -		<version>3.2.10-SNAPSHOT</version>
    24.8 +		<version>3.2.11-SNAPSHOT</version>
    24.9  	</parent>
   24.10  
   24.11  	<artifactId>sesame-queryresultio-spatial-sparqlxml</artifactId>
    25.1 --- a/resultio-spatial/sparqlxml/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLResultsXMLWriter.java	Sun Sep 21 19:21:57 2014 +0300
    25.2 +++ b/resultio-spatial/sparqlxml/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLResultsXMLWriter.java	Mon Sep 22 12:53:55 2014 +0300
    25.3 @@ -35,6 +35,7 @@
    25.4  import org.openrdf.query.BindingSet;
    25.5  import org.openrdf.query.TupleQueryResultHandlerException;
    25.6  import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron;
    25.7 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper;
    25.8  import org.openrdf.query.resultio.TupleQueryResultFormat;
    25.9  import org.openrdf.query.resultio.TupleQueryResultWriter;
   25.10  import org.openrdf.query.resultio.stSPARQLQueryResultFormat;
   25.11 @@ -45,6 +46,7 @@
   25.12   * href="http://www.w3.org/TR/rdf-sparql-XMLres/">SPARQL Query Results XML
   25.13   * Format</a>.
   25.14   * 
   25.15 + * @author Charalampos Nikolaou <charnik@di.uoa.gr>
   25.16   * @author Manos Karpathiotakis <mk@di.uoa.gr>
   25.17   */
   25.18  public class stSPARQLResultsXMLWriter implements TupleQueryResultWriter {
   25.19 @@ -175,7 +177,10 @@
   25.20  			
   25.21  		} else if (value instanceof StrabonPolyhedron) { // spatial case from new geometry construction (SELECT) 
   25.22  			StrabonPolyhedron poly = (StrabonPolyhedron) value;
   25.23 -			Literal literal = new LiteralImpl(poly.stringValue(), new URIImpl(poly.getGeometryDatatype().toString()));
   25.24 +			Literal literal = new LiteralImpl(WKTHelper.createWKT(poly.stringValue(), 
   25.25 +																  poly.getGeometry().getSRID(),
   25.26 +																  poly.getGeometryDatatype().toString()), 
   25.27 +											  new URIImpl(poly.getGeometryDatatype().toString()));
   25.28  			writeLiteral(literal);
   25.29  		}
   25.30  	}
    26.1 --- a/resultio-spatial/text/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    26.2 +++ b/resultio-spatial/text/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    26.3 @@ -5,7 +5,7 @@
    26.4  	<parent>
    26.5  		<groupId>org.openrdf.sesame</groupId>
    26.6  		<artifactId>sesame-queryresultio-spatial</artifactId>
    26.7 -		<version>3.2.10-SNAPSHOT</version>
    26.8 +		<version>3.2.11-SNAPSHOT</version>
    26.9  	</parent>
   26.10  
   26.11  	<artifactId>sesame-queryresultio-spatial-text</artifactId>
    27.1 --- a/resultio-spatial/text/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java	Sun Sep 21 19:21:57 2014 +0300
    27.2 +++ b/resultio-spatial/text/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java	Mon Sep 22 12:53:55 2014 +0300
    27.3 @@ -16,6 +16,7 @@
    27.4  import org.openrdf.model.impl.LiteralImpl;
    27.5  import org.openrdf.model.impl.URIImpl;
    27.6  import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron;
    27.7 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper;
    27.8  import org.openrdf.query.resultio.text.tsv.SPARQLResultsTSVWriter;
    27.9  import org.openrdf.sail.generaldb.model.GeneralDBPolyhedron;
   27.10  
   27.11 @@ -39,7 +40,10 @@
   27.12  			
   27.13  		} else if (val instanceof StrabonPolyhedron) { // might come from the construction of new constants in SELECT
   27.14  			StrabonPolyhedron poly = (StrabonPolyhedron) val;
   27.15 -			val = new LiteralImpl(poly.stringValue(), new URIImpl(poly.getGeometryDatatype().toString()));
   27.16 +			val = new LiteralImpl(WKTHelper.createWKT(poly.stringValue(), 
   27.17 +					  								  poly.getGeometry().getSRID(),
   27.18 +					  								  poly.getGeometryDatatype().toString()), 
   27.19 +					  			  new URIImpl(poly.getGeometryDatatype().toString()));
   27.20  		}
   27.21  		
   27.22  		// write value
    28.1 --- a/runtime/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    28.2 +++ b/runtime/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    28.3 @@ -5,7 +5,7 @@
    28.4  	<parent>
    28.5  		<groupId>eu.earthobservatory</groupId>
    28.6  		<artifactId>strabon</artifactId>
    28.7 -		<version>3.2.10-SNAPSHOT</version>
    28.8 +		<version>3.2.11-SNAPSHOT</version>
    28.9  	</parent>
   28.10  
   28.11  	<artifactId>strabon-runtime</artifactId>
    29.1 --- a/testsuite/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    29.2 +++ b/testsuite/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    29.3 @@ -5,7 +5,7 @@
    29.4  	<parent>
    29.5  		<groupId>eu.earthobservatory</groupId>
    29.6  		<artifactId>strabon</artifactId>
    29.7 -		<version>3.2.10-SNAPSHOT</version>
    29.8 +		<version>3.2.11-SNAPSHOT</version>
    29.9  	</parent>
   29.10  
   29.11  	<artifactId>strabon-testsuite</artifactId>
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/bugs/UnionAndProjectionBug53.java	Mon Sep 22 12:53:55 2014 +0300
    30.3 @@ -0,0 +1,18 @@
    30.4 +/**
    30.5 + * This Source Code Form is subject to the terms of the Mozilla Public
    30.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
    30.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    30.8 + * 
    30.9 + * Copyright (C) 2011, 2012, 2013, 2014 Pyravlos Team
   30.10 + * 
   30.11 + * http://strabon.di.uoa.gr/
   30.12 + */
   30.13 +package eu.earthobservatory.testsuite.bugs;
   30.14 +
   30.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
   30.16 +
   30.17 +/**
   30.18 + * Test for Bug 53 (http://bug.strabon.di.uoa.gr/ticket/53)
   30.19 + * @author Charalampos Nikolaou <charnik@di.uoa.gr>
   30.20 + */
   30.21 +public class UnionAndProjectionBug53 extends TemplateTest{ }
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/geoSPARQL/BasicFunctionsTest.java	Mon Sep 22 12:53:55 2014 +0300
    31.3 @@ -0,0 +1,18 @@
    31.4 +/**
    31.5 + * This Source Code Form is subject to the terms of the Mozilla Public
    31.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
    31.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    31.8 + * 
    31.9 + * Copyright (C) 2011, 2012, 2013, 2014 Pyravlos Team
   31.10 + * 
   31.11 + * http://strabon.di.uoa.gr/
   31.12 + */
   31.13 +package eu.earthobservatory.testsuite.geoSPARQL;
   31.14 +
   31.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
   31.16 +
   31.17 +/**
   31.18 + * @author Charalampos Nikolaou <charnik@di.uoa.gr>
   31.19 + */
   31.20 +public class BasicFunctionsTest extends TemplateTest { }
   31.21 +
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/testsuite/src/test/resources/bugs/UnionAndProjectionBug53/UnionAndProjectionBug53.nt	Mon Sep 22 12:53:55 2014 +0300
    32.3 @@ -0,0 +1,6 @@
    32.4 +<http://www.eionet.europa.eu/gemet/concept/11> <http://www.w3.org/2004/02/skos/core#broader> <http://www.eionet.europa.eu/gemet/concept/2457> .
    32.5 +<http://www.eionet.europa.eu/gemet/concept/11> <http://www.w3.org/2004/02/skos/core#prefLabel> "abiotic factor"@en .
    32.6 +<http://www.eionet.europa.eu/gemet/concept/20> <http://www.w3.org/2004/02/skos/core#broader> <http://www.eionet.europa.eu/gemet/concept/6033> .
    32.7 +<http://www.eionet.europa.eu/gemet/concept/20> <http://www.w3.org/2004/02/skos/core#prefLabel> "acceptable risk level"@en .
    32.8 +<http://www.eionet.europa.eu/gemet/concept/72> <http://www.w3.org/2004/02/skos/core#broader> <http://www.eionet.europa.eu/gemet/concept/11813> .
    32.9 +<http://www.eionet.europa.eu/gemet/concept/72> <http://www.w3.org/2004/02/skos/core#prefLabel> "activated carbon"@en .
   32.10 \ No newline at end of file
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/testsuite/src/test/resources/bugs/UnionAndProjectionBug53/UnionAndProjectionBug53.rq	Mon Sep 22 12:53:55 2014 +0300
    33.3 @@ -0,0 +1,11 @@
    33.4 +SELECT ?term (skos:broader as ?b) ?related
    33.5 +WHERE
    33.6 +{
    33.7 +
    33.8 +    { ?term skos:prefLabel ?label . ?term skos:broader ?related }
    33.9 +
   33.10 +UNION
   33.11 +
   33.12 +    { ?term rdfs:label ?label . ?term skos:broader ?related }
   33.13 +
   33.14 +}
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/testsuite/src/test/resources/bugs/UnionAndProjectionBug53/UnionAndProjectionBug53.srx	Mon Sep 22 12:53:55 2014 +0300
    34.3 @@ -0,0 +1,43 @@
    34.4 +<?xml version='1.0' encoding='UTF-8'?>
    34.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    34.6 +	<head>
    34.7 +		<variable name='term'/>
    34.8 +		<variable name='b'/>
    34.9 +		<variable name='related'/>
   34.10 +	</head>
   34.11 +	<results>
   34.12 +		<result>
   34.13 +			<binding name='term'>
   34.14 +				<uri>http://www.eionet.europa.eu/gemet/concept/11</uri>
   34.15 +			</binding>
   34.16 +			<binding name='b'>
   34.17 +				<uri>http://www.w3.org/2004/02/skos/core#broader</uri>
   34.18 +			</binding>
   34.19 +			<binding name='related'>
   34.20 +				<uri>http://www.eionet.europa.eu/gemet/concept/2457</uri>
   34.21 +			</binding>
   34.22 +		</result>
   34.23 +		<result>
   34.24 +			<binding name='term'>
   34.25 +				<uri>http://www.eionet.europa.eu/gemet/concept/20</uri>
   34.26 +			</binding>
   34.27 +			<binding name='b'>
   34.28 +				<uri>http://www.w3.org/2004/02/skos/core#broader</uri>
   34.29 +			</binding>
   34.30 +			<binding name='related'>
   34.31 +				<uri>http://www.eionet.europa.eu/gemet/concept/6033</uri>
   34.32 +			</binding>
   34.33 +		</result>
   34.34 +		<result>
   34.35 +			<binding name='term'>
   34.36 +				<uri>http://www.eionet.europa.eu/gemet/concept/72</uri>
   34.37 +			</binding>
   34.38 +			<binding name='b'>
   34.39 +				<uri>http://www.w3.org/2004/02/skos/core#broader</uri>
   34.40 +			</binding>
   34.41 +			<binding name='related'>
   34.42 +				<uri>http://www.eionet.europa.eu/gemet/concept/11813</uri>
   34.43 +			</binding>
   34.44 +		</result>				
   34.45 +	</results>
   34.46 +</sparql>
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/BasicFunctionsTest.nt	Mon Sep 22 12:53:55 2014 +0300
    35.3 @@ -0,0 +1,6 @@
    35.4 +<http://ex.org/strdf_2100> <http://strdf.di.uoa.gr/ontology#hasGeometry> "POINT(476083.63 4203777.20);<http://www.opengis.net/def/crs/EPSG/0/2100>"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    35.5 +<http://ex.org/strdf_crs84> <http://strdf.di.uoa.gr/ontology#hasGeometry> "POINT(23.729359899999963 37.983917)"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    35.6 +<http://ex.org/strdf_4326> <http://strdf.di.uoa.gr/ontology#hasGeometry> "POINT(37.983917 23.729359899999963);<http://www.opengis.net/def/crs/EPSG/0/4326>"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    35.7 +<http://ex.org/geosparql_4326> <http://strdf.di.uoa.gr/ontology#hasGeometry> "<http://www.opengis.net/def/crs/EPSG/0/4326> POINT(37.983917 23.729359899999963)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> .
    35.8 +<http://ex.org/geosparql_crs84> <http://strdf.di.uoa.gr/ontology#hasGeometry> "POINT(23.729359899999963 37.983917)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> .
    35.9 +<http://ex.org/geosparql_2100> <http://strdf.di.uoa.gr/ontology#hasGeometry> "<http://www.opengis.net/def/crs/EPSG/0/2100> POINT(476083.63 4203777.20)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> .
   35.10 \ No newline at end of file
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.rq	Mon Sep 22 12:53:55 2014 +0300
    36.3 @@ -0,0 +1,2 @@
    36.4 +SELECT DISTINCT (geof:getSRID(strdf:transform("<http://www.opengis.net/def/crs/EPSG/0/2100> POINT(0 1)"^^geo:wktLiteral, <http://www.opengis.net/def/crs/OGC/1.3/CRS84>)) as ?srid)
    36.5 +WHERE { ?s ?p ?o }
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.srx	Mon Sep 22 12:53:55 2014 +0300
    37.3 @@ -0,0 +1,13 @@
    37.4 +<?xml version='1.0' encoding='UTF-8'?> 
    37.5 +	<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 
    37.6 +		<head> 
    37.7 +			<variable name='srid'/> 
    37.8 +		</head> 
    37.9 +		<results> 
   37.10 +			<result> 
   37.11 +				<binding name='srid'> 
   37.12 +					<uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 
   37.13 +				</binding> 
   37.14 +			</result> 
   37.15 +		</results> 
   37.16 +	</sparql> 
   37.17 \ No newline at end of file
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest2.rq	Mon Sep 22 12:53:55 2014 +0300
    38.3 @@ -0,0 +1,2 @@
    38.4 +SELECT DISTINCT (geof:getSRID("<http://www.opengis.net/def/crs/EPSG/0/2100> POINT(0 1)"^^geo:wktLiteral) as ?srid)   
    38.5 +WHERE { ?s ?p ?o }
    38.6 \ No newline at end of file
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest2.srx	Mon Sep 22 12:53:55 2014 +0300
    39.3 @@ -0,0 +1,13 @@
    39.4 +<?xml version='1.0' encoding='UTF-8'?> 
    39.5 +	<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 
    39.6 +		<head> 
    39.7 +			<variable name='srid'/> 
    39.8 +		</head> 
    39.9 +		<results> 
   39.10 +			<result> 
   39.11 +				<binding name='srid'> 
   39.12 +					<uri>http://www.opengis.net/def/crs/EPSG/0/2100</uri> 
   39.13 +				</binding> 
   39.14 +			</result> 
   39.15 +		</results> 
   39.16 +	</sparql> 
   39.17 \ No newline at end of file
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest3.rq	Mon Sep 22 12:53:55 2014 +0300
    40.3 @@ -0,0 +1,2 @@
    40.4 +SELECT DISTINCT (geof:getSRID("POINT(0 1)"^^geo:wktLiteral) as ?srid)   
    40.5 +WHERE { ?s ?p ?o }
    40.6 \ No newline at end of file
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest3.srx	Mon Sep 22 12:53:55 2014 +0300
    41.3 @@ -0,0 +1,13 @@
    41.4 +<?xml version='1.0' encoding='UTF-8'?> 
    41.5 +	<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 
    41.6 +		<head> 
    41.7 +			<variable name='srid'/> 
    41.8 +		</head> 
    41.9 +		<results> 
   41.10 +			<result> 
   41.11 +				<binding name='srid'> 
   41.12 +					<uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 
   41.13 +				</binding> 
   41.14 +			</result> 
   41.15 +		</results> 
   41.16 +	</sparql> 
   41.17 \ No newline at end of file
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest4.rq	Mon Sep 22 12:53:55 2014 +0300
    42.3 @@ -0,0 +1,2 @@
    42.4 +SELECT DISTINCT (geof:getSRID("POINT(0 1);http://www.opengis.net/def/crs/EPSG/0/2100"^^strdf:WKT) as ?srid)   
    42.5 +WHERE { ?s ?p ?o }
    42.6 \ No newline at end of file
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest4.srx	Mon Sep 22 12:53:55 2014 +0300
    43.3 @@ -0,0 +1,13 @@
    43.4 +<?xml version='1.0' encoding='UTF-8'?> 
    43.5 +	<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 
    43.6 +		<head> 
    43.7 +			<variable name='srid'/> 
    43.8 +		</head> 
    43.9 +		<results> 
   43.10 +			<result> 
   43.11 +				<binding name='srid'> 
   43.12 +					<uri>http://www.opengis.net/def/crs/EPSG/0/2100</uri> 
   43.13 +				</binding> 
   43.14 +			</result> 
   43.15 +		</results> 
   43.16 +	</sparql> 
   43.17 \ No newline at end of file
    44.1 --- a/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.srx	Sun Sep 21 19:21:57 2014 +0300
    44.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.srx	Mon Sep 22 12:53:55 2014 +0300
    44.3 @@ -6,7 +6,7 @@
    44.4  		<results> 
    44.5  			<result> 
    44.6  				<binding name='srid'> 
    44.7 -					<uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 
    44.8 +					<uri>http://www.opengis.net/def/crs/EPSG/0/4326</uri> 
    44.9  				</binding> 
   44.10  			</result> 
   44.11  		</results> 
    45.1 --- a/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromDBTest.srx	Sun Sep 21 19:21:57 2014 +0300
    45.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromDBTest.srx	Mon Sep 22 12:53:55 2014 +0300
    45.3 @@ -14,13 +14,13 @@
    45.4  					<uri>http://www.opengis.net/def/crs/EPSG/0/2100</uri> 
    45.5  				</binding>
    45.6  				<binding name='strdf_crs84'> 
    45.7 -					<uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 
    45.8 +					<uri>http://www.opengis.net/def/crs/EPSG/0/4326</uri> 
    45.9  				</binding>
   45.10  				<binding name='strdf_4326'> 
   45.11  					<uri>http://www.opengis.net/def/crs/EPSG/0/4326</uri> 
   45.12  				</binding>
   45.13  				<binding name='geo_4326'> 
   45.14 -					<uri>http://www.opengis.net/def/crs/EPSG/0/4326</uri> 
   45.15 +					<uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 
   45.16  				</binding>
   45.17  				<binding name='geo_crs84'> 
   45.18  					<uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 
    46.1 --- a/testsuite/src/test/resources/geoSPARQL/GeometryLiteralsTest/DefaultCRS.srx	Sun Sep 21 19:21:57 2014 +0300
    46.2 +++ b/testsuite/src/test/resources/geoSPARQL/GeometryLiteralsTest/DefaultCRS.srx	Mon Sep 22 12:53:55 2014 +0300
    46.3 @@ -6,7 +6,7 @@
    46.4  	<results>
    46.5  		<result>
    46.6  			<binding name='srid'>
    46.7 -				<uri>http://www.opengis.net/def/crs/EPSG/0/4326</uri>
    46.8 +				<uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri>
    46.9  			</binding>
   46.10  		</result>
   46.11  	</results>
    47.1 --- a/testsuite/src/test/resources/prefixes	Sun Sep 21 19:21:57 2014 +0300
    47.2 +++ b/testsuite/src/test/resources/prefixes	Mon Sep 22 12:53:55 2014 +0300
    47.3 @@ -13,4 +13,6 @@
    47.4  PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    47.5  PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    47.6  PREFIX ogc: <http://www.opengis.net/def/uom/OGC/1.0/>
    47.7 -PREFIX ex: <http://example.org#>
    47.8 \ No newline at end of file
    47.9 +PREFIX ex: <http://example.org#>
   47.10 +PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
   47.11 +
    48.1 --- a/vocab/pom.xml	Sun Sep 21 19:21:57 2014 +0300
    48.2 +++ b/vocab/pom.xml	Mon Sep 22 12:53:55 2014 +0300
    48.3 @@ -5,7 +5,7 @@
    48.4  	<parent>
    48.5  		<groupId>eu.earthobservatory</groupId>
    48.6  		<artifactId>strabon</artifactId>
    48.7 -		<version>3.2.10-SNAPSHOT</version>
    48.8 +		<version>3.2.11-SNAPSHOT</version>
    48.9  	</parent>
   48.10  
   48.11  	<artifactId>strabon-vocabulary</artifactId>