Strabon
changeset 1427:5b6b65340693 temporals
merge with default branch
line diff
1.1 --- a/.hgtags Wed Sep 10 12:37:29 2014 +0200 1.2 +++ b/.hgtags Wed Sep 24 18:44:26 2014 +0300 1.3 @@ -19,6 +19,7 @@ 1.4 389213ce7843a9c490be447400c1a5c46d44cc96 v3.2.8 1.5 92b90ac06d39f8fcf76de046f22bb64526d5ff28 v3.2.9 1.6 0ed49ee3eb94c6bfc122254342e86bfd097c1200 v3.2.9-temporals 1.7 +e453684f594f568079ec28733e0a4a6df8be0e37 v3.2.10 1.8 0ed49ee3eb94c6bfc122254342e86bfd097c1200 v3.2.9-temporals 1.9 0000000000000000000000000000000000000000 v3.2.9-temporals 1.10 0000000000000000000000000000000000000000 v3.2.9-temporals
2.1 --- a/ChangeLog Wed Sep 10 12:37:29 2014 +0200 2.2 +++ b/ChangeLog Wed Sep 24 18:44:26 2014 +0300 2.3 @@ -1,7 +1,77 @@ 2.4 - * Fixed a bug that occured when storing quads from endpoint. 2.5 + * Fixed a bug that would not return the correct spatial datatype of a 2.6 + projected geometry literal stored in the database. 2.7 + (bug #71: http://bug.strabon.di.uoa.gr/ticket/71) 2.8 + 2.9 + * Now, geometries expressed in CRS84 and a `geo:wktLiteral' datatype 2.10 + are assigned the correct CRS, i.e., EPSG:4326 with a longitude 2.11 + latitude axis order. 2.12 + 2.13 + * Now, we report a parse error when a constant geometry given in a 2.14 + SELECT or HAVING clause is not well-formed according to the WKT 2.15 + specification. 2.16 + (bug #69: http://bug.strabon.di.uoa.gr/ticket/69) 2.17 + 2.18 + * Function `geof:convexHull' is now supported in a Having clause. 2.19 + 2.20 + * Fixed older implementation of `strdf:distance' that would expect two 2.21 + arguments instead of three when present in a HAVING clause. 2.22 + 2.23 + * Fixed a bug that would cause a class cast exception for grounded 2.24 + expressions with function nesting in the SELECT or HAVING clause. 2.25 + 2.26 + * Fixed a bug in which `postgis:ST_Centroid' did not work in the SELECT 2.27 + clause with input geometries from the database. 2.28 + 2.29 + * Fixed a bug that `geof:getSRID' would return an integer instead of a 2.30 + the URI corrresponding to the CRS that the input geometry was 2.31 + expressed. 2.32 + (bug #32: http://bug.strabon.di.uoa.gr/ticket/32) 2.33 + * Fixed a bug that would raise an exception for queries involving two 2.34 + UNION graph patterns and a projection to a predicate or a URI in 2.35 + general. 2.36 + (bug #53: http://bug.strabon.di.uoa.gr/ticket/53) 2.37 + 2.38 +Wed Sep 17 20:14:12 2014 Pyravlos Team 2.39 2.40 * Version 3.2.10 released. 2.41 2.42 + * The test suite of Strabon has now reached a mature level. It 2.43 + contains tests for both stSPARQL and GeoSPARQL query languages and 2.44 + most of the compliance tests covered in the specification of 2.45 + GeoSPARQL (well, only those tests for the components that we have 2.46 + chosen to implement). 2.47 + 2.48 + * The endpoint now parses Accept headers with multiple values and uses 2.49 + the first mimetype corresponding to a valid stSPARQLQueryResultFormat. 2.50 + (bug #64: http://bug.strabon.di.uoa.gr/ticket/64) 2.51 + 2.52 + * The endpoint now registers a handler for SIGTERM signals, so that if 2.53 + it is run from the command-line (endpoint-exec), then the closing of 2.54 + the connection will be ultimately called. 2.55 + (bug #40: http://bug.strabon.di.uoa.gr/ticket/40) 2.56 + 2.57 + * Strabon goes debian v1. the endpoint-exec jar is now given in a .deb 2.58 + format. By dpkg-ing it, one can run a stand alone strabon endpoint 2.59 + locally. 2.60 + (bug #45 http://bug.strabon.di.uoa.gr/ticket/58) 2.61 + 2.62 + * Fixed a bug in which Strabon hanged when a unary spatial construct 2.63 + had a ternary spatial construct as argument. 2.64 + (bug #45 http://bug.strabon.di.uoa.gr/ticket/45) 2.65 + 2.66 + * Fixed a bug according to which spatial functions in ORDER BY were not 2.67 + evaluated at all. 2.68 + (bug #62: http://bug.strabon.di.uoa.gr/ticket/62) 2.69 + 2.70 + * Fixed a bug according to which spatial boolean functions appearing 2.71 + in the SELECT clause were raising a NULL pointer exception. 2.72 + (bug #34: http://bug.strabon.di.uoa.gr/ticket/34) 2.73 + 2.74 + * Fixed a bug in queries that contain variables that exist inside 2.75 + spatial functions in select and do not exist in the where clause 2.76 + made Strabon throw a NULL pointer exception. 2.77 + (bug #51 https://bug.strabon.di.uoa.gr/ticket/51) 2.78 + 2.79 * Various changes in the interface and behavior of Strabon Endpoint: 2.80 - Revised the logos and the sample queries. 2.81 - Results query limit is set to zero (unlimited). 2.82 @@ -16,8 +86,9 @@ 2.83 - The DESCRIBE functionality can now be accessed through the menu bar. 2.84 2.85 * Fixed a bug where strdf:intersection function did not work as an 2.86 - aggregate when used without 'GROUP BY'. 2.87 - (bug #46 https://bug.strabon.di.uoa.gr/ticket/46) 2.88 + aggregate when used without 'GROUP BY'. 2.89 + (bug #46 https://bug.strabon.di.uoa.gr/ticket/46) 2.90 + 2.91 2.92 Sat Oct 19 23:37:23 2013 Pyravlos Team 2.93
3.1 --- a/README Wed Sep 10 12:37:29 2014 +0200 3.2 +++ b/README Wed Sep 24 18:44:26 2014 +0300 3.3 @@ -63,6 +63,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 3.16 @@ -481,31 +487,6 @@ 3.17 3.18 Known Issues 3.19 ============ 3.20 -* Strabon depends on a version of Sesame OpenRDF that is not hosted at the central 3.21 - repository of Maven. These artifacts resided on the Maven repository of Aduna 3.22 - which is not maintained any more. For this reason, you can use a mirror repository 3.23 - hosted by Ontotext. To configure maven to use the Ontotext mirror for the Aduna 3.24 - repository, you append to your settings file ${user.home}/.m2/settings.xml) the 3.25 - following: 3.26 - 3.27 -<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 3.28 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 3.29 - xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 3.30 - http://maven.apache.org/xsd/settings-1.0.0.xsd"> 3.31 -... 3.32 -... 3.33 - <mirrors> 3.34 - <mirror> 3.35 - <id>aduna-mirror</id> 3.36 - <name>Aduna Maven Repository - Mirror</name> 3.37 - <url>http://maven.ontotext.com/content/repositories/aduna/</url> 3.38 - <mirrorOf>aduna-opensource.releases</mirrorOf> 3.39 - </mirror> 3.40 - </mirrors> 3.41 -... 3.42 -... 3.43 -</settings> 3.44 - 3.45 * By default, Tomcat uses ISO-8859-1 character encoding when decoding URLs received 3.46 from a browser. This can cause problems when encoding is UTF-8, and you are using 3.47 international characters. In order to fix this, edit conf/server.xml and find the
4.1 --- a/endpoint-client/pom.xml Wed Sep 10 12:37:29 2014 +0200 4.2 +++ b/endpoint-client/pom.xml Wed Sep 24 18:44:26 2014 +0300 4.3 @@ -151,7 +151,7 @@ 4.4 <configuration> 4.5 <transformers> 4.6 <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 4.7 - <mainClass>eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint</mainClass> 4.8 + <mainClass>eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint</mainClass> 4.9 </transformer> 4.10 </transformers> 4.11 <filters>
5.1 --- a/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SPARQLEndpoint.java Wed Sep 10 12:37:29 2014 +0200 5.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SPARQLEndpoint.java Wed Sep 24 18:44:26 2014 +0300 5.3 @@ -66,7 +66,7 @@ 5.4 // set the query parameter 5.5 List<NameValuePair> params = new ArrayList<NameValuePair>(); 5.6 params.add(new BasicNameValuePair("query", sparqlQuery)); 5.7 - UrlEncodedFormEntity encodedEntity = new UrlEncodedFormEntity(params, Charset.defaultCharset()); 5.8 + UrlEncodedFormEntity encodedEntity = new UrlEncodedFormEntity(params, Charset.forName("UTF-8")); 5.9 method.setEntity(encodedEntity); 5.10 5.11 // set the content type
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/endpoint-client/src/main/resources/log4j.properties Wed Sep 24 18:44:26 2014 +0300 6.3 @@ -0,0 +1,19 @@ 6.4 +# logger level values: OFF, ERROR, WARN, INFO, DEBUG, ALL 6.5 +#log4j.rootLogger=ALL, CA 6.6 +#log4j.rootLogger=DEBUG, CA 6.7 +log4j.rootLogger=INFO, CA 6.8 + 6.9 +# Console Appender 6.10 +log4j.appender.CA=org.apache.log4j.ConsoleAppender 6.11 +log4j.appender.CA.target=System.err 6.12 +log4j.appender.CA.layout=org.apache.log4j.PatternLayout 6.13 +log4j.appender.CA.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n 6.14 + 6.15 +# File Appender 6.16 +#log4j.appender.FA=org.apache.log4j.FileAppender 6.17 +#log4j.appender.FA.File=sample.log 6.18 +#log4j.appender.FA.layout=org.apache.log4j.PatternLayout 6.19 +#log4j.appender.FA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 6.20 +# Set the logger level of File Appender to WARN 6.21 +#log4j.appender.FA.Threshold = WARN 6.22 +
7.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointStoreWithStrabon.java Wed Sep 10 12:37:29 2014 +0200 7.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointStoreWithStrabon.java Wed Sep 24 18:44:26 2014 +0300 7.3 @@ -14,12 +14,9 @@ 7.4 import java.io.IOException; 7.5 import java.net.MalformedURLException; 7.6 import java.net.URL; 7.7 -import java.util.Vector; 7.8 7.9 import org.junit.Before; 7.10 import org.junit.Test; 7.11 -import org.openrdf.query.resultio.TupleQueryResultFormat; 7.12 -import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 7.13 import org.openrdf.rio.RDFFormat; 7.14 7.15 /** 7.16 @@ -60,12 +57,7 @@ 7.17 URL namedGraph = new URL("http://geo.linkedopendata.gr/map/example"); 7.18 Boolean response = endpoint.store(data, RDFFormat.NTRIPLES , namedGraph); 7.19 7.20 - if (response != true) 7.21 - System.err.println("Error"); 7.22 - 7.23 - 7.24 - // assertTrue(response == true); 7.25 - 7.26 + assertTrue(response == true); 7.27 } 7.28 7.29 7.30 @@ -80,11 +72,7 @@ 7.31 String data = "<http://geo.linkedopendata.gr/map/id/l22> <http://geo.linkedopendata.gr/map/hasName> \"layer22\" . "; 7.32 Boolean response = endpoint.store(data, RDFFormat.NTRIPLES , namedGraph); 7.33 7.34 - if (response != true) 7.35 - System.err.println("Error"); 7.36 - 7.37 - 7.38 - // assertTrue(response == true); 7.39 + assertTrue(response == true); 7.40 7.41 } 7.42 } 7.43 \ No newline at end of file
8.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointUpdateWithStrabon.java Wed Sep 10 12:37:29 2014 +0200 8.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointUpdateWithStrabon.java Wed Sep 24 18:44:26 2014 +0300 8.3 @@ -3,12 +3,9 @@ 8.4 import static org.junit.Assert.assertTrue; 8.5 8.6 import java.io.IOException; 8.7 -import java.net.MalformedURLException; 8.8 -import java.net.URL; 8.9 8.10 import org.junit.Before; 8.11 import org.junit.Test; 8.12 -import org.openrdf.rio.RDFFormat; 8.13 8.14 public class TestSPARQLEndpointUpdateWithStrabon { 8.15 8.16 @@ -37,15 +34,8 @@ 8.17 */ 8.18 @Test 8.19 public void testUpdate() throws IOException { 8.20 - 8.21 Boolean response = endpoint.update(query); 8.22 - 8.23 - if (response != true) 8.24 - System.err.println("Error"); 8.25 - 8.26 - 8.27 - // assertTrue(response == true); 8.28 - 8.29 + assertTrue(response == true); 8.30 } 8.31 8.32 }
9.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithStrabon.java Wed Sep 10 12:37:29 2014 +0200 9.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithStrabon.java Wed Sep 24 18:44:26 2014 +0300 9.3 @@ -32,19 +32,16 @@ 9.4 @Before 9.5 public void init() { 9.6 // initialize endpoint 9.7 - endpoint = new SPARQLEndpoint("geo.linkedopendata.gr", 9090, "gag-endpoint/Query"); 9.8 + endpoint = new SPARQLEndpoint("geo.linkedopendata.gr", 80, "gag-endpoint/Query"); 9.9 9.10 // set query 9.11 query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + 9.12 "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " + 9.13 "PREFIX gag: <http://geo.linkedopendata.gr/gag/ontology/> " + 9.14 9.15 - "SELECT ?geometry " + 9.16 + "SELECT ?g " + 9.17 "WHERE {" + 9.18 - 9.19 - " ?m rdf:type gag:Δήμος . " + 9.20 - " ?m rdfs:label \"ΔΗΜΟΣ ΑΘΗΝΑΙΩΝ\" . " + 9.21 - " ?m gag:έχει_γεωμετρία ?geometry. " + 9.22 + " <http://geo.linkedopendata.gr/gag/id/9186> rdf:έχει_γεωμετρία ?g . " + 9.23 " } " ; 9.24 9.25 // initialized formats 9.26 @@ -67,10 +64,9 @@ 9.27 9.28 if (response.getStatusCode() != 200) { 9.29 System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText()); 9.30 - 9.31 } 9.32 9.33 - // assertTrue(response.getStatusCode() == 200); 9.34 + assertTrue(response.getStatusCode() == 200); 9.35 9.36 } catch (IOException e) { 9.37 e.printStackTrace(); 9.38 @@ -84,7 +80,7 @@ 9.39 * returns an IOException when it should do so. 9.40 */ 9.41 @Test(expected= IOException.class) 9.42 - public void testIOException() throws Exception { 9.43 + public void testIOException() throws IOException { 9.44 SPARQLEndpoint ep = new SPARQLEndpoint("blabla.dgr", 80, "bla"); 9.45 ep.query(query, formats.get(0)); 9.46 }
10.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithVirtuoso.java Wed Sep 10 12:37:29 2014 +0200 10.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithVirtuoso.java Wed Sep 24 18:44:26 2014 +0300 10.3 @@ -23,7 +23,6 @@ 10.4 * @author Kallirroi Dogani <kallirroi@di.uoa.gr> 10.5 * 10.6 */ 10.7 - 10.8 //Virtuso endpoint also needs to be tested for all formats included in stSPARQLQueryResultFormat 10.9 //because some of them are not supported 10.10 public class TestSPARQLEndpointWithVirtuoso { 10.11 @@ -35,7 +34,8 @@ 10.12 @Before 10.13 public void init() { 10.14 // initialize endpoint 10.15 - endpoint = new SPARQLEndpoint("dbpedia.org", 8890, "sparql"); 10.16 + endpoint = new SPARQLEndpoint("dbpedia.org", 80, "sparql"); 10.17 + //endpoint = new SPARQLEndpoint("lod.openlinksw.com", 80, "sparql"); 10.18 10.19 // set query 10.20 query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n" + 10.21 @@ -61,14 +61,12 @@ 10.22 try { 10.23 EndpointResult response = endpoint.query(query, stSPARQLQueryResultFormat.TSV); 10.24 10.25 - // System.out.println(response.getResponse()); 10.26 - 10.27 if (response.getStatusCode() != 200) { 10.28 System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText()); 10.29 10.30 } 10.31 10.32 - // assertTrue(response.getStatusCode() == 200); 10.33 + assertTrue(response.getStatusCode() == 200); 10.34 10.35 } catch (IOException e) { 10.36 e.printStackTrace();
11.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSpatialEndpoint.java Wed Sep 10 12:37:29 2014 +0200 11.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSpatialEndpoint.java Wed Sep 24 18:44:26 2014 +0300 11.3 @@ -8,8 +8,6 @@ 11.4 */ 11.5 package eu.earthobservatory.org.StrabonEndpoint.client; 11.6 11.7 -import static org.junit.Assert.assertTrue; 11.8 - 11.9 import java.io.IOException; 11.10 11.11 import org.junit.Before; 11.12 @@ -23,7 +21,6 @@ 11.13 * @author Kallirroi Dogani <kallirroi@di.uoa.gr> 11.14 * 11.15 */ 11.16 - 11.17 public class TestSpatialEndpoint { 11.18 11.19 private SpatialEndpoint endpoint; 11.20 @@ -32,7 +29,7 @@ 11.21 @Before 11.22 public void init() { 11.23 // initialize endpoint 11.24 - endpoint = new SpatialEndpoint("geo.linkedopendata.gr", 9090, "corine-endpoint/Query"); 11.25 + endpoint = new SpatialEndpoint("geo.linkedopendata.gr", 80, "corine-endpoint/Query"); 11.26 11.27 // set query 11.28 query = "PREFIX corine: <http://geo.linkedopendata.gr/corine/ontology#> \n"+
12.1 --- a/endpoint-exec/pom.xml Wed Sep 10 12:37:29 2014 +0200 12.2 +++ b/endpoint-exec/pom.xml Wed Sep 24 18:44:26 2014 +0300 12.3 @@ -93,6 +93,45 @@ 12.4 </execution> 12.5 </executions> 12.6 </plugin> 12.7 + <plugin> 12.8 + <artifactId>jdeb</artifactId> 12.9 + <groupId>org.vafer</groupId> 12.10 + <version>1.3</version> 12.11 + <executions> 12.12 + <execution> 12.13 + <phase>package</phase> 12.14 + <goals> 12.15 + <goal>jdeb</goal> 12.16 + </goals> 12.17 + <configuration> 12.18 + <skipPOMs>false</skipPOMs> 12.19 + <dataSet> 12.20 + <data> 12.21 + <src>${project.build.directory}/strabon-endpoint-executable-${project.version}.jar</src> 12.22 + <type>file</type> 12.23 + <mapper> 12.24 + <type>perm</type> 12.25 + <prefix>/usr/share/jdeb/lib</prefix> 12.26 + </mapper> 12.27 + </data> 12.28 + <data> 12.29 + <src>${basedir}/strabon-endpoint</src> 12.30 + <type>file</type> 12.31 + <mapper> 12.32 + <type>perm</type> 12.33 + <prefix>/usr/local/bin</prefix> 12.34 + <user>root</user> 12.35 + <group>root</group> 12.36 + <filemode>755</filemode> 12.37 + </mapper> 12.38 + </data> 12.39 + </dataSet> 12.40 + </configuration> 12.41 + </execution> 12.42 + </executions> 12.43 + </plugin> 12.44 + 12.45 + 12.46 </plugins> 12.47 </build> 12.48 </project>
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/endpoint-exec/src/deb/control/control Wed Sep 24 18:44:26 2014 +0300 13.3 @@ -0,0 +1,8 @@ 13.4 +Package: Strabon 13.5 +Version: 3.2.10 13.6 +Section: strabon-endpoint 13.7 +Priority: optional 13.8 +Architecture: all 13.9 +Maintainer: Manolis Karpathiotakis <manos.karpathiotakis@epfl.ch>, Kostis Kyzirakos <Kostis.Kyzirakos@cwi.nl>, Charalambos Nikolaou <charnik@di.uoa.gr>, Konstantina Bereta <konstantina.bereta@di.uoa.gr>, Georgios Garbis <ggarbis@di.uoa.gr>, Dimitrios Bilidas <dbilidas@di.uoa.gr>, Stella Giannakopoulou <sgian@di.uoa.gr>, Panayiotis Smeros <psmeros@di.uoa.gr>, Kalliroi Dogani <kallirroi@di.uoa.gr>, Maria Karpathiotaki <mkarpat@di.uoa.gr>, Ioannis Vlachopoulos <johnvl@di.uoa.gr>, Dimitrianos Savva <dimis@di.uoa.gr>, Georgios Stamoulis <gstam@di.uoa.gr>, Kanela Kaligosi <kalkan@di.uoa.gr> 13.10 +Description: Strabon endpoint executable 13.11 +Distribution: Mozilla v2.0 Public Liscence
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/endpoint-exec/strabon-endpoint Wed Sep 24 18:44:26 2014 +0300 14.3 @@ -0,0 +1,4 @@ 14.4 +#!/bin/bash 14.5 + 14.6 +java -jar /usr/share/jdeb/lib/strabon-endpoint-executable-3.2.10-SNAPSHOT.jar "$@" 14.7 +
15.1 --- a/endpoint/WebContent/query.jsp Wed Sep 10 12:37:29 2014 +0200 15.2 +++ b/endpoint/WebContent/query.jsp Wed Sep 24 18:44:26 2014 +0300 15.3 @@ -147,7 +147,7 @@ 15.4 var x2 = southWest.lng().toFixed(2); 15.5 var y2 = southWest.lat().toFixed(2); 15.6 15.7 - var polygon = "\"<http\://www.opengis.net/def/crs/EPSG/0/4326\> POLYGON((" + 15.8 + var polygon = "\"POLYGON((" + 15.9 x1 + " " + y2 + ", " + 15.10 x2 + " " + y2 + ", " + 15.11 x2 + " " + y1 + ", " +
16.1 --- a/endpoint/src/log4j.properties Wed Sep 10 12:37:29 2014 +0200 16.2 +++ b/endpoint/src/log4j.properties Wed Sep 24 18:44:26 2014 +0300 16.3 @@ -19,6 +19,7 @@ 16.4 # Sesame configuration (debug only Strabon) 16.5 log4j.logger.org.openrdf.query.parser.QueryParserRegistry=INFO 16.6 log4j.logger.org.openrdf.sail.generaldb.managers.TripleTableManager=INFO 16.7 +#log4j.logger.org.openrdf.sail.postgis.evaluation.PostGISEvaluation=DEBUG 16.8 16.9 # "Disable" logging for several services in Tomcat 16.10 log4j.logger.org.springframework=WARN
17.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java Wed Sep 10 12:37:29 2014 +0200 17.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java Wed Sep 24 18:44:26 2014 +0300 17.3 @@ -16,8 +16,6 @@ 17.4 import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 17.5 import org.openrdf.rio.RDFFormat; 17.6 17.7 -import eu.earthobservatory.utils.Format; 17.8 - 17.9 /** 17.10 * Keeps common variables shared by beans and .jsp pages. 17.11 * 17.12 @@ -88,7 +86,6 @@ 17.13 registeredQueryResultsFormatNames.add(format.getName()); 17.14 //} 17.15 } 17.16 - 17.17 } 17.18 17.19 /**
18.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java Wed Sep 10 12:37:29 2014 +0200 18.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java Wed Sep 24 18:44:26 2014 +0300 18.3 @@ -16,10 +16,11 @@ 18.4 import java.math.BigInteger; 18.5 import java.net.URLDecoder; 18.6 import java.security.SecureRandom; 18.7 +import java.util.ArrayList; 18.8 import java.util.Date; 18.9 import java.util.Iterator; 18.10 -import java.util.ArrayList; 18.11 import java.util.List; 18.12 +import java.util.StringTokenizer; 18.13 18.14 import javax.servlet.RequestDispatcher; 18.15 import javax.servlet.ServletConfig; 18.16 @@ -33,7 +34,6 @@ 18.17 import org.apache.commons.io.FileUtils; 18.18 import org.apache.commons.lang.StringEscapeUtils; 18.19 import org.openrdf.query.MalformedQueryException; 18.20 -import org.openrdf.query.TupleQueryResult; 18.21 import org.openrdf.query.resultio.TupleQueryResultFormat; 18.22 import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 18.23 import org.slf4j.Logger; 18.24 @@ -115,9 +115,6 @@ 18.25 // get the name of this web application 18.26 appName = context.getContextPath().replace("/", ""); 18.27 18.28 - 18.29 - 18.30 - 18.31 } 18.32 18.33 public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 18.34 @@ -173,26 +170,30 @@ 18.35 private void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { 18.36 ServletOutputStream out = response.getOutputStream(); 18.37 18.38 - // get the stSPARQL Query Result format (we check only the Accept header) 18.39 - stSPARQLQueryResultFormat format = stSPARQLQueryResultFormat.forMIMEType(request.getHeader("accept")); 18.40 - 18.41 - // get the query 18.42 + // get desired formats (we check only the Accept header) 18.43 + List<stSPARQLQueryResultFormat> formats = parseMultiValuedAcceptHeader(request.getHeader("accept")); 18.44 + 18.45 + // get the query and the limit 18.46 String query = request.getParameter("query"); 18.47 String maxLimit = request.getParameter("maxLimit"); 18.48 - 18.49 - // check for required parameters 18.50 - if (format == null || query == null) { 18.51 - logger.error("[StrabonEndpoint.QueryBean] {}", PARAM_ERROR); 18.52 - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); 18.53 + 18.54 + // check for required parameters 18.55 + if (formats.size() == 0 || query == null) { 18.56 + logger.error("[StrabonEndpoint.QueryBean] {}", PARAM_ERROR); 18.57 + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); 18.58 out.print(ResponseMessages.getXMLHeader()); 18.59 out.print(ResponseMessages.getXMLException(PARAM_ERROR)); 18.60 out.print(ResponseMessages.getXMLFooter()); 18.61 - 18.62 - } else { 18.63 - // decode the query 18.64 - query = URLDecoder.decode(request.getParameter("query"), "UTF-8"); 18.65 - 18.66 + 18.67 + } else { 18.68 + // just use the first specified format 18.69 + stSPARQLQueryResultFormat format = formats.get(0); 18.70 + 18.71 + // decode the query 18.72 + query = URLDecoder.decode(request.getParameter("query"), "UTF-8"); 18.73 + 18.74 response.setContentType(format.getDefaultMIMEType()); 18.75 + 18.76 try { 18.77 query = strabonWrapper.addLimit(query, maxLimit); 18.78 strabonWrapper.query(query, format.getName(), out); 18.79 @@ -205,11 +206,11 @@ 18.80 out.print(ResponseMessages.getXMLException(e.getMessage())); 18.81 out.print(ResponseMessages.getXMLFooter()); 18.82 } 18.83 - } 18.84 - 18.85 - out.flush(); 18.86 + } 18.87 + 18.88 + out.flush(); 18.89 } 18.90 - 18.91 + 18.92 /** 18.93 * Processes the request made from the HTML visual interface of Strabon Endpoint. 18.94 * 18.95 @@ -385,4 +386,43 @@ 18.96 } 18.97 } 18.98 } 18.99 + 18.100 + /** 18.101 + * Given an Accept header, it parses it and extracts the mime types for the accepted formats. 18.102 + * The header might contain multiple accepted values and qvalues as well, however, qvalues 18.103 + * are ignored. The extracted mime types are then transformed to stSPARQLQueryResultFormat 18.104 + * and a list of such objects is returned. If a mimetype is not valid, then it is ignored. 18.105 + * If all mimetypes are invalid, then the returned list has zero elements, but it is not 18.106 + * null. 18.107 + * 18.108 + * @param header 18.109 + * @return 18.110 + */ 18.111 + private List<stSPARQLQueryResultFormat> parseMultiValuedAcceptHeader(String header) { 18.112 + List<stSPARQLQueryResultFormat> formats = new ArrayList<stSPARQLQueryResultFormat>(); 18.113 + 18.114 + StringTokenizer token = new StringTokenizer(header, ", "); 18.115 + 18.116 + while (token.hasMoreTokens()) { 18.117 + String value = token.nextToken(); 18.118 + 18.119 + // value might contain qvalues (e.g., "text/plain; q=0.2") 18.120 + // for the time being, we just discard them 18.121 + int idx_sep_cut = value.indexOf(';'); 18.122 + if (idx_sep_cut > 0) { 18.123 + value = value.substring(0, idx_sep_cut); 18.124 + } 18.125 + 18.126 + // get the stSPARQL Query Result format 18.127 + stSPARQLQueryResultFormat format = stSPARQLQueryResultFormat.forMIMEType(value); 18.128 + 18.129 + // keep only the valid formats (non-null) 18.130 + if (format != null) { 18.131 + formats.add(format); 18.132 + } 18.133 + } 18.134 + 18.135 + return formats; 18.136 + } 18.137 + 18.138 }
19.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java Wed Sep 10 12:37:29 2014 +0200 19.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java Wed Sep 24 18:44:26 2014 +0300 19.3 @@ -19,7 +19,6 @@ 19.4 import java.util.ArrayList; 19.5 import java.util.Collection; 19.6 import java.util.Iterator; 19.7 -import java.util.ArrayList; 19.8 import java.util.List; 19.9 import java.util.regex.Matcher; 19.10 import java.util.regex.Pattern; 19.11 @@ -29,7 +28,6 @@ 19.12 import org.openrdf.model.Statement; 19.13 import org.openrdf.query.MalformedQueryException; 19.14 import org.openrdf.query.QueryEvaluationException; 19.15 -import org.openrdf.query.TupleQuery; 19.16 import org.openrdf.query.TupleQueryResult; 19.17 import org.openrdf.query.TupleQueryResultHandlerException; 19.18 import eu.earthobservatory.constants.TemporalConstants; 19.19 @@ -164,7 +162,8 @@ 19.20 // use PostGIS as the default database backend 19.21 this.strabon = new eu.earthobservatory.runtime.postgis.Strabon(databaseName, user, password, port, serverName, checkForLockTable); 19.22 } 19.23 - 19.24 + 19.25 + installSIGTERMHandler(this.strabon); 19.26 19.27 } catch (Exception e) { 19.28 logger.error("[StrabonEndpoint] Exception occured while creating Strabon. {}\n{}", e.getMessage(), this.getDetails()); 19.29 @@ -175,6 +174,33 @@ 19.30 return true; 19.31 } 19.32 19.33 + /** 19.34 + * Registers a handler for SIGTERM signals, like Ctrl-C. One may send such a signal 19.35 + * at the command prompt, when running Strabon Endpoint from the command line, i.e., 19.36 + * using the endpoint-exec module. 19.37 + * 19.38 + * @param strabon The strabon instance 19.39 + */ 19.40 + private static void installSIGTERMHandler(final Strabon strabon) { 19.41 + if (logger.isDebugEnabled()) { 19.42 + logger.info("[StrabonEndpoint] Installing handler for SIGTERM signals..."); 19.43 + } 19.44 + 19.45 + // register the handler 19.46 + Runtime.getRuntime().addShutdownHook(new Thread() { 19.47 + 19.48 + @Override 19.49 + public void run() { 19.50 + // just call the Strabon.close() method 19.51 + strabon.close(); 19.52 + } 19.53 + }); 19.54 + 19.55 + if (logger.isDebugEnabled()) { 19.56 + logger.info("[StrabonEndpoint] Handler for SIGTERM signals installed successfully."); 19.57 + } 19.58 + } 19.59 + 19.60 public Strabon getStrabon() { 19.61 return strabon; 19.62 } 19.63 @@ -223,8 +249,6 @@ 19.64 gChartString += "data.addColumn('string',\'"+arr.get(0)+"');\n"; 19.65 gChartString += "data.addColumn('number',\'"+arr.get(1)+"');\n"; 19.66 19.67 - int i=1; 19.68 - int index=0; 19.69 while(result.hasNext()){ 19.70 BindingSet bindings = result.next(); 19.71 arr.add(0, bindings.getValue(bindingNames.get(0)).stringValue()); 19.72 @@ -232,7 +256,6 @@ 19.73 19.74 gChartString += "data.addRow([\'"+withoutPrefix(arr.get(0))+"\', "+ 19.75 arr.get(1).replace("\"", "").replace("^^","").replace("<http://www.w3.org/2001/XMLSchema#integer>","")+"]);\n"; 19.76 - i++; 19.77 } 19.78 gChartString += "var options = {'title':'','width':1000, 'height':1000, is3D: true};\n"; 19.79 gChartString += "var chart = new google.visualization.PieChart(document.getElementById('chart_div'));\n"; 19.80 @@ -243,7 +266,6 @@ 19.81 19.82 String chartType; 19.83 int varNum = bindingNames.size(); 19.84 - ArrayList<String> arr = new ArrayList<String>(varNum); 19.85 19.86 gChartString = "var data = google.visualization.arrayToDataTable([["; 19.87 for(int j=0; j<varNum; j++){
20.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/UpdateBean.java Wed Sep 10 12:37:29 2014 +0200 20.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/UpdateBean.java Wed Sep 24 18:44:26 2014 +0300 20.3 @@ -28,8 +28,7 @@ 20.4 import org.springframework.web.context.support.WebApplicationContextUtils; 20.5 20.6 /** 20.7 - * @author charnik 20.8 - * 20.9 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 20.10 */ 20.11 public class UpdateBean extends HttpServlet { 20.12
21.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/AbstractWKT.java Wed Sep 10 12:37:29 2014 +0200 21.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/AbstractWKT.java Wed Sep 24 18:44:26 2014 +0300 21.3 @@ -66,6 +66,12 @@ 21.4 */ 21.5 private int srid; 21.6 21.7 + /** 21.8 + * NOTICE: no check of the validity of the supplied WKT is done 21.9 + * 21.10 + * @param literalValue 21.11 + * @param datatype 21.12 + */ 21.13 public AbstractWKT(String literalValue, String datatype) { 21.14 this.datatype = datatype; 21.15 21.16 @@ -86,10 +92,12 @@ 21.17 * It should be used only when one does not have such information 21.18 * available. 21.19 * 21.20 - * NOTICE: it is not guaranteed that guessing will fill-in the 21.21 + * NOTICE 1: it is not guaranteed that guessing will fill-in the 21.22 * datatype, but it is guaranteed that parsing will be done 21.23 * correctly in any case (well, except for illegal cases). 21.24 * 21.25 + * NOTICE 2: no check of the validity of the supplied WKT is done 21.26 + * 21.27 * @param literalValue 21.28 */ 21.29 public AbstractWKT(String literalValue) { 21.30 @@ -132,7 +140,7 @@ 21.31 21.32 private void parseWKTLITERAL(String literalValue) { 21.33 wkt = literalValue.trim(); 21.34 - srid = GeoConstants.WGS84_LON_LAT_SRID; 21.35 + srid = GeoConstants.default_GeoSPARQL_SRID; 21.36 21.37 if (wkt.length() == 0) { // empty geometry 21.38 wkt = EMPTY_GEOM; 21.39 @@ -144,9 +152,8 @@ 21.40 // FIXME: handle invalid URIs 21.41 URI crs = URI.create(wkt.substring(1, uriIndx)); 21.42 21.43 - // FIXME: get the SRID for crs properly. HOW?? 21.44 - if (GeoConstants.WGS84_LON_LAT.equals(crs.toString())) { 21.45 - srid = GeoConstants.WGS84_LON_LAT_SRID; 21.46 + if (GeoConstants.CRS84_URI.equals(crs.toString())) { 21.47 + srid = GeoConstants.EPSG4326_SRID; 21.48 21.49 } else { // parse it to get the srid 21.50 // FIXME: this code assumes an EPSG URI 21.51 @@ -171,7 +178,7 @@ 21.52 return datatype; 21.53 } 21.54 21.55 - boolean isstRDFWKT() { 21.56 + public boolean isstRDFWKT() { 21.57 return isstRDFWKT; 21.58 } 21.59
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/GeometryDatatype.java Wed Sep 24 18:44:26 2014 +0300 22.3 @@ -0,0 +1,81 @@ 22.4 +/** 22.5 + * This Source Code Form is subject to the terms of the Mozilla Public 22.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 22.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 22.8 + * 22.9 + * Copyright (C) 2012, 2013 Pyravlos Team 22.10 + * 22.11 + * http://www.sextant.di.uoa.gr/ 22.12 + */ 22.13 +package org.openrdf.query.algebra.evaluation.function.spatial; 22.14 + 22.15 +import java.util.HashMap; 22.16 +import java.util.Map; 22.17 + 22.18 +import eu.earthobservatory.constants.GeoConstants; 22.19 + 22.20 +/** 22.21 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 22.22 + */ 22.23 +public enum GeometryDatatype { 22.24 + /** 22.25 + * stRDF WKT literal 22.26 + */ 22.27 + stRDFWKT(GeoConstants.WKT), 22.28 + 22.29 + /** 22.30 + * GeoSPARQL WKT literal 22.31 + */ 22.32 + wktLiteral(GeoConstants.WKTLITERAL), 22.33 + 22.34 + /** 22.35 + * GML literal 22.36 + */ 22.37 + GML(GeoConstants.GMLLITERAL), 22.38 + 22.39 + /** 22.40 + * Unknown geometry format 22.41 + */ 22.42 + UNKNOWN("Unknown GeometryDatatype"); 22.43 + 22.44 + /** 22.45 + * The string representation of this format 22.46 + */ 22.47 + private String name; 22.48 + 22.49 + /** 22.50 + * Map a string constant to a Format 22.51 + */ 22.52 + private static final Map<String, GeometryDatatype> stringToEnum = new HashMap<String, GeometryDatatype>(); 22.53 + 22.54 + 22.55 + static { // initialize map from constant name to enum constant 22.56 + for (GeometryDatatype format : values()) { 22.57 + stringToEnum.put(format.toString(), format); 22.58 + } 22.59 + } 22.60 + 22.61 + /** 22.62 + * GeometryDatatype constructor 22.63 + * 22.64 + * @param name 22.65 + */ 22.66 + GeometryDatatype(String name) { 22.67 + this.name = name; 22.68 + } 22.69 + 22.70 + @Override 22.71 + public String toString() { 22.72 + return name; 22.73 + } 22.74 + 22.75 + /** 22.76 + * Returns a GeometryDatatype enum given a format string. 22.77 + * 22.78 + * @param lang 22.79 + * @return 22.80 + */ 22.81 + public static GeometryDatatype fromString(String format) { 22.82 + return (stringToEnum.get(format) == null) ? UNKNOWN:stringToEnum.get(format); 22.83 + } 22.84 +}
23.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/SpatialConstructFunc.java Wed Sep 10 12:37:29 2014 +0200 23.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/SpatialConstructFunc.java Wed Sep 24 18:44:26 2014 +0300 23.3 @@ -28,9 +28,7 @@ 23.4 public abstract class SpatialConstructFunc implements Function { 23.5 23.6 //No need for any implementation, I will have replaced this class's presence before reaching this place 23.7 - public Value evaluate(ValueFactory valueFactory, Value... args) 23.8 - throws ValueExprEvaluationException { 23.9 - 23.10 + public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { 23.11 return null; 23.12 } 23.13
24.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/SpatialPropertyFunc.java Wed Sep 10 12:37:29 2014 +0200 24.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/SpatialPropertyFunc.java Wed Sep 24 18:44:26 2014 +0300 24.3 @@ -9,6 +9,7 @@ 24.4 */ 24.5 package org.openrdf.query.algebra.evaluation.function.spatial; 24.6 24.7 +import org.apache.log4j.Logger; 24.8 import org.openrdf.model.Value; 24.9 import org.openrdf.model.ValueFactory; 24.10 import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 24.11 @@ -28,13 +29,14 @@ 24.12 */ 24.13 public abstract class SpatialPropertyFunc implements Function { 24.14 24.15 + private static Logger logger = Logger.getLogger(org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc.class); 24.16 + 24.17 //No need for any implementation, I will have replaced this class's presence before reaching this place 24.18 public Value evaluate(ValueFactory valueFactory, Value... args) 24.19 throws ValueExprEvaluationException { 24.20 - 24.21 + logger.error(this.getURI() + ": I should have been taken care of before in GeneralDBEvaluation.evaluate(FunctionCall, BindingSet)."); 24.22 return null; 24.23 } 24.24 24.25 - // charnik: made method (and hence the class) abstract 24.26 public abstract String getURI(); 24.27 }
25.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java Wed Sep 10 12:37:29 2014 +0200 25.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java Wed Sep 24 18:44:26 2014 +0300 25.3 @@ -31,8 +31,8 @@ 25.4 import com.vividsolutions.jts.io.ParseException; 25.5 25.6 /** 25.7 - * A {@link StrabonPolyhedron} is a @{link Value} that is used to represent geometries. 25.8 - * Therefore, a {@link StrabonPolyhedron} wraps around the construct of an RDF @{link Value} 25.9 + * A {@link StrabonPolyhedron} is a {@link Value} that is used to represent geometries. 25.10 + * Therefore, a {@link StrabonPolyhedron} wraps around the construct of an RDF {@link Value} 25.11 * the notion of geometry. This geometry can be expressed in different kinds of 25.12 * representations, such as linear constraints over the reals with addition 25.13 * (Semi-linear point sets), Well-Known Text (WKT), or Geography Markup Language (GML). 25.14 @@ -69,8 +69,8 @@ 25.15 25.16 public static final boolean EnableConstraintRepresentation = false; 25.17 25.18 - private static int MAX_POINTS = Integer.MAX_VALUE;//40000;//Integer.MAX_VALUE;//10000; 25.19 - 25.20 + //private static int MAX_POINTS = Integer.MAX_VALUE;//40000;//Integer.MAX_VALUE;//10000; 25.21 + 25.22 /** 25.23 * Get the Java Topology Suite wrapper instance. 25.24 */ 25.25 @@ -81,12 +81,20 @@ 25.26 */ 25.27 private Geometry geometry; 25.28 25.29 + private GeometryDatatype datatype; 25.30 + 25.31 /** 25.32 * Creates a {@link StrabonPolyhedron} instance with an empty geometry. 25.33 */ 25.34 - public StrabonPolyhedron() { 25.35 + public StrabonPolyhedron(GeometryDatatype datatype) { 25.36 this.geometry = null; 25.37 - 25.38 + this.datatype = datatype; 25.39 + } 25.40 + 25.41 + public StrabonPolyhedron(Geometry geo, int srid, GeometryDatatype datatype) { 25.42 + this(datatype); 25.43 + this.geometry = geo; 25.44 + this.geometry.setSRID(srid); 25.45 } 25.46 25.47 /** 25.48 @@ -95,15 +103,16 @@ 25.49 * @param geo 25.50 * @throws Exception 25.51 */ 25.52 - public StrabonPolyhedron(Geometry geo) throws Exception { 25.53 - this.geometry = new StrabonPolyhedron(geo, 1).geometry; 25.54 - this.geometry.setSRID(geo.getSRID()); 25.55 + public StrabonPolyhedron(Geometry geo, GeometryDatatype datatype) { 25.56 + this(geo, geo.getSRID(), datatype); 25.57 } 25.58 25.59 /** 25.60 * Creates a {@link StrabonPolyhedron} instance with a geometry given 25.61 * in the representation of the argument. The representation could be 25.62 - * either in WKT or in GML. 25.63 + * either in WKT or in GML. Since, we construct the {@link Geometry} 25.64 + * object ourselves there is no way of knowing the SRID, so the 25.65 + * constructor requires it as well. 25.66 * 25.67 * NOTICE: whoever creates StrabonPolyhedron objects is responsible 25.68 * for cleaning the representation of the geometry by removing any 25.69 @@ -112,7 +121,9 @@ 25.70 * @param representation 25.71 * @throws Exception 25.72 */ 25.73 - public StrabonPolyhedron(String representation) throws IllegalArgumentException { 25.74 + public StrabonPolyhedron(String representation, int srid, GeometryDatatype datatype) throws ParseException { 25.75 + this(datatype); 25.76 + 25.77 try { 25.78 // try first as WKT 25.79 geometry = jts.WKTread(representation); 25.80 @@ -122,10 +133,19 @@ 25.81 // try as GML 25.82 geometry = jts.GMLread(representation); 25.83 25.84 + // set datatype (to be on the safe side, when the specified datatype 25.85 + // was unknown; after all, there is no other case for GML 25.86 + if (datatype == GeometryDatatype.UNKNOWN) { 25.87 + datatype = GeometryDatatype.GML; 25.88 + } 25.89 + 25.90 } catch (Exception e1) { 25.91 - throw new IllegalArgumentException(e1); 25.92 + throw new ParseException("The given WKT/GML representation is not valid."); 25.93 } 25.94 } 25.95 + 25.96 + // set its SRID 25.97 + geometry.setSRID(srid); 25.98 } 25.99 25.100 /** 25.101 @@ -135,7 +155,8 @@ 25.102 * @param byteArray 25.103 * @throws ParseException 25.104 */ 25.105 - public StrabonPolyhedron(byte[] byteArray) throws ParseException { 25.106 + public StrabonPolyhedron(byte[] byteArray, GeometryDatatype datatype) throws ParseException { 25.107 + this(datatype); 25.108 this.geometry = jts.WKBread(byteArray); 25.109 } 25.110 25.111 @@ -147,18 +168,32 @@ 25.112 * @param srid 25.113 * @throws ParseException 25.114 */ 25.115 - public StrabonPolyhedron(byte[] byteArray, int srid) throws ParseException { 25.116 - this(byteArray); 25.117 + public StrabonPolyhedron(byte[] byteArray, int srid, GeometryDatatype datatype) throws ParseException { 25.118 + this(byteArray, datatype); 25.119 this.geometry.setSRID(srid); 25.120 } 25.121 25.122 + public GeometryDatatype getGeometryDatatype() { 25.123 + return datatype; 25.124 + } 25.125 + 25.126 /** 25.127 * Returns the string representation of the geometry of this 25.128 * {@link StrabonPolyhedron} instance. The result of this method 25.129 * is the same to the one of method {@link #toWKT()}. 25.130 */ 25.131 public String stringValue() { 25.132 - return toWKT(); 25.133 + switch (datatype) { 25.134 + case GML: 25.135 + return toGML(); 25.136 + 25.137 + case stRDFWKT: 25.138 + case wktLiteral: 25.139 + return toWKT(); 25.140 + 25.141 + default: // UNKNOWN 25.142 + return toWKT(); 25.143 + } 25.144 } 25.145 25.146 @Override 25.147 @@ -175,28 +210,9 @@ 25.148 return false; 25.149 } 25.150 25.151 + // unused 25.152 @Deprecated 25.153 - public StrabonPolyhedron(String WKT, int algorithm) throws Exception { 25.154 - if(WKT.contains("gml")) 25.155 - { 25.156 - Geometry geo = jts.GMLread(WKT); 25.157 - this.geometry = new StrabonPolyhedron(geo).geometry; 25.158 - } 25.159 - else 25.160 - { 25.161 - Geometry geo = jts.WKTread(WKT); 25.162 - this.geometry = new StrabonPolyhedron(geo, algorithm).geometry; 25.163 - } 25.164 - 25.165 - } 25.166 - 25.167 - @Deprecated 25.168 - public StrabonPolyhedron(Geometry geo, int algorithm) throws Exception { 25.169 - this.geometry = new StrabonPolyhedron(geo, algorithm, MAX_POINTS).geometry; 25.170 - } 25.171 - 25.172 - // unused 25.173 - public StrabonPolyhedron(Geometry geo, int algorithm, int maxPoints) throws Exception { 25.174 + private StrabonPolyhedron(Geometry geo, int algorithm, int maxPoints) throws Exception { 25.175 if (geo.isEmpty()) { 25.176 this.geometry = geo; 25.177 return; 25.178 @@ -385,9 +401,13 @@ 25.179 * 25.180 * @return 25.181 */ 25.182 - public String toWKT() { 25.183 + protected String toWKT() { 25.184 return jts.WKTwrite(this.geometry); 25.185 } 25.186 + 25.187 + protected String toGML() { 25.188 + return jts.GMLWrite(this.geometry); 25.189 + } 25.190 25.191 /** 25.192 * Return the geometry of {@link StrabonPolyhedron} as a byte array. 25.193 @@ -669,7 +689,7 @@ 25.194 } 25.195 25.196 public static StrabonPolyhedron union(StrabonPolyhedron A, StrabonPolyhedron B) throws Exception { 25.197 - StrabonPolyhedron poly = new StrabonPolyhedron(); 25.198 + StrabonPolyhedron poly = new StrabonPolyhedron(A.getGeometryDatatype()); 25.199 25.200 int targetSRID = A.getGeometry().getSRID(); 25.201 int sourceSRID = B.getGeometry().getSRID(); 25.202 @@ -680,32 +700,28 @@ 25.203 return poly; 25.204 } 25.205 25.206 + /** 25.207 + * Think that this computation is done in meters and there is no way of doing it 25.208 + * in degrees, except if one calculate the corresponding transformation, which 25.209 + * depends on the spatial reference system used! 25.210 + * 25.211 + * A not so good approximation of meters for degrees: 25.212 + * double meters = (degrees * 6378137 * Math.PI) / 180; 25.213 + */ 25.214 public static StrabonPolyhedron buffer(StrabonPolyhedron A, double B) throws Exception { 25.215 - StrabonPolyhedron poly = new StrabonPolyhedron(); 25.216 - poly.geometry = A.geometry.buffer(B); 25.217 - 25.218 - return poly; 25.219 + return new StrabonPolyhedron(A.geometry.buffer(B), A.getGeometry().getSRID(), A.getGeometryDatatype()); 25.220 } 25.221 25.222 public static StrabonPolyhedron envelope(StrabonPolyhedron A) throws Exception { 25.223 - StrabonPolyhedron poly = new StrabonPolyhedron(); 25.224 - poly.geometry = A.geometry.getEnvelope(); 25.225 - 25.226 - return poly; 25.227 + return new StrabonPolyhedron(A.geometry.getEnvelope(), A.getGeometry().getSRID(), A.getGeometryDatatype()); 25.228 } 25.229 25.230 public static StrabonPolyhedron convexHull(StrabonPolyhedron A) throws Exception { 25.231 - StrabonPolyhedron poly = new StrabonPolyhedron(); 25.232 - poly.geometry = A.geometry.convexHull(); 25.233 - 25.234 - return poly; 25.235 + return new StrabonPolyhedron(A.getGeometry().convexHull(), A.getGeometry().getSRID(), A.getGeometryDatatype()); 25.236 } 25.237 25.238 public static StrabonPolyhedron boundary(StrabonPolyhedron A) throws Exception { 25.239 - StrabonPolyhedron poly = new StrabonPolyhedron(); 25.240 - poly.geometry = A.geometry.getBoundary(); 25.241 - 25.242 - return poly; 25.243 + return new StrabonPolyhedron(A.geometry.getBoundary(), A.getGeometry().getSRID(), A.getGeometryDatatype()); 25.244 } 25.245 25.246 public static StrabonPolyhedron intersection(StrabonPolyhedron A, StrabonPolyhedron B) throws Exception { 25.247 @@ -714,12 +730,11 @@ 25.248 int sourceSRID = B.getGeometry().getSRID(); 25.249 Geometry x = JTSWrapper.getInstance().transform(B.getGeometry(), sourceSRID, targetSRID); 25.250 Geometry geo = A.geometry.intersection(x); 25.251 - geo.setSRID(targetSRID); 25.252 - return new StrabonPolyhedron(geo); 25.253 + return new StrabonPolyhedron(geo, targetSRID, A.getGeometryDatatype()); 25.254 } 25.255 25.256 public static StrabonPolyhedron difference(StrabonPolyhedron A, StrabonPolyhedron B) throws Exception { 25.257 - StrabonPolyhedron poly = new StrabonPolyhedron(); 25.258 + StrabonPolyhedron poly = new StrabonPolyhedron(A.getGeometryDatatype()); 25.259 25.260 int targetSRID = A.getGeometry().getSRID(); 25.261 int sourceSRID = B.getGeometry().getSRID(); 25.262 @@ -731,7 +746,7 @@ 25.263 } 25.264 25.265 public static StrabonPolyhedron symDifference(StrabonPolyhedron A, StrabonPolyhedron B) throws Exception { 25.266 - StrabonPolyhedron poly = new StrabonPolyhedron(); 25.267 + StrabonPolyhedron poly = new StrabonPolyhedron(A.getGeometryDatatype()); 25.268 int targetSRID = A.getGeometry().getSRID(); 25.269 int sourceSRID = B.getGeometry().getSRID(); 25.270 Geometry x = JTSWrapper.getInstance().transform(B.getGeometry(), sourceSRID, targetSRID); 25.271 @@ -752,19 +767,16 @@ 25.272 } 25.273 25.274 public static StrabonPolyhedron project(StrabonPolyhedron A, int[] dims) throws Exception { 25.275 - StrabonPolyhedron poly = new StrabonPolyhedron(); 25.276 ProjectionsFilter filter = new ProjectionsFilter(dims); 25.277 A.geometry.apply(filter); 25.278 A.geometry.geometryChanged(); 25.279 - poly.geometry = A.geometry; 25.280 - return poly; 25.281 + return new StrabonPolyhedron(A.getGeometry(), A.getGeometry().getSRID(), A.getGeometryDatatype()); 25.282 } 25.283 25.284 public static StrabonPolyhedron transform(StrabonPolyhedron A, URI srid) throws Exception { 25.285 - 25.286 - int parsedSRID = Integer.parseInt(srid.toString().substring(srid.toString().lastIndexOf('/')+1)); 25.287 + int parsedSRID = WKTHelper.getSRID_forURI(srid.toString()); 25.288 Geometry converted = JTSWrapper.getInstance().transform(A.getGeometry(), A.getGeometry().getSRID(), parsedSRID); 25.289 - return new StrabonPolyhedron(converted); 25.290 + return new StrabonPolyhedron(converted, A.getGeometryDatatype()); 25.291 } 25.292 25.293 /** 25.294 @@ -779,7 +791,6 @@ 25.295 System.out.println("Merging polyhedrons: A.coordinates=" + A.getGeometry().getCoordinates().length + 25.296 ", B.coordinates=" + B.getGeometry().getCoordinates().length); 25.297 25.298 - StrabonPolyhedron poly = new StrabonPolyhedron(); 25.299 int polygons = 0; 25.300 if (Polygon.class.isInstance(A.geometry)) { 25.301 polygons++; 25.302 @@ -820,24 +831,24 @@ 25.303 } 25.304 } 25.305 25.306 - poly.geometry = new MultiPolygon(polys, new GeometryFactory()); 25.307 - 25.308 - return poly; 25.309 + return new StrabonPolyhedron(new MultiPolygon(polys, new GeometryFactory()), 25.310 + A.getGeometry().getSRID(), 25.311 + A.getGeometryDatatype()); 25.312 } 25.313 25.314 public StrabonPolyhedron getBuffer(double distance) throws Exception { 25.315 Geometry geo = this.geometry.buffer(distance); 25.316 - return new StrabonPolyhedron(geo); 25.317 + return new StrabonPolyhedron(geo, this.geometry.getSRID(), datatype); 25.318 } 25.319 25.320 public StrabonPolyhedron getBoundary() throws Exception { 25.321 Geometry geo = this.geometry.getBoundary(); 25.322 - return new StrabonPolyhedron(geo); 25.323 + return new StrabonPolyhedron(geo, this.geometry.getSRID(), datatype); 25.324 } 25.325 25.326 public StrabonPolyhedron getEnvelope() throws Exception { 25.327 Geometry geo = this.geometry.getEnvelope(); 25.328 - return new StrabonPolyhedron(geo); 25.329 + return new StrabonPolyhedron(geo, this.geometry.getSRID(), datatype); 25.330 } 25.331 25.332 public double getArea() throws Exception { 25.333 @@ -860,4 +871,22 @@ 25.334 GeometryCollection.class.isInstance(geo) ? "GeometryCollection" : 25.335 "Unknown"; 25.336 } 25.337 + 25.338 + 25.339 + /*** 25.340 + * Additions by charnik. 25.341 + * Why all the above operations (symdifference, boundary, etc.) are static methods 25.342 + * and not member methods? 25.343 + */ 25.344 + 25.345 + /** 25.346 + * Returns the centroid of this StrabonPolyhedron as 25.347 + * a new StrabonPolyhedron. 25.348 + * 25.349 + * @return 25.350 + */ 25.351 + public StrabonPolyhedron getCentroid() { 25.352 + Point point = geometry.getCentroid(); 25.353 + return new StrabonPolyhedron(point, geometry.getSRID(), datatype); 25.354 + } 25.355 }
26.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/WKTHelper.java Wed Sep 10 12:37:29 2014 +0200 26.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/WKTHelper.java Wed Sep 24 18:44:26 2014 +0300 26.3 @@ -26,11 +26,13 @@ 26.4 private static Logger logger = LoggerFactory.getLogger(org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper.class); 26.5 26.6 public static String STRDF_SRID_DELIM = ";"; 26.7 - private static String CUT_DELIM = "/"; 26.8 - private static String URI_ENDING = ">"; 26.9 + private static String CUT_DELIM = "/"; 26.10 + private static String URI_ENDING = ">"; 26.11 26.12 /** 26.13 * Returns the given WKT without the SRID (if any). 26.14 + * 26.15 + * FIXME I think that this works only for stRDF. If this is its purpose, rename it to reflect it. 26.16 * 26.17 * @param wkt 26.18 * @return 26.19 @@ -49,14 +51,15 @@ 26.20 26.21 /** 26.22 * Returns the SRID of the given WKT (if any). If the WKT 26.23 - * does not contain any, then the default is returned (specified in 26.24 - * org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron.defaultSRID). 26.25 + * does not contain any, then the default is returned. 26.26 + * 26.27 + * FIXME I think that this works only for stRDF. If this is its purpose, rename it to reflect it. 26.28 * 26.29 * @param wkt 26.30 * @return 26.31 */ 26.32 public static Integer getSRID(String wkt) { 26.33 - int srid = GeoConstants.defaultSRID; 26.34 + int srid = GeoConstants.default_stRDF_SRID; 26.35 26.36 if (wkt == null) return srid; 26.37 26.38 @@ -72,6 +75,107 @@ 26.39 } 26.40 26.41 return srid; 26.42 - 26.43 + } 26.44 + 26.45 + /** 26.46 + * Given the WKT representation of a geometry, a SRID, and a datatype, it 26.47 + * creates a WKT literal conforming to the syntax implied by the given 26.48 + * datatype. If the given datatype is NULL or different than one of the 26.49 + * standard ones (e.g., {@link GeoConstants.WKT} or 26.50 + * {@link GeoConstants.WKTLITERAL}), then the default literal is returned, 26.51 + * which is determined by {@link GeoConstants.default_WKT_datatype}. 26.52 + * 26.53 + * @param plainWKT 26.54 + * @param srid 26.55 + * @param datatype 26.56 + * @return 26.57 + */ 26.58 + public static String createWKT(String plainWKT, int srid, String datatype) { 26.59 + if (GeoConstants.WKTLITERAL.equals(datatype)) { 26.60 + return createWKTLiteral(plainWKT, srid); 26.61 + 26.62 + } else if (GeoConstants.WKT.equals(datatype)) { 26.63 + return createstRDFWKT(plainWKT, srid); 26.64 + 26.65 + } else { // no datatype, create default 26.66 + return createWKT(plainWKT, srid, GeoConstants.default_WKT_datatype); 26.67 + } 26.68 + } 26.69 + 26.70 + /** 26.71 + * Given the well-known representation of a geometry and a SRID, it creates 26.72 + * a stRDF WKT literal. If the given SRID is the default for that type, then 26.73 + * it is ignored. 26.74 + * 26.75 + * @param plainWKT 26.76 + * @param srid 26.77 + * @return 26.78 + */ 26.79 + public static String createstRDFWKT(String plainWKT, int srid) { 26.80 + if (srid == GeoConstants.default_stRDF_SRID) { 26.81 + return plainWKT; 26.82 + 26.83 + } else { 26.84 + return plainWKT + ";" + getEPSGURI_forSRID(srid); 26.85 + } 26.86 + } 26.87 + 26.88 + /** 26.89 + * Given the well-known representation of a geometry and a SRID, it creates 26.90 + * a GeoSPARQL wktLiteral literal. If the given SRID is the default for that type, then 26.91 + * it is ignored. 26.92 + * 26.93 + * @param plainWKT 26.94 + * @param srid 26.95 + * @return 26.96 + */ 26.97 + public static String createWKTLiteral(String plainWKT, int srid) { 26.98 + if (srid == GeoConstants.default_GeoSPARQL_SRID) { 26.99 + return plainWKT; 26.100 + 26.101 + } else { 26.102 + return "<" + getEPSGURI_forSRID(srid) + "> " + plainWKT; 26.103 + } 26.104 + } 26.105 + 26.106 + /** 26.107 + * Returns the URI corresponding to the given SRID. 26.108 + * The given SRID might only be an EPSG one. 26.109 + * If the given SRID is less than 26.110 + * or equal to 0, then an empty string is returned. 26.111 + * 26.112 + * @param srid 26.113 + * @return 26.114 + */ 26.115 + public static String getEPSGURI_forSRID(int srid) { 26.116 + if (srid > 0) { // assuming EPSG now 26.117 + return GeoConstants.EPSG_URI_PREFIX + srid; 26.118 + } 26.119 + 26.120 + return ""; 26.121 + } 26.122 + 26.123 + /** 26.124 + * Returns the SRID corresponding to the given URI identifying a CRS. 26.125 + * In case of a malformed URI, it returns -1. 26.126 + * 26.127 + * @param uriCRS 26.128 + * @return 26.129 + */ 26.130 + public static int getSRID_forURI(String uriCRS) { 26.131 + if (uriCRS == null) return -1; 26.132 + 26.133 + if (GeoConstants.CRS84_URI.equals(uriCRS)) { 26.134 + return GeoConstants.EPSG4326_SRID; 26.135 + 26.136 + } else { // should be an EPSG one, need to parse 26.137 + try { 26.138 + return Integer.parseInt(uriCRS.substring(uriCRS.lastIndexOf(CUT_DELIM) + 1).replace(URI_ENDING, "")); 26.139 + 26.140 + } catch (NumberFormatException e) { 26.141 + logger.warn("[Strabon.WKTHelper] Malformed URI for CRS. The URL was {}.", uriCRS); 26.142 + return -1; 26.143 + } 26.144 + } 26.145 } 26.146 }
27.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/postgis/construct/Centroid.java Wed Sep 10 12:37:29 2014 +0200 27.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/postgis/construct/Centroid.java Wed Sep 24 18:44:26 2014 +0300 27.3 @@ -27,5 +27,4 @@ 27.4 public String getURI() { 27.5 return PostGIS.ST_CENTROID; 27.6 } 27.7 - 27.8 }
28.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/iterator/StSPARQLGroupIterator.java Wed Sep 10 12:37:29 2014 +0200 28.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/iterator/StSPARQLGroupIterator.java Wed Sep 24 18:44:26 2014 +0300 28.3 @@ -52,7 +52,9 @@ 28.4 import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 28.5 import org.openrdf.query.algebra.evaluation.function.Function; 28.6 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 28.7 +import org.openrdf.query.algebra.evaluation.function.spatial.GeometryDatatype; 28.8 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 28.9 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 28.10 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.aggregate.ExtentFunc; 28.11 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BoundaryFunc; 28.12 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BufferFunc; 28.13 @@ -244,6 +246,16 @@ 28.14 private Map<String, FunctionCall> spatialAggregates; 28.15 28.16 private Map<FunctionCall, Geometry> spatialAggregatesResult; 28.17 + 28.18 + /** 28.19 + * Map holding the datatypes of the geometries. We do not use 28.20 + * a single map (like StrabonPolyhedron) for safety reasons of 28.21 + * the implementation of hashCode(), equals(), etc. We need this 28.22 + * to retain the datatype of the expression (or the constants) and 28.23 + * pass it to the final result. Hence, the output will be consistent 28.24 + * with the datatype of the input. 28.25 + */ 28.26 + private Map<FunctionCall, GeometryDatatype> spatialAggregatesResultDatatype; 28.27 28.28 public Entry(BindingSet prototype) 28.29 throws ValueExprEvaluationException, QueryEvaluationException 28.30 @@ -252,6 +264,7 @@ 28.31 this.aggregates = new LinkedHashMap<String, Aggregate>(); 28.32 this.spatialAggregates = new LinkedHashMap<String, FunctionCall>(); 28.33 this.spatialAggregatesResult = new LinkedHashMap<FunctionCall, Geometry>(); 28.34 + this.spatialAggregatesResultDatatype = new LinkedHashMap<FunctionCall, GeometryDatatype>(); 28.35 28.36 for (GroupElem ge : group.getGroupElements()) { 28.37 if(ge.getName().endsWith("-aggregateInside-")) 28.38 @@ -356,8 +369,10 @@ 28.39 } 28.40 if (val != null) { 28.41 if(val instanceof StrabonPolyhedron) 28.42 - { 28.43 - String label = val.toString()+";http://www.opengis.net/def/crs/EPSG/0/"+((StrabonPolyhedron)val).getGeometry().getSRID(); 28.44 + { // TODO FIXME why we assume here strdf:WKT? Can we generalize? 28.45 + String label = WKTHelper.createWKT(val.toString(), 28.46 + ((StrabonPolyhedron)val).getGeometry().getSRID(), 28.47 + GeoConstants.WKT); 28.48 Literal wkt = new LiteralImpl(label,new URIImpl(GeoConstants.WKT)); 28.49 sol.setBinding(name,wkt); 28.50 } 28.51 @@ -366,12 +381,8 @@ 28.52 sol.setBinding(name, val); 28.53 } 28.54 } 28.55 - 28.56 } 28.57 28.58 - 28.59 - 28.60 - 28.61 } 28.62 28.63 /** 28.64 @@ -403,7 +414,8 @@ 28.65 if(((FunctionCall) expr).getArgs().size()==1) 28.66 { 28.67 //Aggregate!!! => Value ready in spatialAggregatesResults 28.68 - return new StrabonPolyhedron(spatialAggregatesResult.get(expr)); 28.69 + return new StrabonPolyhedron(spatialAggregatesResult.get(expr), 28.70 + spatialAggregatesResultDatatype.get(expr)); 28.71 } 28.72 else 28.73 { 28.74 @@ -415,7 +427,8 @@ 28.75 else if(function instanceof ExtentFunc) 28.76 { 28.77 //Aggregate!!! => Value ready in spatialAggregatesResults 28.78 - return new StrabonPolyhedron(spatialAggregatesResult.get(expr)); 28.79 + return new StrabonPolyhedron(spatialAggregatesResult.get(expr), 28.80 + spatialAggregatesResultDatatype.get(expr)); 28.81 } 28.82 else if(function instanceof BufferFunc) 28.83 { 28.84 @@ -452,7 +465,8 @@ 28.85 if(((FunctionCall) expr).getArgs().size()==1) 28.86 { 28.87 //Aggregate!!! => Value ready in spatialAggregatesResults 28.88 - return new StrabonPolyhedron(spatialAggregatesResult.get(expr)); 28.89 + return new StrabonPolyhedron(spatialAggregatesResult.get(expr), 28.90 + spatialAggregatesResultDatatype.get(expr)); 28.91 } 28.92 else 28.93 { 28.94 @@ -576,27 +590,35 @@ 28.95 } 28.96 poly = (StrabonPolyhedron) val; 28.97 Geometry aggr = this.spatialAggregatesResult.get(expr); 28.98 + 28.99 if(aggr==null) 28.100 { 28.101 28.102 if(function instanceof UnionFunc) 28.103 { 28.104 this.spatialAggregatesResult.put((FunctionCall) expr, poly.getGeometry()); 28.105 + this.spatialAggregatesResultDatatype.put((FunctionCall) expr, poly.getGeometryDatatype()); 28.106 } 28.107 else if(function instanceof IntersectionFunc) 28.108 { 28.109 this.spatialAggregatesResult.put((FunctionCall) expr, poly.getGeometry()); 28.110 + this.spatialAggregatesResultDatatype.put((FunctionCall) expr, poly.getGeometryDatatype()); 28.111 } 28.112 else if(function instanceof ExtentFunc) 28.113 { 28.114 Geometry env = poly.getGeometry().getEnvelope(); 28.115 env.setSRID(poly.getGeometry().getSRID()); 28.116 this.spatialAggregatesResult.put((FunctionCall) expr, env); 28.117 + this.spatialAggregatesResultDatatype.put((FunctionCall) expr, poly.getGeometryDatatype()); 28.118 } 28.119 } 28.120 else 28.121 { 28.122 + // get the geometry datatype of the already computed aggregate 28.123 + GeometryDatatype aggrType = spatialAggregatesResultDatatype.get(expr); 28.124 + 28.125 this.spatialAggregatesResult.remove(expr); 28.126 + this.spatialAggregatesResultDatatype.remove(expr); 28.127 if(function instanceof UnionFunc) 28.128 { 28.129 //XXX possible issue with expressions like 28.130 @@ -605,6 +627,7 @@ 28.131 Geometry united = aggr.union(poly.getGeometry()); 28.132 united.setSRID(poly.getGeometry().getSRID()); 28.133 this.spatialAggregatesResult.put((FunctionCall) expr, united); 28.134 + this.spatialAggregatesResultDatatype.put((FunctionCall) expr, aggrType); 28.135 } 28.136 else if(function instanceof IntersectionFunc) 28.137 { 28.138 @@ -614,6 +637,7 @@ 28.139 Geometry intersection = aggr.intersection(poly.getGeometry()); 28.140 intersection.setSRID(poly.getGeometry().getSRID()); 28.141 this.spatialAggregatesResult.put((FunctionCall) expr, intersection); 28.142 + this.spatialAggregatesResultDatatype.put((FunctionCall) expr, aggrType); 28.143 } 28.144 else if(function instanceof ExtentFunc) 28.145 { 28.146 @@ -623,6 +647,7 @@ 28.147 Geometry env = aggr.union(poly.getGeometry().getEnvelope()).getEnvelope(); 28.148 env.setSRID(poly.getGeometry().getSRID()); 28.149 this.spatialAggregatesResult.put((FunctionCall) expr, env); 28.150 + this.spatialAggregatesResultDatatype.put((FunctionCall) expr, aggrType); 28.151 } 28.152 } 28.153 }
29.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java Wed Sep 10 12:37:29 2014 +0200 29.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java Wed Sep 24 18:44:26 2014 +0300 29.3 @@ -19,6 +19,7 @@ 29.4 import org.geotools.referencing.CRS; 29.5 import org.opengis.geometry.MismatchedDimensionException; 29.6 import org.opengis.referencing.FactoryException; 29.7 +import org.opengis.referencing.NoSuchAuthorityCodeException; 29.8 import org.opengis.referencing.crs.CoordinateReferenceSystem; 29.9 import org.opengis.referencing.operation.MathTransform; 29.10 import org.opengis.referencing.operation.TransformException; 29.11 @@ -32,13 +33,13 @@ 29.12 import com.vividsolutions.jts.io.WKTReader; 29.13 import com.vividsolutions.jts.io.WKTWriter; 29.14 import com.vividsolutions.jts.io.gml2.GMLReader; 29.15 +import com.vividsolutions.jts.io.gml2.GMLWriter; 29.16 29.17 /** 29.18 * This class is a singleton and provides access to the readers/writers 29.19 * of Java Topology Suite. 29.20 * 29.21 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 29.22 - * 29.23 */ 29.24 public class JTSWrapper { 29.25 29.26 @@ -69,6 +70,11 @@ 29.27 */ 29.28 private WKBWriter wkbw; 29.29 29.30 + /** 29.31 + * Writer for GML 29.32 + */ 29.33 + private GMLWriter gmlw; 29.34 + 29.35 private JTSWrapper() { 29.36 // use a private constructor to force call of getInstance method and forbid subclassing 29.37 wktr = new WKTReader(); 29.38 @@ -76,6 +82,7 @@ 29.39 wkbr = new WKBReader(); 29.40 wkbw = new WKBWriter(); // PostGIS 29.41 // wkbw = new WKBWriter(2, WKBConstants.wkbXDR); // MonetDB 29.42 + gmlw = new GMLWriter(); 29.43 } 29.44 29.45 public static synchronized JTSWrapper getInstance() { 29.46 @@ -85,6 +92,16 @@ 29.47 return instance; 29.48 } 29.49 29.50 + protected CoordinateReferenceSystem getEPSG_CRS(int srid) throws NoSuchAuthorityCodeException, FactoryException { 29.51 +// if (srid == GeoConstants.WGS84_LONG_LAT_SRID) { 29.52 +// return DefaultGeographicCRS.WGS84; 29.53 +// 29.54 +// } else { // otherwise lookup for EPSG code 29.55 + // TODO: is there a way to be more general (than EPSG)? 29.56 + return CRS.decode("EPSG:" + srid); 29.57 +// } 29.58 + } 29.59 + 29.60 public synchronized Geometry WKTread(String wkt) throws ParseException { 29.61 Geometry geometry = wktr.read(wkt); 29.62 29.63 @@ -130,15 +147,14 @@ 29.64 // the geometry to return 29.65 Geometry output = input; 29.66 29.67 - if(sourceSRID != targetSRID) { 29.68 + if (sourceSRID != targetSRID) { 29.69 CoordinateReferenceSystem sourceCRS = null; 29.70 CoordinateReferenceSystem targetCRS = null; 29.71 29.72 MathTransform transform; 29.73 try { 29.74 - //TODO: EPSG supported currently - is there a way to be more general?? 29.75 - sourceCRS = CRS.decode("EPSG:" + sourceSRID); 29.76 - targetCRS = CRS.decode("EPSG:" + targetSRID); 29.77 + sourceCRS = getEPSG_CRS(sourceSRID); 29.78 + targetCRS = getEPSG_CRS(targetSRID); 29.79 transform = CRS.findMathTransform(sourceCRS, targetCRS, true); 29.80 29.81 output = JTS.transform(input, transform); 29.82 @@ -157,7 +173,7 @@ 29.83 } 29.84 29.85 return output; 29.86 - } 29.87 + } 29.88 29.89 /** 29.90 * Parses and returns a {@link Geometry} object constructed from the given GML representation. 29.91 @@ -182,4 +198,8 @@ 29.92 reader.close(); 29.93 return geometry; 29.94 } 29.95 + 29.96 + public synchronized String GMLWrite(Geometry geom) { 29.97 + return gmlw.write(geom); 29.98 + } 29.99 }
30.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/StSPARQLOrderComparator.java Wed Sep 10 12:37:29 2014 +0200 30.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/StSPARQLOrderComparator.java Wed Sep 24 18:44:26 2014 +0300 30.3 @@ -14,12 +14,14 @@ 30.4 import org.openrdf.model.Value; 30.5 import org.openrdf.query.BindingSet; 30.6 import org.openrdf.query.QueryEvaluationException; 30.7 +import org.openrdf.query.algebra.BindingSetAssignment; 30.8 import org.openrdf.query.algebra.FunctionCall; 30.9 import org.openrdf.query.algebra.Order; 30.10 import org.openrdf.query.algebra.OrderElem; 30.11 import org.openrdf.query.algebra.ValueExpr; 30.12 import org.openrdf.query.algebra.Var; 30.13 import org.openrdf.query.algebra.evaluation.EvaluationStrategy; 30.14 +import org.openrdf.query.algebra.evaluation.QueryBindingSet; 30.15 import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 30.16 import org.slf4j.Logger; 30.17 import org.slf4j.LoggerFactory; 30.18 @@ -28,6 +30,7 @@ 30.19 30.20 /** 30.21 * @author Manos Karpathiotakis <mk@di.uoa.gr> 30.22 + * @author Dimitrianos Savva <dimis@di.uoa.gr> 30.23 */ 30.24 public class StSPARQLOrderComparator implements Comparator<BindingSet> { 30.25 30.26 @@ -63,10 +66,23 @@ 30.27 //I know it is a var cause I 'planted' it earlier 30.28 Var lastArg = (Var) fc.getArgs().get(1); 30.29 String bindingName = lastArg.getName(); 30.30 - 30.31 - v1 = o1.getValue(bindingName); 30.32 - v2 = o2.getValue(bindingName); 30.33 + 30.34 + //avoid function encapsulation @see GeneralDBSelectQueryOptimizer meet(Order) 30.35 + if(bindingName.startsWith("-mbb-")) 30.36 + { 30.37 + //get the encapsulated function 30.38 + v1=evaluate(expr.getArgs().get(0), o1); 30.39 + v2=evaluate(expr.getArgs().get(0), o2); 30.40 + } 30.41 + else 30.42 + { 30.43 + v1 = o1.getValue(bindingName); 30.44 + v2 = o2.getValue(bindingName); 30.45 + } 30.46 + 30.47 + 30.48 //XXX unfinished 30.49 + 30.50 int compare = cmp.compare(v1, v2); 30.51 30.52 if (compare != 0) {
31.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBSpatialFuncInfo.java Wed Sep 10 12:37:29 2014 +0200 31.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBSpatialFuncInfo.java Wed Sep 24 18:44:26 2014 +0300 31.3 @@ -7,16 +7,23 @@ 31.4 * located in select clause. Currently storing info about the name of the field that 31.5 * has to be retrieved from the Result Set, as well as the type of the spatial function. 31.6 * 31.7 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 31.8 * @author Manos Karpathiotakis <mk@di.uoa.gr> 31.9 */ 31.10 public class GeneralDBSpatialFuncInfo { 31.11 31.12 private String fieldName; 31.13 private ResultType type; 31.14 + private boolean sridFunc; 31.15 31.16 - public GeneralDBSpatialFuncInfo(String fieldName, ResultType type) { 31.17 + public GeneralDBSpatialFuncInfo(String fieldName, ResultType type, boolean sridFunc) { 31.18 this.fieldName = fieldName; 31.19 this.type = type; 31.20 + this.sridFunc = sridFunc; 31.21 + } 31.22 + 31.23 + public boolean isSRIDFunc() { 31.24 + return sridFunc; 31.25 } 31.26 31.27 public String getFieldName() {
32.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBSqlTable.java Wed Sep 10 12:37:29 2014 +0200 32.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBSqlTable.java Wed Sep 24 18:44:26 2014 +0300 32.3 @@ -12,11 +12,11 @@ 32.4 /** 32.5 * Converts table names to lower-case and include the analyse optimisation. 32.6 * 32.7 - * @author James Leigh 32.8 - * 32.9 + * @author George Garbis <ggarbis@di.uoa.gr> 32.10 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 32.11 */ 32.12 public abstract class GeneralDBSqlTable extends RdbmsTable { 32.13 - 32.14 + 32.15 public GeneralDBSqlTable(String name) { 32.16 super(name.toLowerCase()); 32.17 }
33.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBValueFactory.java Wed Sep 10 12:37:29 2014 +0200 33.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBValueFactory.java Wed Sep 24 18:44:26 2014 +0300 33.3 @@ -372,12 +372,13 @@ 33.4 * FIXME my addition 33.5 * @throws ParseException 33.6 */ 33.7 - 33.8 public GeneralDBPolyhedron getRdbmsPolyhedron(Number num, String datatype, byte[] wkb, int srid) { 33.9 33.10 Number id = ids.idOf(num); 33.11 try { 33.12 - return new GeneralDBPolyhedron(id, literals.getIdVersion(), vf.createURI(datatype), wkb, srid); 33.13 + if(wkb != null) { 33.14 + return new GeneralDBPolyhedron(id, literals.getIdVersion(), vf.createURI(datatype), wkb, srid); 33.15 + } 33.16 } catch (IOException e) { 33.17 e.printStackTrace(); 33.18 } catch (ClassNotFoundException e) { 33.19 @@ -385,20 +386,4 @@ 33.20 } 33.21 return null; 33.22 } 33.23 - 33.24 -// public GeneralDBPolyhedron getRdbmsPolyhedron(Number num, String datatype, String pointSet) { 33.25 -// 33.26 -// Number id = ids.idOf(num); 33.27 -// try { 33.28 -// return new GeneralDBPolyhedron(id, literals.getIdVersion(), vf.createURI(datatype), pointSet); 33.29 -// } catch (IOException e) { 33.30 -// e.printStackTrace(); 33.31 -// } catch (ClassNotFoundException e) { 33.32 -// e.printStackTrace(); 33.33 -// } 33.34 -// return null; 33.35 -// } 33.36 - /** 33.37 - * 33.38 - */ 33.39 }
34.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSelectQuery.java Wed Sep 10 12:37:29 2014 +0200 34.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSelectQuery.java Wed Sep 24 18:44:26 2014 +0300 34.3 @@ -51,7 +51,6 @@ 34.4 * XXX addition for spatial constructs in select 34.5 * cloned behaviour to apply for the temporal case, too 34.6 */ 34.7 - 34.8 private Map<String, GeneralDBSqlExpr> spatialConstructs = new HashMap<String, GeneralDBSqlExpr>(); 34.9 34.10 private Map<String, GeneralDBSqlExpr> temporalConstructs = new HashMap<String, GeneralDBSqlExpr>();
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 35.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlAbstractGeoSrid.java Wed Sep 24 18:44:26 2014 +0300 35.3 @@ -0,0 +1,37 @@ 35.4 +/** 35.5 + * This Source Code Form is subject to the terms of the Mozilla Public 35.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 35.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 35.8 + * 35.9 + * Copyright (C) 2012, 2013 Pyravlos Team 35.10 + * 35.11 + * http://www.sextant.di.uoa.gr/ 35.12 + */ 35.13 +package org.openrdf.sail.generaldb.algebra; 35.14 + 35.15 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 35.16 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 35.17 + 35.18 +/** 35.19 + * This class is used as a superclass for the classes {@link GeneralDBSqlGeoSPARQLSrid} 35.20 + * and {@link GeneralDBSqlGeoSrid}. This is needed because the corresponding functions 35.21 + * differ only in the types of the returning results, so we do not want to duplicate 35.22 + * code for computing them. Instead, we will compute them based on this abstract 35.23 + * function, and then, when converting the result set, we will differentiate our 35.24 + * behavior based on the actual instantiation. 35.25 + * 35.26 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 35.27 + */ 35.28 +public class GeneralDBSqlAbstractGeoSrid extends GeneralDBSqlSpatialProperty { 35.29 + 35.30 + public GeneralDBSqlAbstractGeoSrid(GeneralDBSqlExpr expr) { 35.31 + super(expr); 35.32 + } 35.33 + 35.34 + @Override 35.35 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) 35.36 + throws X 35.37 + { 35.38 + visitor.meet(this); 35.39 + } 35.40 +}
36.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlDisjoint.java Wed Sep 10 12:37:29 2014 +0200 36.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlDisjoint.java Wed Sep 24 18:44:26 2014 +0300 36.3 @@ -6,8 +6,6 @@ 36.4 package org.openrdf.sail.generaldb.algebra; 36.5 36.6 36.7 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 36.8 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 36.9 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 36.10 36.11 public class GeneralDBSqlDisjoint extends GeneralDBSqlGeoSpatial{ 36.12 @@ -15,6 +13,4 @@ 36.13 public GeneralDBSqlDisjoint(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 36.14 super(left, right); 36.15 } 36.16 - 36.17 - 36.18 } 36.19 \ No newline at end of file
37.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlEqualsSpatial.java Wed Sep 10 12:37:29 2014 +0200 37.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlEqualsSpatial.java Wed Sep 24 18:44:26 2014 +0300 37.3 @@ -6,8 +6,6 @@ 37.4 package org.openrdf.sail.generaldb.algebra; 37.5 37.6 37.7 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 37.8 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 37.9 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 37.10 37.11 public class GeneralDBSqlEqualsSpatial extends GeneralDBSqlGeoSpatial{ 37.12 @@ -15,6 +13,4 @@ 37.13 public GeneralDBSqlEqualsSpatial(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 37.14 super(left, right); 37.15 } 37.16 - 37.17 - 37.18 } 37.19 \ No newline at end of file
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 38.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoSPARQLSrid.java Wed Sep 24 18:44:26 2014 +0300 38.3 @@ -0,0 +1,32 @@ 38.4 +/** 38.5 + * This Source Code Form is subject to the terms of the Mozilla Public 38.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 38.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 38.8 + * 38.9 + * Copyright (C) 2012, 2013 Pyravlos Team 38.10 + * 38.11 + * http://www.sextant.di.uoa.gr/ 38.12 + */ 38.13 +package org.openrdf.sail.generaldb.algebra; 38.14 + 38.15 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 38.16 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 38.17 + 38.18 +/** 38.19 + * @see {@link org.openrdf.query.algebra.evaluation.function.spatial.geosparql.property.GeoSparqlGetSRIDFunc} 38.20 + * 38.21 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 38.22 + */ 38.23 +public class GeneralDBSqlGeoSPARQLSrid extends GeneralDBSqlAbstractGeoSrid { 38.24 + 38.25 + public GeneralDBSqlGeoSPARQLSrid(GeneralDBSqlExpr expr) { 38.26 + super(expr); 38.27 + } 38.28 + 38.29 + @Override 38.30 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) 38.31 + throws X 38.32 + { 38.33 + visitor.meet(this); 38.34 + } 38.35 +}
39.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoSrid.java Wed Sep 10 12:37:29 2014 +0200 39.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoSrid.java Wed Sep 24 18:44:26 2014 +0300 39.3 @@ -14,7 +14,7 @@ 39.4 * 39.5 * @author Manos Karpathiotakis <mk@di.uoa.gr> 39.6 */ 39.7 -public class GeneralDBSqlGeoSrid extends GeneralDBSqlSpatialProperty { 39.8 +public class GeneralDBSqlGeoSrid extends GeneralDBSqlAbstractGeoSrid { 39.9 39.10 public GeneralDBSqlGeoSrid(GeneralDBSqlExpr expr) { 39.11 super(expr);
40.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlIntersects.java Wed Sep 10 12:37:29 2014 +0200 40.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlIntersects.java Wed Sep 24 18:44:26 2014 +0300 40.3 @@ -6,8 +6,6 @@ 40.4 package org.openrdf.sail.generaldb.algebra; 40.5 40.6 40.7 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 40.8 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 40.9 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 40.10 40.11 public class GeneralDBSqlIntersects extends GeneralDBSqlGeoSpatial{
41.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java Wed Sep 10 12:37:29 2014 +0200 41.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java Wed Sep 24 18:44:26 2014 +0300 41.3 @@ -22,6 +22,7 @@ 41.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCompare; 41.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlConcat; 41.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContains; 41.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSPARQLSrid; 41.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbContains; 41.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCrosses; 41.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDiffDateTime; 41.11 @@ -543,6 +544,10 @@ 41.12 public static GeneralDBSqlExpr srid(GeneralDBSqlExpr expr) { 41.13 return new GeneralDBSqlGeoSrid(expr); 41.14 } 41.15 + 41.16 + public static GeneralDBSqlExpr geofSRID(GeneralDBSqlExpr expr) { 41.17 + return new GeneralDBSqlGeoSPARQLSrid(expr); 41.18 + } 41.19 41.20 public static GeneralDBSqlExpr isEmpty(GeneralDBSqlExpr expr) { 41.21 return new GeneralDBSqlGeoIsEmpty(expr);
42.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/UnaryGeneralDBOperator.java Wed Sep 10 12:37:29 2014 +0200 42.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/UnaryGeneralDBOperator.java Wed Sep 24 18:44:26 2014 +0300 42.3 @@ -9,15 +9,19 @@ 42.4 import org.openrdf.query.algebra.QueryModelVisitor; 42.5 import org.openrdf.query.algebra.helpers.QueryModelTreePrinter; 42.6 import org.openrdf.sail.generaldb.optimizers.GeneralDBSqlConstantOptimizer; 42.7 +import org.slf4j.Logger; 42.8 +import org.slf4j.LoggerFactory; 42.9 42.10 /** 42.11 * An SQL operator with one argument. 42.12 * 42.13 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 42.14 * @author James Leigh 42.15 - * 42.16 */ 42.17 public abstract class UnaryGeneralDBOperator extends GeneralDBQueryModelNodeBase implements GeneralDBSqlExpr { 42.18 42.19 + private static Logger logger = LoggerFactory.getLogger(org.openrdf.sail.generaldb.algebra.base.UnaryGeneralDBOperator.class); 42.20 + 42.21 private GeneralDBSqlExpr arg; 42.22 42.23 public UnaryGeneralDBOperator() { 42.24 @@ -51,7 +55,10 @@ 42.25 setArg((GeneralDBSqlExpr)replacement); 42.26 } 42.27 else { 42.28 - super.replaceChildNode(current, replacement); 42.29 + if (logger.isWarnEnabled()) { 42.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."); 42.31 + } 42.32 + //super.replaceChildNode(current, replacement); 42.33 } 42.34 } 42.35
43.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Wed Sep 10 12:37:29 2014 +0200 43.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Wed Sep 24 18:44:26 2014 +0300 43.3 @@ -6,6 +6,7 @@ 43.4 package org.openrdf.sail.generaldb.algebra.factories; 43.5 43.6 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.*; 43.7 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geofSRID; 43.8 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.st_Centroid; 43.9 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.st_MakeLine; 43.10 43.11 @@ -48,8 +49,8 @@ 43.12 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BufferFunc; 43.13 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.ConvexHullFunc; 43.14 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.EnvelopeFunc; 43.15 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.IntersectionFunc; 43.16 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.UnionFunc; 43.17 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.IntersectionFunc; 43.18 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc; 43.19 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.RelateFunc; 43.20 import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.PeriodEndsFunc; 43.21 @@ -861,7 +862,6 @@ 43.22 43.23 return temporalRelationPicker(function, leftArg, rightArg, thirdArg); 43.24 } 43.25 - 43.26 GeneralDBSqlExpr spatialRelationshipFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException 43.27 { 43.28 ValueExpr left = functionCall.getArgs().get(0); 43.29 @@ -901,6 +901,9 @@ 43.30 return spatialRelationshipPicker(function, leftArg, rightArg, thirdArg); 43.31 } 43.32 43.33 + /** 43.34 + * TODO check required number of arguments 43.35 + */ 43.36 GeneralDBSqlExpr spatialConstructFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException 43.37 { 43.38 GeneralDBSqlExpr leftArg = null; 43.39 @@ -997,6 +1000,9 @@ 43.40 43.41 } 43.42 43.43 + /** 43.44 + * TODO check required number of arguments 43.45 + */ 43.46 GeneralDBSqlExpr spatialMetricFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException 43.47 { 43.48 GeneralDBSqlExpr leftArg = null; 43.49 @@ -1360,6 +1366,10 @@ 43.50 } 43.51 43.52 43.53 + 43.54 + /** 43.55 + * FIXME don't check function using getURI(); use instanceof instead 43.56 + */ 43.57 GeneralDBSqlExpr spatialConstructPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg) 43.58 { 43.59 if(function.getURI().equals(GeoConstants.stSPARQLunion)) 43.60 @@ -1450,6 +1460,7 @@ 43.61 * 43.62 * @author George Garbis <ggarbis@di.uoa.gr> 43.63 * 43.64 + * FIXME don't check function using getURI(); use instanceof instead 43.65 */ 43.66 GeneralDBSqlExpr dateTimeMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) 43.67 { 43.68 @@ -1462,7 +1473,10 @@ 43.69 return null; 43.70 } 43.71 43.72 - //TODO more to be added here probably 43.73 + /** 43.74 + * TODO check required number of arguments 43.75 + * FIXME don't check function using getURI(); use instanceof instead 43.76 + */ 43.77 GeneralDBSqlExpr spatialMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg) 43.78 { 43.79 if(function.getURI().equals(GeoConstants.stSPARQLdistance)) 43.80 @@ -1482,6 +1496,9 @@ 43.81 return null; 43.82 } 43.83 43.84 + /** 43.85 + * FIXME don't check function using getURI(); use instanceof instead 43.86 + */ 43.87 GeneralDBSqlExpr spatialPropertyPicker(Function function, GeneralDBSqlExpr arg) 43.88 { 43.89 if(function.getURI().equals(GeoConstants.stSPARQLdimension)) 43.90 @@ -1496,10 +1513,13 @@ 43.91 { 43.92 return asText(arg); 43.93 } 43.94 - else if(function.getURI().equals(GeoConstants.stSPARQLsrid) || 43.95 - function.getURI().equals(GeoConstants.geoSparqlGetSRID)) 43.96 + else if(function.getURI().equals(GeoConstants.stSPARQLsrid)) 43.97 { 43.98 return srid(arg); 43.99 + } 43.100 + else if (function.getURI().equals(GeoConstants.geoSparqlGetSRID)) 43.101 + { 43.102 + return geofSRID(arg); 43.103 } 43.104 else if(function.getURI().equals(GeoConstants.stSPARQLisEmpty)) 43.105 {
44.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/rcc8/GeneralDBSqlRCC8_Dc.java Wed Sep 10 12:37:29 2014 +0200 44.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/rcc8/GeneralDBSqlRCC8_Dc.java Wed Sep 24 18:44:26 2014 +0300 44.3 @@ -7,8 +7,6 @@ 44.4 44.5 44.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSpatial; 44.7 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 44.8 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 44.9 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 44.10 44.11 public class GeneralDBSqlRCC8_Dc extends GeneralDBSqlGeoSpatial{
45.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/sf/GeneralDBSqlSF_Intersects.java Wed Sep 10 12:37:29 2014 +0200 45.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/sf/GeneralDBSqlSF_Intersects.java Wed Sep 24 18:44:26 2014 +0300 45.3 @@ -7,8 +7,6 @@ 45.4 45.5 45.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSpatial; 45.7 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 45.8 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 45.9 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 45.10 45.11 public class GeneralDBSqlSF_Intersects extends GeneralDBSqlGeoSpatial{
46.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Wed Sep 10 12:37:29 2014 +0200 46.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Wed Sep 24 18:44:26 2014 +0300 46.3 @@ -11,7 +11,6 @@ 46.4 46.5 import info.aduna.iteration.CloseableIteration; 46.6 46.7 -import java.text.ParseException; 46.8 import java.util.ArrayList; 46.9 import java.util.Collection; 46.10 import java.util.HashMap; 46.11 @@ -21,9 +20,11 @@ 46.12 46.13 import org.openrdf.model.Literal; 46.14 import org.openrdf.model.Value; 46.15 +import org.openrdf.model.ValueFactory; 46.16 import org.openrdf.model.impl.BooleanLiteralImpl; 46.17 import org.openrdf.model.impl.LiteralImpl; 46.18 import org.openrdf.model.impl.URIImpl; 46.19 +import org.openrdf.model.impl.ValueFactoryImpl; 46.20 import org.openrdf.query.BindingSet; 46.21 import org.openrdf.query.Dataset; 46.22 import org.openrdf.query.QueryEvaluationException; 46.23 @@ -43,12 +44,30 @@ 46.24 import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 46.25 import org.openrdf.query.algebra.evaluation.function.Function; 46.26 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 46.27 +import org.openrdf.query.algebra.evaluation.function.spatial.AbstractWKT; 46.28 +import org.openrdf.query.algebra.evaluation.function.spatial.GeometryDatatype; 46.29 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 46.30 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 46.31 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 46.32 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 46.33 -import org.openrdf.query.algebra.evaluation.function.spatial.StrabonInstant; 46.34 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPeriod; 46.35 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 46.36 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonTemporalElement; 46.37 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 46.38 +import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlConvexHullFunc; 46.39 +import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.property.GeoSparqlGetSRIDFunc; 46.40 +import org.openrdf.query.algebra.evaluation.function.spatial.postgis.construct.Centroid; 46.41 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BoundaryFunc; 46.42 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BufferFunc; 46.43 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc; 46.44 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.DistanceFunc; 46.45 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.AsGMLFunc; 46.46 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.AsTextFunc; 46.47 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.DimensionFunc; 46.48 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.GeometryTypeFunc; 46.49 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.IsEmptyFunc; 46.50 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.IsSimpleFunc; 46.51 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.SridFunc; 46.52 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.AboveFunc; 46.53 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.BelowFunc; 46.54 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.ContainsFunc; 46.55 @@ -66,7 +85,6 @@ 46.56 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbIntersectsFunc; 46.57 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbWithinFunc; 46.58 import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.TemporalConstructFunc; 46.59 -import eu.earthobservatory.constants.TemporalConstants; 46.60 import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalRelationFunc; 46.61 import org.openrdf.query.algebra.evaluation.impl.EvaluationStrategyImpl; 46.62 import org.openrdf.query.algebra.evaluation.iterator.OrderIterator; 46.63 @@ -83,6 +101,7 @@ 46.64 import org.openrdf.sail.generaldb.algebra.GeneralDBSelectProjection; 46.65 import org.openrdf.sail.generaldb.algebra.GeneralDBSelectQuery; 46.66 import org.openrdf.sail.generaldb.algebra.GeneralDBSelectQuery.OrderElem; 46.67 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbstractGeoSrid; 46.68 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 46.69 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDateTimeMetricBinary; 46.70 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoAsGML; 46.71 @@ -91,6 +110,8 @@ 46.72 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoGeometryType; 46.73 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsEmpty; 46.74 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsSimple; 46.75 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSPARQLSrid; 46.76 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSpatial; 46.77 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid; 46.78 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 46.79 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 46.80 @@ -106,6 +127,7 @@ 46.81 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 46.82 import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporalConstructBinary; 46.83 import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlTemporalConstructUnary; 46.84 +import org.openrdf.sail.generaldb.exceptions.UnsupportedExtensionFunctionException; 46.85 import org.openrdf.sail.generaldb.model.GeneralDBPolyhedron; 46.86 import org.openrdf.sail.generaldb.schema.IdSequence; 46.87 import org.openrdf.sail.generaldb.util.StSPARQLValueComparator; 46.88 @@ -116,17 +138,20 @@ 46.89 import org.openrdf.sail.rdbms.model.RdbmsURI; 46.90 import org.slf4j.Logger; 46.91 import org.slf4j.LoggerFactory; 46.92 -import org.openrdf.sail.generaldb.exceptions.UnsupportedExtensionFunctionException; 46.93 - 46.94 46.95 import com.vividsolutions.jts.geom.Geometry; 46.96 +import com.vividsolutions.jts.io.ParseException; 46.97 46.98 import eu.earthobservatory.constants.GeoConstants; 46.99 +import eu.earthobservatory.constants.OGCConstants; 46.100 +import eu.earthobservatory.constants.TemporalConstants; 46.101 46.102 /** 46.103 * Extends the default strategy by accepting {@link GeneralDBSelectQuery} and evaluating 46.104 * them on a database. 46.105 * 46.106 + * @author Dimitrianos Savva <dimis@di.uoa.gr> 46.107 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 46.108 * @author Manos Karpathiotakis <mk@di.uoa.gr> 46.109 */ 46.110 public abstract class GeneralDBEvaluation extends EvaluationStrategyImpl { 46.111 @@ -141,7 +166,7 @@ 46.112 46.113 protected IdSequence ids; 46.114 46.115 - protected HashMap<Integer,String> geoNames = new HashMap<Integer,String>(); 46.116 + protected HashMap<String, Integer> geoNames = new HashMap<String, Integer>(); 46.117 46.118 protected List<GeneralDBSqlExpr> thematicExpressions = new ArrayList<GeneralDBSqlExpr>(5); 46.119 46.120 @@ -149,7 +174,7 @@ 46.121 * Enumeration of the possible types of the results of spatial functions. 46.122 * A <tt>NULL</tt> result type is to be interpreted as error. 46.123 */ 46.124 - public enum ResultType { INTEGER, STRING, BOOLEAN, WKB, DOUBLE, PERIOD,INSTANT, NULL, WKT, WKTLITERAL}; 46.125 + public enum ResultType { INTEGER, STRING, BOOLEAN, WKB, DOUBLE, URI, PERIOD, INSTANT, NULL, WKT, WKTLITERAL}; 46.126 46.127 46.128 //used to retrieve the appropriate column in the Binding Iteration 46.129 @@ -209,7 +234,8 @@ 46.130 // { 46.131 // var.setName(var.getName().replace("-mbbVar-","")); 46.132 // } 46.133 - 46.134 + 46.135 + 46.136 //Case met when evaluating a construct function inside an aggregate 46.137 if(var.getName().endsWith("?spatial")) 46.138 { 46.139 @@ -247,6 +273,13 @@ 46.140 46.141 /** 46.142 * Had to use it for the cases met in group by (Union as an aggregate) 46.143 + * 46.144 + * There is a lot of work here to be done for refactoring the code. 46.145 + * For example, while it returns a Value, that value might be a 46.146 + * StrabonPolyhedron and thus we have lost the datatype of the input 46.147 + * geometries (constant or GeneralDBPolyhedron -- database values). 46.148 + * Therefore, later on, when the writer iterates over the results, it 46.149 + * has to select the default WKT datatype for StrabonPolyhedron values. 46.150 */ 46.151 @Override 46.152 public Value evaluate(FunctionCall fc, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException 46.153 @@ -271,216 +304,167 @@ 46.154 throw new UnsupportedExtensionFunctionException("Extension function " + fc.getURI()+ " is not supported."); 46.155 } 46.156 46.157 - // get the first argument of the function call 46.158 - ValueExpr left = fc.getArgs().get(0); 46.159 - // evaluated first argument of function 46.160 - Value leftResult = null; 46.161 + try { 46.162 + if (fc.getArgs().size() == 0) { 46.163 + throw new NoSuchMethodException("too few arguments"); 46.164 + } 46.165 46.166 - // evaluated second argument of function (if any) 46.167 - Value rightResult = null; 46.168 + // get the first argument of the function call 46.169 + ValueExpr left = fc.getArgs().get(0); 46.170 46.171 - // evaluate first argument 46.172 - leftResult = evaluate(left, bindings); 46.173 - 46.174 - // function call with 2 arguments, evaluate the second one now 46.175 - if ( fc.getArgs().size() == 2 ) 46.176 - { 46.177 - ValueExpr right = fc.getArgs().get(1); 46.178 - rightResult = evaluate(right, bindings); 46.179 - } 46.180 - 46.181 - // having evaluated the arguments of the function, evaluate the function 46.182 - try { 46.183 - if ( function instanceof SpatialConstructFunc ) { 46.184 - return spatialConstructPicker(function, leftResult, rightResult); 46.185 - 46.186 - } else if(function instanceof SpatialRelationshipFunc) { 46.187 + // evaluated first argument of function 46.188 + Value leftResult = null; 46.189 + 46.190 + // evaluated second argument of function (if any) 46.191 + Value rightResult = null; 46.192 + 46.193 + // evaluated third argument of function (if any) 46.194 + Value thirdResult = null; 46.195 + 46.196 + // evaluate first argument 46.197 + leftResult = evaluate(left, bindings); 46.198 + 46.199 + // function call with 2 or more arguments, evaluate the second one now 46.200 + // see distance function as example 46.201 + if ( fc.getArgs().size() >= 2 ) 46.202 + { 46.203 + ValueExpr right = fc.getArgs().get(1); 46.204 + rightResult = evaluate(right, bindings); 46.205 + 46.206 + if (fc.getArgs().size() == 3) { 46.207 + ValueExpr third = fc.getArgs().get(2); 46.208 + thirdResult = evaluate(third, bindings); 46.209 + } 46.210 + } 46.211 + 46.212 + // having evaluated the arguments, evaluate the function now 46.213 + 46.214 + // 46.215 + // SPATIAL METRIC FUNCTIONS 46.216 + // 46.217 + if (function instanceof SpatialMetricFunc) 46.218 + { 46.219 + double funcResult = 0; 46.220 + Geometry leftGeom = getValueAsStrabonPolyhedron(leftResult).getGeometry(); 46.221 + 46.222 + if(function instanceof AreaFunc) 46.223 + { 46.224 + funcResult = leftGeom.getArea(); 46.225 + } 46.226 + else if(function instanceof DistanceFunc) 46.227 + { 46.228 + // check required number of arguments 46.229 + checkArgs(leftResult, rightResult, thirdResult, 3); 46.230 + 46.231 + // get the second geometry 46.232 + Geometry rightGeom = getValueAsStrabonPolyhedron(rightResult).getGeometry(); 46.233 + 46.234 + // FIXME we have a third one as well, but 46.235 + // TODO for the time being we do not support it if it is in meters 46.236 + if (OGCConstants.OGCmetre.equals(thirdResult.stringValue())) { 46.237 + logger.info("[GeneraDBEvaluation] Computation of {} will be done in degrees.", function.getURI()); 46.238 + } 46.239 + 46.240 + int targetSRID = leftGeom.getSRID(); 46.241 + int sourceSRID = rightGeom.getSRID(); 46.242 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.243 + funcResult = leftGeom.distance(rightConverted); 46.244 + } 46.245 + 46.246 + return ValueFactoryImpl.getInstance().createLiteral(funcResult); 46.247 + 46.248 + } 46.249 + 46.250 + // 46.251 + // SPATIAL CONSTRUCT FUNCTIONS 46.252 + // 46.253 + else if (function instanceof SpatialConstructFunc) { 46.254 + return spatialConstructPicker(function, leftResult, rightResult, thirdResult); 46.255 + } 46.256 + 46.257 + // 46.258 + // SPATIAL RELATIONSHIP FUNCTIONS 46.259 + // 46.260 + else if(function instanceof SpatialRelationshipFunc) { 46.261 // Any boolean function present in HAVING - Must evaluate here! 46.262 46.263 + // check required number of arguments 46.264 + checkArgs(leftResult, rightResult, thirdResult, 2); 46.265 + 46.266 boolean funcResult = false; 46.267 46.268 - //For the time being I only include stSPARQL ones 46.269 - Geometry leftGeom = null; 46.270 - Geometry rightGeom = null; 46.271 + // get the geometries and the SRIDs of the left/right arguments 46.272 + Geometry leftGeom = getValueAsStrabonPolyhedron(leftResult).getGeometry(); 46.273 + Geometry rightGeom = getValueAsStrabonPolyhedron(rightResult).getGeometry(); 46.274 + int targetSRID = leftGeom.getSRID(); 46.275 + int sourceSRID = rightGeom.getSRID(); 46.276 46.277 - if(leftResult instanceof StrabonPolyhedron) 46.278 - { 46.279 - leftGeom = ((StrabonPolyhedron) leftResult).getGeometry(); 46.280 - } 46.281 - else if(leftResult instanceof GeneralDBPolyhedron) 46.282 - { 46.283 - leftGeom = ((GeneralDBPolyhedron) leftResult).getPolyhedron().getGeometry(); 46.284 - } 46.285 - else if(leftResult instanceof Literal) 46.286 - { 46.287 - /** 46.288 - * Duplicate work done here in order to retain the literal's datatype... 46.289 - * Instead of only utilizing StrabonPolyhedron items, I converted them to Literals 46.290 - * in order to have them appear in Select Clause along with the appropriate datatype. 46.291 - */ 46.292 - leftGeom = new StrabonPolyhedron(((Literal) leftResult).getLabel()).getGeometry(); 46.293 - int sridPosition = ((Literal) leftResult).getLabel().indexOf(';'); 46.294 - //Default case 46.295 - if(sridPosition == -1) 46.296 - { 46.297 - leftGeom.setSRID(GeoConstants.defaultSRID); 46.298 - } 46.299 - else 46.300 - { 46.301 - sridPosition = ((Literal) leftResult).getLabel().lastIndexOf('/'); 46.302 - int srid = Integer.parseInt(((Literal) leftResult).getLabel().substring(sridPosition+1)); 46.303 - leftGeom.setSRID(srid); 46.304 - } 46.305 - } 46.306 - else 46.307 - { //SHOULD NEVER REACH THIS CASE! 46.308 - return null; 46.309 - } 46.310 - 46.311 - if(rightResult instanceof StrabonPolyhedron) 46.312 - { 46.313 - rightGeom = ((StrabonPolyhedron) rightResult).getGeometry(); 46.314 - } 46.315 - else if(rightResult instanceof GeneralDBPolyhedron) 46.316 - { 46.317 - rightGeom = ((GeneralDBPolyhedron) rightResult).getPolyhedron().getGeometry(); 46.318 - } 46.319 - else if(rightResult instanceof Literal) 46.320 - { 46.321 - /** 46.322 - * Duplicate work done here in order to retain the literal's datatype... 46.323 - * Instead of only utilizing StrabonPolyhedron items, I converted them to Literals 46.324 - * in order to have them appear in Select Clause along with the appropriate datatype. 46.325 - */ 46.326 - rightGeom = new StrabonPolyhedron(((Literal) rightResult).getLabel()).getGeometry(); 46.327 - int sridPosition = ((Literal) rightResult).getLabel().indexOf(';'); 46.328 - //Default case 46.329 - if(sridPosition == -1) 46.330 - { 46.331 - rightGeom.setSRID(GeoConstants.defaultSRID); 46.332 - } 46.333 - else 46.334 - { 46.335 - sridPosition = ((Literal) rightResult).getLabel().lastIndexOf('/'); 46.336 - int srid = Integer.parseInt(((Literal) rightResult).getLabel().substring(sridPosition+1)); 46.337 - rightGeom.setSRID(srid); 46.338 - } 46.339 - } 46.340 - else 46.341 - { //SHOULD NEVER REACH THIS CASE! 46.342 - return null; 46.343 - } 46.344 - 46.345 + // transform the second geometry to the SRID of the first one 46.346 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.347 + 46.348 + // check the spatial relationship 46.349 if(function instanceof AboveFunc) 46.350 { 46.351 - int targetSRID = leftGeom.getSRID(); 46.352 - int sourceSRID = rightGeom.getSRID(); 46.353 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.354 funcResult = leftGeom.getEnvelopeInternal().getMinY() > rightConverted.getEnvelopeInternal().getMaxY(); 46.355 } 46.356 else if(function instanceof IntersectsFunc) 46.357 { 46.358 - int targetSRID = leftGeom.getSRID(); 46.359 - int sourceSRID = rightGeom.getSRID(); 46.360 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.361 funcResult = leftGeom.intersects(rightConverted); 46.362 } 46.363 else if(function instanceof BelowFunc) 46.364 { 46.365 - int targetSRID = leftGeom.getSRID(); 46.366 - int sourceSRID = rightGeom.getSRID(); 46.367 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.368 funcResult = leftGeom.getEnvelopeInternal().getMaxY() < rightConverted.getEnvelopeInternal().getMinY(); 46.369 } 46.370 else if(function instanceof ContainsFunc) 46.371 { 46.372 - int targetSRID = leftGeom.getSRID(); 46.373 - int sourceSRID = rightGeom.getSRID(); 46.374 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.375 funcResult = leftGeom.contains(rightConverted); 46.376 } 46.377 else if(function instanceof CrossesFunc) 46.378 { 46.379 - int targetSRID = leftGeom.getSRID(); 46.380 - int sourceSRID = rightGeom.getSRID(); 46.381 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.382 funcResult = leftGeom.crosses(rightConverted); 46.383 } 46.384 else if(function instanceof DisjointFunc) 46.385 { 46.386 - int targetSRID = leftGeom.getSRID(); 46.387 - int sourceSRID = rightGeom.getSRID(); 46.388 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.389 funcResult = leftGeom.disjoint(rightConverted); 46.390 } 46.391 else if(function instanceof EqualsFunc) 46.392 { 46.393 - int targetSRID = leftGeom.getSRID(); 46.394 - int sourceSRID = rightGeom.getSRID(); 46.395 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.396 funcResult = leftGeom.equals(rightConverted); 46.397 } 46.398 else if(function instanceof WithinFunc) 46.399 { 46.400 - int targetSRID = leftGeom.getSRID(); 46.401 - int sourceSRID = rightGeom.getSRID(); 46.402 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.403 funcResult = leftGeom.within(rightConverted); 46.404 } 46.405 else if(function instanceof LeftFunc) 46.406 { 46.407 - int targetSRID = leftGeom.getSRID(); 46.408 - int sourceSRID = rightGeom.getSRID(); 46.409 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.410 funcResult = leftGeom.getEnvelopeInternal().getMaxX() < rightConverted.getEnvelopeInternal().getMinX(); 46.411 } 46.412 else if(function instanceof OverlapsFunc) 46.413 { 46.414 - int targetSRID = leftGeom.getSRID(); 46.415 - int sourceSRID = rightGeom.getSRID(); 46.416 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.417 funcResult = leftGeom.overlaps(rightConverted); 46.418 } 46.419 else if(function instanceof RightFunc) 46.420 { 46.421 - int targetSRID = leftGeom.getSRID(); 46.422 - int sourceSRID = rightGeom.getSRID(); 46.423 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.424 funcResult = leftGeom.getEnvelopeInternal().getMinX() > rightConverted.getEnvelopeInternal().getMaxX(); 46.425 } 46.426 else if(function instanceof TouchesFunc) 46.427 { 46.428 - int targetSRID = leftGeom.getSRID(); 46.429 - int sourceSRID = rightGeom.getSRID(); 46.430 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.431 funcResult = leftGeom.touches(rightConverted); 46.432 } 46.433 else if(function instanceof MbbIntersectsFunc) 46.434 { 46.435 - int targetSRID = leftGeom.getSRID(); 46.436 - int sourceSRID = rightGeom.getSRID(); 46.437 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.438 funcResult = leftGeom.getEnvelope().intersects(rightConverted.getEnvelope()); 46.439 } 46.440 else if(function instanceof MbbWithinFunc) 46.441 { 46.442 - int targetSRID = leftGeom.getSRID(); 46.443 - int sourceSRID = rightGeom.getSRID(); 46.444 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.445 funcResult = leftGeom.getEnvelope().within(rightConverted.getEnvelope()); 46.446 } 46.447 else if(function instanceof MbbContainsFunc) 46.448 { 46.449 - int targetSRID = leftGeom.getSRID(); 46.450 - int sourceSRID = rightGeom.getSRID(); 46.451 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.452 funcResult = leftGeom.getEnvelope().contains(rightConverted.getEnvelope()); 46.453 } 46.454 else if(function instanceof MbbEqualsFunc) 46.455 { 46.456 - int targetSRID = leftGeom.getSRID(); 46.457 - int sourceSRID = rightGeom.getSRID(); 46.458 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 46.459 funcResult = leftGeom.getEnvelope().equals(rightConverted.getEnvelope()); 46.460 } 46.461 46.462 @@ -493,7 +477,44 @@ 46.463 Boolean temporalFuncResult = temporalRelationshipPicker(function, leftResult, rightResult); 46.464 return temporalFuncResult ? BooleanLiteralImpl.TRUE : BooleanLiteralImpl.FALSE; 46.465 } 46.466 - else { 46.467 + 46.468 + // 46.469 + // SPATIAL PROPERTY FUNCTIONS 46.470 + // 46.471 + else if (function instanceof SpatialPropertyFunc) { 46.472 + ValueFactory localvf = ValueFactoryImpl.getInstance(); 46.473 + 46.474 + if (function instanceof GeoSparqlGetSRIDFunc) { 46.475 + return localvf.createURI(getSRIDFromValue(leftResult)); 46.476 + 46.477 + } else if (function instanceof SridFunc) { 46.478 + return localvf.createLiteral(getSRIDFromValue(leftResult)); 46.479 + 46.480 + } else if (function instanceof IsSimpleFunc) { 46.481 + return localvf.createLiteral(getGeometryFromValue(leftResult).isSimple()); 46.482 + 46.483 + } else if (function instanceof IsEmptyFunc) { 46.484 + return localvf.createLiteral(getGeometryFromValue(leftResult).isEmpty()); 46.485 + 46.486 + } else if (function instanceof GeometryTypeFunc) { 46.487 + return localvf.createLiteral(getGeometryFromValue(leftResult).getGeometryType()); 46.488 + 46.489 + } else if (function instanceof DimensionFunc) { 46.490 + return localvf.createLiteral(getGeometryFromValue(leftResult).getDimension()); 46.491 + 46.492 + } else if (function instanceof AsTextFunc) { 46.493 + // already handled 46.494 + return leftResult; 46.495 + 46.496 + } else if (function instanceof AsGMLFunc) { 46.497 + return localvf.createLiteral(JTSWrapper.getInstance().GMLWrite(getGeometryFromValue(leftResult))); 46.498 + 46.499 + } else { 46.500 + logger.error("[Strabon.evaluate(FunctionCall)] Function {} has not been implemented yet. ", function.getURI()); 46.501 + return null; 46.502 + } 46.503 + 46.504 + } else { 46.505 //Default Sesame Behavior 46.506 List<ValueExpr> args = fc.getArgs(); 46.507 46.508 @@ -505,11 +526,42 @@ 46.509 46.510 return function.evaluate(tripleSource.getValueFactory(), argValues); 46.511 } 46.512 + 46.513 } catch (Exception e) { 46.514 - logger.error("Strabon.evaluate(FunctionCall)] Error during evaluation of extension function.", e); 46.515 + logger.error("[Strabon.evaluate(FunctionCall)] Error during evaluation of extension function {}: {}", function.getURI(), e.getMessage()); 46.516 return null; 46.517 } 46.518 + } 46.519 46.520 + /** 46.521 + * @param leftResult 46.522 + * @param rightResult 46.523 + * @param thirdResult 46.524 + * @param size 46.525 + * @throws NoSuchMethodException 46.526 + */ 46.527 + private void checkArgs(Value leftResult, Value rightResult, Value thirdResult, int size) throws NoSuchMethodException { 46.528 + if (size == 0) { 46.529 + throw new NoSuchMethodException("too few arguments."); 46.530 + 46.531 + } else { 46.532 + if (size >= 1 && leftResult == null) { 46.533 + throw new NoSuchMethodException("expecting an argument."); 46.534 + } 46.535 + 46.536 + if (size >= 2 && rightResult == null) { 46.537 + throw new NoSuchMethodException("expecting a second argument."); 46.538 + } 46.539 + 46.540 + if (size >= 3 && thirdResult == null) { 46.541 + throw new NoSuchMethodException("expecting a third argument."); 46.542 + 46.543 + } 46.544 + 46.545 + if (size > 3) { 46.546 + throw new NoSuchMethodException("too many arguments."); 46.547 + } 46.548 + } 46.549 } 46.550 46.551 public StrabonTemporalElement temporalConstructPicker(Function function, Value left, Value right) throws ParseException 46.552 @@ -597,7 +649,7 @@ 46.553 return null; 46.554 } 46.555 46.556 - public boolean temporalRelationshipPicker (Function function, Value left, Value right) throws ParseException 46.557 + public boolean temporalRelationshipPicker (Function function, Value left, Value right) throws ParseException, java.text.ParseException 46.558 { 46.559 if(function.getURI().equals(TemporalConstants.adjacent)) 46.560 { 46.561 @@ -620,30 +672,48 @@ 46.562 return false; 46.563 } 46.564 } 46.565 - public StrabonPolyhedron spatialConstructPicker(Function function, Value left, Value right) throws Exception 46.566 + 46.567 + /** 46.568 + * FIXME don't check function using getURI(); use instanceof instead 46.569 + */ 46.570 + public StrabonPolyhedron spatialConstructPicker(Function function, Value left, Value right, Value third) throws Exception 46.571 { 46.572 - StrabonPolyhedron leftArg = ((GeneralDBPolyhedron) left).getPolyhedron(); 46.573 + StrabonPolyhedron leftArg = getValueAsStrabonPolyhedron(left); 46.574 if(function.getURI().equals(GeoConstants.stSPARQLunion)) 46.575 { 46.576 - StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 46.577 + // check required number of arguments 46.578 + checkArgs(left, right, third, 2); 46.579 + 46.580 + StrabonPolyhedron rightArg = getValueAsStrabonPolyhedron(right); 46.581 return StrabonPolyhedron.union(leftArg, rightArg); 46.582 } 46.583 - else if(function.getURI().equals(GeoConstants.stSPARQLbuffer)) 46.584 - { 46.585 + else if (function instanceof BufferFunc) { 46.586 + // check required number of arguments 46.587 + checkArgs(left, right, third, 3); 46.588 + 46.589 + // TODO implement computation of the buffer in degrees 46.590 + // you'll get the type (degrees/meter) from the thirdResult, which 46.591 + // would be a URI. 46.592 + if (OGCConstants.OGCdegree.equals(third.stringValue())) { 46.593 + logger.info("[GeneraDBEvaluation] Computation of {} will be done in meters.", function.getURI()); 46.594 + } 46.595 + 46.596 if(right instanceof LiteralImpl) 46.597 { 46.598 - LiteralImpl radius = (LiteralImpl) right; 46.599 - return StrabonPolyhedron.buffer(leftArg,radius.doubleValue()); 46.600 + LiteralImpl meters = (LiteralImpl) right; 46.601 + return StrabonPolyhedron.buffer(leftArg, meters.doubleValue()); 46.602 } 46.603 - else if(right instanceof RdbmsLiteral) 46.604 + else if (right instanceof RdbmsLiteral) 46.605 { 46.606 - RdbmsLiteral radius = (RdbmsLiteral) right; 46.607 - return StrabonPolyhedron.buffer(leftArg,radius.doubleValue()); 46.608 + RdbmsLiteral meters = (RdbmsLiteral) right; 46.609 + return StrabonPolyhedron.buffer(leftArg, meters.doubleValue()); 46.610 } 46.611 - 46.612 } 46.613 else if(function.getURI().equals(GeoConstants.stSPARQLtransform)) 46.614 { 46.615 + // check required number of arguments 46.616 + checkArgs(left, right, third, 2); 46.617 + 46.618 if(right instanceof URIImpl) 46.619 { 46.620 URIImpl srid = (URIImpl) right; 46.621 @@ -652,9 +722,9 @@ 46.622 else if(right instanceof RdbmsURI) 46.623 { 46.624 RdbmsURI srid = (RdbmsURI) right; 46.625 - int parsedSRID = Integer.parseInt(srid.toString().substring(srid.toString().lastIndexOf('/')+1)); 46.626 + int parsedSRID = WKTHelper.getSRID_forURI(srid.toString()); 46.627 Geometry converted = JTSWrapper.getInstance().transform(leftArg.getGeometry(),leftArg.getGeometry().getSRID(), parsedSRID); 46.628 - return new StrabonPolyhedron(converted); 46.629 + return new StrabonPolyhedron(converted, leftArg.getGeometryDatatype()); 46.630 } 46.631 46.632 } 46.633 @@ -662,31 +732,49 @@ 46.634 { 46.635 return StrabonPolyhedron.envelope(leftArg); 46.636 } 46.637 - else if(function.getURI().equals(GeoConstants.stSPARQLconvexHull)) 46.638 + else if(function.getURI().equals(GeoConstants.stSPARQLconvexHull) || 46.639 + function instanceof GeoSparqlConvexHullFunc) 46.640 { 46.641 return StrabonPolyhedron.convexHull(leftArg); 46.642 } 46.643 - else if(function.getURI().equals(GeoConstants.stSPARQLboundary)) 46.644 + else if(function instanceof BoundaryFunc) 46.645 { 46.646 return StrabonPolyhedron.boundary(leftArg); 46.647 + 46.648 } 46.649 else if(function.getURI().equals(GeoConstants.stSPARQLintersection)) 46.650 { 46.651 - StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 46.652 + // check required number of arguments 46.653 + checkArgs(left, right, third, 2); 46.654 + 46.655 + StrabonPolyhedron rightArg = getValueAsStrabonPolyhedron(right); 46.656 return StrabonPolyhedron.intersection(leftArg, rightArg); 46.657 } 46.658 else if(function.getURI().equals(GeoConstants.stSPARQLdifference)) 46.659 { 46.660 - StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 46.661 + // check required number of arguments 46.662 + checkArgs(left, right, third, 2); 46.663 + 46.664 + StrabonPolyhedron rightArg = getValueAsStrabonPolyhedron(right); 46.665 return StrabonPolyhedron.difference(leftArg, rightArg); 46.666 } 46.667 else if(function.getURI().equals(GeoConstants.stSPARQLsymDifference)) 46.668 { 46.669 - StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 46.670 - return StrabonPolyhedron.symDifference(leftArg, rightArg); 46.671 - } 46.672 + // check required number of arguments 46.673 + checkArgs(left, right, third, 2); 46.674 + 46.675 + StrabonPolyhedron rightArg = getValueAsStrabonPolyhedron(right); 46.676 + return StrabonPolyhedron.symDifference(leftArg, rightArg); 46.677 + 46.678 + } else if (function instanceof Centroid) { 46.679 + return leftArg.getCentroid(); 46.680 + 46.681 + } //else if (function instanceof MakeLine) { // TODO add 46.682 + // return null; 46.683 + //} 46.684 + 46.685 + logger.error("[GeneralDBEvaluation.spatialConstructPicker] Extension function {} has not been implemented yet in this kind of expressions.", function.getURI()); 46.686 return null; 46.687 - 46.688 } 46.689 46.690 @Override 46.691 @@ -752,7 +840,7 @@ 46.692 return Long.MAX_VALUE; 46.693 } 46.694 46.695 - //XXX brought it here to override it somehow.. 46.696 + // brought it here to override it somehow.. 46.697 // @Override 46.698 // public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(Extension extension, 46.699 // BindingSet bindings) 46.700 @@ -761,7 +849,7 @@ 46.701 // CloseableIteration<BindingSet, QueryEvaluationException> result; 46.702 // 46.703 // /** 46.704 - // * XXX additions 46.705 + // * additions 46.706 // */ 46.707 // Iterator<ExtensionElem> iter = extension.getElements().iterator(); 46.708 // //for(ExtensionElem elem : extension.getElements()) 46.709 @@ -828,10 +916,10 @@ 46.710 for (String name : qb.getBindingNames(var)) { 46.711 if (!bindings.hasBinding(name)) { 46.712 var.setIndex(index); 46.713 - //XXX if the variable is actually a GeoVar 46.714 + // if the variable is actually a GeoVar 46.715 if(var.isSpatial()) 46.716 { 46.717 - this.geoNames.put(var.getIndex()+2,var.getName()); 46.718 + this.geoNames.put(var.getName(), var.getIndex() + 2); 46.719 //I am carrying SRID too! Therefore, shifting index one more position 46.720 index++; 46.721 } 46.722 @@ -843,7 +931,7 @@ 46.723 query.select(proj.getStringValue()); 46.724 index += 2; 46.725 if (var.getTypes().isLiterals()) { 46.726 - //FIXME changed to remove extra unneeded joins + selections 46.727 + // NOTE: changed to remove extra unneeded joins + selections 46.728 //Original: 46.729 //query.select(proj.getLanguage()); 46.730 //query.select(proj.getDatatype()); 46.731 @@ -867,19 +955,16 @@ 46.732 } 46.733 } 46.734 46.735 - 46.736 - 46.737 - //XXX Attention: Will try to add projections in select for the constructs 46.738 + // Attention: Will try to add projections in select for the constructs 46.739 Iterator it = qb.getSpatialConstructs().entrySet().iterator(); 46.740 while (it.hasNext()) { 46.741 @SuppressWarnings("rawtypes") 46.742 Map.Entry pairs = (Map.Entry)it.next(); 46.743 - //System.out.println(pairs.getKey() + " = " + pairs.getValue()); 46.744 - 46.745 - //Trying to fill what's missing 46.746 + 46.747 + // Trying to fill what's missing 46.748 GeneralDBSqlExpr expr = (GeneralDBSqlExpr) pairs.getValue(); 46.749 - locateColumnVars(expr,qb.getVars()); 46.750 - 46.751 + locateColumnVars(expr, qb.getVars()); 46.752 + 46.753 //Assuming thematic aggregates and spatial expressions won't be combined 46.754 if(!this.thematicExpressions.contains(expr)) 46.755 { 46.756 @@ -893,16 +978,15 @@ 46.757 throw new UnsupportedRdbmsOperatorException("No such spatial expression exists!"); 46.758 46.759 } else { 46.760 - info = new GeneralDBSpatialFuncInfo((String) pairs.getKey(), type); 46.761 - 46.762 + info = new GeneralDBSpatialFuncInfo((String) pairs.getKey(), type, expr instanceof GeneralDBSqlAbstractGeoSrid); 46.763 + 46.764 // set increaseIndex to <tt>true</tt> for geometries only (see commend below) 46.765 if (type == ResultType.WKT || type == ResultType.WKTLITERAL) { 46.766 increaseIndex = true; 46.767 } 46.768 46.769 } 46.770 - //constructIndexesAndNames.put((String) pairs.getKey(),index++); 46.771 - constructIndexesAndNames.put(info,index++); 46.772 + constructIndexesAndNames.put(info, index++); 46.773 if(increaseIndex) 46.774 { 46.775 //Increasing index by one more because of SRID! 46.776 @@ -934,15 +1018,12 @@ 46.777 throw new UnsupportedRdbmsOperatorException("No such temporal expression exists!"); 46.778 46.779 } else { 46.780 - info = new GeneralDBSpatialFuncInfo((String) pairs.getKey(), type); 46.781 + info = new GeneralDBSpatialFuncInfo((String) pairs.getKey(), type, false); 46.782 } 46.783 46.784 - constructIndexesAndNames.put(info,index++); 46.785 - 46.786 - 46.787 + constructIndexesAndNames.put(info, index++); 46.788 } 46.789 } 46.790 - // 46.791 46.792 for (OrderElem by : qb.getOrderElems()) { 46.793 query.orderBy(by.sqlExpr, by.isAscending); 46.794 @@ -1042,7 +1123,7 @@ 46.795 } 46.796 else if(expr instanceof GeneralDBLabelColumn)//ColumnVar at least 46.797 { 46.798 - String name = ((GeneralDBLabelColumn) expr).getVarName().replace("?spatial","");; 46.799 + String name = ((GeneralDBLabelColumn) expr).getVarName().replace("?spatial",""); 46.800 46.801 for(GeneralDBColumnVar reference: allKnown) 46.802 { 46.803 @@ -1101,10 +1182,15 @@ 46.804 locateColumnVars(((GeneralDBSqlMathExpr)expr).getLeftArg(),allKnown); 46.805 locateColumnVars(((GeneralDBSqlMathExpr)expr).getRightArg(),allKnown); 46.806 } 46.807 + else if(expr instanceof GeneralDBSqlGeoSpatial) 46.808 + { 46.809 + locateColumnVars(((GeneralDBSqlGeoSpatial)expr).getLeftArg(),allKnown); 46.810 + locateColumnVars(((GeneralDBSqlGeoSpatial)expr).getRightArg(),allKnown); 46.811 + } 46.812 else if(expr instanceof GeneralDBSqlTemporalConstructBinary) 46.813 { 46.814 locateColumnVars(((GeneralDBSqlTemporalConstructBinary)expr).getLeftArg(),allKnown); 46.815 - locateColumnVars(((GeneralDBSqlTemporalConstructBinary)expr).getRightArg(),allKnown); 46.816 + locateColumnVars(((GeneralDBSqlTemporalConstructBinary)expr).getRightArg(),allKnown); 46.817 } 46.818 else if(expr instanceof GeneralDBSqlTemporalConstructUnary) 46.819 { 46.820 @@ -1136,10 +1222,134 @@ 46.821 } 46.822 46.823 } 46.824 + 46.825 46.826 //return allVars; 46.827 } 46.828 46.829 + 46.830 + /** 46.831 + * Very customized method for taking the URI corresponding to the SRID of a 46.832 + * {@link Value} that may be one of {@link StrabonPolyhedron}, 46.833 + * {@link GeneralDBPolyhedron}, or {@link Literal}. 46.834 + * 46.835 + * The insight is that we would like to return the URI for CRS84 when the 46.836 + * SRID equals {@link GeoConstants.EPSG4326_SRID} and not the URI for 46.837 + * EPSG:4326. Since, we have such information available, we choose to 46.838 + * do compute it. 46.839 + * 46.840 + * @param value 46.841 + * @return 46.842 + * @throws ParseException 46.843 + * when the supplied value is a constant ({@link Literal}) and is not 46.844 + * a valid WKT literal 46.845 + * @throws ParseException 46.846 + */ 46.847 + public String getSRIDFromValue(Value value) throws ParseException { 46.848 + boolean iswktLiteral = false; 46.849 + int srid = -1; 46.850 + 46.851 + if (value instanceof GeneralDBPolyhedron) { 46.852 + StrabonPolyhedron poly = ((GeneralDBPolyhedron) value).getPolyhedron(); 46.853 + srid = poly.getGeometry().getSRID(); 46.854 + 46.855 + if (poly.getGeometryDatatype() == GeometryDatatype.wktLiteral) { 46.856 + iswktLiteral = true; 46.857 + } 46.858 + 46.859 + } else if (value instanceof StrabonPolyhedron) { 46.860 + StrabonPolyhedron poly = ((StrabonPolyhedron) value); 46.861 + srid = poly.getGeometry().getSRID(); 46.862 + 46.863 + if (poly.getGeometryDatatype() == GeometryDatatype.wktLiteral) { 46.864 + iswktLiteral = true; 46.865 + } 46.866 + 46.867 + } else if (value instanceof Literal) { // this is actually a constant 46.868 + Literal literal = (Literal) value; 46.869 + AbstractWKT wkt; 46.870 + 46.871 + if (literal.getDatatype() != null) { 46.872 + wkt = new AbstractWKT(literal.stringValue(), literal.getDatatype().stringValue()); 46.873 + 46.874 + } else { 46.875 + wkt = new AbstractWKT(literal.stringValue()); 46.876 + } 46.877 + 46.878 + srid = wkt.getSRID(); 46.879 + 46.880 + if (!wkt.isstRDFWKT()) { 46.881 + iswktLiteral = true; 46.882 + } 46.883 + 46.884 + // we are constructing a {@link StrabonPolyhedron} now to check 46.885 + // its validity 46.886 + JTSWrapper.getInstance().WKTread(wkt.getWKT()); 46.887 + } 46.888 + 46.889 + if (iswktLiteral && srid == GeoConstants.EPSG4326_SRID) { 46.890 + return GeoConstants.CRS84_URI; 46.891 + 46.892 + } else { 46.893 + return WKTHelper.getEPSGURI_forSRID(srid); 46.894 + } 46.895 + } 46.896 + 46.897 + public Geometry getGeometryFromValue(Value value) throws ParseException { 46.898 + if (value instanceof GeneralDBPolyhedron) { 46.899 + return ((GeneralDBPolyhedron) value).getPolyhedron().getGeometry(); 46.900 + 46.901 + } else if (value instanceof StrabonPolyhedron) { 46.902 + return ((StrabonPolyhedron) value).getGeometry(); 46.903 + 46.904 + } else if (value instanceof Literal) { 46.905 + Literal literal = (Literal) value; 46.906 + AbstractWKT wkt = null; 46.907 + 46.908 + if (literal.getDatatype() == null) { 46.909 + wkt = new AbstractWKT(literal.stringValue()); 46.910 + 46.911 + } else { 46.912 + wkt = new AbstractWKT(literal.stringValue(), literal.getDatatype().stringValue()); 46.913 + } 46.914 + 46.915 + Geometry geom = JTSWrapper.getInstance().WKTread(wkt.getWKT()); 46.916 + geom.setSRID(wkt.getSRID()); 46.917 + 46.918 + return geom; 46.919 + 46.920 + } else { 46.921 + return null; 46.922 + } 46.923 + } 46.924 + 46.925 + StrabonPolyhedron getValueAsStrabonPolyhedron(Value value) throws ParseException { 46.926 + if (value instanceof GeneralDBPolyhedron) { 46.927 + return ((GeneralDBPolyhedron) value).getPolyhedron(); 46.928 + 46.929 + } else if (value instanceof StrabonPolyhedron) { 46.930 + return (StrabonPolyhedron) value; 46.931 + 46.932 + } else if (value instanceof Literal) { 46.933 + Literal literal = (Literal) value; 46.934 + AbstractWKT wkt = null; 46.935 + 46.936 + if (literal.getDatatype() == null) { 46.937 + wkt = new AbstractWKT(literal.stringValue()); 46.938 + 46.939 + } else { 46.940 + wkt = new AbstractWKT(literal.stringValue(), literal.getDatatype().stringValue()); 46.941 + } 46.942 + 46.943 + return new StrabonPolyhedron(wkt.getWKT(), 46.944 + wkt.getSRID(), 46.945 + GeometryDatatype.fromString(literal.getDatatype().stringValue())); 46.946 + 46.947 + } else { // wrong case 46.948 + throw new IllegalArgumentException("The provided argument is not a valid spatial value: " + value.getClass()); 46.949 + } 46.950 + } 46.951 + 46.952 /** 46.953 * Given an expression get the type of the result. 46.954 * Extended it to take into account the temporal constructs 46.955 @@ -1166,6 +1376,9 @@ 46.956 expr instanceof GeneralDBSqlGeoIsEmpty ) 46.957 { 46.958 return ResultType.BOOLEAN; 46.959 + 46.960 + } else if (expr instanceof GeneralDBSqlGeoSPARQLSrid) { 46.961 + return ResultType.URI; 46.962 } 46.963 46.964 } 46.965 @@ -1213,6 +1426,11 @@ 46.966 { 46.967 return ResultType.PERIOD; 46.968 } 46.969 + else if(expr instanceof GeneralDBSqlGeoSpatial) 46.970 + { 46.971 + return ResultType.BOOLEAN; 46.972 + } 46.973 + 46.974 else if(expr instanceof GeneralDBSqlTemporalConstructUnary) 46.975 { 46.976 return ResultType.INSTANT;
47.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java Wed Sep 10 12:37:29 2014 +0200 47.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java Wed Sep 24 18:44:26 2014 +0300 47.3 @@ -35,6 +35,7 @@ 47.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCompare; 47.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlConcat; 47.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContains; 47.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSPARQLSrid; 47.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbContains; 47.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCrosses; 47.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDiffDateTime; 47.11 @@ -146,7 +147,6 @@ 47.12 */ 47.13 public abstract class GeneralDBQueryBuilder { 47.14 47.15 - 47.16 protected GeneralDBSqlQueryBuilder query; 47.17 47.18 protected GeneralDBValueFactory vf; 47.19 @@ -827,8 +827,8 @@ 47.20 } 47.21 47.22 protected void dispatchUnarySqlOperator(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter) 47.23 - throws UnsupportedRdbmsOperatorException 47.24 - { 47.25 + throws UnsupportedRdbmsOperatorException 47.26 + { 47.27 if (expr instanceof GeneralDBSqlAbs) { 47.28 append((GeneralDBSqlAbs)expr, filter); 47.29 } 47.30 @@ -857,6 +857,9 @@ 47.31 else if (expr instanceof GeneralDBSqlGeoBoundary) { 47.32 append((GeneralDBSqlGeoBoundary)expr, filter); 47.33 } 47.34 + else if (expr instanceof GeneralDBSqlST_Centroid) { 47.35 + append((GeneralDBSqlST_Centroid)expr, filter); 47.36 + } 47.37 else if (expr instanceof GeneralDBSqlPeriodStart) { 47.38 append((GeneralDBSqlPeriodStart)expr, filter); 47.39 } 47.40 @@ -882,6 +885,9 @@ 47.41 } 47.42 else if (expr instanceof GeneralDBSqlGeoSrid) { 47.43 append((GeneralDBSqlGeoSrid)expr, filter); 47.44 + 47.45 + } else if (expr instanceof GeneralDBSqlGeoSPARQLSrid) { 47.46 + append((GeneralDBSqlGeoSPARQLSrid)expr, filter); 47.47 } 47.48 else if (expr instanceof GeneralDBSqlGeoIsEmpty) { 47.49 append((GeneralDBSqlGeoIsEmpty)expr, filter); 47.50 @@ -893,7 +899,7 @@ 47.51 else { 47.52 throw unsupported(expr); 47.53 } 47.54 - } 47.55 + } 47.56 47.57 /** 47.58 * @param expr 47.59 @@ -1228,6 +1234,9 @@ 47.60 47.61 protected abstract void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 47.62 throws UnsupportedRdbmsOperatorException; 47.63 + 47.64 + protected abstract void append(GeneralDBSqlGeoSPARQLSrid expr, GeneralDBSqlExprBuilder filter) 47.65 + throws UnsupportedRdbmsOperatorException; 47.66 47.67 protected abstract void append(GeneralDBSqlGeoIsSimple expr, GeneralDBSqlExprBuilder filter) 47.68 throws UnsupportedRdbmsOperatorException; 47.69 @@ -1244,7 +1253,7 @@ 47.70 { 47.71 //I seriously doubt it will ever visit this case 47.72 47.73 - if (var.getRdbmsVar().isResource()) { 47.74 + if (var.getRdbmsVar()==null || var.getRdbmsVar().isResource()) { 47.75 filter.appendNull(); 47.76 47.77 } 47.78 @@ -1255,7 +1264,8 @@ 47.79 47.80 } 47.81 } 47.82 - 47.83 + 47.84 + protected abstract String appendWKT(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException; 47.85 protected void appendPeriod(GeneralDBLabelColumn var, GeneralDBSqlExprBuilder filter) 47.86 { 47.87 //I seriously doubt it will ever visit this case 47.88 @@ -1273,7 +1283,6 @@ 47.89 } 47.90 47.91 47.92 - protected abstract String appendWKT(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter); 47.93 47.94 protected void appendConstructFunction(GeneralDBSqlExpr constr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 47.95 {
48.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Wed Sep 10 12:37:29 2014 +0200 48.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Wed Sep 24 18:44:26 2014 +0300 48.3 @@ -7,6 +7,7 @@ 48.4 48.5 import java.sql.PreparedStatement; 48.6 import java.sql.ResultSet; 48.7 +import java.sql.ResultSetMetaData; 48.8 import java.sql.SQLException; 48.9 import java.text.ParseException; 48.10 import java.text.SimpleDateFormat; 48.11 @@ -22,6 +23,7 @@ 48.12 import org.openrdf.query.QueryEvaluationException; 48.13 import org.openrdf.query.algebra.evaluation.QueryBindingSet; 48.14 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonInstant; 48.15 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 48.16 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPeriod; 48.17 import eu.earthobservatory.constants.TemporalConstants; 48.18 import org.openrdf.sail.generaldb.GeneralDBSpatialFuncInfo; 48.19 @@ -33,18 +35,23 @@ 48.20 import org.openrdf.sail.rdbms.iteration.base.RdbmIterationBase; 48.21 import org.openrdf.sail.rdbms.model.RdbmsResource; 48.22 import org.openrdf.sail.rdbms.model.RdbmsValue; 48.23 +import org.slf4j.Logger; 48.24 +import org.slf4j.LoggerFactory; 48.25 48.26 import eu.earthobservatory.constants.GeoConstants; 48.27 48.28 /** 48.29 * Converts a {@link ResultSet} into a {@link BindingSet} in an iteration. 48.30 * 48.31 + * @author Charalampos Nikolaou <charnik@di.uoa.gr. 48.32 * @author Manos Karpathiotakis <mk@di.uoa.gr> 48.33 * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> (added suport for temporal variables) 48.34 * 48.35 */ 48.36 public abstract class GeneralDBBindingIteration extends RdbmIterationBase<BindingSet, QueryEvaluationException> { 48.37 48.38 + private static Logger logger = LoggerFactory.getLogger(org.openrdf.sail.generaldb.iteration.GeneralDBBindingIteration.class); 48.39 + 48.40 protected BindingSet bindings; 48.41 48.42 protected Collection<GeneralDBColumnVar> projections; 48.43 @@ -53,8 +60,7 @@ 48.44 48.45 protected IdSequence ids; 48.46 48.47 - //XXX addition- manolee 48.48 - protected HashMap<Integer,String> geoNames = new HashMap<Integer, String>(); 48.49 + protected HashMap<String, Integer> geoNames = new HashMap<String, Integer>(); 48.50 48.51 //XXX addition - constant 48.52 protected HashMap<Integer,String> temporalVars = new HashMap<Integer, String>(); 48.53 @@ -88,14 +94,14 @@ 48.54 this.sp_ConstructIndexesAndNames = indexesAndNames; 48.55 } 48.56 48.57 - public HashMap<Integer,String> getGeoNames() { 48.58 + public HashMap<String, Integer> getGeoNames() { 48.59 return geoNames; 48.60 } 48.61 public HashMap<Integer,String> getTemporalVars() { 48.62 return temporalVars; 48.63 } 48.64 48.65 - public void setGeoNames(HashMap<Integer,String> geoNames) { 48.66 + public void setGeoNames(HashMap<String, Integer> geoNames) { 48.67 this.geoNames = geoNames; 48.68 } 48.69 public void setTemporalVars(HashMap<Integer,String> temporalVars) { 48.70 @@ -123,7 +129,6 @@ 48.71 protected BindingSet convert(ResultSet rs) 48.72 throws SQLException 48.73 { 48.74 - 48.75 /// debug 48.76 /*for(int i=1; i<12;i++) { 48.77 Object o = rs.getObject(i); 48.78 @@ -176,34 +181,42 @@ 48.79 Value value = null; 48.80 switch(construct.getType()) 48.81 { 48.82 - case BOOLEAN: 48.83 - value = createBooleanGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.84 - break; 48.85 - case DOUBLE: 48.86 - value = createDoubleGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.87 - break; 48.88 - case INTEGER: 48.89 - value = createIntegerGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.90 - break; 48.91 - case STRING: 48.92 - value = createStringGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.93 - break; 48.94 - case WKT: 48.95 - value = createWellKnownTextGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.96 - break; 48.97 - case WKTLITERAL: 48.98 - value = createWellKnownTextLiteralGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.99 - break; 48.100 + case BOOLEAN: 48.101 + value = createBooleanGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.102 + break; 48.103 + case DOUBLE: 48.104 + value = createDoubleGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.105 + break; 48.106 + case INTEGER: 48.107 + value = createIntegerGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.108 + break; 48.109 + case STRING: 48.110 + value = createStringGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.111 + break; 48.112 + case WKT: 48.113 + value = createWellKnownTextGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.114 + break; 48.115 + case WKTLITERAL: 48.116 + value = createWellKnownTextLiteralGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.117 + break; 48.118 case PERIOD: 48.119 value = createPeriodValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.120 break; 48.121 case INSTANT: 48.122 value = createPeriodValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.123 break; 48.124 + case URI: 48.125 + value = createURIGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct), construct.isSRIDFunc()); 48.126 + break; 48.127 + default: 48.128 + logger.error("[GeneralDBBindingIteration] Unknown result type for function."); 48.129 + break; 48.130 48.131 } 48.132 - //Value value = createGeoValueForSelectConstructs(rs, sp_ConstructIndexesAndNames.get(construct)); 48.133 - result.addBinding(construct.getFieldName(), value); 48.134 + 48.135 + if (value != null) { 48.136 + result.addBinding(construct.getFieldName(), value); 48.137 + } 48.138 } 48.139 48.140 return result; 48.141 @@ -237,11 +250,17 @@ 48.142 } 48.143 48.144 /** 48.145 - * FIXME the implementation of this function for PostGIS and MonetDB 48.146 - * uses by default the {@link GeoConstants#WKT} datatype when creating WKT 48.147 - * literals. What about geo:wktLiteral? 48.148 - * However, this method is called by {@link convert} method only, which 48.149 - * in turn is not called by any method! 48.150 + * Creates a geospatial value from the given result set and index position. 48.151 + * When projecting on a geospatial value, we get also its SRID, and its 48.152 + * datatype, so that we are able to assign that datatype to the new value. 48.153 + * 48.154 + * @param rs the current result set over which we are iterating 48.155 + * @param index the index position to start reading from 48.156 + * index + 1: geospatial value (in binary) 48.157 + * index + 2: SRID 48.158 + * index + 3: datatype 48.159 + * @return 48.160 + * @throws SQLException 48.161 */ 48.162 protected abstract RdbmsValue createGeoValue(ResultSet rs, int index) 48.163 throws SQLException; 48.164 @@ -268,9 +287,13 @@ 48.165 { 48.166 double potentialMetric; 48.167 //case of metrics 48.168 - potentialMetric = rs.getFloat(index + 1); 48.169 + if(rs.getArray(index+1) != null) 48.170 + { 48.171 + potentialMetric = rs.getFloat(index + 1); 48.172 48.173 - return vf.asRdbmsLiteral(vf.createLiteral(potentialMetric)); 48.174 + return vf.asRdbmsLiteral(vf.createLiteral(potentialMetric)); 48.175 + } 48.176 + return null; 48.177 48.178 } 48.179 48.180 @@ -340,6 +363,56 @@ 48.181 return vf.asRdbmsLiteral(vf.createLiteral(spProperty)); 48.182 48.183 } 48.184 + 48.185 + protected RdbmsResource createURIGeoValueForSelectConstructs(ResultSet rs, int index, boolean sridTransform) 48.186 + throws SQLException 48.187 + { 48.188 + String uri = null; 48.189 + 48.190 + if (sridTransform) { 48.191 + // we have to differentiate here for geoSPARQL's getSRID function, since we need to transform 48.192 + // the result to a URI 48.193 + // this is called for GeoSPARQL's getSRID, thus the column would be of type Integer 48.194 + int srid = rs.getInt(index + 1); 48.195 + 48.196 + // NOTICE however, that in case of EPSG:4326 and wktLiterals it would be better to 48.197 + // return CRS84. We have already brought that datatype earlier in the expression, so 48.198 + // we will try to locate it 48.199 + if (srid == GeoConstants.EPSG4326_SRID) { 48.200 + // get the alias name for this column 48.201 + ResultSetMetaData meta = rs.getMetaData(); 48.202 + String aliasSRID = meta.getColumnName(index + 1); 48.203 + 48.204 + // get the index of the column containing the expression for the reference geometry 48.205 + Integer indexOfGeometry = geoNames.get(aliasSRID.replace("_srid", "")); 48.206 + if (indexOfGeometry != null) { 48.207 + // index + 2 would have the datatype 48.208 + String datatype = rs.getString(indexOfGeometry + 2); 48.209 + //System.out.println(datatype); 48.210 + 48.211 + if (GeoConstants.WKTLITERAL.equals(datatype)) { 48.212 + uri = GeoConstants.CRS84_URI; 48.213 + } 48.214 + 48.215 + } else { // we didn't manage to locate the datatype column, so this is probably 48.216 + // a constant for which it is not possible to determine its datatype 48.217 + // since this function is geof:getSRID, we assume a geo:wktLiteral datatype, sorry 48.218 + uri = GeoConstants.CRS84_URI; 48.219 + 48.220 + } 48.221 + } 48.222 + 48.223 + if (uri == null) { // default behavior if we fail to locate or is not 48.224 + // a wktLiteral 48.225 + uri = WKTHelper.getEPSGURI_forSRID(srid); 48.226 + } 48.227 + 48.228 + } else { // we get this as a string first, and then we shall construct the URI 48.229 + uri = rs.getString(index + 1); 48.230 + } 48.231 + 48.232 + return vf.asRdbmsURI(vf.createURI(uri)); 48.233 + } 48.234 48.235 // protected RdbmsValue createGeoValueForSelectConstructs(ResultSet rs, int index) 48.236 // throws SQLException
49.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/LiteralManager.java Wed Sep 10 12:37:29 2014 +0200 49.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/LiteralManager.java Wed Sep 24 18:44:26 2014 +0300 49.3 @@ -119,10 +119,6 @@ 49.4 { 49.5 table.insertGML(id, label, dt, null, null); 49.6 } 49.7 - else if(XMLGSDatatypeUtil.isSemiLinearPointSetDatatype(datatype)) // SemiLinearPointSet case 49.8 - { 49.9 - table.insertGeoSpatial(id, label,dt,null,null); 49.10 - } 49.11 else if(XMLGSDatatypeUtil.isPeriodDatatype(datatype)) // valid period case- Constant 49.12 { //TODO remember that the period should be validated, haven't decided the level yet though 49.13
50.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/model/GeneralDBPolyhedron.java Wed Sep 10 12:37:29 2014 +0200 50.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/model/GeneralDBPolyhedron.java Wed Sep 24 18:44:26 2014 +0300 50.3 @@ -3,13 +3,13 @@ 50.4 import java.io.IOException; 50.5 50.6 import org.openrdf.model.URI; 50.7 +import org.openrdf.query.algebra.evaluation.function.spatial.GeometryDatatype; 50.8 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 50.9 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 50.10 import org.openrdf.sail.rdbms.model.RdbmsValue; 50.11 50.12 import com.vividsolutions.jts.io.ParseException; 50.13 50.14 -import eu.earthobservatory.constants.GeoConstants; 50.15 - 50.16 /** 50.17 * 50.18 * @author Manos Karpathiotakis <mk@di.uoa.gr> 50.19 @@ -44,7 +44,8 @@ 50.20 super(id, version); 50.21 50.22 try { 50.23 - this.polyhedron = new StrabonPolyhedron(polyhedron, srid); 50.24 + this.polyhedron = new StrabonPolyhedron(polyhedron, srid, GeometryDatatype.fromString(datatype.stringValue())); 50.25 + 50.26 } catch (ParseException e) { 50.27 50.28 e.printStackTrace(); 50.29 @@ -57,38 +58,16 @@ 50.30 this.datatype = datatype; 50.31 } 50.32 50.33 - // public GeneralDBPolyhedron(Number id, Integer version, URI datatype, String polyhedron) throws IOException, ClassNotFoundException { 50.34 - // super(id, version); 50.35 - // 50.36 - // try { 50.37 - // this.polyhedron = new StrabonPolyhedron(polyhedron); 50.38 - // } catch (ParseException e) { 50.39 - // 50.40 - // e.printStackTrace(); 50.41 - // } catch (Exception e) { 50.42 - // 50.43 - // e.printStackTrace(); 50.44 - // } 50.45 - // setPolyhedronStringRep(this.polyhedron); 50.46 - // this.datatype = datatype; 50.47 - // } 50.48 - /** 50.49 - * METHODS 50.50 - */ 50.51 - 50.52 public String getPolyhedronStringRep() { 50.53 return polyhedronStringRep; 50.54 } 50.55 50.56 public void setPolyhedronStringRep(StrabonPolyhedron polyhedron) throws IOException, ClassNotFoundException { 50.57 - //TODO kkyzir prepares this method 50.58 - // TODO add GML 50.59 - 50.60 if (StrabonPolyhedron.EnableConstraintRepresentation) { 50.61 this.polyhedronStringRep = polyhedron.toConstraints(); 50.62 50.63 } else { 50.64 - this.polyhedronStringRep = polyhedron.toWKT(); 50.65 + this.polyhedronStringRep = polyhedron.stringValue(); 50.66 } 50.67 } 50.68 50.69 @@ -111,32 +90,18 @@ 50.70 50.71 50.72 public String stringValue() { 50.73 - if(String.valueOf(datatype) == GeoConstants.WKT) 50.74 - return new String(this.polyhedronStringRep)+";http://www.opengis.net/def/crs/EPSG/0/"+this.getPolyhedron().getGeometry().getSRID(); 50.75 - else 50.76 - return new String("<http://www.opengis.net/def/crs/EPSG/0/"+this.getPolyhedron().getGeometry().getSRID()+"> "+this.polyhedronStringRep); 50.77 + // TODO FIXME we miss GML here 50.78 + return WKTHelper.createWKT(this.polyhedronStringRep, 50.79 + this.getPolyhedron().getGeometry().getSRID(), 50.80 + String.valueOf(datatype)); 50.81 } 50.82 50.83 @Override 50.84 public String toString() { 50.85 - if(String.valueOf(datatype) == GeoConstants.WKT) 50.86 - { 50.87 - return new String("\""+this.polyhedronStringRep+";http://www.opengis.net/def/crs/EPSG/0/" 50.88 - +this.getPolyhedron().getGeometry().getSRID()+"\"" + "^^<" + 50.89 - ((StrabonPolyhedron.EnableConstraintRepresentation) ? 50.90 - GeoConstants.stRDFSemiLinearPointset : String.valueOf(datatype)) 50.91 - +">"); 50.92 - } 50.93 - else if(String.valueOf(datatype) == GeoConstants.WKTLITERAL) 50.94 - { 50.95 - return new String("\""+"<"+"http://www.opengis.net/def/crs/EPSG/0/"+this.getPolyhedron().getGeometry().getSRID()+"> "+this.polyhedronStringRep 50.96 - +"\"" + "^^<" + 50.97 - ((StrabonPolyhedron.EnableConstraintRepresentation) ? 50.98 - GeoConstants.stRDFSemiLinearPointset : String.valueOf(datatype)) 50.99 - +">"); 50.100 - } 50.101 - //must not reach this place 50.102 - return null; 50.103 + // TODO FIXME we miss GML here 50.104 + return "\"" + WKTHelper.createWKT(this.polyhedronStringRep, 50.105 + this.getPolyhedron().getGeometry().getSRID(), 50.106 + String.valueOf(datatype)) +"\"" + "^^<" + String.valueOf(datatype) + ">"; 50.107 } 50.108 50.109 @Override
51.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/model/XMLGSDatatypeUtil.java Wed Sep 10 12:37:29 2014 +0200 51.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/model/XMLGSDatatypeUtil.java Wed Sep 24 18:44:26 2014 +0300 51.3 @@ -15,11 +15,11 @@ 51.4 import org.openrdf.model.Value; 51.5 import org.openrdf.model.datatypes.XMLDateTime; 51.6 import org.openrdf.model.vocabulary.XMLSchema; 51.7 - 51.8 -import org.openrdf.sail.generaldb.model.GeneralDBPolyhedron; 51.9 +import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 51.10 51.11 import eu.earthobservatory.constants.GeoConstants; 51.12 import eu.earthobservatory.constants.MiscConstants; 51.13 +import eu.earthobservatory.constants.WKTConstants; 51.14 import eu.earthobservatory.constants.TemporalConstants; 51.15 51.16 51.17 @@ -61,7 +61,7 @@ 51.18 return true; 51.19 } 51.20 51.21 - } else if (value instanceof GeneralDBPolyhedron) { 51.22 + } else if (value instanceof GeneralDBPolyhedron || value instanceof StrabonPolyhedron) { 51.23 return true; 51.24 } 51.25 51.26 @@ -76,7 +76,11 @@ 51.27 * @return 51.28 */ 51.29 public static boolean isWKTLiteral(Literal literal) { 51.30 - return isWKTDatatype(literal.getDatatype()); 51.31 + if (literal.getDatatype() == null){ 51.32 + return containsWKTGeometry(literal); 51.33 + } else { 51.34 + return isWKTDatatype(literal.getDatatype()); 51.35 + } 51.36 } 51.37 51.38 /** 51.39 @@ -105,6 +109,20 @@ 51.40 GeoConstants.WKTLITERAL.equals(datatype.stringValue()); 51.41 } 51.42 51.43 + //TODO: seems a bit quick and dirty 51.44 + 51.45 + public static boolean containsWKTGeometry(Literal literal){ 51.46 + return 51.47 + literal.stringValue().contains(WKTConstants.WKTPOINT)|| 51.48 + literal.stringValue().contains(WKTConstants.WKTLINESTRING)|| 51.49 + literal.stringValue().contains(WKTConstants.WKTLINEARRING)|| 51.50 + literal.stringValue().contains(WKTConstants.WKTPOLYGON)|| 51.51 + literal.stringValue().contains(WKTConstants.WKTMULTIPOINT)|| 51.52 + literal.stringValue().contains(WKTConstants.WKTMULTILINESTRING)|| 51.53 + literal.stringValue().contains(WKTConstants.WKTGEOMETRYCOLLECTION)|| 51.54 + literal.stringValue().contains(WKTConstants.WKTMULTIPOLYGON); 51.55 + } 51.56 + 51.57 /** 51.58 * Checks whether the supplied datatype is actually a GML literal. 51.59 *
52.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Wed Sep 10 12:37:29 2014 +0200 52.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Wed Sep 24 18:44:26 2014 +0300 52.3 @@ -114,7 +114,7 @@ 52.4 /** 52.5 * Rewrites the core algebra model with a relation optimised model, using SQL. 52.6 * 52.7 - * @author James Leigh 52.8 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 52.9 * @author Manos Karpathiotakis <mk@di.uoa.gr> 52.10 * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> 52.11 * 52.12 @@ -154,7 +154,8 @@ 52.13 52.14 //Counter used to enumerate expressions in having 52.15 private int havingID = 1; 52.16 - /** 52.17 + 52.18 + /* 52.19 * addition by constant 52.20 */ 52.21 private List<String> temporalVars = new ArrayList<String>(15); 52.22 @@ -164,10 +165,6 @@ 52.23 private List<Var> existingTemporalJoins = new ArrayList<Var>(); 52.24 52.25 52.26 - /** 52.27 - * 52.28 - */ 52.29 - 52.30 private static final String ALIAS = "t"; 52.31 52.32 private GeneralDBSqlExprFactory sql; 52.33 @@ -211,21 +208,19 @@ 52.34 } 52.35 52.36 @Override 52.37 - public void meet(Distinct node) 52.38 - throws RuntimeException 52.39 - { 52.40 + public void meet(Distinct node) throws RuntimeException 52.41 + { 52.42 super.meet(node); 52.43 if (node.getArg() instanceof GeneralDBSelectQuery) { 52.44 GeneralDBSelectQuery query = (GeneralDBSelectQuery)node.getArg(); 52.45 query.setDistinct(true); 52.46 node.replaceWith(query); 52.47 } 52.48 - } 52.49 + } 52.50 52.51 @Override 52.52 - public void meet(Union node) 52.53 - throws RuntimeException 52.54 - { 52.55 + public void meet(Union node) throws RuntimeException 52.56 + { 52.57 super.meet(node); 52.58 TupleExpr l = node.getLeftArg(); 52.59 TupleExpr r = node.getRightArg(); 52.60 @@ -245,7 +240,7 @@ 52.61 mergeSelectClause(query, right); 52.62 addProjectionsFromUnion(query, union); 52.63 node.replaceWith(query); 52.64 - } 52.65 + } 52.66 52.67 /** 52.68 * This happens when both sides of the union have the same variable name with 52.69 @@ -267,9 +262,8 @@ 52.70 } 52.71 52.72 @Override 52.73 - public void meet(Join node) 52.74 - throws RuntimeException 52.75 - { 52.76 + public void meet(Join node) throws RuntimeException 52.77 + { 52.78 super.meet(node); 52.79 TupleExpr l = node.getLeftArg(); 52.80 TupleExpr r = node.getRightArg(); 52.81 @@ -290,12 +284,11 @@ 52.82 * This change was made before altering the spatial joins operation 52.83 */ 52.84 reference = left; 52.85 - } 52.86 + } 52.87 52.88 @Override 52.89 - public void meet(LeftJoin node) 52.90 - throws RuntimeException 52.91 - { 52.92 + public void meet(LeftJoin node) throws RuntimeException 52.93 + { 52.94 super.meet(node); 52.95 TupleExpr l = node.getLeftArg(); 52.96 TupleExpr r = node.getRightArg(); 52.97 @@ -326,7 +319,7 @@ 52.98 } 52.99 node.replaceWith(left); 52.100 reference = left; 52.101 - } 52.102 + } 52.103 52.104 @Override 52.105 public void meet(StatementPattern sp) { 52.106 @@ -479,12 +472,14 @@ 52.107 proj.setVar(var); 52.108 proj.setId(new GeneralDBRefIdColumn(var)); 52.109 52.110 - 52.111 if(geoNames.contains(var.getName())) 52.112 { 52.113 proj.setStringValue(new GeneralDBLabelColumn(var)); 52.114 //13/09/2011 my addition in order to create a spatial join in the meet(Filter) call that will follow 52.115 previousAlias = var; 52.116 + 52.117 + // add the corresponding datatype (see {@link GeneralDBValueJoinOptimizer.GeneralDBLabelColumn}) 52.118 + proj.setDatatype(new GeneralDBDatatypeColumn(var)); 52.119 } 52.120 else if(temporalVars.contains(var.getName())) 52.121 { 52.122 @@ -493,13 +488,10 @@ 52.123 } 52.124 else 52.125 { 52.126 - 52.127 - 52.128 proj.setStringValue(coalesce(new GeneralDBURIColumn(var), new GeneralDBBNodeColumn(var), new GeneralDBLabelColumn(var), 52.129 new GeneralDBLongLabelColumn(var), new GeneralDBLongURIColumn(var))); 52.130 proj.setDatatype(new GeneralDBDatatypeColumn(var)); 52.131 proj.setLanguage(new GeneralDBLanguageColumn(var)); 52.132 - 52.133 } 52.134 query.addSqlSelectVar(proj); 52.135 } 52.136 @@ -527,15 +519,11 @@ 52.137 from.addFilter(in); 52.138 } 52.139 sp.replaceWith(query); 52.140 - 52.141 - 52.142 } 52.143 52.144 @Override 52.145 - public void meet(Filter node) 52.146 - throws RuntimeException 52.147 - { 52.148 - 52.149 + public void meet(Filter node) throws RuntimeException 52.150 + { 52.151 /** 52.152 * XXX 21/09/2011 addition for spatial joins 52.153 * Ekmetalleyomai to gegonos oti exw 'fytepsei' sta embolima filters twn joins mia statement pattern me to onoma -dummy- 52.154 @@ -1236,13 +1224,15 @@ 52.155 ValueExpr expr = elem.getExpr(); 52.156 GeneralDBSqlExpr sqlExpr = null; 52.157 String name = elem.getName(); 52.158 - if(expr instanceof FunctionCall) 52.159 - { 52.160 + 52.161 + if (expr instanceof FunctionCall) 52.162 + //if (expr instanceof FunctionCall && !isFuncExprGrounded(expr)) 52.163 + { // if the expr is grounded we are going to evaluate it in Java 52.164 if(!evaluateInJava(expr)) 52.165 { 52.166 Function function = FunctionRegistry.getInstance().get(((FunctionCall) expr).getURI()); 52.167 - if(function instanceof SpatialPropertyFunc || function instanceof SpatialRelationshipFunc 52.168 - || function instanceof SpatialConstructFunc || function instanceof SpatialMetricFunc) 52.169 + if(function instanceof SpatialPropertyFunc || function instanceof SpatialRelationshipFunc || 52.170 + function instanceof SpatialConstructFunc || function instanceof SpatialMetricFunc) 52.171 { 52.172 try { 52.173 sqlExpr = sql.getBooleanExprFactory().spatialFunction((FunctionCall) expr); 52.174 @@ -1318,14 +1308,37 @@ 52.175 } 52.176 } 52.177 } 52.178 - /** 52.179 - * 52.180 - */ 52.181 - 52.182 - 52.183 } 52.184 } 52.185 52.186 + /** 52.187 + * Checks whether the given value expression contains only grounded 52.188 + * terms (constants). 52.189 + * 52.190 + * This should work for the spatial case, but I am not 100% sure whether 52.191 + * it is going to work for whole SPARQL 1.1. 52.192 + * 52.193 + * @param funcExpr 52.194 + * @return 52.195 + */ 52.196 + private boolean isFuncExprGrounded(ValueExpr funcExpr) { 52.197 + if (funcExpr instanceof FunctionCall) { 52.198 + // recursively check its arguments 52.199 + boolean groundedChildren = true; 52.200 + for (int i = 0; i < ((FunctionCall) funcExpr).getArgs().size(); i++) { 52.201 + groundedChildren &= isFuncExprGrounded(((FunctionCall) funcExpr).getArgs().get(i)); 52.202 + } 52.203 + 52.204 + return groundedChildren; 52.205 + 52.206 + } else if (funcExpr instanceof Var) { // variable 52.207 + return false; 52.208 + 52.209 + } else { // all other cases (constant, UnaryExpressions, etc...) -> dodgy! 52.210 + return true; 52.211 + } 52.212 + } 52.213 + 52.214 //Checking that no spatial function exists in this metric expression 52.215 private boolean thematicExpression(ValueExpr expr) 52.216 { 52.217 @@ -1450,7 +1463,8 @@ 52.218 52.219 /** 52.220 * Function used recursively to specify whether the function call present in the select clause contains an aggregate 52.221 - * of the form strdf:union(?aggrValue) or strdf:intersection(?aggrValue). 52.222 + * of the form strdf:union(?aggrValue) or strdf:intersection(?aggrValue). 52.223 + * 52.224 * @param expr 52.225 * @return true if no aggregate is present, false otherwise. 52.226 */ 52.227 @@ -1489,9 +1503,6 @@ 52.228 } 52.229 52.230 } 52.231 - /** 52.232 - * 52.233 - */ 52.234 52.235 @Override 52.236 public void meet(Slice node)
53.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBValueJoinOptimizer.java Wed Sep 10 12:37:29 2014 +0200 53.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBValueJoinOptimizer.java Wed Sep 24 18:44:26 2014 +0300 53.3 @@ -42,6 +42,8 @@ 53.4 /** 53.5 * Adds LEFT JOINs to the query for value tables. 53.6 * 53.7 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 53.8 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 53.9 * @author James Leigh 53.10 * @author Manos Karpathiotakis <mk@di.uoa.gr> 53.11 * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> 53.12 @@ -73,7 +75,7 @@ 53.13 * We used data from this tree traversal and supplied it to a new optimizer 53.14 * that got the job done --> SpatialJoinOptimizer 53.15 */ 53.16 - private boolean spatiallyEnabled = false; 53.17 + //private boolean spatiallyEnabled = false; 53.18 //Will be used in the FOLLOWING - NEW - OPTIMIZER! 53.19 private int geo_values_occurences = 0; 53.20 53.21 @@ -90,11 +92,6 @@ 53.22 return geo_values_occurences; 53.23 } 53.24 53.25 - 53.26 - /** 53.27 - * 53.28 - */ 53.29 - 53.30 public void setUriTable(URITable uris) { 53.31 this.uris = uris; 53.32 } 53.33 @@ -117,30 +114,27 @@ 53.34 } 53.35 53.36 @Override 53.37 - public void meetFromItem(GeneralDBFromItem node) 53.38 - throws RuntimeException 53.39 - { 53.40 + public void meetFromItem(GeneralDBFromItem node) throws RuntimeException 53.41 + { 53.42 GeneralDBFromItem top = parent; 53.43 parent = join; 53.44 join = node; 53.45 super.meetFromItem(node); 53.46 join = parent; 53.47 parent = top; 53.48 - } 53.49 + } 53.50 53.51 @Override 53.52 - public void meet(GeneralDBUnionItem node) 53.53 - throws RuntimeException 53.54 - { 53.55 + public void meet(GeneralDBUnionItem node) throws RuntimeException 53.56 + { 53.57 stack.add(node); 53.58 super.meet(node); 53.59 stack.remove(stack.size() - 1); 53.60 - } 53.61 + } 53.62 53.63 @Override 53.64 - public void meet(GeneralDBSelectQuery node) 53.65 - throws RuntimeException 53.66 - { 53.67 + public void meet(GeneralDBSelectQuery node) throws RuntimeException 53.68 + { 53.69 query = node; 53.70 parent = node.getFrom(); 53.71 join = node.getFrom(); 53.72 @@ -148,12 +142,11 @@ 53.73 join = null; 53.74 parent = null; 53.75 query = null; 53.76 - } 53.77 + } 53.78 53.79 @Override 53.80 - public void meet(GeneralDBHashColumn node) 53.81 - throws RuntimeException 53.82 - { 53.83 + public void meet(GeneralDBHashColumn node) throws RuntimeException 53.84 + { 53.85 if (hashes == null || hashes.getName() == null) { 53.86 super.meet(node); 53.87 } 53.88 @@ -163,22 +156,20 @@ 53.89 String tableName = hashes.getName(); 53.90 join(var, alias, tableName, false); 53.91 } 53.92 - } 53.93 + } 53.94 53.95 @Override 53.96 - public void meet(GeneralDBBNodeColumn node) 53.97 - throws RuntimeException 53.98 - { 53.99 + public void meet(GeneralDBBNodeColumn node) throws RuntimeException 53.100 + { 53.101 GeneralDBColumnVar var = node.getRdbmsVar(); 53.102 String alias = "b" + getDBName(var); 53.103 String tableName = bnodes.getName(); 53.104 join(var, alias, tableName); 53.105 - } 53.106 + } 53.107 53.108 @Override 53.109 - public void meet(GeneralDBDatatypeColumn node) 53.110 - throws RuntimeException 53.111 - { 53.112 + public void meet(GeneralDBDatatypeColumn node) throws RuntimeException 53.113 + { 53.114 GeneralDBColumnVar var = node.getRdbmsVar(); 53.115 //XXX If spatial, I don't want this action to take place 53.116 if(!var.isSpatial() && !var.isTemporal()) 53.117 @@ -187,12 +178,11 @@ 53.118 String tableName = literals.getDatatypeTable().getName(); 53.119 join(var, alias, tableName); 53.120 } 53.121 - } 53.122 + } 53.123 53.124 @Override 53.125 - public void meet(GeneralDBDateTimeColumn node) 53.126 - throws RuntimeException 53.127 - { 53.128 + public void meet(GeneralDBDateTimeColumn node) throws RuntimeException 53.129 + { 53.130 GeneralDBColumnVar var = node.getRdbmsVar(); 53.131 String alias = "t" + getDBName(var); 53.132 String tableName = literals.getDateTimeTable().getName(); 53.133 @@ -207,15 +197,14 @@ 53.134 * -> Reverting this in GeneralDBSqlJoinBuilder. The join actually 53.135 * executed will be LEFT after all 53.136 */ 53.137 - join(var, alias, tableName,false); 53.138 - } 53.139 + join(var, alias, tableName, false); 53.140 + } 53.141 53.142 53.143 //Careful! Changes at the alias' name can cause great problems in the query plan! 53.144 @Override 53.145 - public void meet(GeneralDBLabelColumn node) 53.146 - throws RuntimeException 53.147 - { 53.148 + public void meet(GeneralDBLabelColumn node) throws RuntimeException 53.149 + { 53.150 GeneralDBColumnVar var = node.getRdbmsVar(); 53.151 // 53.152 String alias = "l" + getDBName(var); 53.153 @@ -224,13 +213,29 @@ 53.154 53.155 if(var.isSpatial()) 53.156 { 53.157 - //FIXME temporary try 53.158 - //String alias = ""+getDBName(var).subSequence(1, getDBName(var).length()); 53.159 - tableName = "geo_values"; 53.160 //I don't need a left join in this case! Substituting with inner join! 53.161 - //join(var, alias, tableName); 53.162 - join(var,alias,tableName,false); 53.163 - 53.164 + join(var, alias, "geo_values", false); 53.165 + 53.166 + // check whether we are going to project to a geometry value 53.167 + // and if so, add a join with datatype_values, so that we retrieve 53.168 + // the datatype of the geometry as well (see bug #71) 53.169 + if (query.getProjections().contains(var)) { 53.170 + //System.out.println("We will project on a geometry: " + var); 53.171 + 53.172 + String dtAlias = "d" + getDBName(var); 53.173 + if (!isJoined(dtAlias)) { // if this is the first time we do this 53.174 + // carry also the datatype of the geometry 53.175 + GeneralDBFromItem valueJoin = valueJoin(dtAlias, 53.176 + literals.getDatatypeTable().getName(), 53.177 + var, 53.178 + false); 53.179 + 53.180 + // we should add the join to the parent, because geo_values might 53.181 + // be joining through another table (e.g., asWKT) 53.182 + parent.addJoin(valueJoin); 53.183 + 53.184 + } 53.185 + } 53.186 } 53.187 else if(var.isTemporal()) 53.188 { 53.189 @@ -244,7 +249,7 @@ 53.190 join(var, alias, tableName); 53.191 } 53.192 53.193 - } 53.194 + } 53.195 53.196 @Override 53.197 public void meet(GeneralDBLongLabelColumn node) 53.198 @@ -291,14 +296,13 @@ 53.199 } 53.200 53.201 @Override 53.202 - public void meet(GeneralDBURIColumn node) 53.203 - throws RuntimeException 53.204 - { 53.205 + public void meet(GeneralDBURIColumn node) throws RuntimeException 53.206 + { 53.207 GeneralDBColumnVar var = node.getRdbmsVar(); 53.208 String alias = "u" + getDBName(var); 53.209 String tableName = uris.getShortTableName(); 53.210 join(var, alias, tableName); 53.211 - } 53.212 + } 53.213 53.214 private CharSequence getDBName(GeneralDBColumnVar var) { 53.215 String name = var.getName(); 53.216 @@ -351,7 +355,6 @@ 53.217 else { 53.218 parent.addJoinBefore(valueJoin, join); 53.219 } 53.220 - 53.221 } 53.222 } 53.223
54.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/GeoValueTable.java Wed Sep 10 12:37:29 2014 +0200 54.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/GeoValueTable.java Wed Sep 24 18:44:26 2014 +0300 54.3 @@ -33,13 +33,6 @@ 54.4 54.5 private static final String[] PKEY = { "id" }; 54.6 54.7 - //used to be named "value" 54.8 - //private static final String[] VALUE_INDEX = { "original" }; 54.9 - 54.10 - //private static final String[] MINIMUM_BOUNDING_BOX = { "value" }; 54.11 - 54.12 - private static final String[] CONSTRAINT = { "constr" }; 54.13 - 54.14 private int length = -1; 54.15 54.16 private int sqlType; 54.17 @@ -181,88 +174,21 @@ 54.18 table.close(); 54.19 } 54.20 54.21 - 54.22 /** 54.23 - * FIXME careful here !!!!!!!!!!!! 54.24 - * this is the one I am using 54.25 + * Stores the given tuple into the geo_values table. 54.26 + * 54.27 + * @param id hash 54.28 + * @param srid a *PostGIS/MonetDB* EPSG code 54.29 + * @param geom the geometry in bytes expressed in the above srid 54.30 + * @param originalSRID the official SRID of this geometry (e.g., EPSG:4326 lat/long, the custom 66666 WGS84 long/lat) 54.31 + * 54.32 + * @throws SQLException 54.33 + * @throws InterruptedException 54.34 + * @throws NullPointerException 54.35 */ 54.36 - 54.37 - /** 54.38 - * 54.39 - * @param constraint the field contained in "value" --> currently string 54.40 - * @param geom the field contained in "strdfgeo" 54.41 - */ 54.42 - // public synchronized void insert(Number id, /*String constraint,*/ Timestamp interval_start, Timestamp interval_end, byte[] geom) 54.43 - // throws SQLException, InterruptedException 54.44 - // { 54.45 - // /*ValueBatch batch = getValueBatch(); 54.46 - // if (isExpired(batch)) { 54.47 - // batch = newValueBatch(); 54.48 - // initBatch(batch); 54.49 - // } 54.50 - // batch.setObject(1, id); 54.51 - // batch.setObject(2, value); 54.52 - // batch.setObject(3, constraint); 54.53 - // batch.setString(4, mbb); 54.54 - // 54.55 - // batch.addBatch(); 54.56 - // queue(batch); 54.57 - // */ 54.58 - // //tests 54.59 - // 54.60 - //// if (geom.equals("")) { 54.61 - //// throw new SQLException("The formula does not describe a finite point set."); 54.62 - //// } 54.63 - // 54.64 - //// if (geom.equals(ConvexPolyhedron.INCONSISTENT)) { 54.65 - // if (geom.length==0) { 54.66 - // String psqlInsertLine = "INSERT INTO geo_values (id, interval_start, interval_end,strdfgeo) VALUES (?, ? , ?, NULL)"; 54.67 - // Connection conn = table.getConnection(); 54.68 - // PreparedStatement insertStmt = conn.prepareStatement(psqlInsertLine); 54.69 - // 54.70 - // System.out.println("//////////////////////// INCONSISTENT" + geom); 54.71 - // 54.72 - // [B@62f4739 54.73 - // insertStmt.setLong(1, id.longValue()); 54.74 - // //insertStmt.setString(2, constraint); 54.75 - // //insertStmt.setBytes(2, constraint); 54.76 - // insertStmt.setTimestamp(2,interval_start); 54.77 - // insertStmt.setTimestamp(3,interval_end); 54.78 - // //insertStmt.setString(4, geom); 54.79 - // 54.80 - // insertStmt.executeUpdate(); 54.81 - // } else { 54.82 - // //String psqlInsertLine = "INSERT INTO geo_values (id, value,interval_start, interval_end, strdfgeo) VALUES (?, ?, ?, ?, ST_GeometryFromText(?,-1))"; 54.83 - // String psqlInsertLine = "INSERT INTO geo_values (id, interval_start, interval_end, strdfgeo) VALUES (?, ?, ?, ST_GeomFromWKB(?,-1))"; 54.84 - // 54.85 - // Connection conn = table.getConnection(); 54.86 - // PreparedStatement insertStmt = conn.prepareStatement(psqlInsertLine); 54.87 - // 54.88 - // //System.out.println("//////////////////////// STR " + value); 54.89 - // //System.out.println("//////////////////////// GEOM " + geom); 54.90 - // 54.91 - // insertStmt.setLong(1, id.longValue()); 54.92 - // //insertStmt.setString(2, value); 54.93 - // //insertStmt.setString(2, constraint); 54.94 - // //insertStmt.setBytes(2, constraint); 54.95 - // 54.96 - // insertStmt.setTimestamp(2,interval_start); 54.97 - // insertStmt.setTimestamp(3,interval_end); 54.98 - // 54.99 - // 54.100 - // //insertStmt.setString(5, geom);//not using wkt any more -switched to WKB 54.101 - // insertStmt.setBytes(4, geom); 54.102 - // 54.103 - // insertStmt.executeUpdate(); 54.104 - // } 54.105 - // } 54.106 - 54.107 - 54.108 public synchronized void insert(Number id, Integer srid,/*String constraint, Timestamp interval_start, Timestamp interval_end,*/ byte[] geom) 54.109 throws SQLException, InterruptedException, NullPointerException 54.110 { 54.111 - 54.112 - 54.113 ValueBatch batch = getValueBatch(); 54.114 if (isExpired(batch)) { 54.115 batch = newValueBatch(); 54.116 @@ -272,10 +198,9 @@ 54.117 //batch.setObject(2, interval_start); 54.118 //batch.setObject(3, interval_end); 54.119 54.120 - 54.121 if(geom.length==0) 54.122 { 54.123 - batch.setObject(2,null); 54.124 + batch.setObject(2, null); 54.125 } 54.126 else 54.127 { 54.128 @@ -284,7 +209,7 @@ 54.129 // String hexString = new String(Hex.encodeHex(geom)); 54.130 // System.err.println(id+", "+hexString); 54.131 /// 54.132 - batch.setBytes(2,geom); 54.133 + batch.setBytes(2, geom); 54.134 } 54.135 batch.setObject(3, srid); //adding original srid-constant 54.136 batch.setObject(4, srid); 54.137 @@ -294,30 +219,6 @@ 54.138 54.139 } 54.140 54.141 - /** 54.142 - * FIXME careful here 54.143 - * Haven't used it yet 54.144 - */ 54.145 - /*public synchronized void insert(Number id, Number value, String strdfgeo, byte[] constraint) 54.146 - throws SQLException, InterruptedException 54.147 - { 54.148 - ValueBatch batch = getValueBatch(); 54.149 - if (isExpired(batch)) { 54.150 - batch = newValueBatch(); 54.151 - initBatch(batch); 54.152 - } 54.153 - batch.setObject(1, id); 54.154 - //batch.setObject(2, value); 54.155 - batch.setObject(2, constraint); 54.156 - batch.setString(3, strdfgeo); 54.157 - //batch.setString(4, constraint); 54.158 - 54.159 - batch.addBatch(); 54.160 - queue(batch); 54.161 - 54.162 - 54.163 - }*/ 54.164 - 54.165 public ValueBatch getValueBatch() { 54.166 return this.batch; 54.167 }
55.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java Wed Sep 10 12:37:29 2014 +0200 55.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java Wed Sep 24 18:44:26 2014 +0300 55.3 @@ -14,6 +14,7 @@ 55.4 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 55.5 import eu.earthobservatory.constants.TemporalConstants; 55.6 import org.openrdf.query.algebra.evaluation.util.JTSWrapper; 55.7 +import org.openrdf.sail.generaldb.managers.LiteralManager; 55.8 import org.slf4j.Logger; 55.9 import org.slf4j.LoggerFactory; 55.10 55.11 @@ -199,42 +200,17 @@ 55.12 } 55.13 55.14 55.15 - /********************************************************************/ 55.16 - public void insertGeoSpatial(Number id, String label, String datatype,Timestamp start,Timestamp end) throws SQLException, InterruptedException 55.17 - { 55.18 - 55.19 - byte[] geomWKB = null; 55.20 - 55.21 - try { 55.22 - 55.23 - /***XXX new stuff dictated by kkyzir's StrabonPolyhedron - will be added when the functionality is complete***/ 55.24 - StrabonPolyhedron polyhedron = new StrabonPolyhedron(label); 55.25 - geomWKB = polyhedron.toByteArray(); 55.26 - 55.27 - 55.28 - } catch (IllegalArgumentException e) { 55.29 - e.printStackTrace(); 55.30 - } catch (Exception e) { 55.31 - throw new SQLException("An issue occurred in the underlying StrabonPolyhedron's constructor!"); 55.32 - 55.33 - } 55.34 - 55.35 - //Removed 'value' field 55.36 - Integer srid= findSRID(label); 55.37 - geoSpatialTable.insert(id,srid/*,start,end*/, geomWKB); 55.38 - 55.39 - //XXX not needed currently because this method is called AFTER an insertDatatype() 55.40 - // insertSimple(id, label); 55.41 - // datatypes.insert(id, datatype); 55.42 - } 55.43 - 55.44 //the new version will actually deal with WKB 55.45 - public void insertWKT(Number id, String label, String datatype, Timestamp start,Timestamp end) throws SQLException, NullPointerException,InterruptedException,IllegalArgumentException 55.46 + public void insertWKT(Number id, String label, String datatype, Timestamp start, Timestamp end) throws SQLException, NullPointerException,InterruptedException,IllegalArgumentException 55.47 { 55.48 try { 55.49 + JTSWrapper JTS = JTSWrapper.getInstance(); 55.50 + 55.51 AbstractWKT awkt = new AbstractWKT(label, datatype); 55.52 - Geometry geom = JTSWrapper.getInstance().WKTread(awkt.getWKT()); 55.53 - geoSpatialTable.insert(id, awkt.getSRID(),/* start,end,*/ JTSWrapper.getInstance().WKBwrite(geom)); 55.54 + Geometry geom = JTS.WKTread(awkt.getWKT()); 55.55 + int srid = awkt.getSRID(); 55.56 + 55.57 + geoSpatialTable.insert(id, srid, /*start,end,*/ JTS.WKBwrite(geom)); 55.58 55.59 } catch (ParseException e) { 55.60 throw new IllegalArgumentException(e); 55.61 @@ -311,47 +287,4 @@ 55.62 55.63 return bool; 55.64 } 55.65 - 55.66 - 55.67 - 55.68 - public static Integer findSRID(String label){ 55.69 - String[] crs=label.split(";"); 55.70 - String crsUri=null; 55.71 - 55.72 - if((crs.length == 1)) 55.73 - { 55.74 - if(label.contains("gml")) 55.75 - { 55.76 - try { 55.77 - StrabonPolyhedron poly = new StrabonPolyhedron(label); 55.78 - if(poly.getGeometry().getSRID()>0) 55.79 - return poly.getGeometry().getSRID(); 55.80 - } catch (Exception e) { 55.81 - // TODO Auto-generated catch block 55.82 - e.printStackTrace(); 55.83 - } 55.84 - 55.85 - } 55.86 - else 55.87 - { 55.88 - return 4326; 55.89 - } 55.90 - } 55.91 - else 55.92 - crsUri = crs[1]; 55.93 - 55.94 - String prefix="http://www.opengis.net/def/crs/EPSG/0/"; 55.95 - if(crsUri.startsWith(prefix)){ 55.96 - int index=crsUri.lastIndexOf('/'); 55.97 - index++; 55.98 - Integer srid = Integer.parseInt(crsUri.substring(index)); 55.99 - //System.out.println("The EPSG code: " + srid); 55.100 - 55.101 - //System.out.println("SRS FOUND:"+srid); 55.102 - return srid; 55.103 - }else{ 55.104 - throw new IllegalArgumentException("MALFORMED URI FOR SRID!!!"); 55.105 - 55.106 - } 55.107 } 55.108 -}
56.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBSqlTable.java Wed Sep 10 12:37:29 2014 +0200 56.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBSqlTable.java Wed Sep 24 18:44:26 2014 +0300 56.3 @@ -9,15 +9,16 @@ 56.4 56.5 import org.openrdf.sail.generaldb.GeneralDBSqlTable; 56.6 56.7 -import eu.earthobservatory.constants.GeoConstants; 56.8 - 56.9 /** 56.10 * 56.11 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 56.12 * @author George Garbis <ggarbis@di.uoa.gr> 56.13 - * 56.14 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 56.15 */ 56.16 public class MonetDBSqlTable extends GeneralDBSqlTable { 56.17 56.18 + public static final int DEFAULT_SRID = 4326; 56.19 + 56.20 public MonetDBSqlTable(String name) { 56.21 super(name.toLowerCase()); 56.22 } 56.23 @@ -48,8 +49,7 @@ 56.24 56.25 @Override 56.26 public String buildInsertGeometryValue() { 56.27 - Integer srid= GeoConstants.defaultSRID; 56.28 - return " (id, strdfgeo,srid) VALUES (CAST(? AS INTEGER), Transform(GeomFromWKB(CAST(? AS BLOB),CAST(? AS INTEGER)),"+srid+"), CAST(? AS INTEGER))"; 56.29 + return " (id, strdfgeo, srid) VALUES (CAST(? AS INTEGER), Transform(GeomFromWKB(CAST(? AS BLOB), CAST(? AS INTEGER)),"+DEFAULT_SRID+"), CAST(? AS INTEGER))"; 56.30 } 56.31 56.32 @Override
57.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java Wed Sep 10 12:37:29 2014 +0200 57.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java Wed Sep 24 18:44:26 2014 +0300 57.3 @@ -9,12 +9,13 @@ 57.4 import java.util.List; 57.5 57.6 import org.openrdf.query.algebra.QueryModelNode; 57.7 -import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 57.8 +import org.openrdf.query.algebra.evaluation.function.spatial.AbstractWKT; 57.9 import org.openrdf.sail.generaldb.algebra.GeneralDBColumnVar; 57.10 import org.openrdf.sail.generaldb.algebra.GeneralDBDoubleValue; 57.11 import org.openrdf.sail.generaldb.algebra.GeneralDBLabelColumn; 57.12 import org.openrdf.sail.generaldb.algebra.GeneralDBNumericColumn; 57.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbove; 57.14 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbstractGeoSrid; 57.15 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnd; 57.16 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlBelow; 57.17 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 57.18 @@ -37,6 +38,7 @@ 57.19 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIntersection; 57.20 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsEmpty; 57.21 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsSimple; 57.22 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSPARQLSrid; 57.23 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid; 57.24 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSymDifference; 57.25 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 57.26 @@ -391,9 +393,8 @@ 57.27 57.28 //FIXME my addition from here on 57.29 @Override 57.30 - public GeneralDBQueryBuilder construct(GeneralDBSqlExpr expr) 57.31 - throws UnsupportedRdbmsOperatorException 57.32 - { 57.33 + public GeneralDBQueryBuilder construct(GeneralDBSqlExpr expr) throws UnsupportedRdbmsOperatorException 57.34 + { 57.35 if(!(expr instanceof GeneralDBSqlSpatialMetricBinary) 57.36 &&!(expr instanceof GeneralDBSqlSpatialMetricUnary) 57.37 &&!(expr instanceof GeneralDBSqlMathExpr) 57.38 @@ -417,7 +418,7 @@ 57.39 57.40 //SRID support must be explicitly added! 57.41 return this; 57.42 - } 57.43 + } 57.44 57.45 57.46 @Override 57.47 @@ -833,13 +834,27 @@ 57.48 appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_AsGML); 57.49 } 57.50 57.51 + /** 57.52 + * This will call the method below: 57.53 + * {@link org.openrdf.sail.postgis.evaluation.MonetDBQueryBuilder.append#(org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid, org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder)} 57.54 + */ 57.55 @Override 57.56 - protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 57.57 - throws UnsupportedRdbmsOperatorException 57.58 - { 57.59 + protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 57.60 + appendSrid(expr, filter); 57.61 + } 57.62 + 57.63 + /** 57.64 + * This will call the method below: 57.65 + * {@link org.openrdf.sail.postgis.evaluation.MonetDBQueryBuilder.append#(org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid, org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder)} 57.66 + */ 57.67 + @Override 57.68 + protected void append(GeneralDBSqlGeoSPARQLSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 57.69 + appendSrid(expr, filter); 57.70 + } 57.71 + 57.72 + protected void appendSrid(GeneralDBSqlAbstractGeoSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 57.73 + { 57.74 // appendMonetDBSpatialFunctionUnary(expr, filter, SpatialFunctionsMonetDB.ST_SRID); 57.75 - 57.76 - boolean sridNeeded = true; 57.77 filter.openBracket(); 57.78 57.79 boolean check1 = expr.getArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 57.80 @@ -879,15 +894,7 @@ 57.81 { 57.82 child = ((UnaryGeneralDBOperator) tmp).getArg(); 57.83 } 57.84 - else if(tmp instanceof GeneralDBStringValue) 57.85 - { 57.86 - //Constant!! 57.87 - sridNeeded = false; 57.88 - break; 57.89 - } 57.90 - 57.91 - tmp = child; 57.92 - if(tmp instanceof GeneralDBLabelColumn) 57.93 + else if(tmp instanceof GeneralDBLabelColumn) 57.94 { 57.95 //Reached the innermost left var -> need to capture its SRID 57.96 String alias; 57.97 @@ -909,51 +916,43 @@ 57.98 } 57.99 else if(tmp instanceof GeneralDBStringValue) 57.100 { 57.101 - //Constant!! 57.102 - sridNeeded = false; 57.103 + // see why at PostGISQueryBuilder.appendSrid 57.104 break; 57.105 } 57.106 - 57.107 + 57.108 + tmp = child; 57.109 } 57.110 } 57.111 57.112 - if(sridNeeded) 57.113 + filter.appendFunction("ST_SRID"); 57.114 + filter.openBracket(); 57.115 + if(expr.getArg() instanceof GeneralDBStringValue) 57.116 { 57.117 - filter.appendFunction("ST_SRID"); 57.118 - filter.openBracket(); 57.119 - if(expr.getArg() instanceof GeneralDBStringValue) 57.120 - { 57.121 - appendWKT(expr.getArg(),filter); 57.122 - } 57.123 - else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructBinary) 57.124 - { 57.125 - appendConstructFunction(expr.getArg(), filter); 57.126 - } 57.127 - else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructUnary) 57.128 - { 57.129 - appendConstructFunction(expr.getArg(), filter); 57.130 - } 57.131 - else if(expr.getArg() instanceof GeneralDBSqlCase) 57.132 - { 57.133 - GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getArg()).getEntries().get(0).getResult(); 57.134 - appendMBB(onlyLabel,filter); 57.135 - } 57.136 - else 57.137 - { 57.138 - appendMBB((GeneralDBLabelColumn)(expr.getArg()),filter); 57.139 - } 57.140 - 57.141 - filter.closeBracket(); 57.142 + appendWKT(expr.getArg(),filter); 57.143 + } 57.144 + else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructBinary) 57.145 + { 57.146 + appendConstructFunction(expr.getArg(), filter); 57.147 + } 57.148 + else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructUnary) 57.149 + { 57.150 + appendConstructFunction(expr.getArg(), filter); 57.151 + } 57.152 + else if(expr.getArg() instanceof GeneralDBSqlCase) 57.153 + { 57.154 + GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getArg()).getEntries().get(0).getResult(); 57.155 + appendMBB(onlyLabel,filter); 57.156 } 57.157 else 57.158 { 57.159 - //4326 by default - Software House additions 57.160 - filter.append(String.valueOf(GeoConstants.defaultSRID)); 57.161 + appendMBB((GeneralDBLabelColumn)(expr.getArg()),filter); 57.162 } 57.163 + 57.164 + filter.closeBracket(); 57.165 } 57.166 57.167 filter.closeBracket(); 57.168 - } 57.169 + } 57.170 57.171 @Override 57.172 protected void append(GeneralDBSqlGeoIsSimple expr, GeneralDBSqlExprBuilder filter) 57.173 @@ -980,14 +979,8 @@ 57.174 GeneralDBStringValue arg = (GeneralDBStringValue) expr; 57.175 String raw = arg.getValue(); 57.176 57.177 - StrabonPolyhedron poly = null; 57.178 - try{ 57.179 - poly = new StrabonPolyhedron(raw); 57.180 - } catch (Exception e) { 57.181 - e.printStackTrace(); 57.182 - } 57.183 - 57.184 - filter.append(" GeomFromText('"+poly.toWKT() +"',"+String.valueOf(GeoConstants.defaultSRID)+")"); 57.185 + AbstractWKT wkt = new AbstractWKT(raw); 57.186 + filter.append(" GeomFromText('" + wkt.getWKT() + "'," + String.valueOf(GeoConstants.defaultSRID) + ")"); 57.187 57.188 return raw; 57.189 }
58.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java Wed Sep 10 12:37:29 2014 +0200 58.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java Wed Sep 24 18:44:26 2014 +0300 58.3 @@ -19,8 +19,8 @@ 58.4 /** 58.5 * Converts a {@link ResultSet} into a {@link BindingSet} in an iteration. 58.6 * 58.7 - * @author James Leigh 58.8 - * 58.9 + * @author Charalampos Nikolaou <charnik@di.uoa.gr. 58.10 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 58.11 */ 58.12 public class MonetDBBindingIteration extends GeneralDBBindingIteration { 58.13 58.14 @@ -39,8 +39,8 @@ 58.15 Blob labelBlob = rs.getBlob(index + 1); 58.16 byte[] label = labelBlob.getBytes((long)1, (int)labelBlob.length()); 58.17 int srid = rs.getInt(index + 2); 58.18 - return vf.getRdbmsPolyhedron(id, GeoConstants.WKT, label, srid); 58.19 - 58.20 + String datatype = rs.getString(index + 3); 58.21 + return vf.getRdbmsPolyhedron(id, datatype, label, srid); 58.22 } 58.23 58.24 return createResource(rs, index); 58.25 @@ -63,7 +63,7 @@ 58.26 Blob labelBlob = rs.getBlob(index + 1); 58.27 byte[] label = labelBlob.getBytes((long)1, (int)labelBlob.length()); 58.28 int srid = rs.getInt(index + 2); 58.29 - return vf.getRdbmsPolyhedron(114, GeoConstants.WKT, label, srid); 58.30 + return vf.getRdbmsPolyhedron(114, GeoConstants.WKTLITERAL, label, srid); 58.31 } 58.32 58.33 @Override
59.1 --- a/pom.xml Wed Sep 10 12:37:29 2014 +0200 59.2 +++ b/pom.xml Wed Sep 24 18:44:26 2014 +0300 59.3 @@ -487,11 +487,14 @@ 59.4 <version>${geotools.version}</version> 59.5 </dependency> 59.6 59.7 + <!-- 59.8 + One epsg jar file suffices. Read this: http://docs.geotools.org/latest/userguide/faq.html#q-how-to-choose-an-epsg-authority 59.9 <dependency> 59.10 <groupId>org.geotools</groupId> 59.11 <artifactId>gt-epsg-wkt</artifactId> 59.12 <version>${geotools.version}</version> 59.13 </dependency> 59.14 + --> 59.15 59.16 <dependency> 59.17 <groupId>org.geotools</groupId> 59.18 @@ -757,6 +760,44 @@ 59.19 <skipTests>${skipTests}</skipTests> 59.20 </configuration> 59.21 </plugin> 59.22 + 59.23 +<!-- <plugin> 59.24 + <artifactId>jdeb</artifactId> 59.25 + <groupId>org.vafer</groupId> 59.26 + <version>1.3</version> 59.27 + <executions> 59.28 + <execution> 59.29 + <phase>package</phase> 59.30 + <goals> 59.31 + <goal>jdeb</goal> 59.32 + </goals> 59.33 + <configuration> 59.34 + <dataSet> 59.35 + <data> 59.36 + <src>${project.build.directory}/${project.build.finalName}.jar</src> 59.37 + <type>file</type> 59.38 + <mapper> 59.39 + <type>perm</type> 59.40 + <prefix>/usr/share/jdeb/lib</prefix> 59.41 + </mapper> 59.42 + </data> 59.43 + <data> 59.44 + <src>${project.build.directory}/strabon-endpoint</src> 59.45 + <type>file</type> 59.46 + <mapper> 59.47 + <type>perm</type> 59.48 + <prefix>/usr/local/bin</prefix> 59.49 + <user>root</user> 59.50 + <group>root</group> 59.51 + <filemode>755</filemode> 59.52 + </mapper> 59.53 + </data> 59.54 + </dataSet> 59.55 + </configuration> 59.56 + </execution> 59.57 + </executions> 59.58 + </plugin> 59.59 +--> 59.60 </plugins> 59.61 </build> 59.62 59.63 @@ -771,6 +812,7 @@ 59.64 <encoding>utf8</encoding> 59.65 </configuration> 59.66 </plugin> 59.67 + 59.68 <!-- 59.69 <plugin> 59.70 <groupId>org.apache.maven.plugins</groupId> 59.71 @@ -828,11 +870,13 @@ 59.72 <system>Trac</system> 59.73 <url>http://bug.strabon.di.uoa.gr/</url> 59.74 </issueManagement> 59.75 - 59.76 + 59.77 + <!-- TODO: update this 59.78 <ciManagement> 59.79 <system>Jekins - Continuous Integration System</system> 59.80 <url>http://test.strabon.di.uoa.gr/cis</url> 59.81 </ciManagement> 59.82 + --> 59.83 59.84 <mailingLists> 59.85 <mailingList> 59.86 @@ -887,17 +931,17 @@ 59.87 <name>Strabon - maven repository - snapshots</name> 59.88 <url>http://maven.strabon.di.uoa.gr/content/repositories/snapshots</url> 59.89 </repository> 59.90 - <repository> 59.91 - <releases> 59.92 - <enabled>true</enabled> 59.93 - </releases> 59.94 - <snapshots> 59.95 - <enabled>false</enabled> 59.96 - </snapshots> 59.97 - <id>strabon.sesame</id> 59.98 - <name>Strabon - maven repository - sesame artifacts (temporary)</name> 59.99 - <url>http://maven.strabon.di.uoa.gr/content/repositories/strabon.sesame/</url> 59.100 - </repository> 59.101 + <repository> 59.102 + <releases> 59.103 + <enabled>true</enabled> 59.104 + </releases> 59.105 + <snapshots> 59.106 + <enabled>false</enabled> 59.107 + </snapshots> 59.108 + <id>strabon.sesame</id> 59.109 + <name>Strabon - maven repository - sesame artifacts (temporary)</name> 59.110 + <url>http://maven.strabon.di.uoa.gr/content/repositories/strabon.sesame/</url> 59.111 + </repository> 59.112 <repository> 59.113 <releases> 59.114 <enabled>false</enabled>
60.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/PostGISSqlTable.java Wed Sep 10 12:37:29 2014 +0200 60.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/PostGISSqlTable.java Wed Sep 24 18:44:26 2014 +0300 60.3 @@ -9,16 +9,22 @@ 60.4 60.5 import org.openrdf.sail.generaldb.GeneralDBSqlTable; 60.6 60.7 -import eu.earthobservatory.constants.GeoConstants; 60.8 - 60.9 /** 60.10 * Converts table names to lower-case and include the analyse optimisation. 60.11 * 60.12 - * @author James Leigh 60.13 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 60.14 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 60.15 * 60.16 */ 60.17 public class PostGISSqlTable extends GeneralDBSqlTable { 60.18 60.19 + /** 60.20 + * This value should not be changed whatever the semantics of Strabon 60.21 + * is for EPSG:4326. This number is hardcoded in PostGIS's SQL statements 60.22 + * that define several of their ST_ methods. 60.23 + */ 60.24 + public static final int DEFAULT_SRID = 4326; 60.25 + 60.26 public PostGISSqlTable(String name) { 60.27 super(name.toLowerCase()); 60.28 } 60.29 @@ -37,7 +43,7 @@ 60.30 60.31 @Override 60.32 public String buildGeometryCollumn() { 60.33 - return "SELECT AddGeometryColumn('','geo_values','strdfgeo',4326,'GEOMETRY',2)"; 60.34 + return "SELECT AddGeometryColumn('', 'geo_values', 'strdfgeo', " + DEFAULT_SRID + ", 'GEOMETRY', 2)"; 60.35 } 60.36 60.37 @Override 60.38 @@ -46,6 +52,13 @@ 60.39 return "CREATE INDEX test_period_idx ON period_values USING GiST (period)"; 60.40 } 60.41 60.42 + /** 60.43 + * SQL arguments 60.44 + * arg1: hash 60.45 + * arg2: geometry (binary) 60.46 + * arg3: SRID of the given geometry (used to transform it to PostGIS' 4326 long/lat CRS) 60.47 + * arg4: SRID of the given geometry to save to the database 60.48 + */ 60.49 @Override 60.50 public String buildInsertPeriodValue() { 60.51 return " (id, period) VALUES (?,period_in(textout(?)))"; 60.52 @@ -54,13 +67,12 @@ 60.53 60.54 @Override 60.55 public String buildInsertGeometryValue() { 60.56 - Integer srid= GeoConstants.defaultSRID; 60.57 - return " (id, strdfgeo,srid) VALUES (?,ST_Transform(ST_GeomFromWKB(?,?),"+srid+"),?)"; 60.58 + return " (id, strdfgeo, srid) VALUES (?, ST_Transform(ST_GeomFromWKB(?, ?),"+DEFAULT_SRID+"), ?)"; 60.59 } 60.60 60.61 @Override 60.62 public String buildInsertValue(String type) { 60.63 - return " (id, value) VALUES ( ?, ?) "; 60.64 + return " (id, value) VALUES (?, ?) "; 60.65 } 60.66 60.67 @Override
61.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISEvaluation.java Wed Sep 10 12:37:29 2014 +0200 61.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISEvaluation.java Wed Sep 24 18:44:26 2014 +0300 61.3 @@ -73,6 +73,7 @@ 61.4 if (logger.isDebugEnabled()) { 61.5 logger.debug("In PostGIS Evaluation, query is: \n{}", stmt); 61.6 } 61.7 + //System.out.println(stmt); 61.8 GeneralDBBindingIteration result = new PostGISBindingIteration(stmt); 61.9 result.setProjections(proj); 61.10 result.setBindings(bindings);
62.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Wed Sep 10 12:37:29 2014 +0200 62.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Wed Sep 24 18:44:26 2014 +0300 62.3 @@ -3,7 +3,7 @@ 62.4 * License, v. 2.0. If a copy of the MPL was not distributed with this 62.5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 62.6 * 62.7 - * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 62.8 + * Copyright (C) 2010, 2011, 2012, 2013, 2014 Pyravlos Team 62.9 * 62.10 * http://www.strabon.di.uoa.gr/ 62.11 */ 62.12 @@ -20,7 +20,6 @@ 62.13 62.14 import org.openrdf.query.algebra.evaluation.function.datetime.Timezone; 62.15 import org.openrdf.query.algebra.evaluation.function.spatial.AbstractWKT; 62.16 -import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 62.17 import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 62.18 import org.openrdf.sail.generaldb.algebra.GeneralDBColumnVar; 62.19 import org.openrdf.sail.generaldb.algebra.GeneralDBDateTimeColumn; 62.20 @@ -29,6 +28,7 @@ 62.21 import org.openrdf.sail.generaldb.algebra.GeneralDBNumberValue; 62.22 import org.openrdf.sail.generaldb.algebra.GeneralDBNumericColumn; 62.23 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbove; 62.24 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbstractGeoSrid; 62.25 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnd; 62.26 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlBelow; 62.27 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 62.28 @@ -51,6 +51,8 @@ 62.29 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIntersection; 62.30 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsEmpty; 62.31 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsSimple; 62.32 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSPARQLSrid; 62.33 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSpatial; 62.34 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid; 62.35 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSymDifference; 62.36 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 62.37 @@ -127,7 +129,8 @@ 62.38 * Constructs an SQL query from {@link GeneralDBSqlExpr}s and {@link GeneralDBFromItem}s. 62.39 * 62.40 * @author Manos Karpathiotakis <mk@di.uoa.gr> 62.41 - * @Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> 62.42 + * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> 62.43 + * @author Dimitrianos Savva <dimis@di.uoa.gr> 62.44 * 62.45 */ 62.46 public class PostGISQueryBuilder extends GeneralDBQueryBuilder { 62.47 @@ -139,6 +142,7 @@ 62.48 public static final String PERIOD_COLUMN = "period"; //this is the name of the period column in period_values table 62.49 public static final String GEOGRAPHY = "Geography"; 62.50 public static final String GEOMETRY = "Geometry"; 62.51 + 62.52 public static final String PERIOD_TO_CSTRING="period_out"; //postgres temporal functions for converting period to cstring 62.53 public static final String CSTRING_TO_TEXT="textin"; //postres function for converting cstring to text 62.54 /** 62.55 @@ -279,7 +283,7 @@ 62.56 62.57 @Override 62.58 protected void append(GeneralDBLabelColumn var, GeneralDBSqlExprBuilder filter) { 62.59 - if (var.getRdbmsVar().isResource()) { 62.60 + if (var.getRdbmsVar() == null || var.getRdbmsVar().isResource()) { 62.61 filter.appendNull(); 62.62 nullLabel = true; 62.63 } 62.64 @@ -387,6 +391,7 @@ 62.65 &&!(expr instanceof GeneralDBSqlSpatialMetricUnary) 62.66 &&!(expr instanceof GeneralDBSqlMathExpr) 62.67 &&!(expr instanceof GeneralDBSqlSpatialProperty) 62.68 + && !(expr instanceof GeneralDBSqlGeoSpatial) 62.69 &&!(expr instanceof GeneralDBSqlTemporalConstructUnary) 62.70 &&!(expr instanceof GeneralDBSqlTemporalConstructBinary)) 62.71 { 62.72 @@ -404,6 +409,7 @@ 62.73 { 62.74 query.select(); 62.75 } 62.76 + 62.77 if(expr instanceof BinaryGeneralDBOperator) 62.78 { 62.79 dispatchBinarySqlOperator((BinaryGeneralDBOperator) expr, query.select); 62.80 @@ -884,30 +890,45 @@ 62.81 } 62.82 62.83 62.84 +/* 62.85 62.86 - // @Override 62.87 - // protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 62.88 - // throws UnsupportedRdbmsOperatorException 62.89 - // { 62.90 - // appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_SRID); 62.91 - // } 62.92 - 62.93 + @Override 62.94 + protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 62.95 + throws UnsupportedRdbmsOperatorException 62.96 + { 62.97 + appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_SRID); 62.98 + } 62.99 +*/ 62.100 /** 62.101 - * Special Case because I need to retrieve a single different column from geo_values when this function occurs 62.102 - * in the select clause 62.103 + * This will call the method below: 62.104 + * {@link org.openrdf.sail.postgis.evaluation.PostGISQueryBuilder.append#(org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid, org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder)} 62.105 */ 62.106 @Override 62.107 - protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 62.108 - throws UnsupportedRdbmsOperatorException 62.109 - { 62.110 - boolean sridNeeded = true; 62.111 + protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 62.112 + appendSrid(expr, filter); 62.113 + } 62.114 + 62.115 + /** 62.116 + * This will call the method below: 62.117 + * {@link org.openrdf.sail.postgis.evaluation.PostGISQueryBuilder.append#(org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid, org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder)} 62.118 + */ 62.119 + @Override 62.120 + protected void append(GeneralDBSqlGeoSPARQLSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 62.121 + appendSrid(expr, filter); 62.122 + } 62.123 + 62.124 + /** 62.125 + * Special case because I need to retrieve a single different column from geo_values when this function occurs 62.126 + * in the select clause and not call the st_srid() function, which will always give me 4326. 62.127 + */ 62.128 + protected void appendSrid(GeneralDBSqlAbstractGeoSrid expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException { 62.129 filter.openBracket(); 62.130 62.131 boolean check1 = expr.getArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 62.132 boolean check2 = false; 62.133 if(expr.getArg() instanceof GeneralDBLabelColumn) 62.134 { 62.135 - if(((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar().isResource()) 62.136 + if(((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar() == null || ((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar().isResource()) 62.137 { 62.138 check2 = true; 62.139 } 62.140 @@ -923,7 +944,7 @@ 62.141 } 62.142 else 62.143 { 62.144 - //XXX Incorporating SRID 62.145 + // Incorporating SRID 62.146 GeneralDBSqlExpr tmp = expr; 62.147 if(tmp.getParentNode() == null) 62.148 { 62.149 @@ -940,85 +961,82 @@ 62.150 { 62.151 child = ((UnaryGeneralDBOperator) tmp).getArg(); 62.152 } 62.153 - else if(tmp instanceof GeneralDBStringValue) 62.154 - { 62.155 - //Constant!! 62.156 - sridNeeded = false; 62.157 - break; 62.158 - } 62.159 - 62.160 - tmp = child; 62.161 - if(tmp instanceof GeneralDBLabelColumn) 62.162 + else if(tmp instanceof GeneralDBLabelColumn) 62.163 { 62.164 //Reached the innermost left var -> need to capture its SRID 62.165 - String alias; 62.166 - if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.167 + String colRef = null; 62.168 + String alias = null; 62.169 + if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.170 //Predicates used in triple patterns non-existent in db 62.171 - alias="NULL"; 62.172 + colRef = "NULL"; 62.173 } 62.174 else 62.175 { 62.176 //Reached the innermost left var -> need to capture its SRID 62.177 alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar()); 62.178 - alias=alias+".srid"; 62.179 + colRef = alias + ".srid"; 62.180 } 62.181 - sridExpr = alias; 62.182 + sridExpr = colRef; 62.183 + 62.184 filter.append(sridExpr); 62.185 filter.closeBracket(); 62.186 + 62.187 + if (alias != null) { // append an alias for the column of the SRID, 62.188 + // replacing the part of the name corresponding to the geo_values table 62.189 + filter.as((alias + "_srid").replace("l_", "")); 62.190 + } 62.191 + 62.192 return; 62.193 - //break; 62.194 } 62.195 else if(tmp instanceof GeneralDBStringValue) 62.196 { 62.197 - //Constant!! 62.198 - sridNeeded = false; 62.199 + // We need the srid, since this is a constant in the query, so we 62.200 + // should not return just the default SRID, but instead we should 62.201 + // determine it. 62.202 + // Computing it based on the following code using ST_SRID, ST_GeomFromText, 62.203 + // and appendWKT is not the best way, but it does the job good. 62.204 break; 62.205 } 62.206 - 62.207 + 62.208 + tmp = child; 62.209 } 62.210 } 62.211 62.212 - if(sridNeeded) 62.213 + // we have to compute it 62.214 + filter.appendFunction("ST_SRID"); 62.215 + filter.openBracket(); 62.216 + 62.217 + if(expr.getArg() instanceof GeneralDBStringValue) 62.218 { 62.219 - filter.appendFunction("ST_SRID"); 62.220 - filter.openBracket(); 62.221 - if(expr.getArg() instanceof GeneralDBStringValue) 62.222 - { 62.223 - appendWKT(expr.getArg(),filter); 62.224 - } 62.225 - else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructBinary) 62.226 - { 62.227 - appendConstructFunction(expr.getArg(), filter); 62.228 - } 62.229 - else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructUnary) 62.230 - { 62.231 - appendConstructFunction(expr.getArg(), filter); 62.232 - } 62.233 - else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructTriple) 62.234 - { 62.235 - appendConstructFunction(expr.getArg(), filter); 62.236 - } 62.237 - else if(expr.getArg() instanceof GeneralDBSqlCase) 62.238 - { 62.239 - GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getArg()).getEntries().get(0).getResult(); 62.240 - appendMBB(onlyLabel,filter); 62.241 - } 62.242 - else 62.243 - { 62.244 - appendMBB((GeneralDBLabelColumn)(expr.getArg()),filter); 62.245 - } 62.246 - 62.247 - filter.closeBracket(); 62.248 + appendWKT(expr.getArg(),filter); 62.249 + } 62.250 + else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructBinary) 62.251 + { 62.252 + appendConstructFunction(expr.getArg(), filter); 62.253 + } 62.254 + else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructUnary) 62.255 + { 62.256 + appendConstructFunction(expr.getArg(), filter); 62.257 + } 62.258 + else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructTriple) 62.259 + { 62.260 + appendConstructFunction(expr.getArg(), filter); 62.261 + } 62.262 + else if(expr.getArg() instanceof GeneralDBSqlCase) 62.263 + { 62.264 + GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getArg()).getEntries().get(0).getResult(); 62.265 + appendMBB(onlyLabel, filter); 62.266 } 62.267 else 62.268 { 62.269 - // set default SRID ({@link GeoConstants#defaultSRID}) 62.270 - filter.append(String.valueOf(GeoConstants.defaultSRID)); 62.271 + appendMBB((GeneralDBLabelColumn)(expr.getArg()),filter); 62.272 } 62.273 + 62.274 + filter.closeBracket(); 62.275 } 62.276 - 62.277 + 62.278 filter.closeBracket(); 62.279 - } 62.280 + } 62.281 62.282 @Override 62.283 protected void append(GeneralDBSqlGeoIsSimple expr, GeneralDBSqlExprBuilder filter) 62.284 @@ -1037,27 +1055,18 @@ 62.285 62.286 /** 62.287 * 'helper' functions 62.288 + * @throws UnsupportedRdbmsOperatorException 62.289 */ 62.290 - 62.291 @Override 62.292 - protected String appendWKT(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter) 62.293 + protected String appendWKT(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 62.294 { 62.295 GeneralDBStringValue arg = (GeneralDBStringValue) expr; 62.296 String raw = arg.getValue(); 62.297 - 62.298 - StrabonPolyhedron poly = null; 62.299 - try{ 62.300 - // have to parse it before and clean it from possible appearance of CRS 62.301 - AbstractWKT wkt = new AbstractWKT(raw); 62.302 - 62.303 - poly = new StrabonPolyhedron(wkt.getWKT()); 62.304 - 62.305 - filter.append(" ST_GeomFromText('"+poly.toWKT() +"',"+String.valueOf(wkt.getSRID())+")"); 62.306 - 62.307 - } catch (Exception e) { 62.308 - e.printStackTrace(); 62.309 - } 62.310 - 62.311 + 62.312 + // parse raw WKT 62.313 + AbstractWKT wkt = new AbstractWKT(raw); 62.314 + filter.append(" ST_GeomFromText('" + wkt.getWKT() + "'," + String.valueOf(wkt.getSRID()) + ")"); 62.315 + 62.316 return raw; 62.317 } 62.318 62.319 @@ -1452,7 +1461,7 @@ 62.320 62.321 boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 62.322 boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 62.323 - 62.324 + 62.325 if(check1) 62.326 { 62.327 this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 62.328 @@ -1484,7 +1493,7 @@ 62.329 if(tmp instanceof GeneralDBLabelColumn) 62.330 { 62.331 String alias; 62.332 - if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.333 + if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.334 //Predicates used in triple patterns non-existent in db 62.335 alias="NULL"; 62.336 } 62.337 @@ -1497,7 +1506,7 @@ 62.338 sridExpr = alias; 62.339 break; 62.340 } 62.341 - else if (tmp instanceof GeneralDBStringValue) //Constant!! 62.342 + else if (tmp instanceof GeneralDBStringValue) // constant!! 62.343 { 62.344 sridNeeded = false; 62.345 sridExpr = String.valueOf(WKTHelper.getSRID(((GeneralDBStringValue) tmp).getValue())); 62.346 @@ -1567,10 +1576,9 @@ 62.347 filter.keepSRID_part3(); 62.348 } 62.349 else if(expr.getRightArg() instanceof GeneralDBStringValue) 62.350 - { 62.351 - String unparsedSRID = ((GeneralDBStringValue)expr.getRightArg()).getValue(); 62.352 - // TODO Check for other kinds of URIs (e.g., not only for EPSG) 62.353 - sridExpr = String.valueOf(WKTHelper.getSRID(unparsedSRID)); 62.354 + { // the argument is the URI of a CRS 62.355 + String unparsedCRS = ((GeneralDBStringValue)expr.getRightArg()).getValue(); 62.356 + sridExpr = String.valueOf(WKTHelper.getSRID_forURI(unparsedCRS)); 62.357 filter.append(sridExpr); 62.358 filter.closeBracket(); 62.359 } 62.360 @@ -1633,7 +1641,7 @@ 62.361 { 62.362 //Reached the innermost left var -> need to capture its SRID 62.363 String alias; 62.364 - if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.365 + if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.366 //Predicates used in triple patterns non-existent in db 62.367 alias="NULL"; 62.368 } 62.369 @@ -1934,7 +1942,7 @@ 62.370 { 62.371 //Reached the innermost left var -> need to capture its SRID 62.372 String alias; 62.373 - if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.374 + if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.375 //Predicates used in triple patterns non-existent in db 62.376 alias="NULL"; 62.377 } 62.378 @@ -2331,7 +2339,7 @@ 62.379 { 62.380 //Reached the innermost left var -> need to capture its SRID 62.381 String alias; 62.382 - if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.383 + if (((GeneralDBLabelColumn) tmp).getRdbmsVar()==null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.384 //Predicates used in triple patterns non-existent in db 62.385 alias="NULL"; 62.386 } 62.387 @@ -2538,7 +2546,7 @@ 62.388 boolean check2 = false; 62.389 if(expr.getArg() instanceof GeneralDBLabelColumn) 62.390 { 62.391 - if(((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar().isResource()) 62.392 + if(((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar() ==null || ((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar().isResource()) 62.393 { 62.394 check2 = true; 62.395 } 62.396 @@ -2576,13 +2584,17 @@ 62.397 sridNeeded = false; 62.398 break; 62.399 } 62.400 + else if (tmp instanceof GeneralDBSqlSpatialConstructTriple) { 62.401 + //here we consider the case where the current argument is a Spatial Construct Ternary function, to dodge the infinite loop 62.402 + child = ((GeneralDBSqlSpatialConstructTriple) tmp).getLeftArg(); 62.403 + } 62.404 62.405 tmp = child; 62.406 if(tmp instanceof GeneralDBLabelColumn) 62.407 { 62.408 //Reached the innermost left var -> need to capture its SRID 62.409 String alias; 62.410 - if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.411 + if (((GeneralDBLabelColumn) tmp).getRdbmsVar() == null || ((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 62.412 //Predicates used in triple patterns non-existent in db 62.413 alias="NULL"; 62.414 } 62.415 @@ -2631,7 +2643,7 @@ 62.416 filter.openBracket(); 62.417 if(expr.getArg() instanceof GeneralDBStringValue) 62.418 { 62.419 - appendWKT(expr.getArg(),filter); 62.420 + appendWKT(expr.getArg(), filter); 62.421 } 62.422 else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructBinary) 62.423 { 62.424 @@ -2648,7 +2660,7 @@ 62.425 else if(expr.getArg() instanceof GeneralDBSqlCase) 62.426 { 62.427 GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getArg()).getEntries().get(0).getResult(); 62.428 - appendMBB(onlyLabel,filter); 62.429 + appendMBB(onlyLabel, filter); 62.430 } 62.431 else 62.432 {
63.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java Wed Sep 10 12:37:29 2014 +0200 63.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java Wed Sep 24 18:44:26 2014 +0300 63.3 @@ -45,8 +45,8 @@ 63.4 { 63.5 byte[] label = rs.getBytes(index + 1); 63.6 int srid = rs.getInt(index + 2); 63.7 - return vf.getRdbmsPolyhedron(id, GeoConstants.WKT, label, srid); 63.8 - 63.9 + String datatype = rs.getString(index + 3); 63.10 + return vf.getRdbmsPolyhedron(id, datatype, label, srid); 63.11 } 63.12 63.13 return createResource(rs, index);
64.1 --- a/resultio-spatial/sparqlgeojson/src/main/java/org/openrdf/query/resultio/sparqlgeojson/stSPARQLResultsGeoJSONWriter.java Wed Sep 10 12:37:29 2014 +0200 64.2 +++ b/resultio-spatial/sparqlgeojson/src/main/java/org/openrdf/query/resultio/sparqlgeojson/stSPARQLResultsGeoJSONWriter.java Wed Sep 24 18:44:26 2014 +0300 64.3 @@ -20,15 +20,17 @@ 64.4 import org.geotools.feature.simple.SimpleFeatureBuilder; 64.5 import org.geotools.feature.simple.SimpleFeatureTypeBuilder; 64.6 import org.geotools.geojson.feature.FeatureJSON; 64.7 -import org.geotools.referencing.CRS; 64.8 import org.opengis.feature.simple.SimpleFeature; 64.9 import org.opengis.feature.simple.SimpleFeatureType; 64.10 import org.openrdf.model.Literal; 64.11 import org.openrdf.model.Value; 64.12 +import org.openrdf.model.impl.LiteralImpl; 64.13 +import org.openrdf.model.impl.URIImpl; 64.14 import org.openrdf.query.Binding; 64.15 import org.openrdf.query.BindingSet; 64.16 import org.openrdf.query.TupleQueryResultHandlerException; 64.17 import org.openrdf.query.algebra.evaluation.function.spatial.AbstractWKT; 64.18 +import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 64.19 import org.openrdf.query.algebra.evaluation.util.JTSWrapper; 64.20 import org.openrdf.query.resultio.TupleQueryResultFormat; 64.21 import org.openrdf.query.resultio.TupleQueryResultWriter; 64.22 @@ -40,6 +42,8 @@ 64.23 64.24 import com.vividsolutions.jts.geom.Geometry; 64.25 64.26 +import eu.earthobservatory.constants.GeoConstants; 64.27 + 64.28 /** 64.29 * A TupleQueryResultWriter that writes query results in the <a 64.30 * href="http://www.geojson.org/geojson-spec.html/">GeoJSON Format</a>. 64.31 @@ -156,6 +160,11 @@ 64.32 geom = dbpolyhedron.getPolyhedron().getGeometry(); 64.33 srid = dbpolyhedron.getPolyhedron().getGeometry().getSRID(); 64.34 64.35 + } else if (value instanceof StrabonPolyhedron) { // spatial case from new geometry construction (SELECT) 64.36 + StrabonPolyhedron poly = (StrabonPolyhedron) value; 64.37 + geom = poly.getGeometry(); 64.38 + srid = geom.getSRID(); 64.39 + 64.40 } else { // spatial literal WKT or GML 64.41 // get the textual representation of the geometry (WKT or GML) 64.42 String geoText = value.stringValue(); 64.43 @@ -181,10 +190,17 @@ 64.44 64.45 SimpleFeatureTypeBuilder sftb = new SimpleFeatureTypeBuilder(); 64.46 sftb.setName("Feature_" + nresults + "_" + nfeatures); 64.47 - sftb.setCRS(CRS.decode("EPSG:" + srid)); 64.48 - sftb.setSRS("EPSG:" + srid); 64.49 sftb.add("geometry", Geometry.class); 64.50 64.51 + // EPSG:4326 Long/Lat) is the default CRS for GeoJSON features 64.52 + // we transform explicitly, because searching for "EPSG:<code>" CRSs is 64.53 + // not the preferred way for GeoJSON (see here 64.54 + // http://geojson.org/geojson-spec.html#coordinate-reference-system-objects). 64.55 + // Instead the OGC CRS URNs should be preferred. 64.56 + geom = jts.transform(geom, srid, GeoConstants.EPSG4326_SRID); 64.57 + //sftb.setCRS(CRS.decode("EPSG:" + srid)); 64.58 + //sftb.setSRS("EPSG:" + srid); 64.59 + 64.60 // add the feature in the list of features 64.61 features.add(sftb); 64.62
65.1 --- a/resultio-spatial/sparqlkml/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java Wed Sep 10 12:37:29 2014 +0200 65.2 +++ b/resultio-spatial/sparqlkml/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java Wed Sep 24 18:44:26 2014 +0300 65.3 @@ -2,8 +2,9 @@ 65.4 * This Source Code Form is subject to the terms of the Mozilla Public License, 65.5 * v. 2.0. If a copy of the MPL was not distributed with this file, You can 65.6 * obtain one at http://mozilla.org/MPL/2.0/. Copyright (C) 2010, 2011, 2012, 65.7 - * Pyravlos Team http://www.strabon.di.uoa.gr/ 65.8 + * 2013, 2014 Pyravlos Team http://www.strabon.di.uoa.gr/ 65.9 */ 65.10 + 65.11 package org.openrdf.query.resultio.sparqlkml; 65.12 65.13 import java.io.ByteArrayOutputStream; 65.14 @@ -16,7 +17,6 @@ 65.15 import javax.xml.bind.JAXBException; 65.16 import javax.xml.namespace.QName; 65.17 65.18 -import org.apache.xerces.xni.grammars.XMLGrammarDescription; 65.19 import org.geotools.kml.KML; 65.20 import org.geotools.kml.KMLConfiguration; 65.21 import org.geotools.xml.Encoder; 65.22 @@ -26,8 +26,8 @@ 65.23 import org.openrdf.query.Binding; 65.24 import org.openrdf.query.BindingSet; 65.25 import org.openrdf.query.TupleQueryResultHandlerException; 65.26 -import org.openrdf.query.algebra.IsLiteral; 65.27 import org.openrdf.query.algebra.evaluation.function.spatial.AbstractWKT; 65.28 +import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 65.29 import org.openrdf.query.algebra.evaluation.util.JTSWrapper; 65.30 import org.openrdf.query.resultio.TupleQueryResultFormat; 65.31 import org.openrdf.query.resultio.TupleQueryResultWriter; 65.32 @@ -56,7 +56,7 @@ 65.33 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 65.34 * @author Panayiotis Smeros <psmeros@di.uoa.gr> 65.35 * @author George Garbis <ggarbis@di.uoa.gr> 65.36 - * 65.37 + * @author Konstantina Bereta <konstantina.bereta@di.uoa.gr> 65.38 */ 65.39 public class stSPARQLResultsKMLWriter implements TupleQueryResultWriter { 65.40 private static final Logger logger = LoggerFactory.getLogger(org.openrdf.query.resultio.sparqlkml.stSPARQLResultsKMLWriter.class); 65.41 @@ -69,9 +69,9 @@ 65.42 private static final String PLACEMARK_TAG = "Placemark"; 65.43 private static final String TIMESTAMP_TAG = "TimeStamp"; 65.44 private static final String TIMESPAN_TAG = "TimeSpan"; 65.45 - private static final String BEGIN_TAG = "begin"; 65.46 - private static final String END_TAG = "end"; 65.47 - private static final String WHEN_TAG = "when"; 65.48 + private static final String BEGIN_TAG = "begin"; 65.49 + private static final String END_TAG = "end"; 65.50 + private static final String WHEN_TAG = "when"; 65.51 private static final String NAME_TAG = "name"; 65.52 private static final String DESC_TAG = "description"; 65.53 private static final String EXT_DATA_TAG = "ExtendedData"; 65.54 @@ -97,6 +97,11 @@ 65.55 private stSPARQLXMLWriter xmlWriter; 65.56 65.57 /** 65.58 + * The ordered list of binding names of the result. 65.59 + */ 65.60 + private List<String> bindingNames; 65.61 + 65.62 + /** 65.63 * The number of results seen. 65.64 */ 65.65 private int nresults; 65.66 @@ -169,6 +174,8 @@ 65.67 @Override 65.68 public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException { 65.69 try { 65.70 + // keep the order of binding names 65.71 + this.bindingNames = bindingNames; 65.72 xmlWriter.startDocument(); 65.73 xmlWriter.setAttribute("xmlns", NAMESPACE); 65.74 xmlWriter.startTag(ROOT_TAG); 65.75 @@ -240,7 +247,6 @@ 65.76 try { 65.77 // true if there are bindings that do not correspond to geometries 65.78 boolean hasDesc = false; 65.79 - String timeValue; 65.80 65.81 Hashtable<String, String> extData = new Hashtable<String, String>(); 65.82 65.83 @@ -292,34 +298,37 @@ 65.84 xmlWriter.textElement(NAME_TAG, "Result" + nresults); 65.85 65.86 // parse binding set 65.87 - for (Binding binding : bindingSet) { 65.88 - 65.89 - Value value = binding.getValue(); 65.90 + for (String bindingName : bindingNames) { 65.91 65.92 - // check for geometry value 65.93 - if (XMLGSDatatypeUtil.isGeometryValue(value)) { 65.94 - hasGeometry=true; 65.95 - 65.96 - if (logger.isDebugEnabled()) { 65.97 - logger.debug("[Strabon] Found geometry: {}", value); 65.98 + Binding binding = bindingSet.getBinding(bindingName); 65.99 + if(binding != null) { 65.100 + Value value = binding.getValue(); 65.101 + 65.102 + // check for geometry value 65.103 + if (XMLGSDatatypeUtil.isGeometryValue(value)) { 65.104 + hasGeometry=true; 65.105 + 65.106 + if (logger.isDebugEnabled()) { 65.107 + logger.debug("[Strabon] Found geometry: {}", value); 65.108 + } 65.109 + 65.110 + xmlWriter.unescapedText(getKML(value)); 65.111 + 65.112 + } else { // URI, BlankNode, or Literal other than spatial literal 65.113 + 65.114 + if (logger.isDebugEnabled()) { 65.115 + logger.debug("[Strabon.KMLWriter] Found URI/BlankNode/Literal ({}): {}", value.getClass(), value); 65.116 + } 65.117 + 65.118 + // mark that we found sth corresponding to the description 65.119 + hasDesc = true; 65.120 + 65.121 + // write description 65.122 + writeDesc(binding); 65.123 + 65.124 + // fill also the extended data attribute of the Placemark 65.125 + extData.put(binding.getName(), getBindingValue(binding)); 65.126 } 65.127 - 65.128 - xmlWriter.unescapedText(getKML(value)); 65.129 - 65.130 - } else { // URI, BlankNode, or Literal other than spatial literal 65.131 - 65.132 - if (logger.isDebugEnabled()) { 65.133 - logger.debug("[Strabon.KMLWriter] Found URI/BlankNode/Literal ({}): {}", value.getClass(), value); 65.134 - } 65.135 - 65.136 - // mark that we found sth corresponding to the description 65.137 - hasDesc = true; 65.138 - 65.139 - // write description 65.140 - writeDesc(binding); 65.141 - 65.142 - // fill also the extended data attribute of the Placemark 65.143 - extData.put(binding.getName(), getBindingValue(binding)); 65.144 } 65.145 } 65.146 65.147 @@ -402,24 +411,36 @@ 65.148 geom = dbpolyhedron.getPolyhedron().getGeometry(); 65.149 srid = dbpolyhedron.getPolyhedron().getGeometry().getSRID(); 65.150 65.151 + } else if (value instanceof StrabonPolyhedron) { // spatial case from new geometry construction (SELECT) 65.152 + StrabonPolyhedron poly = (StrabonPolyhedron) value; 65.153 + geom = poly.getGeometry(); 65.154 + srid = geom.getSRID(); 65.155 + 65.156 } else { // spatial literal 65.157 Literal spatial = (Literal) value; 65.158 String geomRep = spatial.stringValue(); 65.159 65.160 if (XMLGSDatatypeUtil.isWKTLiteral(spatial)) { // WKT 65.161 - AbstractWKT awkt = new AbstractWKT(geomRep, spatial.getDatatype().stringValue()); 65.162 - 65.163 + 65.164 + AbstractWKT awkt = null; 65.165 + if (spatial.getDatatype() == null) { // plain WKT literal 65.166 + awkt = new AbstractWKT(geomRep); 65.167 + 65.168 + } else { // typed WKT literal 65.169 + awkt = new AbstractWKT(geomRep, spatial.getDatatype().stringValue()); 65.170 + } 65.171 + 65.172 geom = jts.WKTread(awkt.getWKT()); 65.173 srid = awkt.getSRID(); 65.174 - 65.175 + 65.176 } else { // GML 65.177 geom = jts.GMLread(geomRep); 65.178 srid = geom.getSRID(); 65.179 } 65.180 } 65.181 65.182 - // transform the geometry to {@link GeoConstants#defaultSRID} 65.183 - geom = jts.transform(geom, srid, GeoConstants.defaultSRID); 65.184 + // transform the geometry to {@link GeoConstants#EPSG4326_SRID} 65.185 + geom = jts.transform(geom, srid, GeoConstants.EPSG4326_SRID); 65.186 65.187 if (geom instanceof Point) { 65.188 geometryType = KML.Point;
66.1 --- a/resultio-spatial/sparqlxml/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLResultsXMLWriter.java Wed Sep 10 12:37:29 2014 +0200 66.2 +++ b/resultio-spatial/sparqlxml/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLResultsXMLWriter.java Wed Sep 24 18:44:26 2014 +0300 66.3 @@ -34,19 +34,19 @@ 66.4 import org.openrdf.query.Binding; 66.5 import org.openrdf.query.BindingSet; 66.6 import org.openrdf.query.TupleQueryResultHandlerException; 66.7 +import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 66.8 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 66.9 import org.openrdf.query.resultio.TupleQueryResultFormat; 66.10 import org.openrdf.query.resultio.TupleQueryResultWriter; 66.11 import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 66.12 import org.openrdf.sail.generaldb.model.GeneralDBPolyhedron; 66.13 66.14 - 66.15 -import eu.earthobservatory.constants.GeoConstants; 66.16 - 66.17 /** 66.18 * A {@link TupleQueryResultWriter} that writes tuple query results in the <a 66.19 * href="http://www.w3.org/TR/rdf-sparql-XMLres/">SPARQL Query Results XML 66.20 * Format</a>. 66.21 * 66.22 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 66.23 * @author Manos Karpathiotakis <mk@di.uoa.gr> 66.24 */ 66.25 public class stSPARQLResultsXMLWriter implements TupleQueryResultWriter { 66.26 @@ -60,6 +60,11 @@ 66.27 */ 66.28 private XMLWriter xmlWriter; 66.29 66.30 + /** 66.31 + * The ordered list of binding names of the result. 66.32 + */ 66.33 + private List<String> bindingNames; 66.34 + 66.35 /*--------------* 66.36 * Constructors * 66.37 *--------------*/ 66.38 @@ -92,6 +97,9 @@ 66.39 throws TupleQueryResultHandlerException 66.40 { 66.41 try { 66.42 + // keep the order of binding names 66.43 + this.bindingNames = bindingNames; 66.44 + 66.45 xmlWriter.startDocument(); 66.46 66.47 xmlWriter.setAttribute("xmlns", NAMESPACE); 66.48 @@ -133,13 +141,17 @@ 66.49 try { 66.50 xmlWriter.startTag(RESULT_TAG); 66.51 66.52 - for (Binding binding : bindingSet) { 66.53 - xmlWriter.setAttribute(BINDING_NAME_ATT, binding.getName()); 66.54 - xmlWriter.startTag(BINDING_TAG); 66.55 - 66.56 - writeValue(binding.getValue()); 66.57 - 66.58 - xmlWriter.endTag(BINDING_TAG); 66.59 + for (String bindingName : bindingNames) { 66.60 + Binding binding = bindingSet.getBinding(bindingName); 66.61 + if(binding != null) 66.62 + { 66.63 + xmlWriter.setAttribute(BINDING_NAME_ATT, binding.getName()); 66.64 + xmlWriter.startTag(BINDING_TAG); 66.65 + 66.66 + writeValue(binding.getValue()); 66.67 + 66.68 + xmlWriter.endTag(BINDING_TAG); 66.69 + } 66.70 } 66.71 66.72 xmlWriter.endTag(RESULT_TAG); 66.73 @@ -152,16 +164,23 @@ 66.74 private void writeValue(Value value) throws IOException { 66.75 if (value instanceof URI) { 66.76 writeURI((URI) value); 66.77 + 66.78 } else if (value instanceof BNode) { 66.79 writeBNode((BNode) value); 66.80 + 66.81 } else if (value instanceof Literal) { 66.82 writeLiteral((Literal) value); 66.83 - } 66.84 - else { // spatial literal 66.85 - // else if (value instanceof RdbmsPolyhedron) 66.86 - URI datatype = new URIImpl(GeoConstants.WKT); 66.87 - GeneralDBPolyhedron dbpolyhedron = (GeneralDBPolyhedron) value; 66.88 - Literal literal = new LiteralImpl(value.stringValue(), dbpolyhedron.getDatatype()); 66.89 + 66.90 + } else if (value instanceof GeneralDBPolyhedron) { // spatial case from database 66.91 + GeneralDBPolyhedron poly = (GeneralDBPolyhedron) value; 66.92 + writeLiteral(new LiteralImpl(poly.stringValue(), poly.getDatatype())); 66.93 + 66.94 + } else if (value instanceof StrabonPolyhedron) { // spatial case from new geometry construction (SELECT) 66.95 + StrabonPolyhedron poly = (StrabonPolyhedron) value; 66.96 + Literal literal = new LiteralImpl(WKTHelper.createWKT(poly.stringValue(), 66.97 + poly.getGeometry().getSRID(), 66.98 + poly.getGeometryDatatype().toString()), 66.99 + new URIImpl(poly.getGeometryDatatype().toString())); 66.100 writeLiteral(literal); 66.101 } 66.102 }
67.1 --- a/resultio-spatial/text/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java Wed Sep 10 12:37:29 2014 +0200 67.2 +++ b/resultio-spatial/text/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java Wed Sep 24 18:44:26 2014 +0300 67.3 @@ -17,13 +17,13 @@ 67.4 import org.openrdf.model.impl.URIImpl; 67.5 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonInstant; 67.6 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPeriod; 67.7 +import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 67.8 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 67.9 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonTemporalElement; 67.10 import eu.earthobservatory.constants.TemporalConstants; 67.11 import org.openrdf.query.resultio.text.tsv.SPARQLResultsTSVWriter; 67.12 import org.openrdf.sail.generaldb.model.GeneralDBPolyhedron; 67.13 67.14 -import eu.earthobservatory.constants.GeoConstants; 67.15 - 67.16 /** 67.17 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 67.18 * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> (extensions for the temporal case) 67.19 @@ -43,10 +43,14 @@ 67.20 // catch the spatial case and create a new literal 67.21 // constructing a new literal is the only way if we want to reuse the {@link #writeValue(Value)} method 67.22 GeneralDBPolyhedron dbpolyhedron = (GeneralDBPolyhedron) val; 67.23 - if(String.valueOf(dbpolyhedron.getDatatype()) == GeoConstants.WKT) 67.24 - val = new LiteralImpl(dbpolyhedron.getPolyhedronStringRep()+";http://www.opengis.net/def/crs/EPSG/0/"+dbpolyhedron.getPolyhedron().getGeometry().getSRID(), dbpolyhedron.getDatatype()); 67.25 - else 67.26 - val = new LiteralImpl("<http://www.opengis.net/def/crs/EPSG/0/"+dbpolyhedron.getPolyhedron().getGeometry().getSRID()+"> "+dbpolyhedron.getPolyhedronStringRep(),dbpolyhedron.getDatatype()); 67.27 + val = new LiteralImpl(dbpolyhedron.stringValue(), dbpolyhedron.getDatatype()); 67.28 + 67.29 + } else if (val instanceof StrabonPolyhedron) { // might come from the construction of new constants in SELECT 67.30 + StrabonPolyhedron poly = (StrabonPolyhedron) val; 67.31 + val = new LiteralImpl(WKTHelper.createWKT(poly.stringValue(), 67.32 + poly.getGeometry().getSRID(), 67.33 + poly.getGeometryDatatype().toString()), 67.34 + new URIImpl(poly.getGeometryDatatype().toString())); 67.35 } 67.36 else if(val instanceof StrabonTemporalElement){ 67.37 //creating a temporal literal, which is either a period or an instant
68.1 --- a/runtime/pom.xml Wed Sep 10 12:37:29 2014 +0200 68.2 +++ b/runtime/pom.xml Wed Sep 24 18:44:26 2014 +0300 68.3 @@ -317,10 +317,12 @@ 68.4 </dependency> 68.5 68.6 <!-- Geotools --> 68.7 + <!-- One epsg jar file suffices. Read this: http://docs.geotools.org/latest/userguide/faq.html#q-how-to-choose-an-epsg-authority 68.8 <dependency> 68.9 <groupId>org.geotools</groupId> 68.10 <artifactId>gt-epsg-wkt</artifactId> 68.11 </dependency> 68.12 + --> 68.13 68.14 <dependency> 68.15 <groupId>org.geotools</groupId>
69.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java Wed Sep 10 12:37:29 2014 +0200 69.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java Wed Sep 24 18:44:26 2014 +0300 69.3 @@ -33,6 +33,7 @@ 69.4 import java.util.regex.Pattern; 69.5 69.6 import org.openrdf.model.Resource; 69.7 +import org.geotools.factory.Hints; 69.8 import org.openrdf.model.Statement; 69.9 import org.openrdf.model.URI; 69.10 import org.openrdf.model.ValueFactory; 69.11 @@ -133,6 +134,7 @@ 69.12 //Setting up store 69.13 69.14 //Used for the conversions taking place involving JTS + WGS84 (4326) 69.15 + //Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.FALSE); 69.16 System.setProperty("org.geotools.referencing.forceXY", "true"); 69.17 69.18 //our repository
70.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java Wed Sep 10 12:37:29 2014 +0200 70.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java Wed Sep 24 18:44:26 2014 +0300 70.3 @@ -11,6 +11,7 @@ 70.4 70.5 import org.openrdf.query.MalformedQueryException; 70.6 import org.openrdf.sail.generaldb.exceptions.UnsupportedExtensionFunctionException; 70.7 +import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException; 70.8 import org.slf4j.Logger; 70.9 import org.slf4j.LoggerFactory; 70.10 70.11 @@ -60,7 +61,10 @@ 70.12 logger.error("[Strabon.QueryOp] {}", e.getMessage()); 70.13 70.14 } catch (MalformedQueryException e) { 70.15 - logger.error("[Strabon.QueryOp] {}", e.getMessage()); 70.16 + logger.error("[Strabon.QueryOp] Malformed query: {}", e.getMessage()); 70.17 + 70.18 + } catch (UnsupportedRdbmsOperatorException e) { 70.19 + logger.error("[Strabon.QueryOp] Error during execution of SPARQL query: {}", e.getMessage()); 70.20 70.21 } catch (Exception e) { 70.22 logger.error("[Strabon.QueryOp] Error during execution of SPARQL query.", e);
71.1 --- a/runtime/src/main/java/eu/earthobservatory/utils/Format.java Wed Sep 10 12:37:29 2014 +0200 71.2 +++ b/runtime/src/main/java/eu/earthobservatory/utils/Format.java Wed Sep 24 18:44:26 2014 +0300 71.3 @@ -17,7 +17,6 @@ 71.4 * for the results of the evaluation of a SPARQL query. 71.5 * 71.6 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 71.7 - * 71.8 */ 71.9 public enum Format { 71.10
72.1 --- a/runtime/src/main/resources/log4j.properties Wed Sep 10 12:37:29 2014 +0200 72.2 +++ b/runtime/src/main/resources/log4j.properties Wed Sep 24 18:44:26 2014 +0300 72.3 @@ -21,3 +21,4 @@ 72.4 log4j.logger.org.openrdf.query.parser.QueryParserRegistry=INFO 72.5 log4j.logger.org.openrdf.sail.generaldb.managers.TripleTableManager=INFO 72.6 log4j.logger.info.aduna.lang.service.ServiceRegistry=INFO 72.7 +#log4j.logger.org.openrdf.sail.postgis.evaluation.PostGISEvaluation=DEBUG
73.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SPARQL11Tests.java Wed Sep 10 12:37:29 2014 +0200 73.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SPARQL11Tests.java Wed Sep 24 18:44:26 2014 +0300 73.3 @@ -15,6 +15,7 @@ 73.4 import java.io.IOException; 73.5 import java.util.ArrayList; 73.6 73.7 +import org.junit.BeforeClass; 73.8 import org.junit.Test; 73.9 import org.openrdf.model.vocabulary.RDF; 73.10 import org.openrdf.model.vocabulary.XMLSchema; 73.11 @@ -23,7 +24,6 @@ 73.12 import org.openrdf.query.TupleQueryResultHandlerException; 73.13 import org.openrdf.repository.RepositoryException; 73.14 73.15 - 73.16 public class SPARQL11Tests { 73.17 public static Strabon strabon; 73.18 73.19 @@ -49,14 +49,12 @@ 73.20 "PREFIX dc11: <"+DC11_NS+"> \n"; 73.21 73.22 // @BeforeClass 73.23 -// public static void initialize() throws SQLException, ClassNotFoundException 73.24 +// public static void initialize() throws Exception 73.25 // { 73.26 -// strabon = new Strabon("sparql11-tests","postgres","p1r3as", 5432, "localhost", true); 73.27 +// strabon = new eu.earthobservatory.runtime.postgis.Strabon("test", "postgres", "postgres", 5432, "localhost", true); 73.28 // 73.29 // } 73.30 73.31 - 73.32 - 73.33 @Test 73.34 public void testRetrieveEveryEntry() throws MalformedQueryException, RepositoryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException 73.35 {
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 74.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/bugs/RelationalFunctionInSelectTest.java Wed Sep 24 18:44:26 2014 +0300 74.3 @@ -0,0 +1,20 @@ 74.4 +/** 74.5 + * This Source Code Form is subject to the terms of the Mozilla Public 74.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 74.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 74.8 + * 74.9 + * Copyright (C) 2010, 2011, 2012, 2013, 2014 Pyravlos Team 74.10 + * 74.11 + * http://www.strabon.di.uoa.gr/ 74.12 + */ 74.13 +package eu.earthobservatory.testsuite.bugs; 74.14 + 74.15 +import eu.earthobservatory.testsuite.utils.TemplateTest; 74.16 + 74.17 + 74.18 +/** 74.19 + * Test for Bug #34 (http://bug.strabon.di.uoa.gr/ticket/34). 74.20 + * 74.21 + * @author Dimitrianos Savva <dimis@di.uoa.gr 74.22 + */ 74.23 +public class RelationalFunctionInSelectTest extends TemplateTest{}
75.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 75.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/bugs/SpatialFunctionInOrderBy.java Wed Sep 24 18:44:26 2014 +0300 75.3 @@ -0,0 +1,25 @@ 75.4 +/** 75.5 + * This Source Code Form is subject to the terms of the Mozilla Public 75.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 75.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 75.8 + * 75.9 + * Copyright (C) 2010, 2011, 2012, 2013, 2014 Pyravlos Team 75.10 + * 75.11 + * http://www.strabon.di.uoa.gr/ 75.12 + */ 75.13 +package eu.earthobservatory.testsuite.bugs; 75.14 + 75.15 +import eu.earthobservatory.testsuite.utils.TemplateTest; 75.16 + 75.17 + 75.18 +/** 75.19 + * Test for Bug #62 (http://bug.strabon.di.uoa.gr/ticket/62). 75.20 + * 75.21 + * @author Dimitrianos Savva <dimis@di.uoa.gr> 75.22 + */ 75.23 +public class SpatialFunctionInOrderBy extends TemplateTest{ 75.24 + public SpatialFunctionInOrderBy() { 75.25 + super(); 75.26 + this.orderResults=true; 75.27 + } 75.28 +}
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 76.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/bugs/UnionAndProjectionBug53.java Wed Sep 24 18:44:26 2014 +0300 76.3 @@ -0,0 +1,18 @@ 76.4 +/** 76.5 + * This Source Code Form is subject to the terms of the Mozilla Public 76.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 76.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 76.8 + * 76.9 + * Copyright (C) 2011, 2012, 2013, 2014 Pyravlos Team 76.10 + * 76.11 + * http://strabon.di.uoa.gr/ 76.12 + */ 76.13 +package eu.earthobservatory.testsuite.bugs; 76.14 + 76.15 +import eu.earthobservatory.testsuite.utils.TemplateTest; 76.16 + 76.17 +/** 76.18 + * Test for Bug 53 (http://bug.strabon.di.uoa.gr/ticket/53) 76.19 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 76.20 + */ 76.21 +public class UnionAndProjectionBug53 extends TemplateTest{ }
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 77.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/geoSPARQL/BasicFunctionsTest.java Wed Sep 24 18:44:26 2014 +0300 77.3 @@ -0,0 +1,18 @@ 77.4 +/** 77.5 + * This Source Code Form is subject to the terms of the Mozilla Public 77.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 77.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 77.8 + * 77.9 + * Copyright (C) 2011, 2012, 2013, 2014 Pyravlos Team 77.10 + * 77.11 + * http://strabon.di.uoa.gr/ 77.12 + */ 77.13 +package eu.earthobservatory.testsuite.geoSPARQL; 77.14 + 77.15 +import eu.earthobservatory.testsuite.utils.TemplateTest; 77.16 + 77.17 +/** 77.18 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 77.19 + */ 77.20 +public class BasicFunctionsTest extends TemplateTest { } 77.21 +
78.1 --- a/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/AggregateFunctionsTest.java Wed Sep 10 12:37:29 2014 +0200 78.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/AggregateFunctionsTest.java Wed Sep 24 18:44:26 2014 +0300 78.3 @@ -16,5 +16,4 @@ 78.4 * 78.5 * @author Panayiotis Smeros <psmeros@di.uoa.gr> 78.6 */ 78.7 - 78.8 public class AggregateFunctionsTest extends TemplateTest {}
79.1 --- a/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/TemplateTest.java Wed Sep 10 12:37:29 2014 +0200 79.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/TemplateTest.java Wed Sep 24 18:44:26 2014 +0300 79.3 @@ -25,9 +25,10 @@ 79.4 * 2) stores a dataset 79.5 * 3) poses a query 79.6 * 4) checks if the results of the query are the expected 79.7 + * If you use ORDER BY do NOT use this class. 79.8 * 5) drops the database 79.9 * 79.10 - * @author Panayiotis Smeros <psmeros@di.uoa.gr 79.11 + * @author Panayiotis Smeros <psmeros@di.uoa.gr> 79.12 */ 79.13 public abstract class TemplateTest 79.14 { 79.15 @@ -35,7 +36,7 @@ 79.16 protected ArrayList<String> queryFile; 79.17 protected ArrayList<String> resultsFile; 79.18 protected Boolean inference; 79.19 - 79.20 + protected Boolean orderResults; 79.21 79.22 public TemplateTest() 79.23 { 79.24 @@ -73,6 +74,7 @@ 79.25 } 79.26 79.27 inference=false; 79.28 + orderResults=false; 79.29 } 79.30 79.31 @Before 79.32 @@ -91,7 +93,7 @@ 79.33 while(queryFileIterator.hasNext() && resultsFileIterator.hasNext()) 79.34 { 79.35 79.36 - Utils.testQuery(queryFileIterator.next(), resultsFileIterator.next()); 79.37 + Utils.testQuery(queryFileIterator.next(), resultsFileIterator.next(),orderResults); 79.38 } 79.39 } 79.40
80.1 --- a/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/Utils.java Wed Sep 10 12:37:29 2014 +0200 80.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/Utils.java Wed Sep 24 18:44:26 2014 +0300 80.3 @@ -49,6 +49,7 @@ 80.4 * A class with useful methods for the tests. 80.5 * 80.6 * @author Panayiotis Smeros <psmeros@di.uoa.gr> 80.7 + * @author Dimitrianos Savva <dimis@di.uoa.gr> 80.8 */ 80.9 public class Utils 80.10 { 80.11 @@ -141,7 +142,8 @@ 80.12 strabon.storeInRepo(datasetFile, "NQUADS", inference); 80.13 } 80.14 80.15 - public static void testQuery(String queryFile, String resultsFile) throws IOException, MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, URISyntaxException, QueryResultParseException, UnsupportedQueryResultFormatException 80.16 + 80.17 + public static void testQuery(String queryFile, String resultsFile,boolean orderOn) throws IOException, MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, URISyntaxException, QueryResultParseException, UnsupportedQueryResultFormatException 80.18 { 80.19 ByteArrayOutputStream resultsStream = new ByteArrayOutputStream(); 80.20 String query = FileUtils.readFileToString(new File(Utils.class.getResource(prefixesFile).toURI()))+"\n"+FileUtils.readFileToString(new File(Utils.class.getResource(queryFile).toURI())); 80.21 @@ -180,17 +182,19 @@ 80.22 80.23 assertFalse("Results are not the expected. QueryFile: "+queryFile, expectedResults.hasNext() || actualResults.hasNext()); 80.24 80.25 - //Sort bindings alphabetically 80.26 - Collections.sort(eBindingList); 80.27 - Collections.sort(aBindingList); 80.28 - 80.29 + if(!orderOn) 80.30 + { 80.31 + //Sort bindings alphabetically 80.32 + Collections.sort(eBindingList); 80.33 + Collections.sort(aBindingList); 80.34 + } 80.35 //Check bindings one by one 80.36 Iterator<String> eBindingListIterator = eBindingList.iterator(); 80.37 Iterator<String> aBindingListIterator = aBindingList.iterator(); 80.38 80.39 while(eBindingListIterator.hasNext() && aBindingListIterator.hasNext()) 80.40 { 80.41 - assertEquals("Results are not the expected. QueryFile: "+queryFile, eBindingListIterator.next(), aBindingListIterator.next()); 80.42 + assertEquals("Results are not the expected. QueryFile: "+queryFile,eBindingListIterator.next(), aBindingListIterator.next() ); 80.43 } 80.44 80.45 actualResults.close();
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 81.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Crosses_GEOSPARQL_Test.rq Wed Sep 24 18:44:26 2014 +0300 81.3 @@ -0,0 +1,11 @@ 81.4 +SELECT ?x ?y (geof:sfCrosses(?g1, ?g2) as ?overlaps) 81.5 +WHERE 81.6 +{ 81.7 +?x geo:hasGeometry ?geom1. 81.8 +?geom1 geo:asWKT ?g1. 81.9 + 81.10 +?y geo:hasGeometry ?geom2. 81.11 +?geom2 geo:asWKT ?g2. 81.12 + 81.13 +FILTER(str(?x) < str(?y)) 81.14 +} 81.15 \ No newline at end of file
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 82.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Crosses_GEOSPARQL_Test.srx Wed Sep 24 18:44:26 2014 +0300 82.3 @@ -0,0 +1,365 @@ 82.4 +<?xml version='1.0' encoding='UTF-8'?> 82.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 82.6 + <head> 82.7 + <variable name='x'/> 82.8 + <variable name='y'/> 82.9 + <variable name='overlaps'/> 82.10 + </head> 82.11 + <results> 82.12 + <result> 82.13 + <binding name='x'> 82.14 + <uri>http://example.org#A</uri> 82.15 + </binding> 82.16 + <binding name='y'> 82.17 + <uri>http://example.org#B</uri> 82.18 + </binding> 82.19 + <binding name='overlaps'> 82.20 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.21 + </binding> 82.22 + </result> 82.23 + 82.24 + <result> 82.25 + <binding name='x'> 82.26 + <uri>http://example.org#A</uri> 82.27 + </binding> 82.28 + <binding name='y'> 82.29 + <uri>http://example.org#C</uri> 82.30 + </binding> 82.31 + <binding name='overlaps'> 82.32 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.33 + </binding> 82.34 + </result> 82.35 + 82.36 + <result> 82.37 + <binding name='x'> 82.38 + <uri>http://example.org#A</uri> 82.39 + </binding> 82.40 + <binding name='y'> 82.41 + <uri>http://example.org#D</uri> 82.42 + </binding> 82.43 + <binding name='overlaps'> 82.44 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.45 + </binding> 82.46 + </result> 82.47 + 82.48 + <result> 82.49 + <binding name='x'> 82.50 + <uri>http://example.org#A</uri> 82.51 + </binding> 82.52 + <binding name='y'> 82.53 + <uri>http://example.org#E</uri> 82.54 + </binding> 82.55 + <binding name='overlaps'> 82.56 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.57 + </binding> 82.58 + </result> 82.59 + 82.60 + <result> 82.61 + <binding name='x'> 82.62 + <uri>http://example.org#A</uri> 82.63 + </binding> 82.64 + <binding name='y'> 82.65 + <uri>http://example.org#F</uri> 82.66 + </binding> 82.67 + <binding name='overlaps'> 82.68 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.69 + </binding> 82.70 + </result> 82.71 + 82.72 + <result> 82.73 + <binding name='x'> 82.74 + <uri>http://example.org#A</uri> 82.75 + </binding> 82.76 + <binding name='y'> 82.77 + <uri>http://example.org#G</uri> 82.78 + </binding> 82.79 + <binding name='overlaps'> 82.80 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.81 + </binding> 82.82 + </result> 82.83 + 82.84 + 82.85 + 82.86 + <result> 82.87 + <binding name='x'> 82.88 + <uri>http://example.org#A</uri> 82.89 + </binding> 82.90 + <binding name='y'> 82.91 + <uri>http://example.org#H</uri> 82.92 + </binding> 82.93 + <binding name='overlaps'> 82.94 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.95 + </binding> 82.96 + </result> 82.97 + 82.98 + 82.99 + 82.100 + 82.101 + 82.102 + 82.103 + 82.104 + <!-- B --> 82.105 + 82.106 + <result> 82.107 + <binding name='x'> 82.108 + <uri>http://example.org#B</uri> 82.109 + </binding> 82.110 + <binding name='y'> 82.111 + <uri>http://example.org#C</uri> 82.112 + </binding> 82.113 + <binding name='overlaps'> 82.114 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.115 + </binding> 82.116 + </result> 82.117 + 82.118 + <result> 82.119 + <binding name='x'> 82.120 + <uri>http://example.org#B</uri> 82.121 + </binding> 82.122 + <binding name='y'> 82.123 + <uri>http://example.org#D</uri> 82.124 + </binding> 82.125 + <binding name='overlaps'> 82.126 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.127 + </binding> 82.128 + </result> 82.129 + 82.130 + <result> 82.131 + <binding name='x'> 82.132 + <uri>http://example.org#B</uri> 82.133 + </binding> 82.134 + <binding name='y'> 82.135 + <uri>http://example.org#E</uri> 82.136 + </binding> 82.137 + <binding name='overlaps'> 82.138 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.139 + </binding> 82.140 + </result> 82.141 + 82.142 + <result> 82.143 + <binding name='x'> 82.144 + <uri>http://example.org#B</uri> 82.145 + </binding> 82.146 + <binding name='y'> 82.147 + <uri>http://example.org#F</uri> 82.148 + </binding> 82.149 + <binding name='overlaps'> 82.150 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.151 + </binding> 82.152 + </result> 82.153 + 82.154 + <result> 82.155 + <binding name='x'> 82.156 + <uri>http://example.org#B</uri> 82.157 + </binding> 82.158 + <binding name='y'> 82.159 + <uri>http://example.org#G</uri> 82.160 + </binding> 82.161 + <binding name='overlaps'> 82.162 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.163 + </binding> 82.164 + </result> 82.165 + 82.166 + <result> 82.167 + <binding name='x'> 82.168 + <uri>http://example.org#B</uri> 82.169 + </binding> 82.170 + <binding name='y'> 82.171 + <uri>http://example.org#H</uri> 82.172 + </binding> 82.173 + <binding name='overlaps'> 82.174 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.175 + </binding> 82.176 + </result> 82.177 + 82.178 + <!-- C --> 82.179 + 82.180 + <result> 82.181 + <binding name='x'> 82.182 + <uri>http://example.org#C</uri> 82.183 + </binding> 82.184 + <binding name='y'> 82.185 + <uri>http://example.org#D</uri> 82.186 + </binding> 82.187 + <binding name='overlaps'> 82.188 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.189 + </binding> 82.190 + </result> 82.191 + 82.192 + <result> 82.193 + <binding name='x'> 82.194 + <uri>http://example.org#C</uri> 82.195 + </binding> 82.196 + <binding name='y'> 82.197 + <uri>http://example.org#E</uri> 82.198 + </binding> 82.199 + <binding name='overlaps'> 82.200 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.201 + </binding> 82.202 + </result> 82.203 + 82.204 + <result> 82.205 + <binding name='x'> 82.206 + <uri>http://example.org#C</uri> 82.207 + </binding> 82.208 + <binding name='y'> 82.209 + <uri>http://example.org#F</uri> 82.210 + </binding> 82.211 + <binding name='overlaps'> 82.212 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.213 + </binding> 82.214 + </result> 82.215 + 82.216 + <result> 82.217 + <binding name='x'> 82.218 + <uri>http://example.org#C</uri> 82.219 + </binding> 82.220 + <binding name='y'> 82.221 + <uri>http://example.org#G</uri> 82.222 + </binding> 82.223 + <binding name='overlaps'> 82.224 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.225 + </binding> 82.226 + </result> 82.227 + 82.228 + <result> 82.229 + <binding name='x'> 82.230 + <uri>http://example.org#C</uri> 82.231 + </binding> 82.232 + <binding name='y'> 82.233 + <uri>http://example.org#H</uri> 82.234 + </binding> 82.235 + <binding name='overlaps'> 82.236 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.237 + </binding> 82.238 + </result> 82.239 + 82.240 + <!-- D --> 82.241 + 82.242 + <result> 82.243 + <binding name='x'> 82.244 + <uri>http://example.org#D</uri> 82.245 + </binding> 82.246 + <binding name='y'> 82.247 + <uri>http://example.org#E</uri> 82.248 + </binding> 82.249 + <binding name='overlaps'> 82.250 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.251 + </binding> 82.252 + </result> 82.253 + 82.254 + <result> 82.255 + <binding name='x'> 82.256 + <uri>http://example.org#D</uri> 82.257 + </binding> 82.258 + <binding name='y'> 82.259 + <uri>http://example.org#F</uri> 82.260 + </binding> 82.261 + <binding name='overlaps'> 82.262 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 82.263 + </binding> 82.264 + </result> 82.265 + 82.266 + <result> 82.267 + <binding name='x'> 82.268 + <uri>http://example.org#D</uri> 82.269 + </binding> 82.270 + <binding name='y'> 82.271 + <uri>http://example.org#G</uri> 82.272 + </binding> 82.273 + <binding name='overlaps'> 82.274 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.275 + </binding> 82.276 + </result> 82.277 + 82.278 + <result> 82.279 + <binding name='x'> 82.280 + <uri>http://example.org#D</uri> 82.281 + </binding> 82.282 + <binding name='y'> 82.283 + <uri>http://example.org#H</uri> 82.284 + </binding> 82.285 + <binding name='overlaps'> 82.286 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.287 + </binding> 82.288 + </result> 82.289 + 82.290 + <!-- E --> 82.291 + 82.292 + <result> 82.293 + <binding name='x'> 82.294 + <uri>http://example.org#E</uri> 82.295 + </binding> 82.296 + <binding name='y'> 82.297 + <uri>http://example.org#F</uri> 82.298 + </binding> 82.299 + <binding name='overlaps'> 82.300 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 82.301 + </binding> 82.302 + </result> 82.303 + 82.304 + <result> 82.305 + <binding name='x'> 82.306 + <uri>http://example.org#E</uri> 82.307 + </binding> 82.308 + <binding name='y'> 82.309 + <uri>http://example.org#G</uri> 82.310 + </binding> 82.311 + <binding name='overlaps'> 82.312 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.313 + </binding> 82.314 + </result> 82.315 + 82.316 + <result> 82.317 + <binding name='x'> 82.318 + <uri>http://example.org#E</uri> 82.319 + </binding> 82.320 + <binding name='y'> 82.321 + <uri>http://example.org#H</uri> 82.322 + </binding> 82.323 + <binding name='overlaps'> 82.324 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.325 + </binding> 82.326 + </result> 82.327 + 82.328 + <!-- F --> 82.329 + 82.330 + <result> 82.331 + <binding name='x'> 82.332 + <uri>http://example.org#F</uri> 82.333 + </binding> 82.334 + <binding name='y'> 82.335 + <uri>http://example.org#G</uri> 82.336 + </binding> 82.337 + <binding name='overlaps'> 82.338 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.339 + </binding> 82.340 + </result> 82.341 + 82.342 + <result> 82.343 + <binding name='x'> 82.344 + <uri>http://example.org#F</uri> 82.345 + </binding> 82.346 + <binding name='y'> 82.347 + <uri>http://example.org#H</uri> 82.348 + </binding> 82.349 + <binding name='overlaps'> 82.350 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.351 + </binding> 82.352 + </result> 82.353 + 82.354 + <!-- G --> 82.355 + 82.356 + <result> 82.357 + <binding name='x'> 82.358 + <uri>http://example.org#G</uri> 82.359 + </binding> 82.360 + <binding name='y'> 82.361 + <uri>http://example.org#H</uri> 82.362 + </binding> 82.363 + <binding name='overlaps'> 82.364 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 82.365 + </binding> 82.366 + </result> 82.367 + </results> 82.368 +</sparql> 82.369 \ No newline at end of file
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 83.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Crosses_stRDF_Test.rq Wed Sep 24 18:44:26 2014 +0300 83.3 @@ -0,0 +1,11 @@ 83.4 +SELECT ?x ?y (strdf:crosses(?g1, ?g2) as ?overlaps) 83.5 +WHERE 83.6 +{ 83.7 +?x geo:hasGeometry ?geom1. 83.8 +?geom1 geo:asWKT ?g1. 83.9 + 83.10 +?y geo:hasGeometry ?geom2. 83.11 +?geom2 geo:asWKT ?g2. 83.12 + 83.13 +FILTER(str(?x) < str(?y)) 83.14 +} 83.15 \ No newline at end of file
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 84.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Crosses_stRDF_Test.srx Wed Sep 24 18:44:26 2014 +0300 84.3 @@ -0,0 +1,365 @@ 84.4 +<?xml version='1.0' encoding='UTF-8'?> 84.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 84.6 + <head> 84.7 + <variable name='x'/> 84.8 + <variable name='y'/> 84.9 + <variable name='overlaps'/> 84.10 + </head> 84.11 + <results> 84.12 + <result> 84.13 + <binding name='x'> 84.14 + <uri>http://example.org#A</uri> 84.15 + </binding> 84.16 + <binding name='y'> 84.17 + <uri>http://example.org#B</uri> 84.18 + </binding> 84.19 + <binding name='overlaps'> 84.20 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.21 + </binding> 84.22 + </result> 84.23 + 84.24 + <result> 84.25 + <binding name='x'> 84.26 + <uri>http://example.org#A</uri> 84.27 + </binding> 84.28 + <binding name='y'> 84.29 + <uri>http://example.org#C</uri> 84.30 + </binding> 84.31 + <binding name='overlaps'> 84.32 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.33 + </binding> 84.34 + </result> 84.35 + 84.36 + <result> 84.37 + <binding name='x'> 84.38 + <uri>http://example.org#A</uri> 84.39 + </binding> 84.40 + <binding name='y'> 84.41 + <uri>http://example.org#D</uri> 84.42 + </binding> 84.43 + <binding name='overlaps'> 84.44 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.45 + </binding> 84.46 + </result> 84.47 + 84.48 + <result> 84.49 + <binding name='x'> 84.50 + <uri>http://example.org#A</uri> 84.51 + </binding> 84.52 + <binding name='y'> 84.53 + <uri>http://example.org#E</uri> 84.54 + </binding> 84.55 + <binding name='overlaps'> 84.56 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.57 + </binding> 84.58 + </result> 84.59 + 84.60 + <result> 84.61 + <binding name='x'> 84.62 + <uri>http://example.org#A</uri> 84.63 + </binding> 84.64 + <binding name='y'> 84.65 + <uri>http://example.org#F</uri> 84.66 + </binding> 84.67 + <binding name='overlaps'> 84.68 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.69 + </binding> 84.70 + </result> 84.71 + 84.72 + <result> 84.73 + <binding name='x'> 84.74 + <uri>http://example.org#A</uri> 84.75 + </binding> 84.76 + <binding name='y'> 84.77 + <uri>http://example.org#G</uri> 84.78 + </binding> 84.79 + <binding name='overlaps'> 84.80 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.81 + </binding> 84.82 + </result> 84.83 + 84.84 + 84.85 + 84.86 + <result> 84.87 + <binding name='x'> 84.88 + <uri>http://example.org#A</uri> 84.89 + </binding> 84.90 + <binding name='y'> 84.91 + <uri>http://example.org#H</uri> 84.92 + </binding> 84.93 + <binding name='overlaps'> 84.94 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.95 + </binding> 84.96 + </result> 84.97 + 84.98 + 84.99 + 84.100 + 84.101 + 84.102 + 84.103 + 84.104 + <!-- B --> 84.105 + 84.106 + <result> 84.107 + <binding name='x'> 84.108 + <uri>http://example.org#B</uri> 84.109 + </binding> 84.110 + <binding name='y'> 84.111 + <uri>http://example.org#C</uri> 84.112 + </binding> 84.113 + <binding name='overlaps'> 84.114 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.115 + </binding> 84.116 + </result> 84.117 + 84.118 + <result> 84.119 + <binding name='x'> 84.120 + <uri>http://example.org#B</uri> 84.121 + </binding> 84.122 + <binding name='y'> 84.123 + <uri>http://example.org#D</uri> 84.124 + </binding> 84.125 + <binding name='overlaps'> 84.126 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.127 + </binding> 84.128 + </result> 84.129 + 84.130 + <result> 84.131 + <binding name='x'> 84.132 + <uri>http://example.org#B</uri> 84.133 + </binding> 84.134 + <binding name='y'> 84.135 + <uri>http://example.org#E</uri> 84.136 + </binding> 84.137 + <binding name='overlaps'> 84.138 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.139 + </binding> 84.140 + </result> 84.141 + 84.142 + <result> 84.143 + <binding name='x'> 84.144 + <uri>http://example.org#B</uri> 84.145 + </binding> 84.146 + <binding name='y'> 84.147 + <uri>http://example.org#F</uri> 84.148 + </binding> 84.149 + <binding name='overlaps'> 84.150 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.151 + </binding> 84.152 + </result> 84.153 + 84.154 + <result> 84.155 + <binding name='x'> 84.156 + <uri>http://example.org#B</uri> 84.157 + </binding> 84.158 + <binding name='y'> 84.159 + <uri>http://example.org#G</uri> 84.160 + </binding> 84.161 + <binding name='overlaps'> 84.162 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.163 + </binding> 84.164 + </result> 84.165 + 84.166 + <result> 84.167 + <binding name='x'> 84.168 + <uri>http://example.org#B</uri> 84.169 + </binding> 84.170 + <binding name='y'> 84.171 + <uri>http://example.org#H</uri> 84.172 + </binding> 84.173 + <binding name='overlaps'> 84.174 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.175 + </binding> 84.176 + </result> 84.177 + 84.178 + <!-- C --> 84.179 + 84.180 + <result> 84.181 + <binding name='x'> 84.182 + <uri>http://example.org#C</uri> 84.183 + </binding> 84.184 + <binding name='y'> 84.185 + <uri>http://example.org#D</uri> 84.186 + </binding> 84.187 + <binding name='overlaps'> 84.188 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.189 + </binding> 84.190 + </result> 84.191 + 84.192 + <result> 84.193 + <binding name='x'> 84.194 + <uri>http://example.org#C</uri> 84.195 + </binding> 84.196 + <binding name='y'> 84.197 + <uri>http://example.org#E</uri> 84.198 + </binding> 84.199 + <binding name='overlaps'> 84.200 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.201 + </binding> 84.202 + </result> 84.203 + 84.204 + <result> 84.205 + <binding name='x'> 84.206 + <uri>http://example.org#C</uri> 84.207 + </binding> 84.208 + <binding name='y'> 84.209 + <uri>http://example.org#F</uri> 84.210 + </binding> 84.211 + <binding name='overlaps'> 84.212 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.213 + </binding> 84.214 + </result> 84.215 + 84.216 + <result> 84.217 + <binding name='x'> 84.218 + <uri>http://example.org#C</uri> 84.219 + </binding> 84.220 + <binding name='y'> 84.221 + <uri>http://example.org#G</uri> 84.222 + </binding> 84.223 + <binding name='overlaps'> 84.224 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.225 + </binding> 84.226 + </result> 84.227 + 84.228 + <result> 84.229 + <binding name='x'> 84.230 + <uri>http://example.org#C</uri> 84.231 + </binding> 84.232 + <binding name='y'> 84.233 + <uri>http://example.org#H</uri> 84.234 + </binding> 84.235 + <binding name='overlaps'> 84.236 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.237 + </binding> 84.238 + </result> 84.239 + 84.240 + <!-- D --> 84.241 + 84.242 + <result> 84.243 + <binding name='x'> 84.244 + <uri>http://example.org#D</uri> 84.245 + </binding> 84.246 + <binding name='y'> 84.247 + <uri>http://example.org#E</uri> 84.248 + </binding> 84.249 + <binding name='overlaps'> 84.250 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.251 + </binding> 84.252 + </result> 84.253 + 84.254 + <result> 84.255 + <binding name='x'> 84.256 + <uri>http://example.org#D</uri> 84.257 + </binding> 84.258 + <binding name='y'> 84.259 + <uri>http://example.org#F</uri> 84.260 + </binding> 84.261 + <binding name='overlaps'> 84.262 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 84.263 + </binding> 84.264 + </result> 84.265 + 84.266 + <result> 84.267 + <binding name='x'> 84.268 + <uri>http://example.org#D</uri> 84.269 + </binding> 84.270 + <binding name='y'> 84.271 + <uri>http://example.org#G</uri> 84.272 + </binding> 84.273 + <binding name='overlaps'> 84.274 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.275 + </binding> 84.276 + </result> 84.277 + 84.278 + <result> 84.279 + <binding name='x'> 84.280 + <uri>http://example.org#D</uri> 84.281 + </binding> 84.282 + <binding name='y'> 84.283 + <uri>http://example.org#H</uri> 84.284 + </binding> 84.285 + <binding name='overlaps'> 84.286 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.287 + </binding> 84.288 + </result> 84.289 + 84.290 + <!-- E --> 84.291 + 84.292 + <result> 84.293 + <binding name='x'> 84.294 + <uri>http://example.org#E</uri> 84.295 + </binding> 84.296 + <binding name='y'> 84.297 + <uri>http://example.org#F</uri> 84.298 + </binding> 84.299 + <binding name='overlaps'> 84.300 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 84.301 + </binding> 84.302 + </result> 84.303 + 84.304 + <result> 84.305 + <binding name='x'> 84.306 + <uri>http://example.org#E</uri> 84.307 + </binding> 84.308 + <binding name='y'> 84.309 + <uri>http://example.org#G</uri> 84.310 + </binding> 84.311 + <binding name='overlaps'> 84.312 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.313 + </binding> 84.314 + </result> 84.315 + 84.316 + <result> 84.317 + <binding name='x'> 84.318 + <uri>http://example.org#E</uri> 84.319 + </binding> 84.320 + <binding name='y'> 84.321 + <uri>http://example.org#H</uri> 84.322 + </binding> 84.323 + <binding name='overlaps'> 84.324 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.325 + </binding> 84.326 + </result> 84.327 + 84.328 + <!-- F --> 84.329 + 84.330 + <result> 84.331 + <binding name='x'> 84.332 + <uri>http://example.org#F</uri> 84.333 + </binding> 84.334 + <binding name='y'> 84.335 + <uri>http://example.org#G</uri> 84.336 + </binding> 84.337 + <binding name='overlaps'> 84.338 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.339 + </binding> 84.340 + </result> 84.341 + 84.342 + <result> 84.343 + <binding name='x'> 84.344 + <uri>http://example.org#F</uri> 84.345 + </binding> 84.346 + <binding name='y'> 84.347 + <uri>http://example.org#H</uri> 84.348 + </binding> 84.349 + <binding name='overlaps'> 84.350 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.351 + </binding> 84.352 + </result> 84.353 + 84.354 + <!-- G --> 84.355 + 84.356 + <result> 84.357 + <binding name='x'> 84.358 + <uri>http://example.org#G</uri> 84.359 + </binding> 84.360 + <binding name='y'> 84.361 + <uri>http://example.org#H</uri> 84.362 + </binding> 84.363 + <binding name='overlaps'> 84.364 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 84.365 + </binding> 84.366 + </result> 84.367 + </results> 84.368 +</sparql> 84.369 \ No newline at end of file
85.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 85.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Intersects_GEOSPARQL_Test.rq Wed Sep 24 18:44:26 2014 +0300 85.3 @@ -0,0 +1,11 @@ 85.4 +SELECT ?x ?y (geof:sfIntersects(?g1, ?g2) as ?intersects) 85.5 +WHERE 85.6 +{ 85.7 +?x geo:hasGeometry ?geom1. 85.8 +?geom1 geo:asWKT ?g1. 85.9 + 85.10 +?y geo:hasGeometry ?geom2. 85.11 +?geom2 geo:asWKT ?g2. 85.12 + 85.13 +FILTER(str(?x) < str(?y)) 85.14 +} 85.15 \ No newline at end of file
86.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 86.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Intersects_GEOSPARQL_Test.srx Wed Sep 24 18:44:26 2014 +0300 86.3 @@ -0,0 +1,365 @@ 86.4 +<?xml version='1.0' encoding='UTF-8'?> 86.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 86.6 + <head> 86.7 + <variable name='x'/> 86.8 + <variable name='y'/> 86.9 + <variable name='intersects'/> 86.10 + </head> 86.11 + <results> 86.12 + <result> 86.13 + <binding name='x'> 86.14 + <uri>http://example.org#A</uri> 86.15 + </binding> 86.16 + <binding name='y'> 86.17 + <uri>http://example.org#B</uri> 86.18 + </binding> 86.19 + <binding name='intersects'> 86.20 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.21 + </binding> 86.22 + </result> 86.23 + 86.24 + <result> 86.25 + <binding name='x'> 86.26 + <uri>http://example.org#A</uri> 86.27 + </binding> 86.28 + <binding name='y'> 86.29 + <uri>http://example.org#C</uri> 86.30 + </binding> 86.31 + <binding name='intersects'> 86.32 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.33 + </binding> 86.34 + </result> 86.35 + 86.36 + <result> 86.37 + <binding name='x'> 86.38 + <uri>http://example.org#A</uri> 86.39 + </binding> 86.40 + <binding name='y'> 86.41 + <uri>http://example.org#D</uri> 86.42 + </binding> 86.43 + <binding name='intersects'> 86.44 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.45 + </binding> 86.46 + </result> 86.47 + 86.48 + <result> 86.49 + <binding name='x'> 86.50 + <uri>http://example.org#A</uri> 86.51 + </binding> 86.52 + <binding name='y'> 86.53 + <uri>http://example.org#E</uri> 86.54 + </binding> 86.55 + <binding name='intersects'> 86.56 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.57 + </binding> 86.58 + </result> 86.59 + 86.60 + <result> 86.61 + <binding name='x'> 86.62 + <uri>http://example.org#A</uri> 86.63 + </binding> 86.64 + <binding name='y'> 86.65 + <uri>http://example.org#F</uri> 86.66 + </binding> 86.67 + <binding name='intersects'> 86.68 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.69 + </binding> 86.70 + </result> 86.71 + 86.72 + <result> 86.73 + <binding name='x'> 86.74 + <uri>http://example.org#A</uri> 86.75 + </binding> 86.76 + <binding name='y'> 86.77 + <uri>http://example.org#G</uri> 86.78 + </binding> 86.79 + <binding name='intersects'> 86.80 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.81 + </binding> 86.82 + </result> 86.83 + 86.84 + 86.85 + 86.86 + <result> 86.87 + <binding name='x'> 86.88 + <uri>http://example.org#A</uri> 86.89 + </binding> 86.90 + <binding name='y'> 86.91 + <uri>http://example.org#H</uri> 86.92 + </binding> 86.93 + <binding name='intersects'> 86.94 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.95 + </binding> 86.96 + </result> 86.97 + 86.98 + 86.99 + 86.100 + 86.101 + 86.102 + 86.103 + 86.104 + <!-- B --> 86.105 + 86.106 + <result> 86.107 + <binding name='x'> 86.108 + <uri>http://example.org#B</uri> 86.109 + </binding> 86.110 + <binding name='y'> 86.111 + <uri>http://example.org#C</uri> 86.112 + </binding> 86.113 + <binding name='intersects'> 86.114 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.115 + </binding> 86.116 + </result> 86.117 + 86.118 + <result> 86.119 + <binding name='x'> 86.120 + <uri>http://example.org#B</uri> 86.121 + </binding> 86.122 + <binding name='y'> 86.123 + <uri>http://example.org#D</uri> 86.124 + </binding> 86.125 + <binding name='intersects'> 86.126 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.127 + </binding> 86.128 + </result> 86.129 + 86.130 + <result> 86.131 + <binding name='x'> 86.132 + <uri>http://example.org#B</uri> 86.133 + </binding> 86.134 + <binding name='y'> 86.135 + <uri>http://example.org#E</uri> 86.136 + </binding> 86.137 + <binding name='intersects'> 86.138 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.139 + </binding> 86.140 + </result> 86.141 + 86.142 + <result> 86.143 + <binding name='x'> 86.144 + <uri>http://example.org#B</uri> 86.145 + </binding> 86.146 + <binding name='y'> 86.147 + <uri>http://example.org#F</uri> 86.148 + </binding> 86.149 + <binding name='intersects'> 86.150 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.151 + </binding> 86.152 + </result> 86.153 + 86.154 + <result> 86.155 + <binding name='x'> 86.156 + <uri>http://example.org#B</uri> 86.157 + </binding> 86.158 + <binding name='y'> 86.159 + <uri>http://example.org#G</uri> 86.160 + </binding> 86.161 + <binding name='intersects'> 86.162 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.163 + </binding> 86.164 + </result> 86.165 + 86.166 + <result> 86.167 + <binding name='x'> 86.168 + <uri>http://example.org#B</uri> 86.169 + </binding> 86.170 + <binding name='y'> 86.171 + <uri>http://example.org#H</uri> 86.172 + </binding> 86.173 + <binding name='intersects'> 86.174 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.175 + </binding> 86.176 + </result> 86.177 + 86.178 + <!-- C --> 86.179 + 86.180 + <result> 86.181 + <binding name='x'> 86.182 + <uri>http://example.org#C</uri> 86.183 + </binding> 86.184 + <binding name='y'> 86.185 + <uri>http://example.org#D</uri> 86.186 + </binding> 86.187 + <binding name='intersects'> 86.188 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.189 + </binding> 86.190 + </result> 86.191 + 86.192 + <result> 86.193 + <binding name='x'> 86.194 + <uri>http://example.org#C</uri> 86.195 + </binding> 86.196 + <binding name='y'> 86.197 + <uri>http://example.org#E</uri> 86.198 + </binding> 86.199 + <binding name='intersects'> 86.200 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.201 + </binding> 86.202 + </result> 86.203 + 86.204 + <result> 86.205 + <binding name='x'> 86.206 + <uri>http://example.org#C</uri> 86.207 + </binding> 86.208 + <binding name='y'> 86.209 + <uri>http://example.org#F</uri> 86.210 + </binding> 86.211 + <binding name='intersects'> 86.212 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.213 + </binding> 86.214 + </result> 86.215 + 86.216 + <result> 86.217 + <binding name='x'> 86.218 + <uri>http://example.org#C</uri> 86.219 + </binding> 86.220 + <binding name='y'> 86.221 + <uri>http://example.org#G</uri> 86.222 + </binding> 86.223 + <binding name='intersects'> 86.224 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.225 + </binding> 86.226 + </result> 86.227 + 86.228 + <result> 86.229 + <binding name='x'> 86.230 + <uri>http://example.org#C</uri> 86.231 + </binding> 86.232 + <binding name='y'> 86.233 + <uri>http://example.org#H</uri> 86.234 + </binding> 86.235 + <binding name='intersects'> 86.236 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.237 + </binding> 86.238 + </result> 86.239 + 86.240 + <!-- D --> 86.241 + 86.242 + <result> 86.243 + <binding name='x'> 86.244 + <uri>http://example.org#D</uri> 86.245 + </binding> 86.246 + <binding name='y'> 86.247 + <uri>http://example.org#E</uri> 86.248 + </binding> 86.249 + <binding name='intersects'> 86.250 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.251 + </binding> 86.252 + </result> 86.253 + 86.254 + <result> 86.255 + <binding name='x'> 86.256 + <uri>http://example.org#D</uri> 86.257 + </binding> 86.258 + <binding name='y'> 86.259 + <uri>http://example.org#F</uri> 86.260 + </binding> 86.261 + <binding name='intersects'> 86.262 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.263 + </binding> 86.264 + </result> 86.265 + 86.266 + <result> 86.267 + <binding name='x'> 86.268 + <uri>http://example.org#D</uri> 86.269 + </binding> 86.270 + <binding name='y'> 86.271 + <uri>http://example.org#G</uri> 86.272 + </binding> 86.273 + <binding name='intersects'> 86.274 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.275 + </binding> 86.276 + </result> 86.277 + 86.278 + <result> 86.279 + <binding name='x'> 86.280 + <uri>http://example.org#D</uri> 86.281 + </binding> 86.282 + <binding name='y'> 86.283 + <uri>http://example.org#H</uri> 86.284 + </binding> 86.285 + <binding name='intersects'> 86.286 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.287 + </binding> 86.288 + </result> 86.289 + 86.290 + <!-- E --> 86.291 + 86.292 + <result> 86.293 + <binding name='x'> 86.294 + <uri>http://example.org#E</uri> 86.295 + </binding> 86.296 + <binding name='y'> 86.297 + <uri>http://example.org#F</uri> 86.298 + </binding> 86.299 + <binding name='intersects'> 86.300 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 86.301 + </binding> 86.302 + </result> 86.303 + 86.304 + <result> 86.305 + <binding name='x'> 86.306 + <uri>http://example.org#E</uri> 86.307 + </binding> 86.308 + <binding name='y'> 86.309 + <uri>http://example.org#G</uri> 86.310 + </binding> 86.311 + <binding name='intersects'> 86.312 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.313 + </binding> 86.314 + </result> 86.315 + 86.316 + <result> 86.317 + <binding name='x'> 86.318 + <uri>http://example.org#E</uri> 86.319 + </binding> 86.320 + <binding name='y'> 86.321 + <uri>http://example.org#H</uri> 86.322 + </binding> 86.323 + <binding name='intersects'> 86.324 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.325 + </binding> 86.326 + </result> 86.327 + 86.328 + <!-- F --> 86.329 + 86.330 + <result> 86.331 + <binding name='x'> 86.332 + <uri>http://example.org#F</uri> 86.333 + </binding> 86.334 + <binding name='y'> 86.335 + <uri>http://example.org#G</uri> 86.336 + </binding> 86.337 + <binding name='intersects'> 86.338 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.339 + </binding> 86.340 + </result> 86.341 + 86.342 + <result> 86.343 + <binding name='x'> 86.344 + <uri>http://example.org#F</uri> 86.345 + </binding> 86.346 + <binding name='y'> 86.347 + <uri>http://example.org#H</uri> 86.348 + </binding> 86.349 + <binding name='intersects'> 86.350 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.351 + </binding> 86.352 + </result> 86.353 + 86.354 + <!-- G --> 86.355 + 86.356 + <result> 86.357 + <binding name='x'> 86.358 + <uri>http://example.org#G</uri> 86.359 + </binding> 86.360 + <binding name='y'> 86.361 + <uri>http://example.org#H</uri> 86.362 + </binding> 86.363 + <binding name='intersects'> 86.364 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 86.365 + </binding> 86.366 + </result> 86.367 + </results> 86.368 +</sparql> 86.369 \ No newline at end of file
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 87.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Intersects_stRDF_Test.rq Wed Sep 24 18:44:26 2014 +0300 87.3 @@ -0,0 +1,11 @@ 87.4 +SELECT ?x ?y (strdf:intersects(?g1, ?g2) as ?intersects) 87.5 +WHERE 87.6 +{ 87.7 +?x geo:hasGeometry ?geom1. 87.8 +?geom1 geo:asWKT ?g1. 87.9 + 87.10 +?y geo:hasGeometry ?geom2. 87.11 +?geom2 geo:asWKT ?g2. 87.12 + 87.13 +FILTER(str(?x) < str(?y)) 87.14 +} 87.15 \ No newline at end of file
88.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 88.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Intersects_stRDF_Test.srx Wed Sep 24 18:44:26 2014 +0300 88.3 @@ -0,0 +1,365 @@ 88.4 +<?xml version='1.0' encoding='UTF-8'?> 88.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 88.6 + <head> 88.7 + <variable name='x'/> 88.8 + <variable name='y'/> 88.9 + <variable name='intersects'/> 88.10 + </head> 88.11 + <results> 88.12 + <result> 88.13 + <binding name='x'> 88.14 + <uri>http://example.org#A</uri> 88.15 + </binding> 88.16 + <binding name='y'> 88.17 + <uri>http://example.org#B</uri> 88.18 + </binding> 88.19 + <binding name='intersects'> 88.20 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.21 + </binding> 88.22 + </result> 88.23 + 88.24 + <result> 88.25 + <binding name='x'> 88.26 + <uri>http://example.org#A</uri> 88.27 + </binding> 88.28 + <binding name='y'> 88.29 + <uri>http://example.org#C</uri> 88.30 + </binding> 88.31 + <binding name='intersects'> 88.32 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.33 + </binding> 88.34 + </result> 88.35 + 88.36 + <result> 88.37 + <binding name='x'> 88.38 + <uri>http://example.org#A</uri> 88.39 + </binding> 88.40 + <binding name='y'> 88.41 + <uri>http://example.org#D</uri> 88.42 + </binding> 88.43 + <binding name='intersects'> 88.44 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.45 + </binding> 88.46 + </result> 88.47 + 88.48 + <result> 88.49 + <binding name='x'> 88.50 + <uri>http://example.org#A</uri> 88.51 + </binding> 88.52 + <binding name='y'> 88.53 + <uri>http://example.org#E</uri> 88.54 + </binding> 88.55 + <binding name='intersects'> 88.56 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.57 + </binding> 88.58 + </result> 88.59 + 88.60 + <result> 88.61 + <binding name='x'> 88.62 + <uri>http://example.org#A</uri> 88.63 + </binding> 88.64 + <binding name='y'> 88.65 + <uri>http://example.org#F</uri> 88.66 + </binding> 88.67 + <binding name='intersects'> 88.68 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.69 + </binding> 88.70 + </result> 88.71 + 88.72 + <result> 88.73 + <binding name='x'> 88.74 + <uri>http://example.org#A</uri> 88.75 + </binding> 88.76 + <binding name='y'> 88.77 + <uri>http://example.org#G</uri> 88.78 + </binding> 88.79 + <binding name='intersects'> 88.80 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.81 + </binding> 88.82 + </result> 88.83 + 88.84 + 88.85 + 88.86 + <result> 88.87 + <binding name='x'> 88.88 + <uri>http://example.org#A</uri> 88.89 + </binding> 88.90 + <binding name='y'> 88.91 + <uri>http://example.org#H</uri> 88.92 + </binding> 88.93 + <binding name='intersects'> 88.94 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.95 + </binding> 88.96 + </result> 88.97 + 88.98 + 88.99 + 88.100 + 88.101 + 88.102 + 88.103 + 88.104 + <!-- B --> 88.105 + 88.106 + <result> 88.107 + <binding name='x'> 88.108 + <uri>http://example.org#B</uri> 88.109 + </binding> 88.110 + <binding name='y'> 88.111 + <uri>http://example.org#C</uri> 88.112 + </binding> 88.113 + <binding name='intersects'> 88.114 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.115 + </binding> 88.116 + </result> 88.117 + 88.118 + <result> 88.119 + <binding name='x'> 88.120 + <uri>http://example.org#B</uri> 88.121 + </binding> 88.122 + <binding name='y'> 88.123 + <uri>http://example.org#D</uri> 88.124 + </binding> 88.125 + <binding name='intersects'> 88.126 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.127 + </binding> 88.128 + </result> 88.129 + 88.130 + <result> 88.131 + <binding name='x'> 88.132 + <uri>http://example.org#B</uri> 88.133 + </binding> 88.134 + <binding name='y'> 88.135 + <uri>http://example.org#E</uri> 88.136 + </binding> 88.137 + <binding name='intersects'> 88.138 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.139 + </binding> 88.140 + </result> 88.141 + 88.142 + <result> 88.143 + <binding name='x'> 88.144 + <uri>http://example.org#B</uri> 88.145 + </binding> 88.146 + <binding name='y'> 88.147 + <uri>http://example.org#F</uri> 88.148 + </binding> 88.149 + <binding name='intersects'> 88.150 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.151 + </binding> 88.152 + </result> 88.153 + 88.154 + <result> 88.155 + <binding name='x'> 88.156 + <uri>http://example.org#B</uri> 88.157 + </binding> 88.158 + <binding name='y'> 88.159 + <uri>http://example.org#G</uri> 88.160 + </binding> 88.161 + <binding name='intersects'> 88.162 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.163 + </binding> 88.164 + </result> 88.165 + 88.166 + <result> 88.167 + <binding name='x'> 88.168 + <uri>http://example.org#B</uri> 88.169 + </binding> 88.170 + <binding name='y'> 88.171 + <uri>http://example.org#H</uri> 88.172 + </binding> 88.173 + <binding name='intersects'> 88.174 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.175 + </binding> 88.176 + </result> 88.177 + 88.178 + <!-- C --> 88.179 + 88.180 + <result> 88.181 + <binding name='x'> 88.182 + <uri>http://example.org#C</uri> 88.183 + </binding> 88.184 + <binding name='y'> 88.185 + <uri>http://example.org#D</uri> 88.186 + </binding> 88.187 + <binding name='intersects'> 88.188 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.189 + </binding> 88.190 + </result> 88.191 + 88.192 + <result> 88.193 + <binding name='x'> 88.194 + <uri>http://example.org#C</uri> 88.195 + </binding> 88.196 + <binding name='y'> 88.197 + <uri>http://example.org#E</uri> 88.198 + </binding> 88.199 + <binding name='intersects'> 88.200 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.201 + </binding> 88.202 + </result> 88.203 + 88.204 + <result> 88.205 + <binding name='x'> 88.206 + <uri>http://example.org#C</uri> 88.207 + </binding> 88.208 + <binding name='y'> 88.209 + <uri>http://example.org#F</uri> 88.210 + </binding> 88.211 + <binding name='intersects'> 88.212 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.213 + </binding> 88.214 + </result> 88.215 + 88.216 + <result> 88.217 + <binding name='x'> 88.218 + <uri>http://example.org#C</uri> 88.219 + </binding> 88.220 + <binding name='y'> 88.221 + <uri>http://example.org#G</uri> 88.222 + </binding> 88.223 + <binding name='intersects'> 88.224 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.225 + </binding> 88.226 + </result> 88.227 + 88.228 + <result> 88.229 + <binding name='x'> 88.230 + <uri>http://example.org#C</uri> 88.231 + </binding> 88.232 + <binding name='y'> 88.233 + <uri>http://example.org#H</uri> 88.234 + </binding> 88.235 + <binding name='intersects'> 88.236 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.237 + </binding> 88.238 + </result> 88.239 + 88.240 + <!-- D --> 88.241 + 88.242 + <result> 88.243 + <binding name='x'> 88.244 + <uri>http://example.org#D</uri> 88.245 + </binding> 88.246 + <binding name='y'> 88.247 + <uri>http://example.org#E</uri> 88.248 + </binding> 88.249 + <binding name='intersects'> 88.250 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.251 + </binding> 88.252 + </result> 88.253 + 88.254 + <result> 88.255 + <binding name='x'> 88.256 + <uri>http://example.org#D</uri> 88.257 + </binding> 88.258 + <binding name='y'> 88.259 + <uri>http://example.org#F</uri> 88.260 + </binding> 88.261 + <binding name='intersects'> 88.262 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.263 + </binding> 88.264 + </result> 88.265 + 88.266 + <result> 88.267 + <binding name='x'> 88.268 + <uri>http://example.org#D</uri> 88.269 + </binding> 88.270 + <binding name='y'> 88.271 + <uri>http://example.org#G</uri> 88.272 + </binding> 88.273 + <binding name='intersects'> 88.274 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.275 + </binding> 88.276 + </result> 88.277 + 88.278 + <result> 88.279 + <binding name='x'> 88.280 + <uri>http://example.org#D</uri> 88.281 + </binding> 88.282 + <binding name='y'> 88.283 + <uri>http://example.org#H</uri> 88.284 + </binding> 88.285 + <binding name='intersects'> 88.286 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.287 + </binding> 88.288 + </result> 88.289 + 88.290 + <!-- E --> 88.291 + 88.292 + <result> 88.293 + <binding name='x'> 88.294 + <uri>http://example.org#E</uri> 88.295 + </binding> 88.296 + <binding name='y'> 88.297 + <uri>http://example.org#F</uri> 88.298 + </binding> 88.299 + <binding name='intersects'> 88.300 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 88.301 + </binding> 88.302 + </result> 88.303 + 88.304 + <result> 88.305 + <binding name='x'> 88.306 + <uri>http://example.org#E</uri> 88.307 + </binding> 88.308 + <binding name='y'> 88.309 + <uri>http://example.org#G</uri> 88.310 + </binding> 88.311 + <binding name='intersects'> 88.312 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.313 + </binding> 88.314 + </result> 88.315 + 88.316 + <result> 88.317 + <binding name='x'> 88.318 + <uri>http://example.org#E</uri> 88.319 + </binding> 88.320 + <binding name='y'> 88.321 + <uri>http://example.org#H</uri> 88.322 + </binding> 88.323 + <binding name='intersects'> 88.324 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.325 + </binding> 88.326 + </result> 88.327 + 88.328 + <!-- F --> 88.329 + 88.330 + <result> 88.331 + <binding name='x'> 88.332 + <uri>http://example.org#F</uri> 88.333 + </binding> 88.334 + <binding name='y'> 88.335 + <uri>http://example.org#G</uri> 88.336 + </binding> 88.337 + <binding name='intersects'> 88.338 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.339 + </binding> 88.340 + </result> 88.341 + 88.342 + <result> 88.343 + <binding name='x'> 88.344 + <uri>http://example.org#F</uri> 88.345 + </binding> 88.346 + <binding name='y'> 88.347 + <uri>http://example.org#H</uri> 88.348 + </binding> 88.349 + <binding name='intersects'> 88.350 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.351 + </binding> 88.352 + </result> 88.353 + 88.354 + <!-- G --> 88.355 + 88.356 + <result> 88.357 + <binding name='x'> 88.358 + <uri>http://example.org#G</uri> 88.359 + </binding> 88.360 + <binding name='y'> 88.361 + <uri>http://example.org#H</uri> 88.362 + </binding> 88.363 + <binding name='intersects'> 88.364 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 88.365 + </binding> 88.366 + </result> 88.367 + </results> 88.368 +</sparql> 88.369 \ No newline at end of file
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 89.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Overlaps_GEOSPARQL_Test.rq Wed Sep 24 18:44:26 2014 +0300 89.3 @@ -0,0 +1,11 @@ 89.4 +SELECT ?x ?y (geof:sfOverlaps(?g1, ?g2) as ?overlaps) 89.5 +WHERE 89.6 +{ 89.7 +?x geo:hasGeometry ?geom1. 89.8 +?geom1 geo:asWKT ?g1. 89.9 + 89.10 +?y geo:hasGeometry ?geom2. 89.11 +?geom2 geo:asWKT ?g2. 89.12 + 89.13 +FILTER(str(?x) < str(?y)) 89.14 +} 89.15 \ No newline at end of file
90.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 90.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Overlaps_GEOSPARQL_Test.srx Wed Sep 24 18:44:26 2014 +0300 90.3 @@ -0,0 +1,365 @@ 90.4 +<?xml version='1.0' encoding='UTF-8'?> 90.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 90.6 + <head> 90.7 + <variable name='x'/> 90.8 + <variable name='y'/> 90.9 + <variable name='overlaps'/> 90.10 + </head> 90.11 + <results> 90.12 + <result> 90.13 + <binding name='x'> 90.14 + <uri>http://example.org#A</uri> 90.15 + </binding> 90.16 + <binding name='y'> 90.17 + <uri>http://example.org#B</uri> 90.18 + </binding> 90.19 + <binding name='overlaps'> 90.20 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.21 + </binding> 90.22 + </result> 90.23 + 90.24 + <result> 90.25 + <binding name='x'> 90.26 + <uri>http://example.org#A</uri> 90.27 + </binding> 90.28 + <binding name='y'> 90.29 + <uri>http://example.org#C</uri> 90.30 + </binding> 90.31 + <binding name='overlaps'> 90.32 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.33 + </binding> 90.34 + </result> 90.35 + 90.36 + <result> 90.37 + <binding name='x'> 90.38 + <uri>http://example.org#A</uri> 90.39 + </binding> 90.40 + <binding name='y'> 90.41 + <uri>http://example.org#D</uri> 90.42 + </binding> 90.43 + <binding name='overlaps'> 90.44 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.45 + </binding> 90.46 + </result> 90.47 + 90.48 + <result> 90.49 + <binding name='x'> 90.50 + <uri>http://example.org#A</uri> 90.51 + </binding> 90.52 + <binding name='y'> 90.53 + <uri>http://example.org#E</uri> 90.54 + </binding> 90.55 + <binding name='overlaps'> 90.56 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.57 + </binding> 90.58 + </result> 90.59 + 90.60 + <result> 90.61 + <binding name='x'> 90.62 + <uri>http://example.org#A</uri> 90.63 + </binding> 90.64 + <binding name='y'> 90.65 + <uri>http://example.org#F</uri> 90.66 + </binding> 90.67 + <binding name='overlaps'> 90.68 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.69 + </binding> 90.70 + </result> 90.71 + 90.72 + <result> 90.73 + <binding name='x'> 90.74 + <uri>http://example.org#A</uri> 90.75 + </binding> 90.76 + <binding name='y'> 90.77 + <uri>http://example.org#G</uri> 90.78 + </binding> 90.79 + <binding name='overlaps'> 90.80 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.81 + </binding> 90.82 + </result> 90.83 + 90.84 + 90.85 + 90.86 + <result> 90.87 + <binding name='x'> 90.88 + <uri>http://example.org#A</uri> 90.89 + </binding> 90.90 + <binding name='y'> 90.91 + <uri>http://example.org#H</uri> 90.92 + </binding> 90.93 + <binding name='overlaps'> 90.94 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.95 + </binding> 90.96 + </result> 90.97 + 90.98 + 90.99 + 90.100 + 90.101 + 90.102 + 90.103 + 90.104 + <!-- B --> 90.105 + 90.106 + <result> 90.107 + <binding name='x'> 90.108 + <uri>http://example.org#B</uri> 90.109 + </binding> 90.110 + <binding name='y'> 90.111 + <uri>http://example.org#C</uri> 90.112 + </binding> 90.113 + <binding name='overlaps'> 90.114 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 90.115 + </binding> 90.116 + </result> 90.117 + 90.118 + <result> 90.119 + <binding name='x'> 90.120 + <uri>http://example.org#B</uri> 90.121 + </binding> 90.122 + <binding name='y'> 90.123 + <uri>http://example.org#D</uri> 90.124 + </binding> 90.125 + <binding name='overlaps'> 90.126 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.127 + </binding> 90.128 + </result> 90.129 + 90.130 + <result> 90.131 + <binding name='x'> 90.132 + <uri>http://example.org#B</uri> 90.133 + </binding> 90.134 + <binding name='y'> 90.135 + <uri>http://example.org#E</uri> 90.136 + </binding> 90.137 + <binding name='overlaps'> 90.138 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.139 + </binding> 90.140 + </result> 90.141 + 90.142 + <result> 90.143 + <binding name='x'> 90.144 + <uri>http://example.org#B</uri> 90.145 + </binding> 90.146 + <binding name='y'> 90.147 + <uri>http://example.org#F</uri> 90.148 + </binding> 90.149 + <binding name='overlaps'> 90.150 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.151 + </binding> 90.152 + </result> 90.153 + 90.154 + <result> 90.155 + <binding name='x'> 90.156 + <uri>http://example.org#B</uri> 90.157 + </binding> 90.158 + <binding name='y'> 90.159 + <uri>http://example.org#G</uri> 90.160 + </binding> 90.161 + <binding name='overlaps'> 90.162 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.163 + </binding> 90.164 + </result> 90.165 + 90.166 + <result> 90.167 + <binding name='x'> 90.168 + <uri>http://example.org#B</uri> 90.169 + </binding> 90.170 + <binding name='y'> 90.171 + <uri>http://example.org#H</uri> 90.172 + </binding> 90.173 + <binding name='overlaps'> 90.174 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.175 + </binding> 90.176 + </result> 90.177 + 90.178 + <!-- C --> 90.179 + 90.180 + <result> 90.181 + <binding name='x'> 90.182 + <uri>http://example.org#C</uri> 90.183 + </binding> 90.184 + <binding name='y'> 90.185 + <uri>http://example.org#D</uri> 90.186 + </binding> 90.187 + <binding name='overlaps'> 90.188 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.189 + </binding> 90.190 + </result> 90.191 + 90.192 + <result> 90.193 + <binding name='x'> 90.194 + <uri>http://example.org#C</uri> 90.195 + </binding> 90.196 + <binding name='y'> 90.197 + <uri>http://example.org#E</uri> 90.198 + </binding> 90.199 + <binding name='overlaps'> 90.200 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.201 + </binding> 90.202 + </result> 90.203 + 90.204 + <result> 90.205 + <binding name='x'> 90.206 + <uri>http://example.org#C</uri> 90.207 + </binding> 90.208 + <binding name='y'> 90.209 + <uri>http://example.org#F</uri> 90.210 + </binding> 90.211 + <binding name='overlaps'> 90.212 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.213 + </binding> 90.214 + </result> 90.215 + 90.216 + <result> 90.217 + <binding name='x'> 90.218 + <uri>http://example.org#C</uri> 90.219 + </binding> 90.220 + <binding name='y'> 90.221 + <uri>http://example.org#G</uri> 90.222 + </binding> 90.223 + <binding name='overlaps'> 90.224 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.225 + </binding> 90.226 + </result> 90.227 + 90.228 + <result> 90.229 + <binding name='x'> 90.230 + <uri>http://example.org#C</uri> 90.231 + </binding> 90.232 + <binding name='y'> 90.233 + <uri>http://example.org#H</uri> 90.234 + </binding> 90.235 + <binding name='overlaps'> 90.236 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.237 + </binding> 90.238 + </result> 90.239 + 90.240 + <!-- D --> 90.241 + 90.242 + <result> 90.243 + <binding name='x'> 90.244 + <uri>http://example.org#D</uri> 90.245 + </binding> 90.246 + <binding name='y'> 90.247 + <uri>http://example.org#E</uri> 90.248 + </binding> 90.249 + <binding name='overlaps'> 90.250 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.251 + </binding> 90.252 + </result> 90.253 + 90.254 + <result> 90.255 + <binding name='x'> 90.256 + <uri>http://example.org#D</uri> 90.257 + </binding> 90.258 + <binding name='y'> 90.259 + <uri>http://example.org#F</uri> 90.260 + </binding> 90.261 + <binding name='overlaps'> 90.262 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.263 + </binding> 90.264 + </result> 90.265 + 90.266 + <result> 90.267 + <binding name='x'> 90.268 + <uri>http://example.org#D</uri> 90.269 + </binding> 90.270 + <binding name='y'> 90.271 + <uri>http://example.org#G</uri> 90.272 + </binding> 90.273 + <binding name='overlaps'> 90.274 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.275 + </binding> 90.276 + </result> 90.277 + 90.278 + <result> 90.279 + <binding name='x'> 90.280 + <uri>http://example.org#D</uri> 90.281 + </binding> 90.282 + <binding name='y'> 90.283 + <uri>http://example.org#H</uri> 90.284 + </binding> 90.285 + <binding name='overlaps'> 90.286 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.287 + </binding> 90.288 + </result> 90.289 + 90.290 + <!-- E --> 90.291 + 90.292 + <result> 90.293 + <binding name='x'> 90.294 + <uri>http://example.org#E</uri> 90.295 + </binding> 90.296 + <binding name='y'> 90.297 + <uri>http://example.org#F</uri> 90.298 + </binding> 90.299 + <binding name='overlaps'> 90.300 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.301 + </binding> 90.302 + </result> 90.303 + 90.304 + <result> 90.305 + <binding name='x'> 90.306 + <uri>http://example.org#E</uri> 90.307 + </binding> 90.308 + <binding name='y'> 90.309 + <uri>http://example.org#G</uri> 90.310 + </binding> 90.311 + <binding name='overlaps'> 90.312 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.313 + </binding> 90.314 + </result> 90.315 + 90.316 + <result> 90.317 + <binding name='x'> 90.318 + <uri>http://example.org#E</uri> 90.319 + </binding> 90.320 + <binding name='y'> 90.321 + <uri>http://example.org#H</uri> 90.322 + </binding> 90.323 + <binding name='overlaps'> 90.324 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.325 + </binding> 90.326 + </result> 90.327 + 90.328 + <!-- F --> 90.329 + 90.330 + <result> 90.331 + <binding name='x'> 90.332 + <uri>http://example.org#F</uri> 90.333 + </binding> 90.334 + <binding name='y'> 90.335 + <uri>http://example.org#G</uri> 90.336 + </binding> 90.337 + <binding name='overlaps'> 90.338 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.339 + </binding> 90.340 + </result> 90.341 + 90.342 + <result> 90.343 + <binding name='x'> 90.344 + <uri>http://example.org#F</uri> 90.345 + </binding> 90.346 + <binding name='y'> 90.347 + <uri>http://example.org#H</uri> 90.348 + </binding> 90.349 + <binding name='overlaps'> 90.350 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.351 + </binding> 90.352 + </result> 90.353 + 90.354 + <!-- G --> 90.355 + 90.356 + <result> 90.357 + <binding name='x'> 90.358 + <uri>http://example.org#G</uri> 90.359 + </binding> 90.360 + <binding name='y'> 90.361 + <uri>http://example.org#H</uri> 90.362 + </binding> 90.363 + <binding name='overlaps'> 90.364 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 90.365 + </binding> 90.366 + </result> 90.367 + </results> 90.368 +</sparql> 90.369 \ No newline at end of file
91.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 91.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Overlaps_stRDF_Test.rq Wed Sep 24 18:44:26 2014 +0300 91.3 @@ -0,0 +1,11 @@ 91.4 +SELECT ?x ?y (strdf:overlaps(?g1, ?g2) as ?overlaps) 91.5 +WHERE 91.6 +{ 91.7 +?x geo:hasGeometry ?geom1. 91.8 +?geom1 geo:asWKT ?g1. 91.9 + 91.10 +?y geo:hasGeometry ?geom2. 91.11 +?geom2 geo:asWKT ?g2. 91.12 + 91.13 +FILTER(str(?x) < str(?y)) 91.14 +} 91.15 \ No newline at end of file
92.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 92.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/Overlaps_stRDF_Test.srx Wed Sep 24 18:44:26 2014 +0300 92.3 @@ -0,0 +1,365 @@ 92.4 +<?xml version='1.0' encoding='UTF-8'?> 92.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 92.6 + <head> 92.7 + <variable name='x'/> 92.8 + <variable name='y'/> 92.9 + <variable name='overlaps'/> 92.10 + </head> 92.11 + <results> 92.12 + <result> 92.13 + <binding name='x'> 92.14 + <uri>http://example.org#A</uri> 92.15 + </binding> 92.16 + <binding name='y'> 92.17 + <uri>http://example.org#B</uri> 92.18 + </binding> 92.19 + <binding name='overlaps'> 92.20 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.21 + </binding> 92.22 + </result> 92.23 + 92.24 + <result> 92.25 + <binding name='x'> 92.26 + <uri>http://example.org#A</uri> 92.27 + </binding> 92.28 + <binding name='y'> 92.29 + <uri>http://example.org#C</uri> 92.30 + </binding> 92.31 + <binding name='overlaps'> 92.32 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.33 + </binding> 92.34 + </result> 92.35 + 92.36 + <result> 92.37 + <binding name='x'> 92.38 + <uri>http://example.org#A</uri> 92.39 + </binding> 92.40 + <binding name='y'> 92.41 + <uri>http://example.org#D</uri> 92.42 + </binding> 92.43 + <binding name='overlaps'> 92.44 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.45 + </binding> 92.46 + </result> 92.47 + 92.48 + <result> 92.49 + <binding name='x'> 92.50 + <uri>http://example.org#A</uri> 92.51 + </binding> 92.52 + <binding name='y'> 92.53 + <uri>http://example.org#E</uri> 92.54 + </binding> 92.55 + <binding name='overlaps'> 92.56 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.57 + </binding> 92.58 + </result> 92.59 + 92.60 + <result> 92.61 + <binding name='x'> 92.62 + <uri>http://example.org#A</uri> 92.63 + </binding> 92.64 + <binding name='y'> 92.65 + <uri>http://example.org#F</uri> 92.66 + </binding> 92.67 + <binding name='overlaps'> 92.68 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.69 + </binding> 92.70 + </result> 92.71 + 92.72 + <result> 92.73 + <binding name='x'> 92.74 + <uri>http://example.org#A</uri> 92.75 + </binding> 92.76 + <binding name='y'> 92.77 + <uri>http://example.org#G</uri> 92.78 + </binding> 92.79 + <binding name='overlaps'> 92.80 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.81 + </binding> 92.82 + </result> 92.83 + 92.84 + 92.85 + 92.86 + <result> 92.87 + <binding name='x'> 92.88 + <uri>http://example.org#A</uri> 92.89 + </binding> 92.90 + <binding name='y'> 92.91 + <uri>http://example.org#H</uri> 92.92 + </binding> 92.93 + <binding name='overlaps'> 92.94 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.95 + </binding> 92.96 + </result> 92.97 + 92.98 + 92.99 + 92.100 + 92.101 + 92.102 + 92.103 + 92.104 + <!-- B --> 92.105 + 92.106 + <result> 92.107 + <binding name='x'> 92.108 + <uri>http://example.org#B</uri> 92.109 + </binding> 92.110 + <binding name='y'> 92.111 + <uri>http://example.org#C</uri> 92.112 + </binding> 92.113 + <binding name='overlaps'> 92.114 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>true</literal> 92.115 + </binding> 92.116 + </result> 92.117 + 92.118 + <result> 92.119 + <binding name='x'> 92.120 + <uri>http://example.org#B</uri> 92.121 + </binding> 92.122 + <binding name='y'> 92.123 + <uri>http://example.org#D</uri> 92.124 + </binding> 92.125 + <binding name='overlaps'> 92.126 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.127 + </binding> 92.128 + </result> 92.129 + 92.130 + <result> 92.131 + <binding name='x'> 92.132 + <uri>http://example.org#B</uri> 92.133 + </binding> 92.134 + <binding name='y'> 92.135 + <uri>http://example.org#E</uri> 92.136 + </binding> 92.137 + <binding name='overlaps'> 92.138 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.139 + </binding> 92.140 + </result> 92.141 + 92.142 + <result> 92.143 + <binding name='x'> 92.144 + <uri>http://example.org#B</uri> 92.145 + </binding> 92.146 + <binding name='y'> 92.147 + <uri>http://example.org#F</uri> 92.148 + </binding> 92.149 + <binding name='overlaps'> 92.150 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.151 + </binding> 92.152 + </result> 92.153 + 92.154 + <result> 92.155 + <binding name='x'> 92.156 + <uri>http://example.org#B</uri> 92.157 + </binding> 92.158 + <binding name='y'> 92.159 + <uri>http://example.org#G</uri> 92.160 + </binding> 92.161 + <binding name='overlaps'> 92.162 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.163 + </binding> 92.164 + </result> 92.165 + 92.166 + <result> 92.167 + <binding name='x'> 92.168 + <uri>http://example.org#B</uri> 92.169 + </binding> 92.170 + <binding name='y'> 92.171 + <uri>http://example.org#H</uri> 92.172 + </binding> 92.173 + <binding name='overlaps'> 92.174 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.175 + </binding> 92.176 + </result> 92.177 + 92.178 + <!-- C --> 92.179 + 92.180 + <result> 92.181 + <binding name='x'> 92.182 + <uri>http://example.org#C</uri> 92.183 + </binding> 92.184 + <binding name='y'> 92.185 + <uri>http://example.org#D</uri> 92.186 + </binding> 92.187 + <binding name='overlaps'> 92.188 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.189 + </binding> 92.190 + </result> 92.191 + 92.192 + <result> 92.193 + <binding name='x'> 92.194 + <uri>http://example.org#C</uri> 92.195 + </binding> 92.196 + <binding name='y'> 92.197 + <uri>http://example.org#E</uri> 92.198 + </binding> 92.199 + <binding name='overlaps'> 92.200 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.201 + </binding> 92.202 + </result> 92.203 + 92.204 + <result> 92.205 + <binding name='x'> 92.206 + <uri>http://example.org#C</uri> 92.207 + </binding> 92.208 + <binding name='y'> 92.209 + <uri>http://example.org#F</uri> 92.210 + </binding> 92.211 + <binding name='overlaps'> 92.212 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.213 + </binding> 92.214 + </result> 92.215 + 92.216 + <result> 92.217 + <binding name='x'> 92.218 + <uri>http://example.org#C</uri> 92.219 + </binding> 92.220 + <binding name='y'> 92.221 + <uri>http://example.org#G</uri> 92.222 + </binding> 92.223 + <binding name='overlaps'> 92.224 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.225 + </binding> 92.226 + </result> 92.227 + 92.228 + <result> 92.229 + <binding name='x'> 92.230 + <uri>http://example.org#C</uri> 92.231 + </binding> 92.232 + <binding name='y'> 92.233 + <uri>http://example.org#H</uri> 92.234 + </binding> 92.235 + <binding name='overlaps'> 92.236 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.237 + </binding> 92.238 + </result> 92.239 + 92.240 + <!-- D --> 92.241 + 92.242 + <result> 92.243 + <binding name='x'> 92.244 + <uri>http://example.org#D</uri> 92.245 + </binding> 92.246 + <binding name='y'> 92.247 + <uri>http://example.org#E</uri> 92.248 + </binding> 92.249 + <binding name='overlaps'> 92.250 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.251 + </binding> 92.252 + </result> 92.253 + 92.254 + <result> 92.255 + <binding name='x'> 92.256 + <uri>http://example.org#D</uri> 92.257 + </binding> 92.258 + <binding name='y'> 92.259 + <uri>http://example.org#F</uri> 92.260 + </binding> 92.261 + <binding name='overlaps'> 92.262 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.263 + </binding> 92.264 + </result> 92.265 + 92.266 + <result> 92.267 + <binding name='x'> 92.268 + <uri>http://example.org#D</uri> 92.269 + </binding> 92.270 + <binding name='y'> 92.271 + <uri>http://example.org#G</uri> 92.272 + </binding> 92.273 + <binding name='overlaps'> 92.274 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.275 + </binding> 92.276 + </result> 92.277 + 92.278 + <result> 92.279 + <binding name='x'> 92.280 + <uri>http://example.org#D</uri> 92.281 + </binding> 92.282 + <binding name='y'> 92.283 + <uri>http://example.org#H</uri> 92.284 + </binding> 92.285 + <binding name='overlaps'> 92.286 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.287 + </binding> 92.288 + </result> 92.289 + 92.290 + <!-- E --> 92.291 + 92.292 + <result> 92.293 + <binding name='x'> 92.294 + <uri>http://example.org#E</uri> 92.295 + </binding> 92.296 + <binding name='y'> 92.297 + <uri>http://example.org#F</uri> 92.298 + </binding> 92.299 + <binding name='overlaps'> 92.300 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.301 + </binding> 92.302 + </result> 92.303 + 92.304 + <result> 92.305 + <binding name='x'> 92.306 + <uri>http://example.org#E</uri> 92.307 + </binding> 92.308 + <binding name='y'> 92.309 + <uri>http://example.org#G</uri> 92.310 + </binding> 92.311 + <binding name='overlaps'> 92.312 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.313 + </binding> 92.314 + </result> 92.315 + 92.316 + <result> 92.317 + <binding name='x'> 92.318 + <uri>http://example.org#E</uri> 92.319 + </binding> 92.320 + <binding name='y'> 92.321 + <uri>http://example.org#H</uri> 92.322 + </binding> 92.323 + <binding name='overlaps'> 92.324 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.325 + </binding> 92.326 + </result> 92.327 + 92.328 + <!-- F --> 92.329 + 92.330 + <result> 92.331 + <binding name='x'> 92.332 + <uri>http://example.org#F</uri> 92.333 + </binding> 92.334 + <binding name='y'> 92.335 + <uri>http://example.org#G</uri> 92.336 + </binding> 92.337 + <binding name='overlaps'> 92.338 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.339 + </binding> 92.340 + </result> 92.341 + 92.342 + <result> 92.343 + <binding name='x'> 92.344 + <uri>http://example.org#F</uri> 92.345 + </binding> 92.346 + <binding name='y'> 92.347 + <uri>http://example.org#H</uri> 92.348 + </binding> 92.349 + <binding name='overlaps'> 92.350 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.351 + </binding> 92.352 + </result> 92.353 + 92.354 + <!-- G --> 92.355 + 92.356 + <result> 92.357 + <binding name='x'> 92.358 + <uri>http://example.org#G</uri> 92.359 + </binding> 92.360 + <binding name='y'> 92.361 + <uri>http://example.org#H</uri> 92.362 + </binding> 92.363 + <binding name='overlaps'> 92.364 + <literal datatype='http://www.w3.org/2001/XMLSchema#boolean'>false</literal> 92.365 + </binding> 92.366 + </result> 92.367 + </results> 92.368 +</sparql> 92.369 \ No newline at end of file
93.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 93.2 +++ b/testsuite/src/test/resources/bugs/RelationalFunctionInSelectTest/RelationalFunctionInSelectTest.nt Wed Sep 24 18:44:26 2014 +0300 93.3 @@ -0,0 +1,16 @@ 93.4 +<http://example.org#A> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomA>. 93.5 +<http://example.org#B> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomB>. 93.6 +<http://example.org#C> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomC>. 93.7 +<http://example.org#D> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomD>. 93.8 +<http://example.org#E> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomE>. 93.9 +<http://example.org#F> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomF>. 93.10 +<http://example.org#G> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomG>. 93.11 +<http://example.org#H> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomH>. 93.12 +<http://example.org#geomA> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 1 0, 1 1, 0 1, 0 0)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 93.13 +<http://example.org#geomB> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 2 0, 2 2, 0 2 , 0 0)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 93.14 +<http://example.org#geomC> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((1 1, 3 1, 3 2, 1 2, 1 1)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 93.15 +<http://example.org#geomD> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((3 1, 4 1, 4 2, 3 2, 3 1)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 93.16 +<http://example.org#geomE> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((3 1, 4 1, 4 2, 3 2, 3 1)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 93.17 +<http://example.org#geomF> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Linestring(3 2, 4 0) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 93.18 +<http://example.org#geomG> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Point(1 1) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 93.19 +<http://example.org#geomH> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((2.1 1.1, 2.9 1.1, 2.9 1.9, 2.1 1.9, 2.1 1.1)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>.
94.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 94.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/Area_stRDF.rq Wed Sep 24 18:44:26 2014 +0300 94.3 @@ -0,0 +1,7 @@ 94.4 +SELECT ?x 94.5 +WHERE 94.6 +{ 94.7 +?x geo:hasGeometry ?geom1. 94.8 +?geom1 geo:asWKT ?g 94.9 +} 94.10 +ORDER BY DESC(strdf:area(?g)) 94.11 \ No newline at end of file
95.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 95.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/Area_stRDF.srx Wed Sep 24 18:44:26 2014 +0300 95.3 @@ -0,0 +1,48 @@ 95.4 +<?xml version='1.0' encoding='UTF-8'?> 95.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 95.6 + <head> 95.7 + <variable name='x'/> 95.8 + </head> 95.9 + <results> 95.10 + <result> 95.11 + <binding name='x'> 95.12 + <uri>http://example.org#E</uri> 95.13 + </binding> 95.14 + </result> 95.15 + <result> 95.16 + <binding name='x'> 95.17 + <uri>http://example.org#D</uri> 95.18 + </binding> 95.19 + </result> 95.20 + <result> 95.21 + <binding name='x'> 95.22 + <uri>http://example.org#C</uri> 95.23 + </binding> 95.24 + </result> 95.25 + <result> 95.26 + <binding name='x'> 95.27 + <uri>http://example.org#B</uri> 95.28 + </binding> 95.29 + </result> 95.30 + <result> 95.31 + <binding name='x'> 95.32 + <uri>http://example.org#A</uri> 95.33 + </binding> 95.34 + </result> 95.35 + <result> 95.36 + <binding name='x'> 95.37 + <uri>http://example.org#H</uri> 95.38 + </binding> 95.39 + </result> 95.40 + <result> 95.41 + <binding name='x'> 95.42 + <uri>http://example.org#F</uri> 95.43 + </binding> 95.44 + </result> 95.45 + <result> 95.46 + <binding name='x'> 95.47 + <uri>http://example.org#G</uri> 95.48 + </binding> 95.49 + </result> 95.50 + </results> 95.51 +</sparql> 95.52 \ No newline at end of file
96.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 96.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/Distance_stRDF.rq Wed Sep 24 18:44:26 2014 +0300 96.3 @@ -0,0 +1,13 @@ 96.4 +SELECT ?x ?y 96.5 +WHERE 96.6 +{ 96.7 +?x geo:hasGeometry ?geom1 . 96.8 +?geom1 geo:asWKT ?g1 . 96.9 + 96.10 +?y geo:hasGeometry ?geom2 . 96.11 +?geom2 geo:asWKT ?g2 . 96.12 + 96.13 +FILTER(str(?x) < str(?y)) 96.14 +} 96.15 +ORDER BY DESC(strdf:distance(?g1, ?g2, ogc:degree)) 96.16 +LIMIT 2 96.17 \ No newline at end of file
97.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 97.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/Distance_stRDF.srx Wed Sep 24 18:44:26 2014 +0300 97.3 @@ -0,0 +1,25 @@ 97.4 +<?xml version='1.0' encoding='UTF-8'?> 97.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 97.6 + <head> 97.7 + <variable name='x'/> 97.8 + <variable name='y'/> 97.9 + </head> 97.10 + <results> 97.11 + <result> 97.12 + <binding name='x'> 97.13 + <uri>http://example.org#A</uri> 97.14 + </binding> 97.15 + <binding name='y'> 97.16 + <uri>http://example.org#F</uri> 97.17 + </binding> 97.18 + </result> 97.19 + <result> 97.20 + <binding name='x'> 97.21 + <uri>http://example.org#F</uri> 97.22 + </binding> 97.23 + <binding name='y'> 97.24 + <uri>http://example.org#G</uri> 97.25 + </binding> 97.26 + </result> 97.27 + </results> 97.28 +</sparql> 97.29 \ No newline at end of file
98.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 98.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/SpatialFunctionInOrderBy.nt Wed Sep 24 18:44:26 2014 +0300 98.3 @@ -0,0 +1,16 @@ 98.4 +<http://example.org#B> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomB>. 98.5 +<http://example.org#C> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomC>. 98.6 +<http://example.org#D> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomD>. 98.7 +<http://example.org#E> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomE>. 98.8 +<http://example.org#A> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomA>. 98.9 +<http://example.org#F> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomF>. 98.10 +<http://example.org#G> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomG>. 98.11 +<http://example.org#H> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomH>. 98.12 +<http://example.org#geomA> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 1 0, 1 1, 0 1, 0 0)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 98.13 +<http://example.org#geomB> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 1.5 0, 1.5 1.5, 0 1.5 , 0 0)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 98.14 +<http://example.org#geomC> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 2 0, 2 2, 0 2 , 0 0)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 98.15 +<http://example.org#geomD> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 3 0, 3 3, 0 3 , 0 0)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 98.16 +<http://example.org#geomE> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 4 0, 4 4, 0 4 , 0 0)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 98.17 +<http://example.org#geomF> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Linestring(3 2, 4 0) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 98.18 +<http://example.org#geomG> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Point(1 1) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 98.19 +<http://example.org#geomH> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((2.1 1.1, 2.9 1.1, 2.9 1.9, 2.1 1.9, 2.1 1.1)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>.
99.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 99.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/StrExample.rq Wed Sep 24 18:44:26 2014 +0300 99.3 @@ -0,0 +1,8 @@ 99.4 +#Test also a non spatial function to be sure 99.5 + 99.6 +SELECT ?x 99.7 +WHERE 99.8 +{ 99.9 +?x geo:hasGeometry ?geom1 99.10 +} 99.11 +ORDER BY (str(?x)) 99.12 \ No newline at end of file
100.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 100.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/StrExample.srx Wed Sep 24 18:44:26 2014 +0300 100.3 @@ -0,0 +1,48 @@ 100.4 +<?xml version='1.0' encoding='UTF-8'?> 100.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 100.6 + <head> 100.7 + <variable name='x'/> 100.8 + </head> 100.9 + <results> 100.10 + <result> 100.11 + <binding name='x'> 100.12 + <uri>http://example.org#A</uri> 100.13 + </binding> 100.14 + </result> 100.15 + <result> 100.16 + <binding name='x'> 100.17 + <uri>http://example.org#B</uri> 100.18 + </binding> 100.19 + </result> 100.20 + <result> 100.21 + <binding name='x'> 100.22 + <uri>http://example.org#C</uri> 100.23 + </binding> 100.24 + </result> 100.25 + <result> 100.26 + <binding name='x'> 100.27 + <uri>http://example.org#D</uri> 100.28 + </binding> 100.29 + </result> 100.30 + <result> 100.31 + <binding name='x'> 100.32 + <uri>http://example.org#E</uri> 100.33 + </binding> 100.34 + </result> 100.35 + <result> 100.36 + <binding name='x'> 100.37 + <uri>http://example.org#F</uri> 100.38 + </binding> 100.39 + </result> 100.40 + <result> 100.41 + <binding name='x'> 100.42 + <uri>http://example.org#G</uri> 100.43 + </binding> 100.44 + </result> 100.45 + <result> 100.46 + <binding name='x'> 100.47 + <uri>http://example.org#H</uri> 100.48 + </binding> 100.49 + </result> 100.50 + </results> 100.51 +</sparql> 100.52 \ No newline at end of file
101.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 101.2 +++ b/testsuite/src/test/resources/bugs/UnionAndProjectionBug53/UnionAndProjectionBug53.nt Wed Sep 24 18:44:26 2014 +0300 101.3 @@ -0,0 +1,6 @@ 101.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> . 101.5 +<http://www.eionet.europa.eu/gemet/concept/11> <http://www.w3.org/2004/02/skos/core#prefLabel> "abiotic factor"@en . 101.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> . 101.7 +<http://www.eionet.europa.eu/gemet/concept/20> <http://www.w3.org/2004/02/skos/core#prefLabel> "acceptable risk level"@en . 101.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> . 101.9 +<http://www.eionet.europa.eu/gemet/concept/72> <http://www.w3.org/2004/02/skos/core#prefLabel> "activated carbon"@en . 101.10 \ No newline at end of file
102.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 102.2 +++ b/testsuite/src/test/resources/bugs/UnionAndProjectionBug53/UnionAndProjectionBug53.rq Wed Sep 24 18:44:26 2014 +0300 102.3 @@ -0,0 +1,11 @@ 102.4 +SELECT ?term (skos:broader as ?b) ?related 102.5 +WHERE 102.6 +{ 102.7 + 102.8 + { ?term skos:prefLabel ?label . ?term skos:broader ?related } 102.9 + 102.10 +UNION 102.11 + 102.12 + { ?term rdfs:label ?label . ?term skos:broader ?related } 102.13 + 102.14 +}
103.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 103.2 +++ b/testsuite/src/test/resources/bugs/UnionAndProjectionBug53/UnionAndProjectionBug53.srx Wed Sep 24 18:44:26 2014 +0300 103.3 @@ -0,0 +1,43 @@ 103.4 +<?xml version='1.0' encoding='UTF-8'?> 103.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 103.6 + <head> 103.7 + <variable name='term'/> 103.8 + <variable name='b'/> 103.9 + <variable name='related'/> 103.10 + </head> 103.11 + <results> 103.12 + <result> 103.13 + <binding name='term'> 103.14 + <uri>http://www.eionet.europa.eu/gemet/concept/11</uri> 103.15 + </binding> 103.16 + <binding name='b'> 103.17 + <uri>http://www.w3.org/2004/02/skos/core#broader</uri> 103.18 + </binding> 103.19 + <binding name='related'> 103.20 + <uri>http://www.eionet.europa.eu/gemet/concept/2457</uri> 103.21 + </binding> 103.22 + </result> 103.23 + <result> 103.24 + <binding name='term'> 103.25 + <uri>http://www.eionet.europa.eu/gemet/concept/20</uri> 103.26 + </binding> 103.27 + <binding name='b'> 103.28 + <uri>http://www.w3.org/2004/02/skos/core#broader</uri> 103.29 + </binding> 103.30 + <binding name='related'> 103.31 + <uri>http://www.eionet.europa.eu/gemet/concept/6033</uri> 103.32 + </binding> 103.33 + </result> 103.34 + <result> 103.35 + <binding name='term'> 103.36 + <uri>http://www.eionet.europa.eu/gemet/concept/72</uri> 103.37 + </binding> 103.38 + <binding name='b'> 103.39 + <uri>http://www.w3.org/2004/02/skos/core#broader</uri> 103.40 + </binding> 103.41 + <binding name='related'> 103.42 + <uri>http://www.eionet.europa.eu/gemet/concept/11813</uri> 103.43 + </binding> 103.44 + </result> 103.45 + </results> 103.46 +</sparql>
104.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 104.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/BasicFunctionsTest.nt Wed Sep 24 18:44:26 2014 +0300 104.3 @@ -0,0 +1,6 @@ 104.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> . 104.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> . 104.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> . 104.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> . 104.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> . 104.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> . 104.10 \ No newline at end of file
105.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 105.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.rq Wed Sep 24 18:44:26 2014 +0300 105.3 @@ -0,0 +1,2 @@ 105.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) 105.5 +WHERE { ?s ?p ?o }
106.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 106.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest1.srx Wed Sep 24 18:44:26 2014 +0300 106.3 @@ -0,0 +1,13 @@ 106.4 +<?xml version='1.0' encoding='UTF-8'?> 106.5 + <sparql xmlns='http://www.w3.org/2005/sparql-results#'> 106.6 + <head> 106.7 + <variable name='srid'/> 106.8 + </head> 106.9 + <results> 106.10 + <result> 106.11 + <binding name='srid'> 106.12 + <uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 106.13 + </binding> 106.14 + </result> 106.15 + </results> 106.16 + </sparql> 106.17 \ No newline at end of file
107.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 107.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest2.rq Wed Sep 24 18:44:26 2014 +0300 107.3 @@ -0,0 +1,2 @@ 107.4 +SELECT DISTINCT (geof:getSRID("<http://www.opengis.net/def/crs/EPSG/0/2100> POINT(0 1)"^^geo:wktLiteral) as ?srid) 107.5 +WHERE { ?s ?p ?o } 107.6 \ No newline at end of file
108.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 108.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest2.srx Wed Sep 24 18:44:26 2014 +0300 108.3 @@ -0,0 +1,13 @@ 108.4 +<?xml version='1.0' encoding='UTF-8'?> 108.5 + <sparql xmlns='http://www.w3.org/2005/sparql-results#'> 108.6 + <head> 108.7 + <variable name='srid'/> 108.8 + </head> 108.9 + <results> 108.10 + <result> 108.11 + <binding name='srid'> 108.12 + <uri>http://www.opengis.net/def/crs/EPSG/0/2100</uri> 108.13 + </binding> 108.14 + </result> 108.15 + </results> 108.16 + </sparql> 108.17 \ No newline at end of file
109.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 109.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest3.rq Wed Sep 24 18:44:26 2014 +0300 109.3 @@ -0,0 +1,2 @@ 109.4 +SELECT DISTINCT (geof:getSRID("POINT(0 1)"^^geo:wktLiteral) as ?srid) 109.5 +WHERE { ?s ?p ?o } 109.6 \ No newline at end of file
110.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 110.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest3.srx Wed Sep 24 18:44:26 2014 +0300 110.3 @@ -0,0 +1,13 @@ 110.4 +<?xml version='1.0' encoding='UTF-8'?> 110.5 + <sparql xmlns='http://www.w3.org/2005/sparql-results#'> 110.6 + <head> 110.7 + <variable name='srid'/> 110.8 + </head> 110.9 + <results> 110.10 + <result> 110.11 + <binding name='srid'> 110.12 + <uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 110.13 + </binding> 110.14 + </result> 110.15 + </results> 110.16 + </sparql> 110.17 \ No newline at end of file
111.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 111.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest4.rq Wed Sep 24 18:44:26 2014 +0300 111.3 @@ -0,0 +1,2 @@ 111.4 +SELECT DISTINCT (geof:getSRID("POINT(0 1);http://www.opengis.net/def/crs/EPSG/0/2100"^^strdf:WKT) as ?srid) 111.5 +WHERE { ?s ?p ?o } 111.6 \ No newline at end of file
112.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 112.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest4.srx Wed Sep 24 18:44:26 2014 +0300 112.3 @@ -0,0 +1,13 @@ 112.4 +<?xml version='1.0' encoding='UTF-8'?> 112.5 + <sparql xmlns='http://www.w3.org/2005/sparql-results#'> 112.6 + <head> 112.7 + <variable name='srid'/> 112.8 + </head> 112.9 + <results> 112.10 + <result> 112.11 + <binding name='srid'> 112.12 + <uri>http://www.opengis.net/def/crs/EPSG/0/2100</uri> 112.13 + </binding> 112.14 + </result> 112.15 + </results> 112.16 + </sparql> 112.17 \ No newline at end of file
113.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 113.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.rq Wed Sep 24 18:44:26 2014 +0300 113.3 @@ -0,0 +1,2 @@ 113.4 +SELECT DISTINCT (geof:getSRID("POINT(0 1)"^^strdf:WKT) as ?srid) 113.5 +WHERE { ?s ?p ?o } 113.6 \ No newline at end of file
114.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 114.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromConstantTest5.srx Wed Sep 24 18:44:26 2014 +0300 114.3 @@ -0,0 +1,13 @@ 114.4 +<?xml version='1.0' encoding='UTF-8'?> 114.5 + <sparql xmlns='http://www.w3.org/2005/sparql-results#'> 114.6 + <head> 114.7 + <variable name='srid'/> 114.8 + </head> 114.9 + <results> 114.10 + <result> 114.11 + <binding name='srid'> 114.12 + <uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 114.13 + </binding> 114.14 + </result> 114.15 + </results> 114.16 + </sparql> 114.17 \ No newline at end of file
115.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 115.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromDBTest.rq Wed Sep 24 18:44:26 2014 +0300 115.3 @@ -0,0 +1,14 @@ 115.4 +SELECT (geof:getSRID(?g1) as ?strdf_2100) 115.5 + (geof:getSRID(?g2) as ?strdf_crs84) 115.6 + (geof:getSRID(?g3) as ?strdf_4326) 115.7 + (geof:getSRID(?g4) as ?geo_4326) 115.8 + (geof:getSRID(?g5) as ?geo_crs84) 115.9 + (geof:getSRID(?g6) as ?geo_2100) 115.10 +WHERE { 115.11 + <http://ex.org/strdf_2100> ?p ?g1 . 115.12 + <http://ex.org/strdf_crs84> ?p ?g2 . 115.13 + <http://ex.org/strdf_4326> ?p ?g3 . 115.14 + <http://ex.org/geosparql_4326> ?p ?g4 . 115.15 + <http://ex.org/geosparql_crs84> ?p ?g5 . 115.16 + <http://ex.org/geosparql_2100> ?p ?g6 . 115.17 +} 115.18 \ No newline at end of file
116.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 116.2 +++ b/testsuite/src/test/resources/geoSPARQL/BasicFunctionsTest/getSRIDFromDBTest.srx Wed Sep 24 18:44:26 2014 +0300 116.3 @@ -0,0 +1,33 @@ 116.4 +<?xml version='1.0' encoding='UTF-8'?> 116.5 + <sparql xmlns='http://www.w3.org/2005/sparql-results#'> 116.6 + <head> 116.7 + <variable name='strdf_2100'/> 116.8 + <variable name='strdf_crs84'/> 116.9 + <variable name='strdf_4326'/> 116.10 + <variable name='geo_4326'/> 116.11 + <variable name='geo_crs84'/> 116.12 + <variable name='geo_2100'/> 116.13 + </head> 116.14 + <results> 116.15 + <result> 116.16 + <binding name='strdf_2100'> 116.17 + <uri>http://www.opengis.net/def/crs/EPSG/0/2100</uri> 116.18 + </binding> 116.19 + <binding name='strdf_crs84'> 116.20 + <uri>http://www.opengis.net/def/crs/EPSG/0/4326</uri> 116.21 + </binding> 116.22 + <binding name='strdf_4326'> 116.23 + <uri>http://www.opengis.net/def/crs/EPSG/0/4326</uri> 116.24 + </binding> 116.25 + <binding name='geo_4326'> 116.26 + <uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 116.27 + </binding> 116.28 + <binding name='geo_crs84'> 116.29 + <uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 116.30 + </binding> 116.31 + <binding name='geo_2100'> 116.32 + <uri>http://www.opengis.net/def/crs/EPSG/0/2100</uri> 116.33 + </binding> 116.34 + </result> 116.35 + </results> 116.36 + </sparql> 116.37 \ No newline at end of file
117.1 --- a/testsuite/src/test/resources/geoSPARQL/GeometryLiteralsTest/DefaultCRS.srx Wed Sep 10 12:37:29 2014 +0200 117.2 +++ b/testsuite/src/test/resources/geoSPARQL/GeometryLiteralsTest/DefaultCRS.srx Wed Sep 24 18:44:26 2014 +0300 117.3 @@ -6,8 +6,8 @@ 117.4 <results> 117.5 <result> 117.6 <binding name='srid'> 117.7 - <literal datatype='http://www.w3.org/2001/XMLSchema#int'>3857</literal> 117.8 + <uri>http://www.opengis.net/def/crs/OGC/1.3/CRS84</uri> 117.9 </binding> 117.10 </result> 117.11 </results> 117.12 -</sparql> 117.13 \ No newline at end of file 117.14 +</sparql>
118.1 --- a/testsuite/src/test/resources/geoSPARQL/QueryFunctionsTest/BufferDegreesTest.srx Wed Sep 10 12:37:29 2014 +0200 118.2 +++ b/testsuite/src/test/resources/geoSPARQL/QueryFunctionsTest/BufferDegreesTest.srx Wed Sep 24 18:44:26 2014 +0300 118.3 @@ -6,42 +6,42 @@ 118.4 <results> 118.5 <result> 118.6 <binding name='buffer'> 118.7 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((-111319.49079327231 -0.0000000007081155, -111319.49079327231 0.9999999994774795, -109180.5179920264 21718.39727593167, -102845.79911348295 42601.44158500647, -92558.77385160125 61847.7646607793, -78714.76681815831 78717.76512783514, -61845.79543964266 92563.02285962063, -42600.12482590362 102851.2563084728, -21717.355305532114 109186.85060744215, 0 111326.14301871415, 0.9999999999775806 111326.14301871415, 21718.35530553209 109186.85060744215, 42601.1248259036 102851.2563084728, 61846.795439642636 92563.02285962063, 78715.7668181583 78717.76512783514, 92559.77385160122 61847.7646607793, 102846.79911348294 42601.44158500647, 109181.51799202638 21718.39727593167, 111320.49079327229 0.9999999994774795, 111320.49079327229 -0.0000000007081155, 109181.51799202638 -21717.39727013562, 102846.79911348294 -42600.44156270125, 92559.77385160122 -61846.76461376663, 78715.7668181583 -78716.76505167512, 61846.795439642636 -92562.02275431334, 42601.1248259036 -102850.2561784551, 21718.35530553209 -109185.85046091139, 0.9999999999775806 -111325.14286638597, 0 -111325.14286638597, -21717.355305532114 -109185.85046091139, -42600.12482590362 -102850.2561784551, -61845.79543964266 -92562.02275431334, -78714.76681815831 -78716.76505167512, -92558.77385159841 -61846.76461376663, -102845.79911348295 -42600.441562702676, -109180.5179920264 -21717.39727013704, -111319.49079327231 -0.0000000007081155))</literal> 118.8 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'>POLYGON ((-111319.49079327231 -0.0000000007081155, -111319.49079327231 0.9999999994774795, -109180.5179920264 21718.39727593167, -102845.79911348295 42601.44158500647, -92558.77385160125 61847.7646607793, -78714.76681815831 78717.76512783514, -61845.79543964266 92563.02285962063, -42600.12482590362 102851.2563084728, -21717.355305532114 109186.85060744215, 0 111326.14301871415, 0.9999999999775806 111326.14301871415, 21718.35530553209 109186.85060744215, 42601.1248259036 102851.2563084728, 61846.795439642636 92563.02285962063, 78715.7668181583 78717.76512783514, 92559.77385160122 61847.7646607793, 102846.79911348294 42601.44158500647, 109181.51799202638 21718.39727593167, 111320.49079327229 0.9999999994774795, 111320.49079327229 -0.0000000007081155, 109181.51799202638 -21717.39727013562, 102846.79911348294 -42600.44156270125, 92559.77385160122 -61846.76461376663, 78715.7668181583 -78716.76505167512, 61846.795439642636 -92562.02275431334, 42601.1248259036 -102850.2561784551, 21718.35530553209 -109185.85046091139, 0.9999999999775806 -111325.14286638597, 0 -111325.14286638597, -21717.355305532114 -109185.85046091139, -42600.12482590362 -102850.2561784551, -61845.79543964266 -92562.02275431334, -78714.76681815831 -78716.76505167512, -92558.77385159841 -61846.76461376663, -102845.79911348295 -42600.441562702676, -109180.5179920264 -21717.39727013704, -111319.49079327231 -0.0000000007081155))</literal> 118.9 </binding> 118.10 </result> 118.11 <result> 118.12 <binding name='buffer'> 118.13 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((-111319.49079327231 -0.0000000007081155, -111319.49079327231 1.9999999993709712, -109180.5179920264 21719.39728173002, -102845.79911348295 42602.44160731312, -92558.77385160125 61848.7647077953, -78714.76681815831 78718.76520399722, -61845.79543964266 92564.02296492962, -42600.12482590362 102852.25643849418, -21717.355305532114 109187.85075397529, 0 111327.14317104667, 1.9999999999551612 111327.14317104667, 21719.35530553207 109187.85075397529, 42602.12482590358 102852.25643849418, 61847.795439642614 92564.02296492962, 78716.76681815827 78718.76520399722, 92560.7738516012 61848.7647077953, 102847.7991134829 42602.44160731312, 109182.51799202636 21719.39728173002, 111321.49079327227 1.9999999993709712, 111321.49079327227 -0.0000000007081155, 109182.51799202636 -21717.39727013562, 102847.7991134829 -42600.44156270125, 92560.7738516012 -61846.76461376663, 78716.76681815827 -78716.76505167512, 61847.795439642614 -92562.02275431334, 42602.12482590358 -102850.2561784551, 21719.35530553207 -109185.85046091139, 1.9999999999551612 -111325.14286638597, 0 -111325.14286638597, -21717.355305532114 -109185.85046091139, -42600.12482590362 -102850.2561784551, -61845.79543964266 -92562.02275431334, -78714.76681815831 -78716.76505167512, -92558.77385159841 -61846.76461376663, -102845.79911348295 -42600.441562702676, -109180.5179920264 -21717.39727013704, -111319.49079327231 -0.0000000007081155))</literal> 118.14 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'>POLYGON ((-111319.49079327231 -0.0000000007081155, -111319.49079327231 1.9999999993709712, -109180.5179920264 21719.39728173002, -102845.79911348295 42602.44160731312, -92558.77385160125 61848.7647077953, -78714.76681815831 78718.76520399722, -61845.79543964266 92564.02296492962, -42600.12482590362 102852.25643849418, -21717.355305532114 109187.85075397529, 0 111327.14317104667, 1.9999999999551612 111327.14317104667, 21719.35530553207 109187.85075397529, 42602.12482590358 102852.25643849418, 61847.795439642614 92564.02296492962, 78716.76681815827 78718.76520399722, 92560.7738516012 61848.7647077953, 102847.7991134829 42602.44160731312, 109182.51799202636 21719.39728173002, 111321.49079327227 1.9999999993709712, 111321.49079327227 -0.0000000007081155, 109182.51799202636 -21717.39727013562, 102847.7991134829 -42600.44156270125, 92560.7738516012 -61846.76461376663, 78716.76681815827 -78716.76505167512, 61847.795439642614 -92562.02275431334, 42602.12482590358 -102850.2561784551, 21719.35530553207 -109185.85046091139, 1.9999999999551612 -111325.14286638597, 0 -111325.14286638597, -21717.355305532114 -109185.85046091139, -42600.12482590362 -102850.2561784551, -61845.79543964266 -92562.02275431334, -78714.76681815831 -78716.76505167512, -92558.77385159841 -61846.76461376663, -102845.79911348295 -42600.441562702676, -109180.5179920264 -21717.39727013704, -111319.49079327231 -0.0000000007081155))</literal> 118.15 </binding> 118.16 </result> 118.17 <result> 118.18 <binding name='buffer'> 118.19 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((-111318.49079327233 0.9999999994774795, -111318.49079327233 1.9999999993709712, -109179.51799202642 21719.39728173002, -102844.79911348298 42602.44160731312, -92557.77385160128 61848.7647077953, -78713.76681815834 78718.76520399722, -61844.79543964268 92564.02296492962, -42599.124825903644 102852.25643849418, -21716.35530553214 109187.85075397529, 0.9999999999775806 111327.14317104667, 2.999999999932742 111327.14317104667, 21720.355305532048 109187.85075397529, 42603.12482590356 102852.25643849418, 61848.79543964259 92564.02296492962, 78717.76681815826 78718.76520399722, 92561.77385160117 61848.7647077953, 102848.79911348289 42602.44160731312, 109183.51799202633 21719.39728173002, 111322.49079327224 1.9999999993709712, 111322.49079327224 0.9999999994774795, 109183.51799202633 -21716.397264339004, 102848.79911348289 -42599.44154039624, 92561.77385160117 -61845.76456675433, 78717.76681815826 -78715.76497551735, 61848.79543964259 -92561.02264900785, 42603.12482590356 -102849.25604843823, 21720.355305532048 -109184.85031438306, 2.999999999932742 -111324.14271405865, 0.9999999999775806 -111324.14271405865, -21716.35530553214 -109184.85031438306, -42599.124825903644 -102849.25604843823, -61844.79543964268 -92561.02264900785, -78713.76681815834 -78715.76497551735, -92557.77385159844 -61845.76456675433, -102844.79911348298 -42599.44154039766, -109179.51799202642 -21716.397264339717, -111318.49079327233 0.9999999994774795))</literal> 118.20 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'>POLYGON ((-111318.49079327233 0.9999999994774795, -111318.49079327233 1.9999999993709712, -109179.51799202642 21719.39728173002, -102844.79911348298 42602.44160731312, -92557.77385160128 61848.7647077953, -78713.76681815834 78718.76520399722, -61844.79543964268 92564.02296492962, -42599.124825903644 102852.25643849418, -21716.35530553214 109187.85075397529, 0.9999999999775806 111327.14317104667, 2.999999999932742 111327.14317104667, 21720.355305532048 109187.85075397529, 42603.12482590356 102852.25643849418, 61848.79543964259 92564.02296492962, 78717.76681815826 78718.76520399722, 92561.77385160117 61848.7647077953, 102848.79911348289 42602.44160731312, 109183.51799202633 21719.39728173002, 111322.49079327224 1.9999999993709712, 111322.49079327224 0.9999999994774795, 109183.51799202633 -21716.397264339004, 102848.79911348289 -42599.44154039624, 92561.77385160117 -61845.76456675433, 78717.76681815826 -78715.76497551735, 61848.79543964259 -92561.02264900785, 42603.12482590356 -102849.25604843823, 21720.355305532048 -109184.85031438306, 2.999999999932742 -111324.14271405865, 0.9999999999775806 -111324.14271405865, -21716.35530553214 -109184.85031438306, -42599.124825903644 -102849.25604843823, -61844.79543964268 -92561.02264900785, -78713.76681815834 -78715.76497551735, -92557.77385159844 -61845.76456675433, -102844.79911348298 -42599.44154039766, -109179.51799202642 -21716.397264339717, -111318.49079327233 0.9999999994774795))</literal> 118.21 </binding> 118.22 </result> 118.23 <result> 118.24 <binding name='buffer'> 118.25 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((-111316.49079327237 0.9999999994774795, -111316.49079327237 1.9999999993709712, -109177.51799202646 21719.39728173002, -102842.79911348302 42602.44160731312, -92555.77385160132 61848.7647077953, -78711.76681815839 78718.76520399722, -61842.79543964272 92564.02296492962, -42597.12482590369 102852.25643849418, -21714.355305532183 109187.85075397529, 2.999999999932742 111327.14317104667, 3.9999999999103224 111327.14317104667, 21721.355305532026 109187.85075397529, 42604.124825903535 102852.25643849418, 61849.79543964257 92564.02296492962, 78718.76681815823 78718.76520399722, 92562.77385160116 61848.7647077953, 102849.79911348286 42602.44160731312, 109184.5179920263 21719.39728173002, 111323.49079327221 1.9999999993709712, 111323.49079327221 0.9999999994774795, 109184.5179920263 -21716.397264339004, 102849.79911348286 -42599.44154039624, 92562.77385160116 -61845.76456675433, 78718.76681815823 -78715.76497551735, 61849.79543964257 -92561.02264900785, 42604.124825903535 -102849.25604843823, 21721.355305532026 -109184.85031438306, 3.9999999999103224 -111324.14271405865, 2.999999999932742 -111324.14271405865, -21714.355305532183 -109184.85031438306, -42597.12482590369 -102849.25604843823, -61842.79543964272 -92561.02264900785, -78711.76681815555 -78715.76497551735, -92555.77385159848 -61845.76456675433, -102842.79911348302 -42599.44154039766, -109177.51799202646 -21716.397264339717, -111316.49079327237 0.9999999994774795))</literal> 118.26 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'>POLYGON ((-111316.49079327237 0.9999999994774795, -111316.49079327237 1.9999999993709712, -109177.51799202646 21719.39728173002, -102842.79911348302 42602.44160731312, -92555.77385160132 61848.7647077953, -78711.76681815839 78718.76520399722, -61842.79543964272 92564.02296492962, -42597.12482590369 102852.25643849418, -21714.355305532183 109187.85075397529, 2.999999999932742 111327.14317104667, 3.9999999999103224 111327.14317104667, 21721.355305532026 109187.85075397529, 42604.124825903535 102852.25643849418, 61849.79543964257 92564.02296492962, 78718.76681815823 78718.76520399722, 92562.77385160116 61848.7647077953, 102849.79911348286 42602.44160731312, 109184.5179920263 21719.39728173002, 111323.49079327221 1.9999999993709712, 111323.49079327221 0.9999999994774795, 109184.5179920263 -21716.397264339004, 102849.79911348286 -42599.44154039624, 92562.77385160116 -61845.76456675433, 78718.76681815823 -78715.76497551735, 61849.79543964257 -92561.02264900785, 42604.124825903535 -102849.25604843823, 21721.355305532026 -109184.85031438306, 3.9999999999103224 -111324.14271405865, 2.999999999932742 -111324.14271405865, -21714.355305532183 -109184.85031438306, -42597.12482590369 -102849.25604843823, -61842.79543964272 -92561.02264900785, -78711.76681815555 -78715.76497551735, -92555.77385159848 -61845.76456675433, -102842.79911348302 -42599.44154039766, -109177.51799202646 -21716.397264339717, -111316.49079327237 0.9999999994774795))</literal> 118.27 </binding> 118.28 </result> 118.29 <result> 118.30 <binding name='buffer'> 118.31 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((-111316.49079327237 0.9999999994774795, -111316.49079327237 1.9999999993709712, -109177.51799202646 21719.39728173002, -102842.79911348302 42602.44160731312, -92555.77385160132 61848.7647077953, -78711.76681815839 78718.76520399722, -61842.79543964272 92564.02296492962, -42597.12482590369 102852.25643849418, -21714.355305532183 109187.85075397529, 2.999999999932742 111327.14317104667, 3.9999999999103224 111327.14317104667, 21721.355305532026 109187.85075397529, 42604.124825903535 102852.25643849418, 61849.79543964257 92564.02296492962, 78718.76681815823 78718.76520399722, 92562.77385160116 61848.7647077953, 102849.79911348286 42602.44160731312, 109184.5179920263 21719.39728173002, 111323.49079327221 1.9999999993709712, 111323.49079327221 0.9999999994774795, 109184.5179920263 -21716.397264339004, 102849.79911348286 -42599.44154039624, 92562.77385160116 -61845.76456675433, 78718.76681815823 -78715.76497551735, 61849.79543964257 -92561.02264900785, 42604.124825903535 -102849.25604843823, 21721.355305532026 -109184.85031438306, 3.9999999999103224 -111324.14271405865, 2.999999999932742 -111324.14271405865, -21714.355305532183 -109184.85031438306, -42597.12482590369 -102849.25604843823, -61842.79543964272 -92561.02264900785, -78711.76681815555 -78715.76497551735, -92555.77385159848 -61845.76456675433, -102842.79911348302 -42599.44154039766, -109177.51799202646 -21716.397264339717, -111316.49079327237 0.9999999994774795))</literal> 118.32 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'>POLYGON ((-111316.49079327237 0.9999999994774795, -111316.49079327237 1.9999999993709712, -109177.51799202646 21719.39728173002, -102842.79911348302 42602.44160731312, -92555.77385160132 61848.7647077953, -78711.76681815839 78718.76520399722, -61842.79543964272 92564.02296492962, -42597.12482590369 102852.25643849418, -21714.355305532183 109187.85075397529, 2.999999999932742 111327.14317104667, 3.9999999999103224 111327.14317104667, 21721.355305532026 109187.85075397529, 42604.124825903535 102852.25643849418, 61849.79543964257 92564.02296492962, 78718.76681815823 78718.76520399722, 92562.77385160116 61848.7647077953, 102849.79911348286 42602.44160731312, 109184.5179920263 21719.39728173002, 111323.49079327221 1.9999999993709712, 111323.49079327221 0.9999999994774795, 109184.5179920263 -21716.397264339004, 102849.79911348286 -42599.44154039624, 92562.77385160116 -61845.76456675433, 78718.76681815823 -78715.76497551735, 61849.79543964257 -92561.02264900785, 42604.124825903535 -102849.25604843823, 21721.355305532026 -109184.85031438306, 3.9999999999103224 -111324.14271405865, 2.999999999932742 -111324.14271405865, -21714.355305532183 -109184.85031438306, -42597.12482590369 -102849.25604843823, -61842.79543964272 -92561.02264900785, -78711.76681815555 -78715.76497551735, -92555.77385159848 -61845.76456675433, -102842.79911348302 -42599.44154039766, -109177.51799202646 -21716.397264339717, -111316.49079327237 0.9999999994774795))</literal> 118.33 </binding> 118.34 </result> 118.35 <result> 118.36 <binding name='buffer'> 118.37 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((99571.1794533233 49784.095233765314, 107370.32057019752 29402.523047645867, 111043.43419928358 7891.331633639709, 110449.36464372445 -13923.030097627636, 105610.94166338131 -35202.492608737426, 96714.1031399717 -55129.489996122364, 84100.74958854054 -72938.31391010896, 68255.60511242234 -87944.51401695433, 49787.58972777618 -99571.22368602054, 29406.41890885074 -107371.3915985718, 7895.329620324772 -111045.04371917108, -13919.019040003313 -110450.88460588455, -35198.313886741154 -105611.76745125338, -55124.80355249933 -96713.80910711788, -72932.72421432048 -84099.18637554247, -87937.7274679757 -68252.90771551307, -99563.17945332348 -49784.095233765554, -99564.17945332346 -49782.095172843314, -107363.32057019768 -29400.523026397652, -111036.43419928374 -7889.331632109998, -110442.36464372459 13925.030102392711, -105603.94166338147 35204.49263920068, -96707.10313997185 55131.49007083525, -84093.74958854068 72940.31404088806, -68248.6051124225 87946.51420708228, -49780.589727776336 99573.22392974293, -29399.4189088509 107373.39188197645, -7888.329620324928 111047.04402230024, 13926.019040003157 110452.88490577831, 35205.313886741 105613.76772544422, 55131.80355249917 96715.80933705314, 72939.72421432033 84101.18654940644, 87944.72746797555 68254.90783002945, 99570.17945332333 49786.095294692954, 99571.1794533233 49784.095233765314))</literal> 118.38 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'>POLYGON ((99571.1794533233 49784.095233765314, 107370.32057019752 29402.523047645867, 111043.43419928358 7891.331633639709, 110449.36464372445 -13923.030097627636, 105610.94166338131 -35202.492608737426, 96714.1031399717 -55129.489996122364, 84100.74958854054 -72938.31391010896, 68255.60511242234 -87944.51401695433, 49787.58972777618 -99571.22368602054, 29406.41890885074 -107371.3915985718, 7895.329620324772 -111045.04371917108, -13919.019040003313 -110450.88460588455, -35198.313886741154 -105611.76745125338, -55124.80355249933 -96713.80910711788, -72932.72421432048 -84099.18637554247, -87937.7274679757 -68252.90771551307, -99563.17945332348 -49784.095233765554, -99564.17945332346 -49782.095172843314, -107363.32057019768 -29400.523026397652, -111036.43419928374 -7889.331632109998, -110442.36464372459 13925.030102392711, -105603.94166338147 35204.49263920068, -96707.10313997185 55131.49007083525, -84093.74958854068 72940.31404088806, -68248.6051124225 87946.51420708228, -49780.589727776336 99573.22392974293, -29399.4189088509 107373.39188197645, -7888.329620324928 111047.04402230024, 13926.019040003157 110452.88490577831, 35205.313886741 105613.76772544422, 55131.80355249917 96715.80933705314, 72939.72421432033 84101.18654940644, 87944.72746797555 68254.90783002945, 99570.17945332333 49786.095294692954, 99571.1794533233 49784.095233765314))</literal> 118.39 </binding> 118.40 </result> 118.41 <result> 118.42 <binding name='buffer'> 118.43 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((111320.49079327229 0.9999999994774795, 109181.51799202638 -21716.397264339004, 102846.79911348294 -42599.44154039624, 92559.77385160122 -61845.76456675433, 78715.7668181583 -78715.76497551735, 61846.795439642636 -92561.02264900785, 42601.1248259036 -102849.25604843823, 21718.35530553209 -109184.85031438306, 0.9999999999775806 -111324.14271405865, -21716.35530553214 -109184.85031438306, -42599.124825903644 -102849.25604843823, -61844.79543964268 -92561.02264900785, -78713.76681815834 -78715.76497551735, -92557.77385159844 -61845.76456675433, -102844.79911348298 -42599.44154039624, -109179.51799202642 -21716.397264339717, -111318.49079327233 0.9999999994774795, -109179.51799202642 21718.39727593167, -102844.79911348298 42601.44158500647, -92557.77385160128 61847.7646607793, -78713.76681815834 78717.76512783514, -61844.79543964268 92563.02285962063, -42599.124825903644 102851.2563084728, -21716.35530553214 109186.85060744215, 0.9999999999775806 111326.14301871415, 21718.35530553209 109186.85060744351, 42601.1248259036 102851.2563084728, 61846.795439642636 92563.02285962063, 78715.7668181583 78717.76512783514, 92559.7738515984 61847.7646607793, 102846.79911348294 42601.44158500647, 109181.51799202638 21718.397275933083, 111320.49079327229 0.9999999994774795))</literal> 118.44 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'>POLYGON ((111320.49079327229 0.9999999994774795, 109181.51799202638 -21716.397264339004, 102846.79911348294 -42599.44154039624, 92559.77385160122 -61845.76456675433, 78715.7668181583 -78715.76497551735, 61846.795439642636 -92561.02264900785, 42601.1248259036 -102849.25604843823, 21718.35530553209 -109184.85031438306, 0.9999999999775806 -111324.14271405865, -21716.35530553214 -109184.85031438306, -42599.124825903644 -102849.25604843823, -61844.79543964268 -92561.02264900785, -78713.76681815834 -78715.76497551735, -92557.77385159844 -61845.76456675433, -102844.79911348298 -42599.44154039624, -109179.51799202642 -21716.397264339717, -111318.49079327233 0.9999999994774795, -109179.51799202642 21718.39727593167, -102844.79911348298 42601.44158500647, -92557.77385160128 61847.7646607793, -78713.76681815834 78717.76512783514, -61844.79543964268 92563.02285962063, -42599.124825903644 102851.2563084728, -21716.35530553214 109186.85060744215, 0.9999999999775806 111326.14301871415, 21718.35530553209 109186.85060744351, 42601.1248259036 102851.2563084728, 61846.795439642636 92563.02285962063, 78715.7668181583 78717.76512783514, 92559.7738515984 61847.7646607793, 102846.79911348294 42601.44158500647, 109181.51799202638 21718.397275933083, 111320.49079327229 0.9999999994774795))</literal> 118.45 </binding> 118.46 </result> 118.47 <result> 118.48 <binding name='buffer'> 118.49 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((-111317.39079327292 1.0999999994410274, -111317.39079327292 1.9000000007720514, -109178.41799202701 21719.297281149902, -102843.69911348357 42602.34160508346, -92556.67385159903 61848.66470309359, -78712.6668181561 78718.66519638135, -61843.69543964327 92563.92295439992, -42598.024825904235 102852.1564254931, -21715.255305529896 109187.7507393229, 2.099999999386427 111327.04315581366, 2.900000000501476 111327.04315581366, 21720.255305529783 109187.7507393229, 42603.024825904125 102852.1564254931, 61848.69543964316 92563.92295439992, 78717.666818156 78718.66519638135, 92561.67385159891 61848.66470309359, 102848.69911348345 42602.34160508346, 109183.4179920269 21719.297281149902, 111322.39079327282 1.9000000007720514, 111322.39079327282 1.0999999994410274, 109183.4179920269 -21716.297263759512, 102848.69911348345 -42599.34153816638, 92561.67385159891 -61845.66456205315, 78717.666818156 -78715.66496790186, 61848.69543964316 -92560.92263847838, 42603.024825904125 -102849.15603543755, 21720.255305529783 -109184.750299731, 2.900000000501476 -111324.04269882677, 2.099999999386427 -111324.04269882677, -21715.255305529896 -109184.750299731, -42598.024825904235 -102849.15603543755, -61843.69543964327 -92560.92263847838, -78712.6668181561 -78715.66496790186, -92556.67385159903 -61845.66456205315, -102843.69911348357 -42599.3415381678, -109178.41799202419 -21716.29726376093, -111317.39079327292 1.0999999994410274))</literal> 118.50 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'>POLYGON ((-111317.39079327292 1.0999999994410274, -111317.39079327292 1.9000000007720514, -109178.41799202701 21719.297281149902, -102843.69911348357 42602.34160508346, -92556.67385159903 61848.66470309359, -78712.6668181561 78718.66519638135, -61843.69543964327 92563.92295439992, -42598.024825904235 102852.1564254931, -21715.255305529896 109187.7507393229, 2.099999999386427 111327.04315581366, 2.900000000501476 111327.04315581366, 21720.255305529783 109187.7507393229, 42603.024825904125 102852.1564254931, 61848.69543964316 92563.92295439992, 78717.666818156 78718.66519638135, 92561.67385159891 61848.66470309359, 102848.69911348345 42602.34160508346, 109183.4179920269 21719.297281149902, 111322.39079327282 1.9000000007720514, 111322.39079327282 1.0999999994410274, 109183.4179920269 -21716.297263759512, 102848.69911348345 -42599.34153816638, 92561.67385159891 -61845.66456205315, 78717.666818156 -78715.66496790186, 61848.69543964316 -92560.92263847838, 42603.024825904125 -102849.15603543755, 21720.255305529783 -109184.750299731, 2.900000000501476 -111324.04269882677, 2.099999999386427 -111324.04269882677, -21715.255305529896 -109184.750299731, -42598.024825904235 -102849.15603543755, -61843.69543964327 -92560.92263847838, -78712.6668181561 -78715.66496790186, -92556.67385159903 -61845.66456205315, -102843.69911348357 -42599.3415381678, -109178.41799202419 -21716.29726376093, -111317.39079327292 1.0999999994410274))</literal> 118.51 </binding> 118.52 </result> 118.53 </results>
119.1 --- a/testsuite/src/test/resources/geoSPARQL/QueryFunctionsTest/BufferDistanceTest.srx Wed Sep 10 12:37:29 2014 +0200 119.2 +++ b/testsuite/src/test/resources/geoSPARQL/QueryFunctionsTest/BufferDistanceTest.srx Wed Sep 24 18:44:26 2014 +0300 119.3 @@ -6,7 +6,7 @@ 119.4 <results> 119.5 <result> 119.6 <binding name='buffer'> 119.7 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((0 -0.0000000007081155, 0 0.9999999994774795, 0.9999999999775806 0.9999999994774795, 0.9999999999775806 -0.0000000007081155, 0 -0.0000000007081155))</literal> 119.8 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/OGC/1.3/CRS84> POLYGON ((0 -0.0000000007081155, 0 0.9999999994774795, 0.9999999999775806 0.9999999994774795, 0.9999999999775806 -0.0000000007081155, 0 -0.0000000007081155))</literal> 119.9 </binding> 119.10 </result> 119.11 </results>
120.1 --- a/testsuite/src/test/resources/geoSPARQL/QueryFunctionsTest/BufferMetresTest.srx Wed Sep 10 12:37:29 2014 +0200 120.2 +++ b/testsuite/src/test/resources/geoSPARQL/QueryFunctionsTest/BufferMetresTest.srx Wed Sep 24 18:44:26 2014 +0300 120.3 @@ -6,42 +6,42 @@ 120.4 <results> 120.5 <result> 120.6 <binding name='buffer'> 120.7 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((-0.9990081738166161 0.0000000042486927, -0.9990081738166161 0.9999999952287875, -0.9798122883145344 1.1962126302901517, -0.9229623124999344 1.3848849246898498, -0.8306429666620074 1.5587663054501864, -0.7064020253620464 1.7111746129273868, -0.5550139995434042 1.836252877299558, -0.3822966468222901 1.9291944153368505, -0.1948873967788809 1.9864275306074628, 0.000011717894552 2.0057527898363583, 1.0000117178721326 2.005752798333741, 1.1949108325455655 1.9864275433535372, 1.3823200854214366 1.9291944294991554, 1.5550374438074743 1.836252894294324, 1.7064254724585783 1.7111746299221529, 1.830666419423463 1.5587663224449533, 1.9229857709263136 1.3848849388521558, 1.9798357467409136 1.1962126430362277, 1.9990316350754571 1.0000000037261716, 1.9990316350754571 -0.0000000049568082, 1.9798357467409136 -0.1962126435362148, 1.9229857709263136 -0.3848849393871292, 1.830666419423463 -0.5587663235673946, 1.7064254724585783 -0.7111746307609169, 1.5550374438074743 -0.8362528955212613, 1.3823200854214366 -0.929194429953204, 1.1949108325455655 -0.9864275444782631, 1.0000117178721326 -1.005752800027154, 0.000011717894552 -1.0057527915297673, -0.1948873967788809 -0.9864275317321829, -0.3822966468222901 -0.9291944157908929, -0.5550139995434042 -0.8362528785264882, -0.7064020253620464 -0.7111746137661441, -0.8306429666620074 -0.5587663065726222, -0.9229623124999344 -0.3848849252248193, -0.9798122883145344 -0.1962126307901362, -0.9990081738166161 0.0000000042486927))</literal> 120.8 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/OGC/1.3/CRS84> POLYGON ((-0.9990081738166161 0.0000000042486927, -0.9990081738166161 0.9999999952287875, -0.9798122883145344 1.1962126302901517, -0.9229623124999344 1.3848849246898498, -0.8306429666620074 1.5587663054501864, -0.7064020253620464 1.7111746129273868, -0.5550139995434042 1.836252877299558, -0.3822966468222901 1.9291944153368505, -0.1948873967788809 1.9864275306074628, 0.000011717894552 2.0057527898363583, 1.0000117178721326 2.005752798333741, 1.1949108325455655 1.9864275433535372, 1.3823200854214366 1.9291944294991554, 1.5550374438074743 1.836252894294324, 1.7064254724585783 1.7111746299221529, 1.830666419423463 1.5587663224449533, 1.9229857709263136 1.3848849388521558, 1.9798357467409136 1.1962126430362277, 1.9990316350754571 1.0000000037261716, 1.9990316350754571 -0.0000000049568082, 1.9798357467409136 -0.1962126435362148, 1.9229857709263136 -0.3848849393871292, 1.830666419423463 -0.5587663235673946, 1.7064254724585783 -0.7111746307609169, 1.5550374438074743 -0.8362528955212613, 1.3823200854214366 -0.929194429953204, 1.1949108325455655 -0.9864275444782631, 1.0000117178721326 -1.005752800027154, 0.000011717894552 -1.0057527915297673, -0.1948873967788809 -0.9864275317321829, -0.3822966468222901 -0.9291944157908929, -0.5550139995434042 -0.8362528785264882, -0.7064020253620464 -0.7111746137661441, -0.8306429666620074 -0.5587663065726222, -0.9229623124999344 -0.3848849252248193, -0.9798122883145344 -0.1962126307901362, -0.9990081738166161 0.0000000042486927))</literal> 120.9 </binding> 120.10 </result> 120.11 <result> 120.12 <binding name='buffer'> 120.13 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((-0.9990081738166161 0.0000000084973855, -0.9990081738166161 1.9999999908735884, -0.9798122883145344 2.196212627744941, -0.9229623153323963 2.3848849223043818, -0.8306429666620074 2.5587663041272326, -0.7064020253620464 2.711174611784923, -0.5550139995434042 2.8362528777900806, -0.3822966468222901 2.9291944154177822, -0.1948873967788809 2.986427530212449, 0.000011717894552 3.005752790660113, 2.000011717849713 3.0057528076548756, 2.194910835355608 2.9864275500396724, 2.382320088231479 2.9291944380774666, 2.5550374466175167 2.836252901865995, 2.7064254781010826 2.7111746372770686, 2.830666425065967 2.5587663296193788, 2.922985776568818 2.384884944964068, 2.979835752383418 2.196212647572167, 2.999031643550423 2.000000007868354, 2.999031643550423 -0.0000000092055009, 2.979835752383418 -0.1962126477849076, 2.922985776568818 -0.3848849450520532, 2.830666425065967 -0.5587663306485497, 2.7064254781010826 -0.7111746378420722, 2.5550374466175167 -0.8362529026024169, 2.382320088231479 -0.9291944384505907, 2.194910835355608 -0.9864275515594186, 2.000011717849713 -1.0057528085245409, 0.000011717894552 -1.0057527915297673, -0.1948873967788809 -0.9864275317321829, -0.3822966468222901 -0.9291944157908929, -0.5550139995434042 -0.8362528785264882, -0.7064020253620464 -0.7111746123499131, -0.8306429666620074 -0.5587663051563913, -0.9229623153323963 -0.3848849223923573, -0.9798122883145344 -0.1962126279576742, -0.9990081738166161 0.0000000084973855))</literal> 120.14 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/OGC/1.3/CRS84> POLYGON ((-0.9990081738166161 0.0000000084973855, -0.9990081738166161 1.9999999908735884, -0.9798122883145344 2.196212627744941, -0.9229623153323963 2.3848849223043818, -0.8306429666620074 2.5587663041272326, -0.7064020253620464 2.711174611784923, -0.5550139995434042 2.8362528777900806, -0.3822966468222901 2.9291944154177822, -0.1948873967788809 2.986427530212449, 0.000011717894552 3.005752790660113, 2.000011717849713 3.0057528076548756, 2.194910835355608 2.9864275500396724, 2.382320088231479 2.9291944380774666, 2.5550374466175167 2.836252901865995, 2.7064254781010826 2.7111746372770686, 2.830666425065967 2.5587663296193788, 2.922985776568818 2.384884944964068, 2.979835752383418 2.196212647572167, 2.999031643550423 2.000000007868354, 2.999031643550423 -0.0000000092055009, 2.979835752383418 -0.1962126477849076, 2.922985776568818 -0.3848849450520532, 2.830666425065967 -0.5587663306485497, 2.7064254781010826 -0.7111746378420722, 2.5550374466175167 -0.8362529026024169, 2.382320088231479 -0.9291944384505907, 2.194910835355608 -0.9864275515594186, 2.000011717849713 -1.0057528085245409, 0.000011717894552 -1.0057527915297673, -0.1948873967788809 -0.9864275317321829, -0.3822966468222901 -0.9291944157908929, -0.5550139995434042 -0.8362528785264882, -0.7064020253620464 -0.7111746123499131, -0.8306429666620074 -0.5587663051563913, -0.9229623153323963 -0.3848849223923573, -0.9798122883145344 -0.1962126279576742, -0.9990081738166161 0.0000000084973855))</literal> 120.15 </binding> 120.16 </result> 120.17 <result> 120.18 <binding name='buffer'> 120.19 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((0.000991817663579 1.0000000037261716, 0.000991817663579 1.9999999951222798, 0.0201877059981226 2.196212631993632, 0.0770376789802607 2.3848849279693036, 0.1693570276506495 2.5587663112083843, 0.2935979689506105 2.7111746188660746, 0.4449859976017145 2.836252884871232, 0.6177033503228286 2.9291944224989335, 0.8051126031986997 2.9864275387098305, 1.0000117178721326 3.005752799157494, 3.000011717827294 3.0057528161522575, 3.1949108353331885 2.986427558537054, 3.3823200910415214 2.929194445158618, 3.555037452260021 2.8362529089471464, 3.706425483743587 2.7111746429419896, 3.8306664307084715 2.5587663324518393, 3.922985785043784 2.3848849463802986, 3.9798357636908457 2.1962126461559364, 3.9990316520253892 2.0000000036196623, 3.9990316520253892 0.9999999952287875, 3.9798357636908457 0.8037873527150411, 3.922985785043784 0.6151150538719149, 3.8306664307084715 0.4412336672128966, 3.706425483743587 0.2888253562982981, 3.555037452260021 0.1637470899049591, 3.3823200910415214 0.070805554466369, 3.1949108353331885 0.0135724404172515, 3.000011717827294 -0.0057528170585263, 1.0000117178721326 -0.0057528000637554, 0.8051126031986997 0.0135724602444842, 0.6177033503228286 0.0708055771260633, 0.4449859976017145 0.1637471139808839, 0.2935979689506105 0.2888253803742225, 0.1693570276506495 0.4412336884563588, 0.0770376789802607 0.615115072282915, 0.0201877059981226 0.8037873668773485, 0.000991817663579 1.0000000037261716))</literal> 120.20 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/OGC/1.3/CRS84> POLYGON ((0.000991817663579 1.0000000037261716, 0.000991817663579 1.9999999951222798, 0.0201877059981226 2.196212631993632, 0.0770376789802607 2.3848849279693036, 0.1693570276506495 2.5587663112083843, 0.2935979689506105 2.7111746188660746, 0.4449859976017145 2.836252884871232, 0.6177033503228286 2.9291944224989335, 0.8051126031986997 2.9864275387098305, 1.0000117178721326 3.005752799157494, 3.000011717827294 3.0057528161522575, 3.1949108353331885 2.986427558537054, 3.3823200910415214 2.929194445158618, 3.555037452260021 2.8362529089471464, 3.706425483743587 2.7111746429419896, 3.8306664307084715 2.5587663324518393, 3.922985785043784 2.3848849463802986, 3.9798357636908457 2.1962126461559364, 3.9990316520253892 2.0000000036196623, 3.9990316520253892 0.9999999952287875, 3.9798357636908457 0.8037873527150411, 3.922985785043784 0.6151150538719149, 3.8306664307084715 0.4412336672128966, 3.706425483743587 0.2888253562982981, 3.555037452260021 0.1637470899049591, 3.3823200910415214 0.070805554466369, 3.1949108353331885 0.0135724404172515, 3.000011717827294 -0.0057528170585263, 1.0000117178721326 -0.0057528000637554, 0.8051126031986997 0.0135724602444842, 0.6177033503228286 0.0708055771260633, 0.4449859976017145 0.1637471139808839, 0.2935979689506105 0.2888253803742225, 0.1693570276506495 0.4412336884563588, 0.0770376789802607 0.615115072282915, 0.0201877059981226 0.8037873668773485, 0.000991817663579 1.0000000037261716))</literal> 120.21 </binding> 120.22 </result> 120.23 <result> 120.24 <binding name='buffer'> 120.25 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((2.0009918006239693 1.0000000037261716, 2.0009918006239693 1.9999999951222798, 2.020187688958513 2.1962126362423238, 2.077037661940651 2.384884933634225, 2.1693570134435016 2.5587663197057666, 2.2935979575759244 2.7111746316121472, 2.4449859862270285 2.8362528990335347, 2.617703344613066 2.9291944380774666, 2.805112600321399 2.9864275557045934, 3.000011717827294 3.0057528161522575, 4.000011717804874 3.005752824649639, 4.194910838143231 2.9864275670344353, 4.382320093851564 2.929194452239769, 4.555037455070064 2.836252916028298, 4.706425489386091 2.7111746486069106, 4.830666439183437 2.5587663367005304, 4.92298579351875 2.384884949212759, 4.97983576933335 2.196212647572167, 4.999031660500355 2.0000000036196623, 4.999031660500355 0.9999999952287875, 4.97983576933335 0.8037873512988103, 4.92298579351875 0.6151150510394534, 4.830666439183437 0.4412336629642042, 4.706425489386091 0.2888253506333747, 4.555037455070064 0.1637470828238047, 4.382320093851564 0.0708055473852146, 4.194910838143231 0.0135724319198661, 4.000011717804874 -0.0057528255559118, 3.000011717827294 -0.0057528170585263, 2.8051125974889373 0.0135724432497134, 2.617703344613066 0.0708055615475235, 2.4449859862270285 0.1637470998185752, 2.2935979575759244 0.2888253676281449, 2.1693570134435016 0.441233679958974, 2.077037661940651 0.615115066617992, 2.020187688958513 0.8037873626286562, 2.0009918006239693 1.0000000037261716))</literal> 120.26 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/OGC/1.3/CRS84> POLYGON ((2.0009918006239693 1.0000000037261716, 2.0009918006239693 1.9999999951222798, 2.020187688958513 2.1962126362423238, 2.077037661940651 2.384884933634225, 2.1693570134435016 2.5587663197057666, 2.2935979575759244 2.7111746316121472, 2.4449859862270285 2.8362528990335347, 2.617703344613066 2.9291944380774666, 2.805112600321399 2.9864275557045934, 3.000011717827294 3.0057528161522575, 4.000011717804874 3.005752824649639, 4.194910838143231 2.9864275670344353, 4.382320093851564 2.929194452239769, 4.555037455070064 2.836252916028298, 4.706425489386091 2.7111746486069106, 4.830666439183437 2.5587663367005304, 4.92298579351875 2.384884949212759, 4.97983576933335 2.196212647572167, 4.999031660500355 2.0000000036196623, 4.999031660500355 0.9999999952287875, 4.97983576933335 0.8037873512988103, 4.92298579351875 0.6151150510394534, 4.830666439183437 0.4412336629642042, 4.706425489386091 0.2888253506333747, 4.555037455070064 0.1637470828238047, 4.382320093851564 0.0708055473852146, 4.194910838143231 0.0135724319198661, 4.000011717804874 -0.0057528255559118, 3.000011717827294 -0.0057528170585263, 2.8051125974889373 0.0135724432497134, 2.617703344613066 0.0708055615475235, 2.4449859862270285 0.1637470998185752, 2.2935979575759244 0.2888253676281449, 2.1693570134435016 0.441233679958974, 2.077037661940651 0.615115066617992, 2.020187688958513 0.8037873626286562, 2.0009918006239693 1.0000000037261716))</literal> 120.27 </binding> 120.28 </result> 120.29 <result> 120.30 <binding name='buffer'> 120.31 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((2.0009918006239693 1.0000000037261716, 2.0009918006239693 1.9999999951222798, 2.020187688958513 2.1962126362423238, 2.077037661940651 2.384884933634225, 2.1693570134435016 2.5587663197057666, 2.2935979575759244 2.7111746316121472, 2.4449859862270285 2.8362528990335347, 2.617703344613066 2.9291944380774666, 2.805112600321399 2.9864275557045934, 3.000011717827294 3.0057528161522575, 4.000011717804874 3.005752824649639, 4.194910838143231 2.9864275670344353, 4.382320093851564 2.929194452239769, 4.555037455070064 2.836252916028298, 4.706425489386091 2.7111746486069106, 4.830666439183437 2.5587663367005304, 4.92298579351875 2.384884949212759, 4.97983576933335 2.196212647572167, 4.999031660500355 2.0000000036196623, 4.999031660500355 0.9999999952287875, 4.97983576933335 0.8037873512988103, 4.92298579351875 0.6151150510394534, 4.830666439183437 0.4412336629642042, 4.706425489386091 0.2888253506333747, 4.555037455070064 0.1637470828238047, 4.382320093851564 0.0708055473852146, 4.194910838143231 0.0135724319198661, 4.000011717804874 -0.0057528255559118, 3.000011717827294 -0.0057528170585263, 2.8051125974889373 0.0135724432497134, 2.617703344613066 0.0708055615475235, 2.4449859862270285 0.1637470998185752, 2.2935979575759244 0.2888253676281449, 2.1693570134435016 0.441233679958974, 2.077037661940651 0.615115066617992, 2.020187688958513 0.8037873626286562, 2.0009918006239693 1.0000000037261716))</literal> 120.32 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/OGC/1.3/CRS84> POLYGON ((2.0009918006239693 1.0000000037261716, 2.0009918006239693 1.9999999951222798, 2.020187688958513 2.1962126362423238, 2.077037661940651 2.384884933634225, 2.1693570134435016 2.5587663197057666, 2.2935979575759244 2.7111746316121472, 2.4449859862270285 2.8362528990335347, 2.617703344613066 2.9291944380774666, 2.805112600321399 2.9864275557045934, 3.000011717827294 3.0057528161522575, 4.000011717804874 3.005752824649639, 4.194910838143231 2.9864275670344353, 4.382320093851564 2.929194452239769, 4.555037455070064 2.836252916028298, 4.706425489386091 2.7111746486069106, 4.830666439183437 2.5587663367005304, 4.92298579351875 2.384884949212759, 4.97983576933335 2.196212647572167, 4.999031660500355 2.0000000036196623, 4.999031660500355 0.9999999952287875, 4.97983576933335 0.8037873512988103, 4.92298579351875 0.6151150510394534, 4.830666439183437 0.4412336629642042, 4.706425489386091 0.2888253506333747, 4.555037455070064 0.1637470828238047, 4.382320093851564 0.0708055473852146, 4.194910838143231 0.0135724319198661, 4.000011717804874 -0.0057528255559118, 3.000011717827294 -0.0057528170585263, 2.8051125974889373 0.0135724432497134, 2.617703344613066 0.0708055615475235, 2.4449859862270285 0.1637470998185752, 2.2935979575759244 0.2888253676281449, 2.1693570134435016 0.441233679958974, 2.077037661940651 0.615115066617992, 2.020187688958513 0.8037873626286562, 2.0009918006239693 1.0000000037261716))</literal> 120.33 </binding> 120.34 </result> 120.35 <result> 120.36 <binding name='buffer'> 120.37 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((4.892356290662825 0.4522064960767662, 4.962840667011444 0.2682564216646194, 4.996324064926611 0.0739974018390475, 4.991519739490134 -0.1231052973699739, 4.9486123133959445 -0.3154771269815041, 4.86925070146047 -0.495725347890648, 4.756484720127086 -0.6569231212775386, 4.614647908520599 -0.7928757071754876, 4.4491909711948034 -0.8983585240191035, 4.266472326078234 -0.9693179273504574, 4.07351375365782 -1.003026984213504, 3.8777305370113853 -0.9981902766065905, 3.6866465189809543 -0.9549936778710609, 3.5076049503077904 -0.8750972077887265, 3.347486297126129 -0.7615712411396766, 3.2124438306522203 -0.6187785219475874, 3.107667156276771 -0.4522064898997295, 2.1076671704614993 1.5477934983172499, 2.037182796945342 1.7317435698161605, 2.0036993961977134 1.9260025830548837, 2.0085037188017285 2.123105276297947, 2.051411139230994 2.3154771024624923, 2.1307727455015453 2.4957253211107155, 2.2435387183375437 2.6569230941281, 2.3853755271115693 2.7928756815524096, 2.550832458772441 2.8983585024963183, 2.733551095391625 2.9693179095337885, 2.9265096678120393 3.0030269723109986, 3.122292881626012 2.998190271278887, 3.313376899656443 2.9549936794894767, 3.4924184711620687 2.8750972134820656, 3.652537127176192 2.7615712534974763, 3.7875795993150243 2.6187785363401255, 3.8923562765229356 2.4522065080179463, 4.892356290662825 0.4522064960767662))</literal> 120.38 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/OGC/1.3/CRS84> POLYGON ((4.892356290662825 0.4522064960767662, 4.962840667011444 0.2682564216646194, 4.996324064926611 0.0739974018390475, 4.991519739490134 -0.1231052973699739, 4.9486123133959445 -0.3154771269815041, 4.86925070146047 -0.495725347890648, 4.756484720127086 -0.6569231212775386, 4.614647908520599 -0.7928757071754876, 4.4491909711948034 -0.8983585240191035, 4.266472326078234 -0.9693179273504574, 4.07351375365782 -1.003026984213504, 3.8777305370113853 -0.9981902766065905, 3.6866465189809543 -0.9549936778710609, 3.5076049503077904 -0.8750972077887265, 3.347486297126129 -0.7615712411396766, 3.2124438306522203 -0.6187785219475874, 3.107667156276771 -0.4522064898997295, 2.1076671704614993 1.5477934983172499, 2.037182796945342 1.7317435698161605, 2.0036993961977134 1.9260025830548837, 2.0085037188017285 2.123105276297947, 2.051411139230994 2.3154771024624923, 2.1307727455015453 2.4957253211107155, 2.2435387183375437 2.6569230941281, 2.3853755271115693 2.7928756815524096, 2.550832458772441 2.8983585024963183, 2.733551095391625 2.9693179095337885, 2.9265096678120393 3.0030269723109986, 3.122292881626012 2.998190271278887, 3.313376899656443 2.9549936794894767, 3.4924184711620687 2.8750972134820656, 3.652537127176192 2.7615712534974763, 3.7875795993150243 2.6187785363401255, 3.8923562765229356 2.4522065080179463, 4.892356290662825 0.4522064960767662))</literal> 120.39 </binding> 120.40 </result> 120.41 <result> 120.42 <binding name='buffer'> 120.43 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((1.9990316350754571 1.0000000079748637, 1.9798357495733754 0.8037873682935792, 1.9229857737587754 0.6151150708666843, 1.8306664250883866 0.4412336856238972, 1.7064254809559638 0.2888253761255299, 1.5550374523048598 0.1637471097321913, 1.382320093918822 0.0708055728773707, 1.194910841042951 0.0135724588282533, 1.000011726369518 -0.0057528000637554, 0.8051126116960852 0.0135724588282533, 0.6177033588202141 0.0708055728773707, 0.4449860032666382 0.1637471083159604, 0.293597977447996 0.2888253718768374, 0.1693570333155732 0.441233679958974, 0.0770376818127225 0.6151150623692996, 0.0201877059981226 0.8037873541312718, 0.000991817663579 0.9999999909800954, 0.0201877031656608 1.1962126274576905, 0.0770376761477989 1.3848849232736193, 0.1693570248181877 1.5587663054501864, 0.2935979661181487 1.711174614343617, 0.4449859919367909 1.8362528815482495, 0.617703344657905 1.929194419585542, 0.8051125947013142 1.9864275376886154, 1.0000117093747471 2.005752798333741, 1.1949108268806419 1.9864275447697675, 1.382320079756513 1.9291944323316164, 1.5550374381425507 1.8362528985430158, 1.7064254696261165 1.7111746341708447, 1.8306664165910012 1.5587663266936451, 1.9229857680938518 1.3848849445170783, 1.9798357467409136 1.1962126472849197, 1.9990316350754571 1.0000000079748637))</literal> 120.44 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/OGC/1.3/CRS84> POLYGON ((1.9990316350754571 1.0000000079748637, 1.9798357495733754 0.8037873682935792, 1.9229857737587754 0.6151150708666843, 1.8306664250883866 0.4412336856238972, 1.7064254809559638 0.2888253761255299, 1.5550374523048598 0.1637471097321913, 1.382320093918822 0.0708055728773707, 1.194910841042951 0.0135724588282533, 1.000011726369518 -0.0057528000637554, 0.8051126116960852 0.0135724588282533, 0.6177033588202141 0.0708055728773707, 0.4449860032666382 0.1637471083159604, 0.293597977447996 0.2888253718768374, 0.1693570333155732 0.441233679958974, 0.0770376818127225 0.6151150623692996, 0.0201877059981226 0.8037873541312718, 0.000991817663579 0.9999999909800954, 0.0201877031656608 1.1962126274576905, 0.0770376761477989 1.3848849232736193, 0.1693570248181877 1.5587663054501864, 0.2935979661181487 1.711174614343617, 0.4449859919367909 1.8362528815482495, 0.617703344657905 1.929194419585542, 0.8051125947013142 1.9864275376886154, 1.0000117093747471 2.005752798333741, 1.1949108268806419 1.9864275447697675, 1.382320079756513 1.9291944323316164, 1.5550374381425507 1.8362528985430158, 1.7064254696261165 1.7111746341708447, 1.8306664165910012 1.5587663266936451, 1.9229857680938518 1.3848849445170783, 1.9798357467409136 1.1962126472849197, 1.9990316350754571 1.0000000079748637))</literal> 120.45 </binding> 120.46 </result> 120.47 <result> 120.48 <binding name='buffer'> 120.49 - <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/EPSG/0/3857> POLYGON ((1.1009918085750399 1.1000000022734888, 1.1009918085750399 1.8999999979395905, 1.1201876940771216 2.0962126350548136, 1.1770376698917215 2.284884932572364, 1.2693570185621104 2.458766317121424, 1.3935979626945332 2.6111746257524264, 1.5449859913456372 2.7362528937186306, 1.7177033468992131 2.8291944313872914, 1.9051125997750842 2.886427549911751, 2.100011717280979 2.9057528092461773, 2.900011718396028 2.9057528149110983, 3.094910835901923 2.8864275598253633, 3.2823200916102557 2.829194444133364, 3.4550374499962935 2.7362529078809334, 3.606425484312321 2.61117464133096, 3.7306664312772058 2.4587663312837273, 3.8229857856125182 2.2848849453184377, 3.879835761427118 2.096212644968426, 3.8990316497616617 1.9000000036045124, 3.8990316497616617 1.099999996608566, 3.879835761427118 0.90378735433869, 3.8229857856125182 0.7151150542049814, 3.7306664312772058 0.5412336674397112, 3.606425484312321 0.3888253574984246, 3.4550374499962935 0.2637470916499018, 3.2823200916102557 0.1708055548360394, 3.094910835901923 0.113572438851793, 2.900011718396028 0.0942471838033537, 2.100011717280979 0.0942471894682772, 1.9051125997750842 0.1135724487654092, 1.7177033468992131 0.1708055675821173, 1.5449859913456372 0.2637471058122103, 1.3935979626945332 0.3888253730769637, 1.2693570185621104 0.5412336816020191, 1.1770376698917215 0.7151150669510582, 1.1201876969095834 0.903787364252305, 1.1009918085750399 1.1000000022734888))</literal> 120.50 + <literal datatype='http://www.opengis.net/ont/geosparql#wktLiteral'><http://www.opengis.net/def/crs/OGC/1.3/CRS84> POLYGON ((1.1009918085750399 1.1000000022734888, 1.1009918085750399 1.8999999979395905, 1.1201876940771216 2.0962126350548136, 1.1770376698917215 2.284884932572364, 1.2693570185621104 2.458766317121424, 1.3935979626945332 2.6111746257524264, 1.5449859913456372 2.7362528937186306, 1.7177033468992131 2.8291944313872914, 1.9051125997750842 2.886427549911751, 2.100011717280979 2.9057528092461773, 2.900011718396028 2.9057528149110983, 3.094910835901923 2.8864275598253633, 3.2823200916102557 2.829194444133364, 3.4550374499962935 2.7362529078809334, 3.606425484312321 2.61117464133096, 3.7306664312772058 2.4587663312837273, 3.8229857856125182 2.2848849453184377, 3.879835761427118 2.096212644968426, 3.8990316497616617 1.9000000036045124, 3.8990316497616617 1.099999996608566, 3.879835761427118 0.90378735433869, 3.8229857856125182 0.7151150542049814, 3.7306664312772058 0.5412336674397112, 3.606425484312321 0.3888253574984246, 3.4550374499962935 0.2637470916499018, 3.2823200916102557 0.1708055548360394, 3.094910835901923 0.113572438851793, 2.900011718396028 0.0942471838033537, 2.100011717280979 0.0942471894682772, 1.9051125997750842 0.1135724487654092, 1.7177033468992131 0.1708055675821173, 1.5449859913456372 0.2637471058122103, 1.3935979626945332 0.3888253730769637, 1.2693570185621104 0.5412336816020191, 1.1770376698917215 0.7151150669510582, 1.1201876969095834 0.903787364252305, 1.1009918085750399 1.1000000022734888))</literal> 120.51 </binding> 120.52 </result> 120.53 </results>
121.1 --- a/testsuite/src/test/resources/prefixes Wed Sep 10 12:37:29 2014 +0200 121.2 +++ b/testsuite/src/test/resources/prefixes Wed Sep 24 18:44:26 2014 +0300 121.3 @@ -13,4 +13,6 @@ 121.4 PREFIX geo: <http://www.opengis.net/ont/geosparql#> 121.5 PREFIX geof: <http://www.opengis.net/def/function/geosparql/> 121.6 PREFIX ogc: <http://www.opengis.net/def/uom/OGC/1.0/> 121.7 -PREFIX ex: <http://example.org#> 121.8 \ No newline at end of file 121.9 +PREFIX ex: <http://example.org#> 121.10 +PREFIX skos:<http://www.w3.org/2004/02/skos/core#> 121.11 +
122.1 --- a/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/ExtentGroupByTest.srx Wed Sep 10 12:37:29 2014 +0200 122.2 +++ b/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/ExtentGroupByTest.srx Wed Sep 24 18:44:26 2014 +0300 122.3 @@ -6,7 +6,7 @@ 122.4 <results> 122.5 <result> 122.6 <binding name='extent'> 122.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 0 2, 2 2, 2 0, 0 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 122.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 0 2, 2 2, 2 0, 0 0))</literal> 122.9 </binding> 122.10 </result> 122.11 </results>
123.1 --- a/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/ExtentTest.srx Wed Sep 10 12:37:29 2014 +0200 123.2 +++ b/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/ExtentTest.srx Wed Sep 24 18:44:26 2014 +0300 123.3 @@ -6,7 +6,7 @@ 123.4 <results> 123.5 <result> 123.6 <binding name='extent'> 123.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 0 2, 2 2, 2 0, 0 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 123.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 0 2, 2 2, 2 0, 0 0))</literal> 123.9 </binding> 123.10 </result> 123.11 </results>
124.1 --- a/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/IntersectionGroupByTest.srx Wed Sep 10 12:37:29 2014 +0200 124.2 +++ b/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/IntersectionGroupByTest.srx Wed Sep 24 18:44:26 2014 +0300 124.3 @@ -6,7 +6,7 @@ 124.4 <results> 124.5 <result> 124.6 <binding name='intersection'> 124.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((1 0, 0 0, 0 1, 1 1, 1 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 124.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((1 0, 0 0, 0 1, 1 1, 1 0))</literal> 124.9 </binding> 124.10 </result> 124.11 </results>
125.1 --- a/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/IntersectionTest.srx Wed Sep 10 12:37:29 2014 +0200 125.2 +++ b/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/IntersectionTest.srx Wed Sep 24 18:44:26 2014 +0300 125.3 @@ -6,7 +6,7 @@ 125.4 <results> 125.5 <result> 125.6 <binding name='intersection'> 125.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((1 0, 0 0, 0 1, 1 1, 1 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 125.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((1 0, 0 0, 0 1, 1 1, 1 0))</literal> 125.9 </binding> 125.10 </result> 125.11 </results>
126.1 --- a/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/UnionGroupByTest.srx Wed Sep 10 12:37:29 2014 +0200 126.2 +++ b/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/UnionGroupByTest.srx Wed Sep 24 18:44:26 2014 +0300 126.3 @@ -6,7 +6,7 @@ 126.4 <results> 126.5 <result> 126.6 <binding name='union'> 126.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((1 0, 0 0, 0 1, 0 2, 2 2, 2 0, 1 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 126.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((1 0, 0 0, 0 1, 0 2, 2 2, 2 0, 1 0))</literal> 126.9 </binding> 126.10 </result> 126.11 </results>
127.1 --- a/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/UnionTest.srx Wed Sep 10 12:37:29 2014 +0200 127.2 +++ b/testsuite/src/test/resources/stSPARQL/AggregateFunctionsTest/UnionTest.srx Wed Sep 24 18:44:26 2014 +0300 127.3 @@ -6,7 +6,7 @@ 127.4 <results> 127.5 <result> 127.6 <binding name='union'> 127.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((1 0, 0 0, 0 1, 0 2, 2 2, 2 0, 1 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 127.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((1 0, 0 0, 0 1, 0 2, 2 2, 2 0, 1 0))</literal> 127.9 </binding> 127.10 </result> 127.11 </results>
128.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BoundaryTest.srx Wed Sep 10 12:37:29 2014 +0200 128.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BoundaryTest.srx Wed Sep 24 18:44:26 2014 +0300 128.3 @@ -6,7 +6,7 @@ 128.4 <results> 128.5 <result> 128.6 <binding name='boundary'> 128.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>LINESTRING (0 0, 1 0, 1 1, 0 1, 0 0);http://www.opengis.net/def/crs/EPSG/0/4326</literal> 128.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>LINESTRING (0 0, 1 0, 1 1, 0 1, 0 0)</literal> 128.9 </binding> 128.10 </result> 128.11 </results>
129.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BufferDegreesTest.srx Wed Sep 10 12:37:29 2014 +0200 129.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BufferDegreesTest.srx Wed Sep 24 18:44:26 2014 +0300 129.3 @@ -6,7 +6,7 @@ 129.4 <results> 129.5 <result> 129.6 <binding name='buffer'> 129.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((-1 0, -1 1, -0.9807852804032304 1.1950903220161286, -0.9238795325112867 1.3826834323650898, -0.8314696123025453 1.5555702330196022, -0.7071067811865475 1.7071067811865475, -0.555570233019602 1.8314696123025453, -0.3826834323650897 1.9238795325112867, -0.1950903220161282 1.9807852804032304, 0 2, 1 2, 1.1950903220161284 1.9807852804032304, 1.3826834323650898 1.9238795325112867, 1.5555702330196022 1.8314696123025453, 1.7071067811865475 1.7071067811865475, 1.8314696123025453 1.5555702330196022, 1.9238795325112867 1.3826834323650898, 1.9807852804032304 1.1950903220161282, 2 1, 2 0, 1.9807852804032304 -0.1950903220161282, 1.9238795325112867 -0.3826834323650898, 1.8314696123025453 -0.5555702330196022, 1.7071067811865475 -0.7071067811865475, 1.5555702330196022 -0.8314696123025452, 1.3826834323650898 -0.9238795325112867, 1.1950903220161284 -0.9807852804032304, 1 -1, 0 -1, -0.1950903220161276 -0.9807852804032305, -0.3826834323650883 -0.9238795325112874, -0.5555702330196002 -0.8314696123025467, -0.7071067811865452 -0.7071067811865498, -0.8314696123025431 -0.5555702330196054, -0.9238795325112849 -0.3826834323650944, -0.9807852804032293 -0.1950903220161338, -1 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 129.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((-1 0, -1 1, -0.9807852804032304 1.1950903220161286, -0.9238795325112867 1.3826834323650898, -0.8314696123025453 1.5555702330196022, -0.7071067811865475 1.7071067811865475, -0.555570233019602 1.8314696123025453, -0.3826834323650897 1.9238795325112867, -0.1950903220161282 1.9807852804032304, 0 2, 1 2, 1.1950903220161284 1.9807852804032304, 1.3826834323650898 1.9238795325112867, 1.5555702330196022 1.8314696123025453, 1.7071067811865475 1.7071067811865475, 1.8314696123025453 1.5555702330196022, 1.9238795325112867 1.3826834323650898, 1.9807852804032304 1.1950903220161282, 2 1, 2 0, 1.9807852804032304 -0.1950903220161282, 1.9238795325112867 -0.3826834323650898, 1.8314696123025453 -0.5555702330196022, 1.7071067811865475 -0.7071067811865475, 1.5555702330196022 -0.8314696123025452, 1.3826834323650898 -0.9238795325112867, 1.1950903220161284 -0.9807852804032304, 1 -1, 0 -1, -0.1950903220161276 -0.9807852804032305, -0.3826834323650883 -0.9238795325112874, -0.5555702330196002 -0.8314696123025467, -0.7071067811865452 -0.7071067811865498, -0.8314696123025431 -0.5555702330196054, -0.9238795325112849 -0.3826834323650944, -0.9807852804032293 -0.1950903220161338, -1 0))</literal> 129.9 </binding> 129.10 </result> 129.11 </results>
130.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BufferDistanceTest.srx Wed Sep 10 12:37:29 2014 +0200 130.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BufferDistanceTest.srx Wed Sep 24 18:44:26 2014 +0300 130.3 @@ -6,7 +6,7 @@ 130.4 <results> 130.5 <result> 130.6 <binding name='buffer'> 130.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 130.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))</literal> 130.9 </binding> 130.10 </result> 130.11 </results>
131.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BufferFilterTest.srx Wed Sep 10 12:37:29 2014 +0200 131.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BufferFilterTest.srx Wed Sep 24 18:44:26 2014 +0300 131.3 @@ -6,7 +6,7 @@ 131.4 <results> 131.5 <result> 131.6 <binding name='g'> 131.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 131.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))</literal> 131.9 </binding> 131.10 </result> 131.11 </results>
132.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BufferMetresTest.srx Wed Sep 10 12:37:29 2014 +0200 132.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/BufferMetresTest.srx Wed Sep 24 18:44:26 2014 +0300 132.3 @@ -6,7 +6,7 @@ 132.4 <results> 132.5 <result> 132.6 <binding name='buffer'> 132.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((-0.0000089742421724 0.0000000041320001, -0.0000089756042497 0.9999999958676328, -0.0000088038727715 1.000001758887806, -0.0000082936785241 1.000003454288746, -0.0000074646355678 1.0000050168919496, -0.0000063486158786 1.0000063866242281, -0.0000049885240509 1.0000075108271815, -0.0000034366478647 1.0000083462816112, -0.0000017526481133 1.0000088608690552, -0.0000000012649917 1.0000090348065567, 1.000000001382874 1.0000090417390572, 1.000001753270632 1.0000088678363337, 1.0000034378207576 1.000008353345387, 1.0000049903344987 1.0000075180263417, 1.0000063511842439 1.0000063939614114, 1.000007468103648 1.0000050243227139, 1.00000829819503 1.0000034617141529, 1.0000088095769561 1.0000017661510532, 1.000008982608709 1.0000000027551426, 1.0000089812481228 -0.0000000027553523, 1.0000088082090899 -0.0000017663254316, 1.0000082968068948 -0.0000034620428641, 1.0000074666868386 -0.0000050247673794, 1.0000063497376341 -0.0000063944675745, 1.0000049888664135 -0.0000075185269942, 1.0000034363504715 -0.0000083537653708, 1.0000017518290543 -0.0000088680973752, 1.0000000000123404 -0.0000090417651615, 0.0000000001052692 -0.0000090348310455, -0.000001751206439 -0.0000088611285075, -0.000003435177146 -0.0000083467000897, -0.0000049870552338 -0.0000075113264655, -0.0000063471682793 -0.0000063871292121, -0.0000074632175604 -0.0000050173356793, -0.0000082922890308 -0.0000034546168228, -0.0000088025034469 -0.0000017590619133, -0.0000089742421724 0.0000000041320001));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 132.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((-0.0000089742421724 0.0000000041320001, -0.0000089756042497 0.9999999958676328, -0.0000088038727715 1.000001758887806, -0.0000082936785241 1.000003454288746, -0.0000074646355678 1.0000050168919496, -0.0000063486158786 1.0000063866242281, -0.0000049885240509 1.0000075108271815, -0.0000034366478647 1.0000083462816112, -0.0000017526481133 1.0000088608690552, -0.0000000012649917 1.0000090348065567, 1.000000001382874 1.0000090417390572, 1.000001753270632 1.0000088678363337, 1.0000034378207576 1.000008353345387, 1.0000049903344987 1.0000075180263417, 1.0000063511842439 1.0000063939614114, 1.000007468103648 1.0000050243227139, 1.00000829819503 1.0000034617141529, 1.0000088095769561 1.0000017661510532, 1.000008982608709 1.0000000027551426, 1.0000089812481228 -0.0000000027553523, 1.0000088082090899 -0.0000017663254316, 1.0000082968068948 -0.0000034620428641, 1.0000074666868386 -0.0000050247673794, 1.0000063497376341 -0.0000063944675745, 1.0000049888664135 -0.0000075185269942, 1.0000034363504715 -0.0000083537653708, 1.0000017518290543 -0.0000088680973752, 1.0000000000123404 -0.0000090417651615, 0.0000000001052692 -0.0000090348310455, -0.000001751206439 -0.0000088611285075, -0.000003435177146 -0.0000083467000897, -0.0000049870552338 -0.0000075113264655, -0.0000063471682793 -0.0000063871292121, -0.0000074632175604 -0.0000050173356793, -0.0000082922890308 -0.0000034546168228, -0.0000088025034469 -0.0000017590619133, -0.0000089742421724 0.0000000041320001))</literal> 132.9 </binding> 132.10 </result> 132.11 </results>
133.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/ConvexHullTest.srx Wed Sep 10 12:37:29 2014 +0200 133.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/ConvexHullTest.srx Wed Sep 24 18:44:26 2014 +0300 133.3 @@ -6,7 +6,7 @@ 133.4 <results> 133.5 <result> 133.6 <binding name='convexHull'> 133.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 133.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))</literal> 133.9 </binding> 133.10 </result> 133.11 </results>
134.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/DifferenceTest.srx Wed Sep 10 12:37:29 2014 +0200 134.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/DifferenceTest.srx Wed Sep 24 18:44:26 2014 +0300 134.3 @@ -6,7 +6,7 @@ 134.4 <results> 134.5 <result> 134.6 <binding name='difference'> 134.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 1, 0 2, 2 2, 2 0, 1 0, 1 1, 0 1));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 134.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 1, 0 2, 2 2, 2 0, 1 0, 1 1, 0 1))</literal> 134.9 </binding> 134.10 </result> 134.11 </results>
135.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/EnvelopeTest.srx Wed Sep 10 12:37:29 2014 +0200 135.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/EnvelopeTest.srx Wed Sep 24 18:44:26 2014 +0300 135.3 @@ -6,7 +6,7 @@ 135.4 <results> 135.5 <result> 135.6 <binding name='envelope'> 135.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 135.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))</literal> 135.9 </binding> 135.10 </result> 135.11 </results>
136.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/Intersection1Test.srx Wed Sep 10 12:37:29 2014 +0200 136.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/Intersection1Test.srx Wed Sep 24 18:44:26 2014 +0300 136.3 @@ -6,7 +6,7 @@ 136.4 <results> 136.5 <result> 136.6 <binding name='intersection'> 136.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POINT (1 1);http://www.opengis.net/def/crs/EPSG/0/4326</literal> 136.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POINT (1 1)</literal> 136.9 </binding> 136.10 </result> 136.11 </results>
137.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/Intersection2Test.srx Wed Sep 10 12:37:29 2014 +0200 137.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/Intersection2Test.srx Wed Sep 24 18:44:26 2014 +0300 137.3 @@ -6,7 +6,7 @@ 137.4 <results> 137.5 <result> 137.6 <binding name='intersection'> 137.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>GEOMETRYCOLLECTION EMPTY;http://www.opengis.net/def/crs/EPSG/0/4326</literal> 137.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>GEOMETRYCOLLECTION EMPTY</literal> 137.9 </binding> 137.10 </result> 137.11 </results>
138.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/SymDifferenceTest.srx Wed Sep 10 12:37:29 2014 +0200 138.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/SymDifferenceTest.srx Wed Sep 24 18:44:26 2014 +0300 138.3 @@ -6,7 +6,7 @@ 138.4 <results> 138.5 <result> 138.6 <binding name='symDifference'> 138.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>MULTIPOLYGON (((2 1, 2 0, 0 0, 0 2, 1 2, 1 1, 2 1)), ((2 1, 2 2, 3 2, 3 1, 2 1)));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 138.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>MULTIPOLYGON (((2 1, 2 0, 0 0, 0 2, 1 2, 1 1, 2 1)), ((2 1, 2 2, 3 2, 3 1, 2 1)))</literal> 138.9 </binding> 138.10 </result> 138.11 </results>
139.1 --- a/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/UnionTest.srx Wed Sep 10 12:37:29 2014 +0200 139.2 +++ b/testsuite/src/test/resources/stSPARQL/SpatialAnalysisFunctionsTest/UnionTest.srx Wed Sep 24 18:44:26 2014 +0300 139.3 @@ -6,7 +6,7 @@ 139.4 <results> 139.5 <result> 139.6 <binding name='union'> 139.7 - <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>MULTIPOLYGON (((1 1, 1 0, 0 0, 0 1, 1 1)), ((1 1, 1 2, 3 2, 3 1, 1 1)));http://www.opengis.net/def/crs/EPSG/0/4326</literal> 139.8 + <literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>MULTIPOLYGON (((1 1, 1 0, 0 0, 0 1, 1 1)), ((1 1, 1 2, 3 2, 3 1, 1 1)))</literal> 139.9 </binding> 139.10 </result> 139.11 </results>
140.1 --- a/vocab/src/main/java/eu/earthobservatory/constants/GeoConstants.java Wed Sep 10 12:37:29 2014 +0200 140.2 +++ b/vocab/src/main/java/eu/earthobservatory/constants/GeoConstants.java Wed Sep 24 18:44:26 2014 +0300 140.3 @@ -162,31 +162,52 @@ 140.4 public static final String stSPARQLextent = stRDF + "extent"; 140.5 140.6 /** 140.7 - * WGS 84 latitude-longitude (EPSG:4326) 140.8 + * Prefix used in EPSG URIs 140.9 */ 140.10 - public static final String WGS84_LAT_LON = "http://www.opengis.net/def/crs/EPSG/0/4326"; 140.11 + public static final String EPSG_URI_PREFIX = "http://www.opengis.net/def/crs/EPSG/0/"; 140.12 140.13 /** 140.14 - * WGS 84 longitude-longitude 140.15 - * (used as the default CRS for GeoSPARQL geometries) 140.16 + * WGS 84 latitude-longitude (EPSG:4326) 140.17 + * 140.18 + * NOTICE: 140.19 + * We treat this CRS with long/lat semantics however, like 140.20 + * most of the world does. This is in contrast to what EPSG considers. 140.21 */ 140.22 - public static final String WGS84_LON_LAT = "http://www.opengis.net/def/crs/OGC/1.3/CRS84"; 140.23 - 140.24 + public static final String EPSG4326_URI = EPSG_URI_PREFIX + "4326"; 140.25 + 140.26 + /** 140.27 + * WGS 84 longitude-latitude 140.28 + * 140.29 + * NOTICE: 140.30 + * Yes, since we treat EPSG:4326 with a long/lat ordering, then OGC CRS84 140.31 + * is synonmous to EPSG:4326. 140.32 + */ 140.33 + public static final String CRS84_URI = "http://www.opengis.net/def/crs/OGC/1.3/CRS84"; 140.34 + 140.35 /** 140.36 * EPSG:4326 140.37 */ 140.38 - public static final Integer WGS84_LAT_LON_SRID = 4326; 140.39 + public static final Integer EPSG4326_SRID = 4326; 140.40 140.41 /** 140.42 - * EPSG:3857 (not sure whether this is correct for WGS84_LON_LAT) 140.43 - * http://spatialreference.org/ref/sr-org/7483/ 140.44 + * Default stRDF/stSPARQL SRID 140.45 */ 140.46 - public static final Integer WGS84_LON_LAT_SRID = 3857; 140.47 - 140.48 + public static final Integer default_stRDF_SRID = EPSG4326_SRID; 140.49 + 140.50 /** 140.51 - * Default SRID (WGS84 latitude-longitude) 140.52 + * Default GeoSPARQL SRID 140.53 */ 140.54 - public static final Integer defaultSRID = WGS84_LAT_LON_SRID; 140.55 + public static final Integer default_GeoSPARQL_SRID = EPSG4326_SRID; 140.56 + 140.57 + /** 140.58 + * Default SRID 140.59 + */ 140.60 + public static final Integer defaultSRID = EPSG4326_SRID; 140.61 + 140.62 + /** 140.63 + * Default datatype for creating new well-known text literals 140.64 + */ 140.65 + public static final String default_WKT_datatype = WKTLITERAL; 140.66 140.67 /** * 140.68 * Extended functions *
141.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 141.2 +++ b/vocab/src/main/java/eu/earthobservatory/constants/WKTConstants.java Wed Sep 24 18:44:26 2014 +0300 141.3 @@ -0,0 +1,33 @@ 141.4 +/** 141.5 + * This Source Code Form is subject to the terms of the Mozilla Public 141.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 141.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 141.8 + * 141.9 + * Copyright (C) 2014 Pyravlos Team 141.10 + * 141.11 + * http://www.strabon.di.uoa.gr/ 141.12 + */ 141.13 + 141.14 +package eu.earthobservatory.constants; 141.15 + 141.16 +/** 141.17 + * This is class contains constants that represent type of geometries 141.18 + * that can be found in a WKT literal, not necessarily compliant 141.19 + * with GeoSPARQL or strdf. This is to "catch"the cases where 141.20 + * geometries are represented using WKT literals 141.21 + * 141.22 + * @author Konstantina Bereta <konstantina.bereta@di.uoa.gr> 141.23 + */ 141.24 + 141.25 +public class WKTConstants { 141.26 + 141.27 + public static final String WKTPOINT = "POINT"; 141.28 + public static final String WKTLINESTRING = "LINESTRING"; 141.29 + public static final String WKTLINEARRING = "LINEARRING"; 141.30 + public static final String WKTPOLYGON = "POLYGON"; 141.31 + public static final String WKTMULTIPOINT = "MULTIPOINT"; 141.32 + public static final String WKTMULTILINESTRING = "MULTILINESTRING"; 141.33 + public static final String WKTMULTIPOLYGON = "MULTIPOLYGON"; 141.34 + public static final String WKTGEOMETRYCOLLECTION = "GEOMETRYCOLLECTION"; 141.35 + 141.36 +}