Strabon
changeset 1052:e88617751ee6 temporals
merge withe default
line diff
1.1 --- a/.hgignore Fri Apr 19 09:11:47 2013 +0300 1.2 +++ b/.hgignore Fri Apr 19 14:37:09 2013 +0300 1.3 @@ -1,4 +1,5 @@ 1.4 /target$ 1.5 +target$ 1.6 \.project$ 1.7 \.settings$ 1.8 \.classpath$ 1.9 @@ -12,3 +13,4 @@ 1.10 stderr\.log 1.11 stdout\.log 1.12 endpoint-client/dependency-reduced-pom\.xml 1.13 +WEB-INF/faces-config.xml
2.1 --- a/ChangeLog Fri Apr 19 09:11:47 2013 +0300 2.2 +++ b/ChangeLog Fri Apr 19 14:37:09 2013 +0300 2.3 @@ -2,6 +2,31 @@ 2.4 2.5 * Version 3.2.9 released. 2.6 2.7 + * Added support of all SPARQL result types provided by Sesame (json, 2.8 + xml, csv, tsv, binary). To get the respective writer, just prepend the 2.9 + string "SPARQL/", e.g., "SPARQL/JSON". This is to ensure that we 2.10 + support all SPARQL result formats of the SPARQL Protocol. 2.11 + 2.12 + * Fixed a bug where a non-implemented extension function would make 2.13 + Strabon throw a NULL pointer exception. Now we get away with it 2.14 + through a warning. 2.15 + 2.16 + * Strabon endpoint now publishes the URIs of the supported units of 2.17 + measure for use in strdf:distance and geof:distance functions of 2.18 + stSPARQL and GeoSPARQL, respectively. The URIs are those defined by 2.19 + OGC Units of Measure 1.0 specification which may be found at 2.20 + http://www.opengis.net/def/uom/OGC/1.0/. Strabon endpoint publishes 2.21 + the URIs at http://localhost:8080/endpoint/Capabilities. 2.22 + 2.23 + * Created new module with name 'vocab` and artifactId 2.24 + 'strabon-vocabulary` and moved GeoConstants.java there. Other 2.25 + vocabularies have been added as well, such as Simple Features, and 2.26 + GeoSPARQL. 2.27 + 2.28 + * Strabon endpoint now publishes the URIs of the supported extension 2.29 + functions for stSPARQL and GeoSPARQL. One should access them by 2.30 + hitting the link http://localhost:8080/endpoint/Capabilities. 2.31 + 2.32 * Support for parsing EPSG URIs in geometry literals with datatype 2.33 geo:wktLiteral. 2.34 (bug #33: http://bug.strabon.di.uoa.gr/ticket/33)
3.1 --- a/README Fri Apr 19 09:11:47 2013 +0300 3.2 +++ b/README Fri Apr 19 14:37:09 2013 +0300 3.3 @@ -33,6 +33,17 @@ 3.4 extension of GeoSPARQL. 3.5 3.6 3.7 +Conformance to GeoSPARQL 3.8 +======================== 3.9 +Strabon implements the `Core', the `Topology Vocabulary Extension', the 3.10 +`Geometry Extension', the `Geometry Topology Extension', and the `RDFS Entailment 3.11 +Extension' except for Req. 25 3.12 +(http://www.opengis.net/spec/geosparql/1.0/req/rdfs-entailment-extension/bgp-rdfs-ent). 3.13 + 3.14 +With respect to GML, Strabon supports the GML Profile corresponding to Simple 3.15 +Features, that is, GML Simple Features Profile 2.0. 3.16 + 3.17 + 3.18 Strabon Homepage 3.19 ================ 3.20 The homepage of Strabon is at http://www.strabon.di.uoa.gr/. 3.21 @@ -43,6 +54,84 @@ 3.22 You can find a demo of the system Strabon at http://test.strabon.di.uoa.gr/NOA/. 3.23 3.24 3.25 +How to build and run Strabon from command line 3.26 +============================================== 3.27 +Assuming you have already downloaded Strabon and you are in the top-level 3.28 +directory of Strabon, issue the following command to build it from command line: 3.29 + 3.30 + $ mvn package 3.31 + 3.32 +The above command runs automatically the JUnit tests. To skip them pass option 3.33 +`-DskipTests=true' to the above command. The complete command is the following: 3.34 + 3.35 + $ mvn -DskipTests=true package 3.36 + 3.37 +In case of an error during building of Strabon and assuming that the error does 3.38 +not come from the JUnit tests, please have a look at the `Known Issues' section 3.39 +below. If none of the known issues of that section applies, please contact the 3.40 +developers through the Strabon mailing-list or submit a corresponding bug 3.41 +(see `Bugs' section below). 3.42 + 3.43 +After you have successfully built Strabon, you have access to the following 3.44 +components: 3.45 + 3.46 + * Strabon Endpoint 3.47 + 3.48 + This is a SPARQL endpoint for Strabon. It is distributed as a war file so 3.49 + you may deploy it in a Tomcat container. You may find the war file under 3.50 + directory `endpoint/target'. 3.51 + 3.52 + * Strabon Endpoint (standalone) 3.53 + 3.54 + This is a SPARQL endpoint for Strabon like the above one, but it differs 3.55 + only in that it does not require the user to have already set up a Tomcat 3.56 + container. The standalone Strabon Endpoint may be run by issuing the 3.57 + following command: 3.58 + 3.59 + $ java -jar endpoint-exec/target/strabon-endpoint-executable-${version}.jar 3.60 + 3.61 + After issuing the above command, you may access the Strabon Endpoint at 3.62 + the following URL: <http://localhost:8080/>. 3.63 + 3.64 + Please see the page at <http://hg.strabon.di.uoa.gr/Strabon/rev/674f8f91162b> 3.65 + to find out other options that you may pass to the Tomcat container that 3.66 + will run by the above command. 3.67 + 3.68 + SPECIAL NOTE: if you need to configure the connection details to the 3.69 + underlying database, you may do so in two ways: 3.70 + 1. By modifying file `endpoint/WebContent/WEB-INF/connection.properties' 3.71 + before building Strabon and executing the above command. 3.72 + 2. After executing the above command, by visiting the following page by a 3.73 + browser: <http://localhost:8080/ChangeConnection> 3.74 + 3.75 + * Strabon Endpoint Client 3.76 + 3.77 + This is a Java client for interacting with Strabon Endpoint or any other 3.78 + SPARQL endpoint. It is packaged as a jar file and may be found under 3.79 + directory `endpoint-client/target/' with name 3.80 + `strabon-endpoint-client-${version}.jar'. This jar contains any dependencies 3.81 + to other code, so may copy and paste it to your project and start playing 3.82 + with the code immediately. 3.83 + 3.84 + * Strabon script 3.85 + 3.86 + The `strabon' script is located under the `scripts/' directory and it is the 3.87 + main command-line tool for interacting with Strabon. You may use it to store 3.88 + RDF data with geospatial information or query/update it using one of 3.89 + stSPARQL or GeoSPARQL query languages. 3.90 + 3.91 + * Endpoint script 3.92 + 3.93 + The `endpoint' script is located under the `scripts' directory and it is the 3.94 + main command-line tool for interacting with a `Strabon Endpoint'. You may 3.95 + use it to do any operation you would like to do with the `strabon' script 3.96 + above, but in contrast to the `strabon' script you need to have access to a 3.97 + Strabon endpoint. Of course, the `Strabon Endpoint Client' component above 3.98 + can be used as well as a command-line tool. At the time of writing, the 3.99 + `Strabon Endpoint Client' component supports only querying of RDF data with 3.100 + geospatial information. 3.101 + 3.102 + 3.103 Getting Started 3.104 =============== 3.105 To get started with Strabon please have a look at the tutorial for the stRDF 3.106 @@ -89,6 +178,107 @@ 3.107 You can see some examples in the classes gr.uoa.di.strabon.example.PostgisExample 3.108 and gr.uoa.di.strabon.example.PostgisExample2. 3.109 3.110 + Tuning PostgreSQL 3.111 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3.112 +The default settings of Postgres are rather conservative. As a result, parameter 3.113 +tuning is neccessary for speeding up Postgres, therefore Strabon. If you are 3.114 +using Strabon to compare its performance against your implementation of 3.115 +stSPARQL/GeoSPARQL, you are *strongly* encouraged to contact us using the Strabon 3.116 +Users mailing list for assistance on tuning Postgres. 3.117 + 3.118 +You can follow the instructions below for tuning a Postgres server running on an 3.119 +Ubuntu machine that is dedicated to PostgreSQL and Strabon. 3.120 + 3.121 +1. Append the following text at the end of postgresql.conf. 3.122 +*Uncomment* the appropriate lines. 3.123 + 3.124 +### RAM 3.125 +## 4 GB of RAM 3.126 +#shared_buffers = 3GB 3.127 +#effective_cache_size = 3GB 3.128 +#maintenance_work_mem = 1GB 3.129 +#work_mem = 2GB 3.130 +## 8 GB of RAM 3.131 +#shared_buffers = 5GB 3.132 +#effective_cache_size = 6GB 3.133 +#maintenance_work_mem = 2GB 3.134 +#work_mem = 5GB 3.135 +## 16 GB of RAM 3.136 +#shared_buffers = 10GB 3.137 +#effective_cache_size = 14GB 3.138 +#maintenance_work_mem = 4GB 3.139 +#work_mem = 10GB 3.140 +## 24 GB of RAM 3.141 +#shared_buffers = 16GB 3.142 +#effective_cache_size = 22GB 3.143 +#maintenance_work_mem = 6GB 3.144 +#work_mem = 15GB 3.145 +## 48 GB of RAM 3.146 +#shared_buffers = 32GB 3.147 +#effective_cache_size = 46GB 3.148 +#maintenance_work_mem = 8GB 3.149 +#work_mem = 30GB 3.150 +## 64 GB of RAM 3.151 +# contact us to find out! 3.152 +### HD 3.153 +## RAID with ordinary 7.200 disks 3.154 +#random_page_cost = 3.5 #3.0-3.5 3.155 +## High-End NAS/SAN 3.156 +#random_page_cost = 2 #1.5-2.5 3.157 +## Amazon EBS/Heroku 3.158 +#random_page_cost = 1.3 #1.1-2.0 3.159 +## SSD array 3.160 +#random_page_cost = 2.0 #1.5-2.5 3.161 +### Misc 3.162 +default_statistics_target = 10000 3.163 +constraint_exclusion = on 3.164 +checkpoint_completion_target = 0.9 3.165 +wal_buffers = 32MB 3.166 +checkpoint_segments = 64 3.167 +### Connections 3.168 +max_connections = 10 3.169 + 3.170 +2. Append the following lines at the end of /etc/sysctl.conf 3.171 +*Uncomment* the appropriate lines. 3.172 + 3.173 +## 4 GB of RAM 3.174 +#kernel.shmmax = 3758096384 3.175 +#kernel.shmall = 3758096384 3.176 +#kernel.shmmni = 4096 3.177 +## 8 GB of RAM 3.178 +#kernel.shmmax = 5905580032 3.179 +#kernel.shmall = 5905580032 3.180 +#kernel.shmmni = 4096 3.181 +## 16 GB of RAM 3.182 +#kernel.shmmax = 11274289152 3.183 +#kernel.shmall = 11274289152 3.184 +#kernel.shmmni = 4096 3.185 +## 24 GB of RAM 3.186 +#kernel.shmmax = 17716740096 3.187 +#kernel.shmall = 17716740096 3.188 +#kernel.shmmni = 4096 3.189 +## 48 GB of RAM 3.190 +#kernel.shmmax = 35433480192 3.191 +#kernel.shmall = 35433480192 3.192 +#kernel.shmmni = 4224 3.193 +## 64 GB of RAM 3.194 +# contact us to find out! 3.195 + 3.196 +3. Apply all changes by executing 3.197 + 3.198 +$ sudo sysctl -p 3.199 +$ sudo /etc/init.d/postgresql restart 3.200 + 3.201 +4. Prepare for the next run by issuing the command 3.202 + 3.203 +$ sudo -u postgres psql -c 'VACUUM ANALYZE;' db 3.204 + 3.205 +or 3.206 + 3.207 +$ psql -c 'VACUUM ANALYZE;' db 3.208 + 3.209 +where db is the name of the Postgres database that Strabon will use. 3.210 + 3.211 3.212 Developer Guide 3.213 ~~~~~~~~~~~~~~~ 3.214 @@ -115,8 +305,45 @@ 3.215 project, download any dependencies and build the project. 3.216 3.217 3.218 - Storing stRDF graphs and evaluating stSPARQL queries 3.219 - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3.220 +Tester Guide 3.221 +~~~~~~~~~~~~ 3.222 +Assuming again that you are familiar with Maven and Junit these are the steps 3.223 +you need to follow to test the functionality of Strabon: 3.224 + 3.225 + 3.226 +* Using Eclipse 3.227 + 3.228 + If you want to create a new test: 3.229 + 3.230 + 1. Import Strabon into Eclipse as explained in the Developer Guide. 3.231 + 2. Go to strabon-testsuite project. 3.232 + 3. Create a new folder (Recommended folder name: <test's name>) and place inside the following files: 3.233 + 3.1. An ntriples or nquads file with the test dataset (with .nt or .nq extension). 3.234 + 3.2. Pairs of files with sparql test queries and expected test results in xml format. 3.235 + Notice that each pair must have the same name and .rq extension for the queryFile and .srx extension for the resultsFile. 3.236 + 4. Create a test class that extends TemplateTest class. 3.237 + 5. If you have followed the recommendations the test is ready. If you have different names for your 3.238 + files, insert them explicitly in the constructor of TemplateTest class (super class). 3.239 + 3.240 + If you want to run a test: 3.241 + 3.242 + 1. Right-click on the test class. 3.243 + 2. Select "Run as JUnit Test". 3.244 + 3. Database properties are retrieved from database.properties file. If you want, you can change a property 3.245 + "on the fly" with an environment variable. 3.246 + 3.247 + 3.248 +* Command Line 3.249 + 3.250 + If you want to run all the tests: 3.251 + 3.252 + 1. Go to Strabon directory (root directory of all the subprojects). 3.253 + 2. Run "mvn test". 3.254 + 3. Optionally you can pass an environment variable with "-DvariableName=variableValue". 3.255 + 3.256 + 3.257 +Storing stRDF graphs and evaluating stSPARQL queries 3.258 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3.259 You can see some examples in the classes 3.260 eu.earthobservatory.runtime.postgis.StoreOp and 3.261 eu.earthobservatory.runtime.postgis.QueryOp. 3.262 @@ -216,10 +443,17 @@ 3.263 3.264 Mailing-list 3.265 ============ 3.266 -Currently, there is only a developers mailing-list, Strabon-devel, for support 3.267 -and other questions concerning Strabon. To subscribe to the mailing-list, please 3.268 -visit page http://cgi.di.uoa.gr/~mailman/listinfo/strabon-devel. To post e-mails 3.269 -to Strabon-devel mailing-list, write to Strabon-devel@di.uoa.gr. 3.270 +Currently, we maintain the following mailing lists: 3.271 + 3.272 +* Strabon-users, is used as a communication channel for Strabon users. 3.273 +To subscribe to the mailing-list, please visit page 3.274 +http://cgi.di.uoa.gr/~mailman/listinfo/strabon-users. To post e-mails 3.275 +to Strabon-users mailing-list, write to strabon-users@di.uoa.gr. 3.276 + 3.277 +* Strabon-devel, is used as a communication channel with the developers 3.278 +of Strabon. To subscribe to the mailing-list, please visit page 3.279 +http://cgi.di.uoa.gr/~mailman/listinfo/strabon-devel. To post e-mails 3.280 +to Strabon-devel mailing-list, write to strabon-devel@di.uoa.gr. 3.281 3.282 3.283 Bugs 3.284 @@ -250,6 +484,10 @@ 3.285 3.286 $ mvn clean package -Dshade.skip 3.287 3.288 + * When using MonetDB as a backend, the following source code of MonetDB must be 3.289 + used: 3.290 + https://hg.strabon.di.uoa.gr/MonetDB/ 3.291 + 3.292 3.293 License 3.294 =======
4.1 --- a/endpoint-client/pom.xml Fri Apr 19 09:11:47 2013 +0300 4.2 +++ b/endpoint-client/pom.xml Fri Apr 19 14:37:09 2013 +0300 4.3 @@ -37,6 +37,12 @@ 4.4 <artifactId>junit</artifactId> 4.5 <scope>test</scope> 4.6 </dependency> 4.7 + <dependency> 4.8 + <groupId>org.openrdf.sesame</groupId> 4.9 + <artifactId> 4.10 + sesame-queryresultio-spatial-sparqlkml 4.11 + </artifactId> 4.12 + </dependency> 4.13 </dependencies> 4.14 4.15 <build>
5.1 --- a/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/EndpointResult.java Fri Apr 19 09:11:47 2013 +0300 5.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/EndpointResult.java Fri Apr 19 14:37:09 2013 +0300 5.3 @@ -13,23 +13,27 @@ 5.4 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 5.5 * 5.6 */ 5.7 -public interface EndpointResult { 5.8 +public class EndpointResult { 5.9 5.10 - /** 5.11 - * Returns the HTTP status code as returned by the endpoint. 5.12 - * @return 5.13 - */ 5.14 - public int getStatusCode(); 5.15 + private int statusCode; 5.16 + private String statusText; 5.17 + private String response; 5.18 5.19 - /** 5.20 - * Returns the status text corresponding to the status code. 5.21 - * @return 5.22 - */ 5.23 - public String getStatusText(); 5.24 + public EndpointResult(int statusCode, String statusLine, String response) { 5.25 + this.statusCode = statusCode; 5.26 + this.statusText = statusLine; 5.27 + this.response = response; 5.28 + } 5.29 5.30 - /** 5.31 - * Returns the response of the endpoint. 5.32 - * @return 5.33 - */ 5.34 - public String getResponse(); 5.35 + public int getStatusCode() { 5.36 + return statusCode; 5.37 + } 5.38 + 5.39 + public String getStatusText() { 5.40 + return statusText; 5.41 + } 5.42 + 5.43 + public String getResponse() { 5.44 + return response; 5.45 + } 5.46 }
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/HTTPClient.java Fri Apr 19 14:37:09 2013 +0300 6.3 @@ -0,0 +1,112 @@ 6.4 +/** 6.5 + * This Source Code Form is subject to the terms of the Mozilla Public 6.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 6.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 6.8 + * 6.9 + * Copyright (C) 2012, Pyravlos Team 6.10 + * 6.11 + * http://www.strabon.di.uoa.gr/ 6.12 + */ 6.13 +package eu.earthobservatory.org.StrabonEndpoint.client; 6.14 + 6.15 +import org.apache.http.client.HttpClient; 6.16 +import org.apache.http.conn.ClientConnectionManager; 6.17 +import org.apache.http.impl.client.DefaultHttpClient; 6.18 +import org.apache.http.impl.conn.PoolingClientConnectionManager; 6.19 + 6.20 +/** 6.21 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 6.22 + * 6.23 + */ 6.24 +public abstract class HTTPClient { 6.25 + 6.26 + /** 6.27 + * The host on which the endpoint is located. 6.28 + */ 6.29 + protected String host; 6.30 + 6.31 + /** 6.32 + * The port of the host. 6.33 + */ 6.34 + protected int port; 6.35 + 6.36 + /** 6.37 + * The name of the endpoint. 6.38 + * 6.39 + * This is useful for {@link SPARQLEndpoint} instances that are usually 6.40 + * deployed in a tomcat container as web applications. 6.41 + */ 6.42 + protected String endpointName; 6.43 + 6.44 + /** 6.45 + * The username to be used in case the endpoint requires authentication. 6.46 + */ 6.47 + protected String user; 6.48 + 6.49 + /** 6.50 + * The password to be used in case the endpoint requires authentication. 6.51 + */ 6.52 + protected String password; 6.53 + 6.54 + /** 6.55 + * The connection manager that manages sharing of connections to endpoints 6.56 + * among several threads. 6.57 + */ 6.58 + private ClientConnectionManager connectionManager; 6.59 + 6.60 + /** 6.61 + * The HttpClient to be used for connecting to an endpoint. 6.62 + */ 6.63 + protected HttpClient hc; 6.64 + 6.65 + public HTTPClient(String host, int port) { 6.66 + this(host, port, "/"); 6.67 + } 6.68 + 6.69 + public HTTPClient(String host, int port, String endpointName) { 6.70 + this.host = host; 6.71 + this.port = port; 6.72 + 6.73 + this.endpointName = (endpointName == null ? "":endpointName); 6.74 + 6.75 + // create a connection manager for allowing the users of this class use threads 6.76 + connectionManager = new PoolingClientConnectionManager(); 6.77 + 6.78 + // create an HttpClient instance that establishes connections based on the connection manager 6.79 + hc = new DefaultHttpClient(connectionManager); 6.80 + } 6.81 + 6.82 + public String getHost() { 6.83 + return host; 6.84 + } 6.85 + 6.86 + public int getPort() { 6.87 + return port; 6.88 + } 6.89 + 6.90 + public void setUser(String user) { 6.91 + this.user = user; 6.92 + } 6.93 + 6.94 + public void setPassword(String pass) { 6.95 + this.password = pass; 6.96 + } 6.97 + 6.98 + public String getUser() { 6.99 + return user; 6.100 + } 6.101 + 6.102 + public String getPassword() { 6.103 + return password; 6.104 + } 6.105 + 6.106 + /** 6.107 + * Returns a URL (actually a {@link String}) for establishing connections 6.108 + * to an endpoint based on the information given to the constructor. 6.109 + * 6.110 + * @return 6.111 + */ 6.112 + protected String getConnectionURL() { 6.113 + return "http://" + host + ":" + port + "/" + endpointName; 6.114 + } 6.115 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SPARQLEndpoint.java Fri Apr 19 14:37:09 2013 +0300 7.3 @@ -0,0 +1,230 @@ 7.4 +/** 7.5 + * This Source Code Form is subject to the terms of the Mozilla Public 7.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 7.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 7.8 + * 7.9 + * Copyright (C) 2012, Pyravlos Team 7.10 + * 7.11 + * http://www.strabon.di.uoa.gr/ 7.12 + */ 7.13 +package eu.earthobservatory.org.StrabonEndpoint.client; 7.14 + 7.15 +import java.io.BufferedReader; 7.16 +import java.io.IOException; 7.17 +import java.io.InputStream; 7.18 +import java.io.InputStreamReader; 7.19 +import java.net.URL; 7.20 +import java.nio.charset.Charset; 7.21 +import java.util.ArrayList; 7.22 +import java.util.List; 7.23 + 7.24 +import org.apache.http.HttpEntity; 7.25 +import org.apache.http.HttpResponse; 7.26 +import org.apache.http.NameValuePair; 7.27 +import org.apache.http.client.entity.UrlEncodedFormEntity; 7.28 +import org.apache.http.client.methods.HttpPost; 7.29 +import org.apache.http.message.BasicNameValuePair; 7.30 +import org.openrdf.query.resultio.TupleQueryResultFormat; 7.31 +import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 7.32 +import org.openrdf.rio.RDFFormat; 7.33 + 7.34 +/** 7.35 + * This class is the implementation of a java client for accessing 7.36 + * SPARQLEndpoint instances. 7.37 + * 7.38 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 7.39 + * @author Kallirroi Dogani <kallirroi@di.uoa.gr. 7.40 + */ 7.41 +public class SPARQLEndpoint extends HTTPClient{ 7.42 + 7.43 + public SPARQLEndpoint(String host, int port) { 7.44 + super(host, port); 7.45 + } 7.46 + 7.47 + public SPARQLEndpoint(String host, int port, String endpointName) { 7.48 + super(host, port, endpointName); 7.49 + } 7.50 + 7.51 + 7.52 + /** 7.53 + * Executes a SPARQL query on the Endpoint and get the results 7.54 + * in the format specified by stSPARQLQueryResultFormat, which is 7.55 + * an instance of class (or a subclass) {@link TupleQueryResultFormat}. 7.56 + * 7.57 + * @param sparqlQuery 7.58 + * @param format 7.59 + * @return 7.60 + * @throws IOException 7.61 + */ 7.62 + public EndpointResult query(String sparqlQuery, stSPARQLQueryResultFormat format) throws IOException { 7.63 + assert(format != null); 7.64 + 7.65 + // create a post method to execute 7.66 + HttpPost method = new HttpPost(getConnectionURL()); 7.67 + 7.68 + // set the query parameter 7.69 + List<NameValuePair> params = new ArrayList<NameValuePair>(); 7.70 + params.add(new BasicNameValuePair("query", sparqlQuery)); 7.71 + UrlEncodedFormEntity encodedEntity = new UrlEncodedFormEntity(params, Charset.defaultCharset()); 7.72 + method.setEntity(encodedEntity); 7.73 + 7.74 + // set the content type 7.75 + method.setHeader("Content-Type", "application/x-www-form-urlencoded"); 7.76 + 7.77 + // set the accept format 7.78 + method.addHeader("Accept", format.getDefaultMIMEType()); 7.79 + 7.80 + try { 7.81 + // response that will be filled next 7.82 + String responseBody = ""; 7.83 + 7.84 + // execute the method 7.85 + HttpResponse response = hc.execute(method); 7.86 + int statusCode = response.getStatusLine().getStatusCode(); 7.87 + 7.88 + // If the response does not enclose an entity, there is no need 7.89 + // to worry about connection release 7.90 + HttpEntity entity = response.getEntity(); 7.91 + if (entity != null) { 7.92 + InputStream instream = entity.getContent(); 7.93 + try { 7.94 + 7.95 + BufferedReader reader = new BufferedReader(new InputStreamReader(instream)); 7.96 + StringBuffer strBuf = new StringBuffer(); 7.97 + 7.98 + // do something useful with the response 7.99 + String nextLine; 7.100 + while ((nextLine = reader.readLine()) != null) { 7.101 + strBuf.append(nextLine + "\n"); 7.102 + } 7.103 + 7.104 + // remove last newline character 7.105 + if (strBuf.length() > 0) { 7.106 + strBuf.setLength(strBuf.length() - 1); 7.107 + } 7.108 + 7.109 + responseBody = strBuf.toString(); 7.110 + 7.111 + } catch (IOException ex) { 7.112 + // In case of an IOException the connection will be released 7.113 + // back to the connection manager automatically 7.114 + throw ex; 7.115 + 7.116 + } catch (RuntimeException ex) { 7.117 + // In case of an unexpected exception you may want to abort 7.118 + // the HTTP request in order to shut down the underlying 7.119 + // connection and release it back to the connection manager. 7.120 + method.abort(); 7.121 + throw ex; 7.122 + 7.123 + } finally { 7.124 + // Closing the input stream will trigger connection release 7.125 + instream.close(); 7.126 + } 7.127 + } 7.128 + 7.129 + return new EndpointResult(statusCode, response.getStatusLine().getReasonPhrase(), responseBody); 7.130 + 7.131 + } catch (IOException e) { 7.132 + throw e; 7.133 + 7.134 + } finally { 7.135 + // release the connection. 7.136 + method.releaseConnection(); 7.137 + } 7.138 + } 7.139 + 7.140 + /** 7.141 + * Stores the RDF <code>data</code> which are in the RDF format 7.142 + * <code>format</code> in the named graph specified by the URL 7.143 + * <code>namedGraph</code>. 7.144 + * 7.145 + * @param data 7.146 + * @param format 7.147 + * @param namedGraph 7.148 + * @return <code>true</code> if store was successful, <code>false</code> otherwise 7.149 + */ 7.150 + 7.151 + public boolean store(String data, RDFFormat format, URL namedGraph) { 7.152 + throw new UnsupportedOperationException(); 7.153 + } 7.154 + 7.155 + /** 7.156 + * Stores the RDF data located at <code>data</code> which are in the 7.157 + * RDF format <code>format</code> in the named graph specified by the 7.158 + * URL <code>namedGraph</code>. 7.159 + * 7.160 + * @param data 7.161 + * @param format 7.162 + * @param namedGraph 7.163 + * @return <code>true</code> if store was successful, <code>false</code> otherwise 7.164 + */ 7.165 + 7.166 + public boolean store(URL data, RDFFormat format, URL namedGraph) { 7.167 + throw new UnsupportedOperationException(); 7.168 + } 7.169 + 7.170 + /** 7.171 + * Executes the SPARQL Update query specified in <code>sparqlUpdate</code>. 7.172 + * 7.173 + * @param sparqlUpdate 7.174 + * @return <code>true</code> if store was successful, <code>false</code> otherwise 7.175 + */ 7.176 + 7.177 + public boolean update(String sparqlUpdate) { 7.178 + throw new UnsupportedOperationException(); 7.179 + } 7.180 + 7.181 + public EndpointResult describe(String sparqlDescribe) { 7.182 + throw new UnsupportedOperationException(); 7.183 + } 7.184 + 7.185 + public EndpointResult construct(String sparqlConstruct) { 7.186 + throw new UnsupportedOperationException(); 7.187 + } 7.188 + 7.189 + public EndpointResult ask(String sparqlAsk) { 7.190 + throw new UnsupportedOperationException(); 7.191 + } 7.192 + 7.193 + 7.194 + public static void main(String args[]) { 7.195 + if (args.length < 4) { 7.196 + System.err.println("Usage: eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint <HOST> <PORT> <APPNAME> [<FORMAT>]"); 7.197 + System.err.println(" where <HOST> is the hostname of the Strabon Endpoint"); 7.198 + System.err.println(" <PORT> is the port to connect to on the host"); 7.199 + System.err.println(" <APPNAME> is the application name of Strabon Endpoint as deployed in the Tomcat container"); 7.200 + System.err.println(" <QUERY> is the query to execute on the endpoint"); 7.201 + System.err.println(" [<FORMAT>] is the format of your results. Should be one of XML (default), KML, KMZ, GeoJSON, TSV, or HTML."); 7.202 + System.exit(1); 7.203 + } 7.204 + 7.205 + String host = args[0]; 7.206 + Integer port = new Integer(args[1]); 7.207 + String appName = args[2]; 7.208 + String query = args[3]; 7.209 + String format = ""; 7.210 + 7.211 + if (args.length == 5) { 7.212 + format = args[4]; 7.213 + 7.214 + } else { 7.215 + format = "XML"; 7.216 + } 7.217 + 7.218 + SPARQLEndpoint endpoint = new SPARQLEndpoint(host, port, appName); 7.219 + 7.220 + try { 7.221 + EndpointResult result = endpoint.query(query, (stSPARQLQueryResultFormat) stSPARQLQueryResultFormat.valueOf(format)); 7.222 + 7.223 + System.out.println("Status code: " + result.getStatusCode()); 7.224 + System.out.println("Status text: " + result.getStatusText()); 7.225 + System.out.println("<----- Result ----->"); 7.226 + System.out.println(result.getResponse().replaceAll("\n", "\n\t")); 7.227 + System.out.println("<----- Result ----->"); 7.228 + 7.229 + } catch (IOException e) { 7.230 + e.printStackTrace(); 7.231 + } 7.232 + } 7.233 +}
8.1 --- a/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SpatialEndpoint.java Fri Apr 19 09:11:47 2013 +0300 8.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SpatialEndpoint.java Fri Apr 19 14:37:09 2013 +0300 8.3 @@ -3,36 +3,73 @@ 8.4 * License, v. 2.0. If a copy of the MPL was not distributed with this 8.5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8.6 * 8.7 - * Copyright (C) 2012, Pyravlos Team 8.8 + * Copyright (C) 2012, 2013, Pyravlos Team 8.9 * 8.10 * http://www.strabon.di.uoa.gr/ 8.11 */ 8.12 package eu.earthobservatory.org.StrabonEndpoint.client; 8.13 8.14 +import java.io.ByteArrayInputStream; 8.15 +import java.io.ByteArrayOutputStream; 8.16 import java.io.IOException; 8.17 -import java.net.URL; 8.18 +import java.io.InputStream; 8.19 +import java.util.Vector; 8.20 8.21 +import org.openrdf.query.QueryEvaluationException; 8.22 +import org.openrdf.query.TupleQueryResult; 8.23 +import org.openrdf.query.TupleQueryResultHandlerException; 8.24 +import org.openrdf.query.resultio.QueryResultIO; 8.25 +import org.openrdf.query.resultio.QueryResultParseException; 8.26 +import org.openrdf.query.resultio.TupleQueryResultFormat; 8.27 +import org.openrdf.query.resultio.UnsupportedQueryResultFormatException; 8.28 import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 8.29 -import org.openrdf.rio.RDFFormat; 8.30 +import org.openrdf.query.resultio.sparqlkml.stSPARQLResultsKMLWriter; 8.31 8.32 /** 8.33 - * Every SPARQL endpoint that supports storing and querying of 8.34 - * spatial RDF data should implement the {@link SpatialEndpoint} 8.35 - * interface. 8.36 + * SpatialEndpoint is a SPARQLEndpoint which can store and 8.37 + * query for spatial data. It also supports KML format for 8.38 + * this kind of data. 8.39 * 8.40 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 8.41 + * @author Kallirroi Dogani <kallirroi@di.uoa.gr> 8.42 */ 8.43 -public interface SpatialEndpoint { 8.44 +public class SpatialEndpoint extends SPARQLEndpoint { 8.45 + 8.46 + public SpatialEndpoint(String host, int port) { 8.47 + super(host, port); 8.48 + } 8.49 + 8.50 + public SpatialEndpoint(String host, int port, String endpointName) { 8.51 + super(host, port, endpointName); 8.52 + } 8.53 + 8.54 + public EndpointResult queryForKML(String sparqlQuery) throws IOException, QueryResultParseException, TupleQueryResultHandlerException, UnsupportedQueryResultFormatException, QueryEvaluationException{ 8.55 + 8.56 + EndpointResult xmlResult = query(sparqlQuery, stSPARQLQueryResultFormat.XML); 8.57 + 8.58 + if (xmlResult.getStatusCode() != 200) { 8.59 + throw new RuntimeException("Failed : HTTP error code : " + xmlResult.getStatusCode() + " " + xmlResult.getStatusText()); 8.60 + } 8.61 + 8.62 + String xml = xmlResult.getResponse(); 8.63 + 8.64 + InputStream inputStream = new ByteArrayInputStream(xml.getBytes("UTF-8")); 8.65 + TupleQueryResult results = QueryResultIO.parse(inputStream, TupleQueryResultFormat.SPARQL); 8.66 + 8.67 + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); 8.68 + stSPARQLResultsKMLWriter kmlWriter = new stSPARQLResultsKMLWriter(outputStream); 8.69 + 8.70 + kmlWriter.startQueryResult(new Vector<String>()); 8.71 + 8.72 + while(results.hasNext()){ 8.73 + 8.74 + kmlWriter.handleSolution(results.next()); 8.75 + } 8.76 + 8.77 + kmlWriter.endQueryResult(); 8.78 + 8.79 + EndpointResult kmlResult = new EndpointResult(xmlResult.getStatusCode(), xmlResult.getStatusText(), outputStream.toString()); 8.80 + return kmlResult; 8.81 + } 8.82 8.83 - public EndpointResult query(String sparqlQuery, stSPARQLQueryResultFormat format) throws IOException; 8.84 - 8.85 - public boolean store(String data, RDFFormat format); 8.86 - 8.87 - public boolean store(URL data, RDFFormat format); 8.88 - 8.89 - public boolean update(String sparqlUpdate); 8.90 - 8.91 - public EndpointResult describe(String sparqlDescribe); 8.92 - 8.93 - public EndpointResult construct(String sparqlConstruct); 8.94 }
9.1 --- a/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SpatialEndpointImpl.java Fri Apr 19 09:11:47 2013 +0300 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,112 +0,0 @@ 9.4 -/** 9.5 - * This Source Code Form is subject to the terms of the Mozilla Public 9.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 9.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 9.8 - * 9.9 - * Copyright (C) 2012, Pyravlos Team 9.10 - * 9.11 - * http://www.strabon.di.uoa.gr/ 9.12 - */ 9.13 -package eu.earthobservatory.org.StrabonEndpoint.client; 9.14 - 9.15 -import org.apache.http.client.HttpClient; 9.16 -import org.apache.http.conn.ClientConnectionManager; 9.17 -import org.apache.http.impl.client.DefaultHttpClient; 9.18 -import org.apache.http.impl.conn.PoolingClientConnectionManager; 9.19 - 9.20 -/** 9.21 - * @author Charalampos Nikolaou <charnik@di.uoa.gr> 9.22 - * 9.23 - */ 9.24 -public abstract class SpatialEndpointImpl implements SpatialEndpoint { 9.25 - 9.26 - /** 9.27 - * The host on which the endpoint is located. 9.28 - */ 9.29 - protected String host; 9.30 - 9.31 - /** 9.32 - * The port of the host. 9.33 - */ 9.34 - protected int port; 9.35 - 9.36 - /** 9.37 - * The name of the endpoint. 9.38 - * 9.39 - * This is useful for {@link StrabonEndpoint} instances that are usually 9.40 - * deployed in a tomcat container as web applications. 9.41 - */ 9.42 - protected String endpointName; 9.43 - 9.44 - /** 9.45 - * The username to be used in case the endpoint requires authentication. 9.46 - */ 9.47 - protected String user; 9.48 - 9.49 - /** 9.50 - * The password to be used in case the endpoint requires authentication. 9.51 - */ 9.52 - protected String password; 9.53 - 9.54 - /** 9.55 - * The connection manager that manages sharing of connections to endpoints 9.56 - * among several threads. 9.57 - */ 9.58 - private ClientConnectionManager connectionManager; 9.59 - 9.60 - /** 9.61 - * The HttpClient to be used for connecting to an endpoint. 9.62 - */ 9.63 - protected HttpClient hc; 9.64 - 9.65 - public SpatialEndpointImpl(String host, int port) { 9.66 - this(host, port, "/"); 9.67 - } 9.68 - 9.69 - public SpatialEndpointImpl(String host, int port, String endpointName) { 9.70 - this.host = host; 9.71 - this.port = port; 9.72 - 9.73 - this.endpointName = (endpointName == null ? "":endpointName); 9.74 - 9.75 - // create a connection manager for allowing the users of this class use threads 9.76 - connectionManager = new PoolingClientConnectionManager(); 9.77 - 9.78 - // create an HttpClient instance that establishes connections based on the connection manager 9.79 - hc = new DefaultHttpClient(connectionManager); 9.80 - } 9.81 - 9.82 - public String getHost() { 9.83 - return host; 9.84 - } 9.85 - 9.86 - public int getPort() { 9.87 - return port; 9.88 - } 9.89 - 9.90 - public void setUser(String user) { 9.91 - this.user = user; 9.92 - } 9.93 - 9.94 - public void setPassword(String pass) { 9.95 - this.password = pass; 9.96 - } 9.97 - 9.98 - public String getUser() { 9.99 - return user; 9.100 - } 9.101 - 9.102 - public String getPassword() { 9.103 - return password; 9.104 - } 9.105 - 9.106 - /** 9.107 - * Returns a URL (actually a {@link String}) for establishing connections 9.108 - * to an endpoint based on the information given to the constructor. 9.109 - * 9.110 - * @return 9.111 - */ 9.112 - protected String getConnectionURL() { 9.113 - return "http://" + host + ":" + port + "/" + endpointName; 9.114 - } 9.115 -}
10.1 --- a/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/StrabonEndpoint.java Fri Apr 19 09:11:47 2013 +0300 10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 10.3 @@ -1,189 +0,0 @@ 10.4 -/** 10.5 - * This Source Code Form is subject to the terms of the Mozilla Public 10.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 10.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 10.8 - * 10.9 - * Copyright (C) 2012, Pyravlos Team 10.10 - * 10.11 - * http://www.strabon.di.uoa.gr/ 10.12 - */ 10.13 -package eu.earthobservatory.org.StrabonEndpoint.client; 10.14 - 10.15 -import java.io.BufferedReader; 10.16 -import java.io.IOException; 10.17 -import java.io.InputStream; 10.18 -import java.io.InputStreamReader; 10.19 -import java.net.URL; 10.20 -import java.nio.charset.Charset; 10.21 -import java.util.ArrayList; 10.22 -import java.util.List; 10.23 - 10.24 -import org.apache.http.HttpEntity; 10.25 -import org.apache.http.HttpResponse; 10.26 -import org.apache.http.NameValuePair; 10.27 -import org.apache.http.client.entity.UrlEncodedFormEntity; 10.28 -import org.apache.http.client.methods.HttpPost; 10.29 -import org.apache.http.message.BasicNameValuePair; 10.30 -import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 10.31 -import org.openrdf.rio.RDFFormat; 10.32 - 10.33 -/** 10.34 - * This class is the implementation of a java client for accessing 10.35 - * StrabonEndpoint instances. 10.36 - * 10.37 - * @author Charalampos Nikolaou <charnik@di.uoa.gr> 10.38 - */ 10.39 -public class StrabonEndpoint extends SpatialEndpointImpl { 10.40 - 10.41 - public StrabonEndpoint(String host, int port) { 10.42 - super(host, port); 10.43 - } 10.44 - 10.45 - public StrabonEndpoint(String host, int port, String endpointName) { 10.46 - super(host, port, endpointName); 10.47 - } 10.48 - 10.49 - @Override 10.50 - public EndpointResult query(String sparqlQuery, stSPARQLQueryResultFormat format) throws IOException { 10.51 - assert(format != null); 10.52 - 10.53 - // create a post method to execute 10.54 - HttpPost method = new HttpPost(getConnectionURL() + "/Query"); 10.55 - 10.56 - // set the query parameter 10.57 - List<NameValuePair> params = new ArrayList<NameValuePair>(); 10.58 - params.add(new BasicNameValuePair("query", sparqlQuery)); 10.59 - UrlEncodedFormEntity encodedEntity = new UrlEncodedFormEntity(params, Charset.defaultCharset()); 10.60 - method.setEntity(encodedEntity); 10.61 - 10.62 - // set the content type 10.63 - method.setHeader("Content-Type", "application/x-www-form-urlencoded"); 10.64 - 10.65 - // set the accept format 10.66 - method.addHeader("Accept", format.getDefaultMIMEType()); 10.67 - 10.68 - try { 10.69 - // response that will be filled next 10.70 - String responseBody = ""; 10.71 - 10.72 - // execute the method 10.73 - HttpResponse response = hc.execute(method); 10.74 - int statusCode = response.getStatusLine().getStatusCode(); 10.75 - 10.76 - // If the response does not enclose an entity, there is no need 10.77 - // to worry about connection release 10.78 - HttpEntity entity = response.getEntity(); 10.79 - if (entity != null) { 10.80 - InputStream instream = entity.getContent(); 10.81 - try { 10.82 - 10.83 - BufferedReader reader = new BufferedReader(new InputStreamReader(instream)); 10.84 - StringBuffer strBuf = new StringBuffer(); 10.85 - 10.86 - // do something useful with the response 10.87 - String nextLine; 10.88 - while ((nextLine = reader.readLine()) != null) { 10.89 - strBuf.append(nextLine + "\n"); 10.90 - } 10.91 - 10.92 - // remove last newline character 10.93 - if (strBuf.length() > 0) { 10.94 - strBuf.setLength(strBuf.length() - 1); 10.95 - } 10.96 - 10.97 - responseBody = strBuf.toString(); 10.98 - 10.99 - } catch (IOException ex) { 10.100 - // In case of an IOException the connection will be released 10.101 - // back to the connection manager automatically 10.102 - throw ex; 10.103 - 10.104 - } catch (RuntimeException ex) { 10.105 - // In case of an unexpected exception you may want to abort 10.106 - // the HTTP request in order to shut down the underlying 10.107 - // connection and release it back to the connection manager. 10.108 - method.abort(); 10.109 - throw ex; 10.110 - 10.111 - } finally { 10.112 - // Closing the input stream will trigger connection release 10.113 - instream.close(); 10.114 - } 10.115 - } 10.116 - 10.117 - return new StrabonEndpointResult(statusCode, response.getStatusLine().getReasonPhrase(), responseBody); 10.118 - 10.119 - } catch (IOException e) { 10.120 - throw e; 10.121 - 10.122 - } finally { 10.123 - // release the connection. 10.124 - method.releaseConnection(); 10.125 - } 10.126 - } 10.127 - 10.128 - @Override 10.129 - public boolean store(String data, RDFFormat format) { 10.130 - return false; 10.131 - } 10.132 - 10.133 - @Override 10.134 - public boolean store(URL data, RDFFormat format) { 10.135 - return false; 10.136 - } 10.137 - 10.138 - @Override 10.139 - public boolean update(String sparqlUpdate) { 10.140 - return false; 10.141 - } 10.142 - 10.143 - @Override 10.144 - public EndpointResult describe(String sparqlDescribe) { 10.145 - return null; 10.146 - } 10.147 - 10.148 - @Override 10.149 - public EndpointResult construct(String sparqlConstruct) { 10.150 - return null; 10.151 - } 10.152 - 10.153 - public static void main(String args[]) { 10.154 - if (args.length < 4) { 10.155 - System.err.println("Usage: eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint <HOST> <PORT> <APPNAME> [<FORMAT>]"); 10.156 - System.err.println(" where <HOST> is the hostname of the Strabon Endpoint"); 10.157 - System.err.println(" <PORT> is the port to connect to on the host"); 10.158 - System.err.println(" <APPNAME> is the application name of Strabon Endpoint as deployed in the Tomcat container"); 10.159 - System.err.println(" <QUERY> is the query to execute on the endpoint"); 10.160 - System.err.println(" [<FORMAT>] is the format of your results. Should be one of XML (default), KML, KMZ, GeoJSON, TSV, or HTML."); 10.161 - System.exit(1); 10.162 - } 10.163 - 10.164 - String host = args[0]; 10.165 - Integer port = new Integer(args[1]); 10.166 - String appName = args[2]; 10.167 - String query = args[3]; 10.168 - String format = ""; 10.169 - 10.170 - if (args.length == 5) { 10.171 - format = args[4]; 10.172 - 10.173 - } else { 10.174 - format = "XML"; 10.175 - } 10.176 - 10.177 - StrabonEndpoint endpoint = new StrabonEndpoint(host, port, appName); 10.178 - 10.179 - try { 10.180 - EndpointResult result = endpoint.query(query, stSPARQLQueryResultFormat.valueOf(format)); 10.181 - 10.182 - System.out.println("Status code: " + result.getStatusCode()); 10.183 - System.out.println("Status text: " + result.getStatusText()); 10.184 - System.out.println("<----- Result ----->"); 10.185 - System.out.println(result.getResponse().replaceAll("\n", "\n\t")); 10.186 - System.out.println("<----- Result ----->"); 10.187 - 10.188 - } catch (IOException e) { 10.189 - e.printStackTrace(); 10.190 - } 10.191 - } 10.192 -}
11.1 --- a/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/StrabonEndpointResult.java Fri Apr 19 09:11:47 2013 +0300 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,42 +0,0 @@ 11.4 -/** 11.5 - * This Source Code Form is subject to the terms of the Mozilla Public 11.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 11.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 11.8 - * 11.9 - * Copyright (C) 2012, Pyravlos Team 11.10 - * 11.11 - * http://www.strabon.di.uoa.gr/ 11.12 - */ 11.13 -package eu.earthobservatory.org.StrabonEndpoint.client; 11.14 - 11.15 -/** 11.16 - * @author Charalampos Nikolaou <charnik@di.uoa.gr> 11.17 - * 11.18 - */ 11.19 -public class StrabonEndpointResult implements EndpointResult { 11.20 - 11.21 - private int statusCode; 11.22 - private String statusText; 11.23 - private String response; 11.24 - 11.25 - public StrabonEndpointResult(int statusCode, String statusLine, String response) { 11.26 - this.statusCode = statusCode; 11.27 - this.statusText = statusLine; 11.28 - this.response = response; 11.29 - } 11.30 - 11.31 - @Override 11.32 - public int getStatusCode() { 11.33 - return statusCode; 11.34 - } 11.35 - 11.36 - @Override 11.37 - public String getStatusText() { 11.38 - return statusText; 11.39 - } 11.40 - 11.41 - @Override 11.42 - public String getResponse() { 11.43 - return response; 11.44 - } 11.45 -}
12.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestLimit.java Fri Apr 19 09:11:47 2013 +0300 12.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestLimit.java Fri Apr 19 14:37:09 2013 +0300 12.3 @@ -1,109 +1,109 @@ 12.4 -/** 12.5 - * This Source Code Form is subject to the terms of the Mozilla Public 12.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 12.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 12.8 - * 12.9 - * Copyright (C) 2012, Pyravlos Team 12.10 - * 12.11 - * http://www.strabon.di.uoa.gr/ 12.12 - */ 12.13 -package eu.earthobservatory.org.StrabonEndpoint.client; 12.14 - 12.15 - 12.16 -import static org.junit.Assert.assertTrue; 12.17 - 12.18 -import java.io.IOException; 12.19 -import org.junit.Before; 12.20 -import org.junit.Test; 12.21 -import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 12.22 - 12.23 -/** 12.24 - * @author Stella Giannakopoulou <sgian@di.uoa.gr> 12.25 - * 12.26 - */ 12.27 -public class TestLimit { 12.28 - 12.29 - private StrabonEndpoint endpoint; 12.30 - private String [] testQueries; 12.31 - private stSPARQLQueryResultFormat format; 12.32 - 12.33 - @Before 12.34 - public void init() { 12.35 - 12.36 - // initialize endpoint 12.37 - endpoint = new StrabonEndpoint("localhost", 8080, "strabon-endpoint"); 12.38 - testQueries = new String[6]; 12.39 - 12.40 - // set queries 12.41 - testQueries[0] = "SELECT *\n" + 12.42 - "WHERE\n"+ 12.43 - "{\n"+ 12.44 - " ?x ?y ?z\n" + 12.45 - "}\n" + 12.46 - "limit 3"; 12.47 - 12.48 - testQueries[1] = "SELECT *\n" + 12.49 - "WHERE\n"+ 12.50 - "{\n"+ 12.51 - " ?x ?limit 5\n" + 12.52 - "}\n" + 12.53 - "limit 3"; 12.54 - 12.55 - testQueries[2] = "SELECT *\n" + 12.56 - "WHERE\n"+ 12.57 - "{\n"+ 12.58 - " ?x ?limit 5\n" + 12.59 - "}\n" + 12.60 - "limit 3\n" + 12.61 - "offset 4"; 12.62 - 12.63 - testQueries[3] = "SELECT *\n" + 12.64 - "WHERE\n"+ 12.65 - "{\n"+ 12.66 - " ?x ?y ?z\n" + 12.67 - "}\n" + 12.68 - "limit 3000"; 12.69 - 12.70 - testQueries[4] = "SELECT *\n" + 12.71 - "WHERE\n"+ 12.72 - "{\n"+ 12.73 - " ?x ?y ?z\n" + 12.74 - "}\n" + 12.75 - "offset 5" + 12.76 - "limit 3000"; 12.77 - 12.78 - testQueries[5] = "SELECT *\n" + 12.79 - "WHERE\n"+ 12.80 - "{\n"+ 12.81 - " ?x ?z 5\n" + 12.82 - "}\n" + 12.83 - "limit3000\n" + 12.84 - "offset 2"; 12.85 - 12.86 - // format does not matter for the test 12.87 - format = stSPARQLQueryResultFormat.HTML; 12.88 - } 12.89 - 12.90 - /** 12.91 - * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 12.92 - */ 12.93 - @Test 12.94 - public void testQuery() { 12.95 - 12.96 - for (String query : testQueries) { 12.97 - try { 12.98 - EndpointResult response = endpoint.query(query, format); 12.99 - 12.100 - if (response.getStatusCode() != 200) { 12.101 - System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText()); 12.102 - 12.103 - } 12.104 - 12.105 - assertTrue(response.getStatusCode() == 200); 12.106 - 12.107 - } catch (IOException e) { 12.108 - e.printStackTrace(); 12.109 - } 12.110 - } 12.111 - } 12.112 -} 12.113 +///** 12.114 +// * This Source Code Form is subject to the terms of the Mozilla Public 12.115 +// * License, v. 2.0. If a copy of the MPL was not distributed with this 12.116 +// * file, You can obtain one at http://mozilla.org/MPL/2.0/. 12.117 +// * 12.118 +// * Copyright (C) 2012, Pyravlos Team 12.119 +// * 12.120 +// * http://www.strabon.di.uoa.gr/ 12.121 +// */ 12.122 +//package eu.earthobservatory.org.StrabonEndpoint.client; 12.123 +// 12.124 +// 12.125 +//import static org.junit.Assert.assertTrue; 12.126 +// 12.127 +//import java.io.IOException; 12.128 +//import org.junit.Before; 12.129 +//import org.junit.Test; 12.130 +//import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 12.131 +// 12.132 +///** 12.133 +// * @author Stella Giannakopoulou <sgian@di.uoa.gr> 12.134 +// * 12.135 +// */ 12.136 +//public class TestLimit { 12.137 +// 12.138 +// private SPARQLEndpoint endpoint; 12.139 +// private String [] testQueries; 12.140 +// private stSPARQLQueryResultFormat format; 12.141 +// 12.142 +// @Before 12.143 +// public void init() { 12.144 +// 12.145 +// // initialize endpoint 12.146 +// endpoint = new SPARQLEndpoint("localhost", 8080, "strabon-endpoint/Query"); 12.147 +// testQueries = new String[6]; 12.148 +// 12.149 +// // set queries 12.150 +// testQueries[0] = "SELECT *\n" + 12.151 +// "WHERE\n"+ 12.152 +// "{\n"+ 12.153 +// " ?x ?y ?z\n" + 12.154 +// "}\n" + 12.155 +// "limit 3"; 12.156 +// 12.157 +// testQueries[1] = "SELECT *\n" + 12.158 +// "WHERE\n"+ 12.159 +// "{\n"+ 12.160 +// " ?x ?limit 5\n" + 12.161 +// "}\n" + 12.162 +// "limit 3"; 12.163 +// 12.164 +// testQueries[2] = "SELECT *\n" + 12.165 +// "WHERE\n"+ 12.166 +// "{\n"+ 12.167 +// " ?x ?limit 5\n" + 12.168 +// "}\n" + 12.169 +// "limit 3\n" + 12.170 +// "offset 4"; 12.171 +// 12.172 +// testQueries[3] = "SELECT *\n" + 12.173 +// "WHERE\n"+ 12.174 +// "{\n"+ 12.175 +// " ?x ?y ?z\n" + 12.176 +// "}\n" + 12.177 +// "limit 3000"; 12.178 +// 12.179 +// testQueries[4] = "SELECT *\n" + 12.180 +// "WHERE\n"+ 12.181 +// "{\n"+ 12.182 +// " ?x ?y ?z\n" + 12.183 +// "}\n" + 12.184 +// "offset 5" + 12.185 +// "limit 3000"; 12.186 +// 12.187 +// testQueries[5] = "SELECT *\n" + 12.188 +// "WHERE\n"+ 12.189 +// "{\n"+ 12.190 +// " ?x ?z 5\n" + 12.191 +// "}\n" + 12.192 +// "limit3000\n" + 12.193 +// "offset 2"; 12.194 +// 12.195 +// // format does not matter for the test 12.196 +// format = stSPARQLQueryResultFormat.HTML; 12.197 +// } 12.198 +// 12.199 +// /** 12.200 +// * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 12.201 +// */ 12.202 +// @Test 12.203 +// public void testQuery() { 12.204 +// 12.205 +// for (String query : testQueries) { 12.206 +// try { 12.207 +// EndpointResult response = endpoint.query(query, format); 12.208 +// 12.209 +// if (response.getStatusCode() != 200) { 12.210 +// System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText()); 12.211 +// 12.212 +// } 12.213 +// 12.214 +// assertTrue(response.getStatusCode() == 200); 12.215 +// 12.216 +// } catch (IOException e) { 12.217 +// e.printStackTrace(); 12.218 +// } 12.219 +// } 12.220 +// } 12.221 +//}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithParliament.java Fri Apr 19 14:37:09 2013 +0300 13.3 @@ -0,0 +1,75 @@ 13.4 +///* This Source Code Form is subject to the terms of the Mozilla Public 13.5 +// * License, v. 2.0. If a copy of the MPL was not distributed with this 13.6 +// * file, You can obtain one at http://mozilla.org/MPL/2.0/. 13.7 +// * 13.8 +// * Copyright (C) 2013, Pyravlos Team 13.9 +// * 13.10 +// * http://www.strabon.di.uoa.gr/ 13.11 +// */ 13.12 +//package eu.earthobservatory.org.StrabonEndpoint.client; 13.13 +// 13.14 +//import static org.junit.Assert.assertTrue; 13.15 +// 13.16 +//import java.io.IOException; 13.17 +// 13.18 +//import org.junit.Before; 13.19 +//import org.junit.Test; 13.20 +//import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 13.21 +// 13.22 +///** 13.23 +// * @author Kallirroi Dogani <kallirroi@di.uoa.gr> 13.24 +// * 13.25 +// */ 13.26 +// 13.27 +//public class TestSPARQLEndpointWithParliament { 13.28 +// 13.29 +// private SPARQLEndpoint endpoint; 13.30 +// private String query; 13.31 +// 13.32 +// @Before 13.33 +// public void init() { 13.34 +// // initialize endpoint 13.35 +// endpoint = new SPARQLEndpoint("luna.di.uoa.gr", 8080, "parliament/sparql"); 13.36 +// 13.37 +// // set query 13.38 +// query = "PREFIX ex: <http://example.org/> \n" + 13.39 +// "SELECT ?k ?g WHERE {\n" + 13.40 +// " ex:pol1 ?k ?g\n" + 13.41 +// "}" + 13.42 +// "\nLIMIT 1"; 13.43 +// 13.44 +// } 13.45 +// 13.46 +// /** 13.47 +// * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 13.48 +// */ 13.49 +// @Test 13.50 +// public void testQuery() { 13.51 +// try { 13.52 +// EndpointResult response = endpoint.query(query, stSPARQLQueryResultFormat.XML); 13.53 +// 13.54 +// System.out.println(response.getResponse()); 13.55 +// 13.56 +// if (response.getStatusCode() != 200) { 13.57 +// System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText()); 13.58 +// 13.59 +// } 13.60 +// 13.61 +// assertTrue(response.getStatusCode() == 200); 13.62 +// 13.63 +// } catch (IOException e) { 13.64 +// e.printStackTrace(); 13.65 +// } 13.66 +// 13.67 +// } 13.68 +// 13.69 +// /** 13.70 +// * Test method for testing that method {@link eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 13.71 +// * returns an IOException when it should do so. 13.72 +// */ 13.73 +// @Test(expected= IOException.class) 13.74 +// public void testIOException() throws Exception { 13.75 +// SPARQLEndpoint ep = new SPARQLEndpoint("blabla.dgr", 80, "bla"); 13.76 +// ep.query(query, stSPARQLQueryResultFormat.XML); 13.77 +// } 13.78 +//}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithStrabon.java Fri Apr 19 14:37:09 2013 +0300 14.3 @@ -0,0 +1,91 @@ 14.4 +/** 14.5 + * This Source Code Form is subject to the terms of the Mozilla Public 14.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 14.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 14.8 + * 14.9 + * Copyright (C) 2012, Pyravlos Team 14.10 + * 14.11 + * http://www.strabon.di.uoa.gr/ 14.12 + */ 14.13 +package eu.earthobservatory.org.StrabonEndpoint.client; 14.14 + 14.15 +import static org.junit.Assert.assertTrue; 14.16 + 14.17 +import java.io.IOException; 14.18 +import java.util.Vector; 14.19 + 14.20 +import org.junit.Before; 14.21 +import org.junit.Test; 14.22 +import org.openrdf.query.resultio.TupleQueryResultFormat; 14.23 +import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 14.24 + 14.25 +/** 14.26 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 14.27 + * 14.28 + */ 14.29 +public class TestSPARQLEndpointWithStrabon { 14.30 + 14.31 + private SPARQLEndpoint endpoint; 14.32 + private String query; 14.33 + private Vector<stSPARQLQueryResultFormat> formats = new Vector<stSPARQLQueryResultFormat>(); 14.34 + 14.35 + @Before 14.36 + public void init() { 14.37 + // initialize endpoint 14.38 + endpoint = new SPARQLEndpoint("geo.linkedopendata.gr", 9090, "gag-endpoint/Query"); 14.39 + 14.40 + // set query 14.41 + query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + 14.42 + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> " + 14.43 + "PREFIX gag: <http://geo.linkedopendata.gr/gag/ontology/> " + 14.44 + 14.45 + "SELECT ?geometry " + 14.46 + "WHERE {" + 14.47 + 14.48 + " ?m rdf:type gag:Δήμος . " + 14.49 + " ?m rdfs:label \"ΔΗΜΟΣ ΑΘΗΝΑΙΩΝ\" . " + 14.50 + " ?m gag:έχει_γεωμετρία ?geometry. " + 14.51 + " } " ; 14.52 + 14.53 + // initialized formats 14.54 + for (TupleQueryResultFormat format : stSPARQLQueryResultFormat.values()) { 14.55 + if (format instanceof stSPARQLQueryResultFormat) { 14.56 + formats.add((stSPARQLQueryResultFormat) format); 14.57 + } 14.58 + } 14.59 + 14.60 + } 14.61 + 14.62 + /** 14.63 + * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 14.64 + */ 14.65 + @Test 14.66 + public void testQuery() { 14.67 + for (stSPARQLQueryResultFormat format : formats) { 14.68 + try { 14.69 + EndpointResult response = endpoint.query(query, format); 14.70 + 14.71 + if (response.getStatusCode() != 200) { 14.72 + System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText()); 14.73 + 14.74 + } 14.75 + 14.76 + assertTrue(response.getStatusCode() == 200); 14.77 + 14.78 + } catch (IOException e) { 14.79 + e.printStackTrace(); 14.80 + } 14.81 + 14.82 + } 14.83 + } 14.84 + 14.85 + /** 14.86 + * Test method for testing that method {@link eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 14.87 + * returns an IOException when it should do so. 14.88 + */ 14.89 + @Test(expected= IOException.class) 14.90 + public void testIOException() throws Exception { 14.91 + SPARQLEndpoint ep = new SPARQLEndpoint("blabla.dgr", 80, "bla"); 14.92 + ep.query(query, formats.get(0)); 14.93 + } 14.94 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithVirtuoso.java Fri Apr 19 14:37:09 2013 +0300 15.3 @@ -0,0 +1,88 @@ 15.4 +/** 15.5 + * This Source Code Form is subject to the terms of the Mozilla Public 15.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 15.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 15.8 + * 15.9 + * Copyright (C) 2013, Pyravlos Team 15.10 + * 15.11 + * http://www.strabon.di.uoa.gr/ 15.12 + */ 15.13 +package eu.earthobservatory.org.StrabonEndpoint.client; 15.14 + 15.15 +import static org.junit.Assert.assertTrue; 15.16 + 15.17 +import java.io.IOException; 15.18 +import java.util.Vector; 15.19 + 15.20 +import org.junit.Before; 15.21 +import org.junit.Test; 15.22 +import org.openrdf.query.resultio.TupleQueryResultFormat; 15.23 +import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 15.24 + 15.25 +/** 15.26 + * @author Kallirroi Dogani <kallirroi@di.uoa.gr> 15.27 + * 15.28 + */ 15.29 + 15.30 +//Virtuso endpoint also needs to be tested for all formats included in stSPARQLQueryResultFormat 15.31 +//because some of them are not supported 15.32 +public class TestSPARQLEndpointWithVirtuoso { 15.33 + 15.34 + private SPARQLEndpoint endpoint; 15.35 + private String query; 15.36 + private Vector<stSPARQLQueryResultFormat> formats = new Vector<stSPARQLQueryResultFormat>(); 15.37 + 15.38 + @Before 15.39 + public void init() { 15.40 + // initialize endpoint 15.41 + endpoint = new SPARQLEndpoint("dbpedia.org", 8890, "sparql"); 15.42 + 15.43 + // set query 15.44 + query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n" + 15.45 + "SELECT ?x ?y WHERE {\n" + 15.46 + " ?x rdf:type ?y\n" + 15.47 + "}" + 15.48 + "\nLIMIT 10"; 15.49 + 15.50 + // initialized formats 15.51 + for (TupleQueryResultFormat format : stSPARQLQueryResultFormat.values()) { 15.52 + if (format instanceof stSPARQLQueryResultFormat) { 15.53 + formats.add((stSPARQLQueryResultFormat) format); 15.54 + } 15.55 + } 15.56 + 15.57 + } 15.58 + 15.59 + /** 15.60 + * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 15.61 + */ 15.62 + @Test 15.63 + public void testQuery() { 15.64 + try { 15.65 + EndpointResult response = endpoint.query(query, stSPARQLQueryResultFormat.XML); 15.66 + 15.67 + //System.out.println(response.getResponse()); 15.68 + 15.69 + if (response.getStatusCode() != 200) { 15.70 + System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText()); 15.71 + 15.72 + } 15.73 + 15.74 + assertTrue(response.getStatusCode() == 200); 15.75 + 15.76 + } catch (IOException e) { 15.77 + e.printStackTrace(); 15.78 + } 15.79 + 15.80 + } 15.81 + 15.82 + /** 15.83 + * Test method for testing that method {@link eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 15.84 + * returns an IOException when it should do so. 15.85 + */ 15.86 + @Test(expected= IOException.class) 15.87 + public void testIOException() throws Exception { 15.88 + SPARQLEndpoint ep = new SPARQLEndpoint("blabla.dgr", 80, "bla"); 15.89 + ep.query(query, formats.get(0)); 15.90 + } 15.91 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSpatialEndpoint.java Fri Apr 19 14:37:09 2013 +0300 16.3 @@ -0,0 +1,82 @@ 16.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 16.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 16.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 16.7 + * 16.8 + * Copyright (C) 2013, Pyravlos Team 16.9 + * 16.10 + * http://www.strabon.di.uoa.gr/ 16.11 + */ 16.12 +package eu.earthobservatory.org.StrabonEndpoint.client; 16.13 + 16.14 +import static org.junit.Assert.assertTrue; 16.15 + 16.16 +import java.io.IOException; 16.17 + 16.18 +import org.junit.Before; 16.19 +import org.junit.Test; 16.20 +import org.openrdf.query.QueryEvaluationException; 16.21 +import org.openrdf.query.TupleQueryResultHandlerException; 16.22 +import org.openrdf.query.resultio.QueryResultParseException; 16.23 +import org.openrdf.query.resultio.UnsupportedQueryResultFormatException; 16.24 + 16.25 +/** 16.26 + * @author Kallirroi Dogani <kallirroi@di.uoa.gr> 16.27 + * 16.28 + */ 16.29 + 16.30 +public class TestSpatialEndpoint { 16.31 + 16.32 + private SpatialEndpoint endpoint; 16.33 + private String query; 16.34 + 16.35 + @Before 16.36 + public void init() { 16.37 + // initialize endpoint 16.38 + endpoint = new SpatialEndpoint("geo.linkedopendata.gr", 9090, "corine-endpoint/Query"); 16.39 + 16.40 + // set query 16.41 + query = "PREFIX corine: <http://geo.linkedopendata.gr/corine/ontology#> \n"+ 16.42 + "SELECT ?geometry \n" + 16.43 + "WHERE {\n " + 16.44 + " ?area corine:hasLandUse corine:burntAreas . \n" + 16.45 + " ?area corine:hasGeometry ?geometry . } \n" + 16.46 + "LIMIT 2" ; 16.47 + } 16.48 + 16.49 + /** 16.50 + * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.SpatialEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 16.51 + * @throws TupleQueryResultHandlerException 16.52 + */ 16.53 + @Test 16.54 + public void testQuery() { 16.55 + try { 16.56 + EndpointResult response; 16.57 + 16.58 + response = endpoint.queryForKML(query); 16.59 + 16.60 + //System.out.println("KML format:"); 16.61 + //System.out.println(response.getResponse()); 16.62 + 16.63 + if (response.getStatusCode() != 200) { 16.64 + System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText()); 16.65 + 16.66 + } 16.67 + 16.68 + assertTrue(response.getStatusCode() == 200); 16.69 + 16.70 + }catch (QueryResultParseException e) { 16.71 + e.printStackTrace(); 16.72 + } catch (UnsupportedQueryResultFormatException e) { 16.73 + e.printStackTrace(); 16.74 + } 16.75 + catch (TupleQueryResultHandlerException e) { 16.76 + e.printStackTrace(); 16.77 + } 16.78 + catch (IOException e) { 16.79 + e.printStackTrace(); 16.80 + } catch (QueryEvaluationException e) { 16.81 + e.printStackTrace(); 16.82 + } 16.83 + 16.84 + } 16.85 +}
17.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestStrabonEndpoint.java Fri Apr 19 09:11:47 2013 +0300 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,85 +0,0 @@ 17.4 -/** 17.5 - * This Source Code Form is subject to the terms of the Mozilla Public 17.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 17.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 17.8 - * 17.9 - * Copyright (C) 2012, Pyravlos Team 17.10 - * 17.11 - * http://www.strabon.di.uoa.gr/ 17.12 - */ 17.13 -package eu.earthobservatory.org.StrabonEndpoint.client; 17.14 - 17.15 -import static org.junit.Assert.assertTrue; 17.16 - 17.17 -import java.io.IOException; 17.18 -import java.util.Vector; 17.19 - 17.20 -import org.junit.Before; 17.21 -import org.junit.Test; 17.22 -import org.openrdf.query.resultio.TupleQueryResultFormat; 17.23 -import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 17.24 - 17.25 -/** 17.26 - * @author Charalampos Nikolaou <charnik@di.uoa.gr> 17.27 - * 17.28 - */ 17.29 -public class TestStrabonEndpoint { 17.30 - 17.31 - private StrabonEndpoint endpoint; 17.32 - private String query; 17.33 - private Vector<stSPARQLQueryResultFormat> formats = new Vector<stSPARQLQueryResultFormat>(); 17.34 - 17.35 - @Before 17.36 - public void init() { 17.37 - // initialize endpoint 17.38 - endpoint = new StrabonEndpoint("test.strabon.di.uoa.gr", 80, "DLR"); 17.39 - 17.40 - // set query 17.41 - query = "PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>\n" + 17.42 - "SELECT ?s ?g WHERE {\n" + 17.43 - " ?s teleios:hasGeometry ?g\n" + 17.44 - "}" + 17.45 - "\nLIMIT 1"; 17.46 - 17.47 - // initialized formats 17.48 - for (TupleQueryResultFormat format : stSPARQLQueryResultFormat.values()) { 17.49 - if (format instanceof stSPARQLQueryResultFormat) { 17.50 - formats.add((stSPARQLQueryResultFormat) format); 17.51 - } 17.52 - } 17.53 - 17.54 - } 17.55 - 17.56 - /** 17.57 - * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 17.58 - */ 17.59 - @Test 17.60 - public void testQuery() { 17.61 - for (stSPARQLQueryResultFormat format : formats) { 17.62 - try { 17.63 - EndpointResult response = endpoint.query(query, format); 17.64 - 17.65 - if (response.getStatusCode() != 200) { 17.66 - System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText()); 17.67 - 17.68 - } 17.69 - 17.70 - assertTrue(response.getStatusCode() == 200); 17.71 - 17.72 - } catch (IOException e) { 17.73 - e.printStackTrace(); 17.74 - } 17.75 - 17.76 - } 17.77 - } 17.78 - 17.79 - /** 17.80 - * Test method for testing that method {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 17.81 - * returns an IOException when it should do so. 17.82 - */ 17.83 - @Test(expected= IOException.class) 17.84 - public void testIOException() throws Exception { 17.85 - StrabonEndpoint ep = new StrabonEndpoint("blabla.dgr", 80, "bla"); 17.86 - ep.query(query, formats.get(0)); 17.87 - } 17.88 -}
18.1 --- a/endpoint/WebContent/WEB-INF/beans.xml Fri Apr 19 09:11:47 2013 +0300 18.2 +++ b/endpoint/WebContent/WEB-INF/beans.xml Fri Apr 19 14:37:09 2013 +0300 18.3 @@ -19,7 +19,7 @@ 18.4 <!-- true : AutoDiscoveryCapabilities --> 18.5 <!-- false: EndpointCapabilities --> 18.6 <constructor-arg type="boolean"> 18.7 - <value>true</value> 18.8 + <value>false</value> 18.9 </constructor-arg> 18.10 </bean> 18.11
19.1 --- a/endpoint/pom.xml Fri Apr 19 09:11:47 2013 +0300 19.2 +++ b/endpoint/pom.xml Fri Apr 19 14:37:09 2013 +0300 19.3 @@ -26,6 +26,11 @@ 19.4 19.5 <dependency> 19.6 <groupId>eu.earthobservatory</groupId> 19.7 + <artifactId>strabon-vocabulary</artifactId> 19.8 + </dependency> 19.9 + 19.10 + <dependency> 19.11 + <groupId>eu.earthobservatory</groupId> 19.12 <artifactId>strabon-runtime</artifactId> 19.13 <type>jar</type> 19.14 <scope>compile</scope> 19.15 @@ -97,28 +102,6 @@ 19.16 </exclusions> 19.17 </dependency> 19.18 19.19 - <!-- 19.20 - <dependency> 19.21 - <groupId>org.apache.cxf</groupId> 19.22 - <artifactId>cxf-rt-frontend-jaxws</artifactId> 19.23 - </dependency> 19.24 - 19.25 - <dependency> 19.26 - <groupId>org.apache.cxf</groupId> 19.27 - <artifactId>cxf-rt-transports-http</artifactId> 19.28 - </dependency> 19.29 - 19.30 - <dependency> 19.31 - <groupId>org.apache.cxf</groupId> 19.32 - <artifactId>cxf-rt-transports-http-jetty</artifactId> 19.33 - <exclusions> 19.34 - <exclusion> 19.35 - <artifactId>slf4j-jdk14</artifactId> 19.36 - <groupId>org.slf4j</groupId> 19.37 - </exclusion> 19.38 - </exclusions> 19.39 - </dependency> 19.40 - --> 19.41 <dependency> 19.42 <groupId>commons-validator</groupId> 19.43 <artifactId>commons-validator</artifactId> 19.44 @@ -126,6 +109,22 @@ 19.45 </dependencies> 19.46 19.47 <build> 19.48 + <resources> 19.49 + <resource> 19.50 + <directory>src/main/resources</directory> 19.51 + <filtering>true</filtering> 19.52 + <includes> 19.53 + <include>**/version.properties</include> 19.54 + </includes> 19.55 + </resource> 19.56 + <resource> 19.57 + <directory>src/main/resources</directory> 19.58 + <filtering>false</filtering> 19.59 + <excludes> 19.60 + <exclude>**/version.properties</exclude> 19.61 + </excludes> 19.62 + </resource> 19.63 + </resources> 19.64 <plugins> 19.65 <plugin> 19.66 <groupId>org.apache.maven.plugins</groupId>
20.1 --- a/endpoint/src/log4j.properties Fri Apr 19 09:11:47 2013 +0300 20.2 +++ b/endpoint/src/log4j.properties Fri Apr 19 14:37:09 2013 +0300 20.3 @@ -5,7 +5,7 @@ 20.4 # Console Appender 20.5 log4j.appender.CA=org.apache.log4j.ConsoleAppender 20.6 log4j.appender.CA.layout=org.apache.log4j.PatternLayout 20.7 -log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 20.8 +log4j.appender.CA.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n 20.9 20.10 # File Appender 20.11 #log4j.appender.FA=org.apache.log4j.FileAppender
21.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/BrowseBean.java Fri Apr 19 09:11:47 2013 +0300 21.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/BrowseBean.java Fri Apr 19 14:37:09 2013 +0300 21.3 @@ -23,6 +23,7 @@ 21.4 import javax.servlet.http.HttpServletResponse; 21.5 21.6 import org.apache.commons.lang.StringEscapeUtils; 21.7 +import org.openrdf.query.resultio.TupleQueryResultFormat; 21.8 import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 21.9 import org.slf4j.Logger; 21.10 import org.slf4j.LoggerFactory; 21.11 @@ -179,7 +180,7 @@ 21.12 String format = request.getParameter("format"); 21.13 21.14 // get stSPARQLQueryResultFormat from given format name 21.15 - stSPARQLQueryResultFormat queryResultFormat = stSPARQLQueryResultFormat.valueOf(format); 21.16 + TupleQueryResultFormat queryResultFormat = stSPARQLQueryResultFormat.valueOf(format); 21.17 21.18 if (query == null || format == null || queryResultFormat == null) { 21.19 dispatcher = request.getRequestDispatcher("browse.jsp");
22.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java Fri Apr 19 09:11:47 2013 +0300 22.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java Fri Apr 19 14:37:09 2013 +0300 22.3 @@ -65,7 +65,7 @@ 22.4 /** 22.5 * Keeps the registered and available stSPARQL Query Results Formats. 22.6 */ 22.7 - public static final List<stSPARQLQueryResultFormat> registeredQueryResultsFormats = new ArrayList<stSPARQLQueryResultFormat>(); 22.8 + public static final List<TupleQueryResultFormat> registeredQueryResultsFormats = new ArrayList<TupleQueryResultFormat>(); 22.9 22.10 /** 22.11 * Keeps the name of the registered and available stSPARQL Query Results Formats. 22.12 @@ -76,10 +76,10 @@ 22.13 // initialize registered and available stSPARQL query results formats 22.14 static { 22.15 for (TupleQueryResultFormat format : stSPARQLQueryResultFormat.values()) { 22.16 - if (format instanceof stSPARQLQueryResultFormat) { 22.17 - registeredQueryResultsFormats.add((stSPARQLQueryResultFormat) format); 22.18 + //if (format instanceof stSPARQLQueryResultFormat) { 22.19 + registeredQueryResultsFormats.add(format); 22.20 registeredQueryResultsFormatNames.add(format.getName()); 22.21 - } 22.22 + //} 22.23 } 22.24 } 22.25
23.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java Fri Apr 19 09:11:47 2013 +0300 23.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/QueryBean.java Fri Apr 19 14:37:09 2013 +0300 23.3 @@ -30,6 +30,7 @@ 23.4 23.5 import org.apache.commons.io.FileUtils; 23.6 import org.apache.commons.lang.StringEscapeUtils; 23.7 +import org.openrdf.query.resultio.TupleQueryResultFormat; 23.8 import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 23.9 import org.slf4j.Logger; 23.10 import org.slf4j.LoggerFactory; 23.11 @@ -221,7 +222,7 @@ 23.12 String maxLimit = request.getParameter("maxLimit"); 23.13 23.14 // get stSPARQLQueryResultFormat from given format name 23.15 - stSPARQLQueryResultFormat queryResultFormat = stSPARQLQueryResultFormat.valueOf(format); 23.16 + TupleQueryResultFormat queryResultFormat = stSPARQLQueryResultFormat.valueOf(format); 23.17 23.18 if (query == null || format == null || queryResultFormat == null) { 23.19 dispatcher = request.getRequestDispatcher("query.jsp");
24.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/AutoDiscoveryCapabilities.java Fri Apr 19 09:11:47 2013 +0300 24.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/AutoDiscoveryCapabilities.java Fri Apr 19 14:37:09 2013 +0300 24.3 @@ -10,6 +10,7 @@ 24.4 package eu.earthobservatory.org.StrabonEndpoint.capabilities; 24.5 24.6 import java.io.IOException; 24.7 +import java.util.List; 24.8 24.9 import org.apache.commons.httpclient.HttpClient; 24.10 import org.apache.commons.httpclient.methods.PostMethod; 24.11 @@ -245,4 +246,28 @@ 24.12 private String getConnectionURL() { 24.13 return "http://" + host + ":" + port + "/" + appName; 24.14 } 24.15 + 24.16 + /* (non-Javadoc) 24.17 + * @see eu.earthobservatory.org.StrabonEndpoint.capabilities.Capabilities#getstSPARQLSpatialExtensionFunctions() 24.18 + */ 24.19 + @Override 24.20 + public List<String> getstSPARQLSpatialExtensionFunctions() { 24.21 + return null; 24.22 + } 24.23 + 24.24 + /* (non-Javadoc) 24.25 + * @see eu.earthobservatory.org.StrabonEndpoint.capabilities.Capabilities#getGeoSPARQLSpatialExtensionFunctions() 24.26 + */ 24.27 + @Override 24.28 + public List<String> getGeoSPARQLSpatialExtensionFunctions() { 24.29 + return null; 24.30 + } 24.31 + 24.32 + /* (non-Javadoc) 24.33 + * @see eu.earthobservatory.org.StrabonEndpoint.capabilities.Capabilities#getUnitsOfMeasure() 24.34 + */ 24.35 + @Override 24.36 + public List<String> getUnitsOfMeasure() { 24.37 + return null; 24.38 + } 24.39 }
25.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/Capabilities.java Fri Apr 19 09:11:47 2013 +0300 25.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/Capabilities.java Fri Apr 19 14:37:09 2013 +0300 25.3 @@ -9,6 +9,8 @@ 25.4 */ 25.5 package eu.earthobservatory.org.StrabonEndpoint.capabilities; 25.6 25.7 +import java.util.List; 25.8 + 25.9 25.10 /** 25.11 * Interface that exposes the capabilities of a Strabon Endpoint. 25.12 @@ -87,6 +89,34 @@ 25.13 public boolean supportsConnectionModification(); 25.14 25.15 /** 25.16 + * Return a list of URIs corresponding to the spatial extension 25.17 + * functions that stSPARQL supports. 25.18 + * 25.19 + * @return 25.20 + */ 25.21 + public List<String> getstSPARQLSpatialExtensionFunctions(); 25.22 + 25.23 + // TODO 25.24 + //public List<String> getstSPARQLTemporalExtensionFunctions(); 25.25 + 25.26 + /** 25.27 + * Return a list of URIs corresponding to the spatial extension 25.28 + * functions that GeoSPARQL supports. 25.29 + * 25.30 + * @return 25.31 + */ 25.32 + public List<String> getGeoSPARQLSpatialExtensionFunctions(); 25.33 + 25.34 + /** 25.35 + * Return a list of URIs corresponding to the units of measure 25.36 + * that can be used in an extension function requiring such an 25.37 + * argument. 25.38 + * 25.39 + * @return 25.40 + */ 25.41 + public List<String> getUnitsOfMeasure(); 25.42 + 25.43 + /** 25.44 * Returns a {@link RequestCapabilities} instance containing 25.45 * the details for how one can query the Query service of the 25.46 * endpoint.
26.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/CapabilitiesBean.java Fri Apr 19 09:11:47 2013 +0300 26.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/CapabilitiesBean.java Fri Apr 19 14:37:09 2013 +0300 26.3 @@ -124,16 +124,49 @@ 26.4 26.5 RequestCapabilities reCap = caps.getQueryCapabilities(); 26.6 26.7 - for (Parameter param : reCap.getParametersObject().getParameters()) { 26.8 - out.println("Supports parameter : " + param.getName()); 26.9 - 26.10 - if (param.getAcceptedValues().size() > 0) { 26.11 - out.println(" Accepted values : "); 26.12 - for (String acceptedValue : param.getAcceptedValues()) { 26.13 - out.println("\t\t " + acceptedValue); 26.14 + if (reCap.getParametersObject() != null) { 26.15 + for (Parameter param : reCap.getParametersObject().getParameters()) { 26.16 + out.println("Supports parameter : " + param.getName()); 26.17 + 26.18 + if (param.getAcceptedValues().size() > 0) { 26.19 + out.println(" Accepted values : "); 26.20 + for (String acceptedValue : param.getAcceptedValues()) { 26.21 + out.println("\t\t " + acceptedValue); 26.22 + } 26.23 } 26.24 } 26.25 } 26.26 + 26.27 + // print supported spatial extension functions for stSPARQL 26.28 + if (caps.getstSPARQLSpatialExtensionFunctions() != null) { 26.29 + out.println("stSPARQL Extension Functions"); 26.30 + out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); 26.31 + for(String extFunc : caps.getstSPARQLSpatialExtensionFunctions()) { 26.32 + out.println(extFunc); 26.33 + } 26.34 + } 26.35 + 26.36 + out.println(); 26.37 + 26.38 + // print supported spatial extension functions for GeoSPARQL 26.39 + if (caps.getGeoSPARQLSpatialExtensionFunctions() != null) { 26.40 + out.println("GeoSPARQL Extension Functions"); 26.41 + out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); 26.42 + for(String extFunc : caps.getGeoSPARQLSpatialExtensionFunctions()) { 26.43 + out.println(extFunc); 26.44 + } 26.45 + } 26.46 + 26.47 + out.println(); 26.48 + 26.49 + // print supported units of measure 26.50 + if (caps.getUnitsOfMeasure() != null) { 26.51 + out.println("Supported Units of Measure (OGC)"); 26.52 + out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); 26.53 + for(String uom : caps.getUnitsOfMeasure()) { 26.54 + out.println(uom); 26.55 + } 26.56 + } 26.57 } 26.58 26.59 private String getYesNo(boolean val) {
27.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/EndpointCapabilities.java Fri Apr 19 09:11:47 2013 +0300 27.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/EndpointCapabilities.java Fri Apr 19 14:37:09 2013 +0300 27.3 @@ -9,6 +9,17 @@ 27.4 */ 27.5 package eu.earthobservatory.org.StrabonEndpoint.capabilities; 27.6 27.7 +import java.io.IOException; 27.8 +import java.io.InputStream; 27.9 +import java.util.List; 27.10 +import java.util.Properties; 27.11 + 27.12 +import org.slf4j.Logger; 27.13 +import org.slf4j.LoggerFactory; 27.14 + 27.15 +import eu.earthobservatory.constants.GeoConstants; 27.16 +import eu.earthobservatory.constants.OGCConstants; 27.17 + 27.18 27.19 /** 27.20 * This class implements the {@link Capabilities} interface and 27.21 @@ -19,9 +30,34 @@ 27.22 */ 27.23 public class EndpointCapabilities implements Capabilities { 27.24 27.25 + private static Logger logger = LoggerFactory.getLogger(eu.earthobservatory.org.StrabonEndpoint.capabilities.EndpointCapabilities.class); 27.26 + 27.27 + private static final String VERSION_PROPERTIES_FILE = "/version.properties"; 27.28 + private static final Properties PROPERTIES = new Properties(); 27.29 + 27.30 + private static String VERSION; 27.31 + 27.32 + // load the properties file to get the version 27.33 + static { 27.34 + InputStream vin = Capabilities.class.getResourceAsStream(VERSION_PROPERTIES_FILE); 27.35 + if (vin != null) { 27.36 + try { 27.37 + PROPERTIES.load(vin); 27.38 + vin.close(); 27.39 + 27.40 + } catch (IOException e) { 27.41 + logger.error("[StrabonEndpoint.EndpointCapabilities] Error during reading of {} file.", VERSION_PROPERTIES_FILE, e); 27.42 + } 27.43 + } else { 27.44 + logger.warn("[StrabonEndpoint.EndpointCapabilities] Could not read version file."); 27.45 + } 27.46 + 27.47 + VERSION = PROPERTIES.getProperty("version"); 27.48 + } 27.49 + 27.50 @Override 27.51 public String getVersion() { 27.52 - return "3.2.4-SNAPSHOT"; 27.53 + return VERSION; 27.54 } 27.55 27.56 @Override 27.57 @@ -88,4 +124,25 @@ 27.58 public RequestCapabilities getConnectionCapabilities() { 27.59 return ConnectionBeanCapabilities.getInstance(); 27.60 } 27.61 + 27.62 + /* (non-Javadoc) 27.63 + * @see eu.earthobservatory.org.StrabonEndpoint.capabilities.Capabilities#getstSPARQLSpatialExtensionFunctions() 27.64 + */ 27.65 + @Override 27.66 + public List<String> getstSPARQLSpatialExtensionFunctions() { 27.67 + return GeoConstants.STSPARQLSpatialExtFunc; 27.68 + } 27.69 + 27.70 + /* (non-Javadoc) 27.71 + * @see eu.earthobservatory.org.StrabonEndpoint.capabilities.Capabilities#getGeoSPARQLSpatialExtensionFunctions() 27.72 + */ 27.73 + @Override 27.74 + public List<String> getGeoSPARQLSpatialExtensionFunctions() { 27.75 + return GeoConstants.GEOSPARQLExtFunc; 27.76 + } 27.77 + 27.78 + @Override 27.79 + public List<String> getUnitsOfMeasure() { 27.80 + return OGCConstants.supportedUnitsOfMeasure; 27.81 + } 27.82 }
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/endpoint/src/main/resources/version.properties Fri Apr 19 14:37:09 2013 +0300 28.3 @@ -0,0 +1,1 @@ 28.4 +version=${project.version}
29.1 --- a/evaluation/pom.xml Fri Apr 19 09:11:47 2013 +0300 29.2 +++ b/evaluation/pom.xml Fri Apr 19 14:37:09 2013 +0300 29.3 @@ -15,6 +15,12 @@ 29.4 <packaging>jar</packaging> 29.5 29.6 <dependencies> 29.7 + 29.8 + <dependency> 29.9 + <groupId>eu.earthobservatory</groupId> 29.10 + <artifactId>strabon-vocabulary</artifactId> 29.11 + </dependency> 29.12 + 29.13 <dependency> 29.14 <groupId>org.openrdf.sesame</groupId> 29.15 <artifactId>sesame-queryalgebra-evaluation</artifactId>
30.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/datetime/stsparql/metric/DiffDateTime.java Fri Apr 19 09:11:47 2013 +0300 30.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/datetime/stsparql/metric/DiffDateTime.java Fri Apr 19 14:37:09 2013 +0300 30.3 @@ -9,15 +9,9 @@ 30.4 */ 30.5 package org.openrdf.query.algebra.evaluation.function.datetime.stsparql.metric; 30.6 30.7 -import java.text.SimpleDateFormat; 30.8 -import java.util.Calendar; 30.9 -import java.util.GregorianCalendar; 30.10 +import org.openrdf.query.algebra.evaluation.function.spatial.DateTimeMetricFunc; 30.11 30.12 -import org.openrdf.model.Value; 30.13 -import org.openrdf.model.ValueFactory; 30.14 -import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 30.15 -import org.openrdf.query.algebra.evaluation.function.spatial.DateTimeMetricFunc; 30.16 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 30.17 +import eu.earthobservatory.constants.GeoConstants; 30.18 30.19 /** 30.20 * Addition for datetime metric functions
31.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/link/SimilarTermFunc.java Fri Apr 19 09:11:47 2013 +0300 31.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/link/SimilarTermFunc.java Fri Apr 19 14:37:09 2013 +0300 31.3 @@ -13,7 +13,8 @@ 31.4 import org.openrdf.model.ValueFactory; 31.5 import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 31.6 import org.openrdf.query.algebra.evaluation.function.Function; 31.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 31.8 + 31.9 +import eu.earthobservatory.constants.GeoConstants; 31.10 31.11 /** 31.12 *
32.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/AbstractWKT.java Fri Apr 19 09:11:47 2013 +0300 32.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/AbstractWKT.java Fri Apr 19 14:37:09 2013 +0300 32.3 @@ -14,6 +14,8 @@ 32.4 import org.slf4j.Logger; 32.5 import org.slf4j.LoggerFactory; 32.6 32.7 +import eu.earthobservatory.constants.GeoConstants; 32.8 + 32.9 32.10 /** 32.11 * This class generalizes WKT literal values that can be given according
33.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/GeoConstants.java Fri Apr 19 09:11:47 2013 +0300 33.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 33.3 @@ -1,301 +0,0 @@ 33.4 -/** 33.5 - * This Source Code Form is subject to the terms of the Mozilla Public 33.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 33.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 33.8 - * 33.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 33.10 - * 33.11 - * http://www.strabon.di.uoa.gr/ 33.12 - */ 33.13 -package org.openrdf.query.algebra.evaluation.function.spatial; 33.14 - 33.15 -/** 33.16 - * This class is a placeholder for various constants around geometries. These 33.17 - * constants range from URIs of namespaces, functions, representations, etc., 33.18 - * to other constants, such as the default spatial reference system (SRID) that 33.19 - * is assumed in Strabon. 33.20 - * 33.21 - * @author Charalampos Nikolaou <charnik@di.uoa.gr> 33.22 - * @author Kostis Kyzirakos <kkyzir@di.uoa.gr> 33.23 - * @author Kallirroi Dogani <kallirroi@di.uoa.gr> 33.24 - */ 33.25 -public class GeoConstants { 33.26 - /** * 33.27 - * Namespaces * 33.28 - * */ 33.29 - 33.30 - /** 33.31 - * The namespace for stRDF data model 33.32 - */ 33.33 - public static final String stRDF = "http://strdf.di.uoa.gr/ontology#"; 33.34 - 33.35 - /** 33.36 - * The namespace for the RDFi framework 33.37 - */ 33.38 - public static final String rdfi = "http://rdfi.di.uoa.gr/ontology#"; 33.39 - 33.40 - 33.41 - /** * 33.42 - * GeoSPARQL Version 1.0.1 Document# 11-052r4 * 33.43 - * http://schemas.opengis.net/geosparql/geosparql-1_0_1.zip */ 33.44 - 33.45 - /** 33.46 - * The namespace for GeoSPARQL ontology 33.47 - */ 33.48 - public static final String GEO = "http://www.opengis.net/ont/geosparql#"; 33.49 - 33.50 - /** 33.51 - * The namespace for geometry functions declared by GeoSPARQL 33.52 - */ 33.53 - public static final String GEOF = "http://www.opengis.net/def/function/geosparql/"; 33.54 - 33.55 - /** 33.56 - * The namespace for the ontology of simple features 33.57 - */ 33.58 - public static final String SF = "http://www.opengis.net/ont/sf#"; 33.59 - 33.60 - /** 33.61 - * 33.62 - * The namespace of GML. 33.63 - * 33.64 - * Initially, it was set to "http://www.opengis.net/def/geometryType/OGC-GML/3.2/". 33.65 - * Afterwards, it was set to "http://www.opengis.net/gml/3.2/" in order to be compliant 33.66 - * with GML version 3.3, as defined by OGC in the document with title 33.67 - * <tt>"OGC® Geography Markup Language (GML) — Extended schemas and encoding rules"</tt> 33.68 - * ({@link https://portal.opengeospatial.org/files/?artifact_id=46568}). However, none 33.69 - * of these work with the parser provided by JTS, which assumes that the namespace for 33.70 - * GML should be only "http://www.opengis.net/gml" and nothing else. In every other case, 33.71 - * an exception is thrown by the GML parser. 33.72 - * 33.73 - * 33.74 - * @see {@link org.openrdf.query.algebra.evaluation.util.JTSWrapper.GMLReader}, {@link GMLReader} 33.75 - */ 33.76 - public static final String GML_OGC = "http://www.opengis.net/gml"; 33.77 - 33.78 - 33.79 - 33.80 - 33.81 - /** * 33.82 - * URIs * 33.83 - * */ 33.84 - 33.85 - /** * 33.86 - * GeoSPARQL Version 1.0.1 Document# 11-052r4 * 33.87 - * http://schemas.opengis.net/geosparql/geosparql-1_0_1.zip */ 33.88 - 33.89 - /** The following GeoSPARQL classes and properties are 33.90 - * commented out because they are not currently used. 33.91 - */ 33.92 - 33.93 - /** 33.94 - * The URIs for GeoSPARQL classes 33.95 - */ 33.96 -/* public static final String SpatialObject = GEO + "SpatialObject"; 33.97 - public static final String Geometry = GEO + "Geometry"; 33.98 - public static final String Feauture = GEO + "Feature"; 33.99 -*/ 33.100 - 33.101 - /** 33.102 - * The URIs for GeoSPARQL properties 33.103 - */ 33.104 -/* public static final String hasGeometry_OGC = GEO + "hasGeometry"; 33.105 - public static final String defaultGeometry_OGC = GEO + "defaultGeometry"; 33.106 - public static final String dimension_OGC = GEO + "dimension"; 33.107 - public static final String coordinateDimension_OGC = GEO + "coordinateDimension"; 33.108 - public static final String spatialDimension_OGC = GEO + "spatialDimension"; 33.109 - public static final String isEmpty_OGC = GEO + "isEmpty"; 33.110 - public static final String isSimple_OGC = GEO + "isSimple"; 33.111 - public static final String asWKT_OGC = GEO + "asWKT"; 33.112 - public static final String asGML_OGC = GEO + "asGML"; 33.113 -*/ 33.114 - 33.115 - 33.116 - /** * 33.117 - * URIs for datatypes * 33.118 - * */ 33.119 - 33.120 - 33.121 - /** 33.122 - * The URI for the datatype SemiLinearPointSet 33.123 - * (linear constraint-based representation of geometries) 33.124 - */ 33.125 - public static final String stRDFSemiLinearPointset = stRDF + "SemiLinearPointSet"; 33.126 - 33.127 - 33.128 - /** 33.129 - * The URI for the datatype Well-Known Text (WKT) 33.130 - */ 33.131 - public static final String WKT = stRDF + "WKT"; 33.132 - 33.133 - /** 33.134 - * The URI for the datatype Geography Markup Language (GML) as it defined 33.135 - * in the model stRDF and query language stSPARQL 33.136 - */ 33.137 - public static final String GML = stRDF + "GML"; 33.138 - 33.139 - /** 33.140 - * The URI for the datatype wktLiteral 33.141 - */ 33.142 - public static final String WKTLITERAL = GEO + "wktLiteral"; 33.143 - 33.144 - /** 33.145 - * The URI for the datatype gmlLiteral 33.146 - */ 33.147 - public static final String GMLLITERAL = GEO + "gmlLiteral"; 33.148 - 33.149 - 33.150 - 33.151 - 33.152 - /** * 33.153 - * Extended functions * 33.154 - * stSPARQL * 33.155 - * */ 33.156 - // Spatial Relationships 33.157 - public static final String equals = stRDF + "equals"; 33.158 - public static final String disjoint = stRDF + "disjoint"; 33.159 - public static final String intersects = stRDF + "intersects"; 33.160 - public static final String touches = stRDF + "touches"; 33.161 - public static final String within = stRDF + "within"; 33.162 - public static final String contains = stRDF + "contains"; 33.163 - public static final String overlaps = stRDF + "overlaps"; 33.164 - public static final String crosses = stRDF + "crosses"; 33.165 - 33.166 - // The generic relate function 33.167 - public static final String relate = stRDF + "relate"; 33.168 - 33.169 - // Topological Relationships utilizing mbb 33.170 - public static final String mbbIntersects = stRDF + "mbbIntersects"; 33.171 - public static final String mbbContains = stRDF + "mbbContains"; 33.172 - public static final String mbbEquals = stRDF + "mbbEquals"; 33.173 - public static final String mbbWithin = stRDF + "mbbWithin"; 33.174 - 33.175 - // Directional functions 33.176 - public static final String left = stRDF + "left"; 33.177 - public static final String right = stRDF + "right"; 33.178 - public static final String above = stRDF + "above"; 33.179 - public static final String below = stRDF + "below"; 33.180 - 33.181 - // Spatial Constructs 33.182 - public static final String union = stRDF + "union"; 33.183 - public static final String buffer = stRDF + "buffer"; 33.184 - public static final String envelope = stRDF + "envelope"; 33.185 - public static final String convexHull = stRDF + "convexHull"; 33.186 - public static final String boundary = stRDF + "boundary"; 33.187 - public static final String intersection = stRDF + "intersection"; 33.188 - public static final String difference = stRDF + "difference"; 33.189 - public static final String symDifference = stRDF + "symDifference"; 33.190 - public static final String transform = stRDF + "transform"; 33.191 - 33.192 - // Spatial Metric Functions 33.193 - public static final String distance = stRDF + "distance"; 33.194 - public static final String area = stRDF + "area"; 33.195 - 33.196 - // Spatial Properties 33.197 - public static final String dimension = stRDF + "dimension"; 33.198 - public static final String geometryType = stRDF + "geometryType"; 33.199 - public static final String asText = stRDF + "asText"; 33.200 - public static final String asGML = stRDF + "asGML"; 33.201 - public static final String srid = stRDF + "srid"; 33.202 - public static final String isEmpty = stRDF + "isEmpty"; 33.203 - public static final String isSimple = stRDF + "isSimple"; 33.204 - 33.205 - // Spatial Aggregate Functions 33.206 - public static final String extent = stRDF + "extent"; 33.207 - 33.208 - /** 33.209 - * WGS 84 latitude-longitude (EPSG:4326) 33.210 - */ 33.211 - public static final String WGS84_LAT_LON = "http://www.opengis.net/def/crs/EPSG/0/4326"; 33.212 - 33.213 - /** 33.214 - * WGS 84 longitude-longitude 33.215 - * (used as the default CRS for GeoSPARQL geometries) 33.216 - */ 33.217 - public static final String WGS84_LON_LAT = "http://www.opengis.net/def/crs/OGC/1.3/CRS84"; 33.218 - 33.219 - /** 33.220 - * EPSG:4326 33.221 - */ 33.222 - public static final Integer WGS84_LAT_LON_SRID = 4326; 33.223 - 33.224 - /** 33.225 - * EPSG:3857 (not sure whether this is correct for WGS84_LON_LAT) 33.226 - * http://spatialreference.org/ref/sr-org/7483/ 33.227 - */ 33.228 - public static final Integer WGS84_LON_LAT_SRID = 3857; 33.229 - 33.230 - /** 33.231 - * Default SRID (WGS84 latitude-longitude) 33.232 - */ 33.233 - public static final Integer defaultSRID = WGS84_LAT_LON_SRID; 33.234 - 33.235 - /** * 33.236 - * Extended functions * 33.237 - * GeoSPARQL * 33.238 - * */ 33.239 - // Non-topological 33.240 - public static final String geoSparqlDistance = GEOF + "distance"; //3 arguments 33.241 - public static final String geoSparqlBuffer = GEOF + "buffer"; //3 arguments 33.242 - public static final String geoSparqlConvexHull = GEOF + "convexHull"; 33.243 - public static final String geoSparqlIntersection = GEOF + "intersection"; 33.244 - public static final String geoSparqlUnion = GEOF + "union"; 33.245 - public static final String geoSparqlDifference = GEOF + "difference"; 33.246 - public static final String geoSparqlSymmetricDifference = GEOF + "symmetricDifference"; 33.247 - public static final String geoSparqlEnvelope = GEOF + "envelope"; 33.248 - public static final String geoSparqlBoundary = GEOF + "boundary"; 33.249 - 33.250 - // Simple Features - 8 functions - all with 2 arguments + boolean 33.251 - public static final String sfEquals = GEOF + "sfEquals"; 33.252 - public static final String sfDisjoint = GEOF + "sfDisjoint"; 33.253 - public static final String sfIntersects = GEOF + "sfIntersects"; 33.254 - public static final String sfTouches = GEOF + "sfTouches"; 33.255 - public static final String sfCrosses = GEOF + "sfCrosses"; 33.256 - public static final String sfWithin = GEOF + "sfWithin"; 33.257 - public static final String sfContains = GEOF + "sfContains"; 33.258 - public static final String sfOverlaps = GEOF + "sfOverlaps"; 33.259 - 33.260 - // Egenhofer - 8 functions - all with 2 arguments + boolean 33.261 - public static final String ehEquals = GEOF + "ehEquals"; 33.262 - public static final String ehDisjoint = GEOF + "ehDisjoint"; 33.263 - public static final String ehMeet = GEOF + "ehMeet"; 33.264 - public static final String ehOverlap = GEOF + "ehOverlap"; 33.265 - public static final String ehCovers = GEOF + "ehCovers"; 33.266 - public static final String ehCoveredBy = GEOF + "ehCoveredBy"; 33.267 - public static final String ehInside = GEOF + "ehInside"; 33.268 - public static final String ehContains = GEOF + "ehContains"; 33.269 - 33.270 - // RCC8 - 8 functions - all with 2 arguments + boolean 33.271 - public static final String rccEquals = GEOF + "rcc8eq"; 33.272 - public static final String rccDisconnected = GEOF + "rcc8dc"; 33.273 - public static final String rccExternallyConnected = GEOF + "rcc8ec"; 33.274 - public static final String rccPartiallyOverlapping = GEOF + "rcc8po"; 33.275 - public static final String rccTangentialProperPartInverse = GEOF + "rcc8tppi"; 33.276 - public static final String rccTangentialProperPart = GEOF + "rcc8tpp"; 33.277 - public static final String rccNonTangentialProperPart = GEOF + "rcc8ntpp"; 33.278 - public static final String rccNonTangentialProperPartInverse = GEOF + "rcc8ntppi"; 33.279 - 33.280 - // The generic relate function 33.281 - public static final String geoSparqlRelate = GEOF + "relate"; 33.282 - 33.283 - /** 33.284 - * Addition for datetime metric functions 33.285 - * 33.286 - * @author George Garbis <ggarbis@di.uoa.gr> 33.287 - * 33.288 - */ 33.289 - public static final String diffDateTime = "http://strdf.di.uoa.gr/extensions/ontology#diffDateTime"; 33.290 - /** End of addition **/ 33.291 - 33.292 - 33.293 - /** 33.294 - * RCC-8 relations for the RDFi framework 33.295 - */ 33.296 - public static final String rdfiDC = rdfi + "DC"; 33.297 - public static final String rdfiEC = rdfi + "EC"; 33.298 - public static final String rdfiPO = rdfi + "PO"; 33.299 - public static final String rdfiNTPP = rdfi + "NTPP"; 33.300 - public static final String rdfiNTPPi = rdfi + "NTPPi"; 33.301 - public static final String rdfiTPP = rdfi + "TPP"; 33.302 - public static final String rdfiTPPi = rdfi + "TPPi"; 33.303 - public static final String rdfiEQ = rdfi + "EQ"; 33.304 -}
34.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/SpatialPropertyFunc.java Fri Apr 19 09:11:47 2013 +0300 34.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/SpatialPropertyFunc.java Fri Apr 19 14:37:09 2013 +0300 34.3 @@ -20,6 +20,7 @@ 34.4 * and so on), its type (Polygon, Point, etc.), SRID, etc. 34.5 * 34.6 * @see package {@link org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property} 34.7 + * @see package {@link org.openrdf.query.algebra.evaluation.function.spatial.geosparql.property} 34.8 * 34.9 * @author Manos Karpathiotakis <mk@di.uoa.gr> 34.10 * @author Charalampos Nikolaou <charnik@di.uoa.gr>
35.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java Fri Apr 19 09:11:47 2013 +0300 35.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java Fri Apr 19 14:37:09 2013 +0300 35.3 @@ -190,7 +190,7 @@ 35.4 this.geometry = new StrabonPolyhedron(geo, algorithm, MAX_POINTS).geometry; 35.5 } 35.6 35.7 - @SuppressWarnings("unused") 35.8 + // unused 35.9 public StrabonPolyhedron(Geometry geo, int algorithm, int maxPoints) throws Exception { 35.10 if (geo.isEmpty()) { 35.11 this.geometry = geo; 35.12 @@ -843,6 +843,7 @@ 35.13 return this.geometry.getNumPoints(); 35.14 } 35.15 35.16 + @SuppressWarnings("unused") 35.17 private static String FindGeoType(Geometry geo) { 35.18 return 35.19 Point.class.isInstance(geo) ? "Point" :
36.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/WKTHelper.java Fri Apr 19 09:11:47 2013 +0300 36.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/WKTHelper.java Fri Apr 19 14:37:09 2013 +0300 36.3 @@ -12,6 +12,8 @@ 36.4 import org.slf4j.Logger; 36.5 import org.slf4j.LoggerFactory; 36.6 36.7 +import eu.earthobservatory.constants.GeoConstants; 36.8 + 36.9 36.10 /** 36.11 *
37.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/GeoSparqlRelateFunc.java Fri Apr 19 09:11:47 2013 +0300 37.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/GeoSparqlRelateFunc.java Fri Apr 19 14:37:09 2013 +0300 37.3 @@ -9,9 +9,10 @@ 37.4 */ 37.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql; 37.6 37.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 37.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 37.9 37.10 +import eu.earthobservatory.constants.GeoConstants; 37.11 + 37.12 /** 37.13 * 37.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
38.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferContainsFunc.java Fri Apr 19 09:11:47 2013 +0300 38.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferContainsFunc.java Fri Apr 19 14:37:09 2013 +0300 38.3 @@ -9,9 +9,10 @@ 38.4 */ 38.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.egenhofer; 38.6 38.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 38.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 38.9 38.10 +import eu.earthobservatory.constants.GeoConstants; 38.11 + 38.12 /** 38.13 * 38.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
39.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferCoveredByFunc.java Fri Apr 19 09:11:47 2013 +0300 39.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferCoveredByFunc.java Fri Apr 19 14:37:09 2013 +0300 39.3 @@ -9,9 +9,10 @@ 39.4 */ 39.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.egenhofer; 39.6 39.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 39.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 39.9 39.10 +import eu.earthobservatory.constants.GeoConstants; 39.11 + 39.12 39.13 public class EgenhoferCoveredByFunc extends GeoSparqlRelation { 39.14
40.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferCoversFunc.java Fri Apr 19 09:11:47 2013 +0300 40.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferCoversFunc.java Fri Apr 19 14:37:09 2013 +0300 40.3 @@ -9,9 +9,10 @@ 40.4 */ 40.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.egenhofer; 40.6 40.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 40.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 40.9 40.10 +import eu.earthobservatory.constants.GeoConstants; 40.11 + 40.12 40.13 public class EgenhoferCoversFunc extends GeoSparqlRelation { 40.14
41.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferDisjointFunc.java Fri Apr 19 09:11:47 2013 +0300 41.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferDisjointFunc.java Fri Apr 19 14:37:09 2013 +0300 41.3 @@ -9,9 +9,10 @@ 41.4 */ 41.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.egenhofer; 41.6 41.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 41.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 41.9 41.10 +import eu.earthobservatory.constants.GeoConstants; 41.11 + 41.12 41.13 public class EgenhoferDisjointFunc extends GeoSparqlRelation { 41.14
42.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferEqualsFunc.java Fri Apr 19 09:11:47 2013 +0300 42.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferEqualsFunc.java Fri Apr 19 14:37:09 2013 +0300 42.3 @@ -9,9 +9,10 @@ 42.4 */ 42.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.egenhofer; 42.6 42.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 42.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 42.9 42.10 +import eu.earthobservatory.constants.GeoConstants; 42.11 + 42.12 42.13 public class EgenhoferEqualsFunc extends GeoSparqlRelation { 42.14
43.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferInsideFunc.java Fri Apr 19 09:11:47 2013 +0300 43.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferInsideFunc.java Fri Apr 19 14:37:09 2013 +0300 43.3 @@ -9,9 +9,10 @@ 43.4 */ 43.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.egenhofer; 43.6 43.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 43.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 43.9 43.10 +import eu.earthobservatory.constants.GeoConstants; 43.11 + 43.12 43.13 public class EgenhoferInsideFunc extends GeoSparqlRelation { 43.14
44.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferMeetFunc.java Fri Apr 19 09:11:47 2013 +0300 44.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferMeetFunc.java Fri Apr 19 14:37:09 2013 +0300 44.3 @@ -9,9 +9,10 @@ 44.4 */ 44.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.egenhofer; 44.6 44.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 44.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 44.9 44.10 +import eu.earthobservatory.constants.GeoConstants; 44.11 + 44.12 44.13 public class EgenhoferMeetFunc extends GeoSparqlRelation { 44.14
45.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferOverlapFunc.java Fri Apr 19 09:11:47 2013 +0300 45.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/egenhofer/EgenhoferOverlapFunc.java Fri Apr 19 14:37:09 2013 +0300 45.3 @@ -9,9 +9,10 @@ 45.4 */ 45.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.egenhofer; 45.6 45.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 45.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 45.9 45.10 +import eu.earthobservatory.constants.GeoConstants; 45.11 + 45.12 45.13 public class EgenhoferOverlapFunc extends GeoSparqlRelation { 45.14
46.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlBoundaryFunc.java Fri Apr 19 09:11:47 2013 +0300 46.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlBoundaryFunc.java Fri Apr 19 14:37:09 2013 +0300 46.3 @@ -9,8 +9,9 @@ 46.4 */ 46.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological; 46.6 46.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 46.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlNonTopologicalConstruct; 46.9 + 46.10 +import eu.earthobservatory.constants.GeoConstants; 46.11 46.12 /** 46.13 *
47.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlBufferFunc.java Fri Apr 19 09:11:47 2013 +0300 47.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlBufferFunc.java Fri Apr 19 14:37:09 2013 +0300 47.3 @@ -9,8 +9,9 @@ 47.4 */ 47.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological; 47.6 47.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 47.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlNonTopologicalConstruct; 47.9 + 47.10 +import eu.earthobservatory.constants.GeoConstants; 47.11 47.12 /** 47.13 *
48.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlConvexHullFunc.java Fri Apr 19 09:11:47 2013 +0300 48.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlConvexHullFunc.java Fri Apr 19 14:37:09 2013 +0300 48.3 @@ -9,8 +9,9 @@ 48.4 */ 48.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological; 48.6 48.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 48.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlNonTopologicalConstruct; 48.9 + 48.10 +import eu.earthobservatory.constants.GeoConstants; 48.11 48.12 /** 48.13 *
49.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlDifferenceFunc.java Fri Apr 19 09:11:47 2013 +0300 49.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlDifferenceFunc.java Fri Apr 19 14:37:09 2013 +0300 49.3 @@ -9,9 +9,10 @@ 49.4 */ 49.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological; 49.6 49.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 49.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlNonTopologicalConstruct; 49.9 49.10 +import eu.earthobservatory.constants.GeoConstants; 49.11 + 49.12 /** 49.13 * 49.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
50.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlDistanceFunc.java Fri Apr 19 09:11:47 2013 +0300 50.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlDistanceFunc.java Fri Apr 19 14:37:09 2013 +0300 50.3 @@ -9,9 +9,10 @@ 50.4 */ 50.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological; 50.6 50.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 50.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlNonTopologicalMetric; 50.9 50.10 +import eu.earthobservatory.constants.GeoConstants; 50.11 + 50.12 /** 50.13 * 50.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
51.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlEnvelopeFunc.java Fri Apr 19 09:11:47 2013 +0300 51.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlEnvelopeFunc.java Fri Apr 19 14:37:09 2013 +0300 51.3 @@ -9,8 +9,9 @@ 51.4 */ 51.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological; 51.6 51.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 51.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlNonTopologicalConstruct; 51.9 + 51.10 +import eu.earthobservatory.constants.GeoConstants; 51.11 51.12 /** 51.13 *
52.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlIntersectionFunc.java Fri Apr 19 09:11:47 2013 +0300 52.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlIntersectionFunc.java Fri Apr 19 14:37:09 2013 +0300 52.3 @@ -9,9 +9,10 @@ 52.4 */ 52.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological; 52.6 52.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 52.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlNonTopologicalConstruct; 52.9 52.10 +import eu.earthobservatory.constants.GeoConstants; 52.11 + 52.12 /** 52.13 * 52.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
53.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlSymmetricDifferenceFunc.java Fri Apr 19 09:11:47 2013 +0300 53.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlSymmetricDifferenceFunc.java Fri Apr 19 14:37:09 2013 +0300 53.3 @@ -9,9 +9,10 @@ 53.4 */ 53.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological; 53.6 53.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 53.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlNonTopologicalConstruct; 53.9 53.10 +import eu.earthobservatory.constants.GeoConstants; 53.11 + 53.12 /** 53.13 * 53.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
54.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlUnionFunc.java Fri Apr 19 09:11:47 2013 +0300 54.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/nontopological/GeoSparqlUnionFunc.java Fri Apr 19 14:37:09 2013 +0300 54.3 @@ -9,9 +9,10 @@ 54.4 */ 54.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological; 54.6 54.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 54.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlNonTopologicalConstruct; 54.9 54.10 +import eu.earthobservatory.constants.GeoConstants; 54.11 + 54.12 /** 54.13 * 54.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 55.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/property/GeoSparqlGetSRIDFunc.java Fri Apr 19 14:37:09 2013 +0300 55.3 @@ -0,0 +1,29 @@ 55.4 +/** 55.5 + * This Source Code Form is subject to the terms of the Mozilla Public 55.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 55.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 55.8 + * 55.9 + * Copyright (C) 2013, Pyravlos Team 55.10 + * 55.11 + * http://www.strabon.di.uoa.gr/ 55.12 + */ 55.13 +package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.property; 55.14 + 55.15 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 55.16 + 55.17 +import eu.earthobservatory.constants.GeoConstants; 55.18 + 55.19 +/** 55.20 + * Implementation of the <code>geof:getSRID(geom: ogc:geomLiteral): xsd:anyURI</code> 55.21 + * function of GeoSPARQL. 55.22 + * 55.23 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 55.24 + * 55.25 + */ 55.26 +public class GeoSparqlGetSRIDFunc extends SpatialPropertyFunc { 55.27 + 55.28 + @Override 55.29 + public String getURI() { 55.30 + return GeoConstants.geoSparqlGetSRID; 55.31 + } 55.32 +}
56.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8DisconnectedFunc.java Fri Apr 19 09:11:47 2013 +0300 56.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8DisconnectedFunc.java Fri Apr 19 14:37:09 2013 +0300 56.3 @@ -9,9 +9,10 @@ 56.4 */ 56.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.rcc8; 56.6 56.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 56.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 56.9 56.10 +import eu.earthobservatory.constants.GeoConstants; 56.11 + 56.12 /** 56.13 * 56.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
57.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8EqualsFunc.java Fri Apr 19 09:11:47 2013 +0300 57.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8EqualsFunc.java Fri Apr 19 14:37:09 2013 +0300 57.3 @@ -9,9 +9,10 @@ 57.4 */ 57.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.rcc8; 57.6 57.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 57.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 57.9 57.10 +import eu.earthobservatory.constants.GeoConstants; 57.11 + 57.12 /** 57.13 * 57.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
58.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8ExternallyConnectedFunc.java Fri Apr 19 09:11:47 2013 +0300 58.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8ExternallyConnectedFunc.java Fri Apr 19 14:37:09 2013 +0300 58.3 @@ -9,9 +9,10 @@ 58.4 */ 58.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.rcc8; 58.6 58.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 58.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 58.9 58.10 +import eu.earthobservatory.constants.GeoConstants; 58.11 + 58.12 /** 58.13 * 58.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
59.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8NonTangentialProperPartFunc.java Fri Apr 19 09:11:47 2013 +0300 59.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8NonTangentialProperPartFunc.java Fri Apr 19 14:37:09 2013 +0300 59.3 @@ -9,9 +9,10 @@ 59.4 */ 59.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.rcc8; 59.6 59.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 59.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 59.9 59.10 +import eu.earthobservatory.constants.GeoConstants; 59.11 + 59.12 /** 59.13 * 59.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
60.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8NonTangentialProperPartInverseFunc.java Fri Apr 19 09:11:47 2013 +0300 60.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8NonTangentialProperPartInverseFunc.java Fri Apr 19 14:37:09 2013 +0300 60.3 @@ -9,9 +9,10 @@ 60.4 */ 60.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.rcc8; 60.6 60.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 60.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 60.9 60.10 +import eu.earthobservatory.constants.GeoConstants; 60.11 + 60.12 /** 60.13 * 60.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
61.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8PartiallyOverlappingFunc.java Fri Apr 19 09:11:47 2013 +0300 61.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8PartiallyOverlappingFunc.java Fri Apr 19 14:37:09 2013 +0300 61.3 @@ -9,9 +9,10 @@ 61.4 */ 61.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.rcc8; 61.6 61.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 61.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 61.9 61.10 +import eu.earthobservatory.constants.GeoConstants; 61.11 + 61.12 /** 61.13 * 61.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
62.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8TangentialProperPartFunc.java Fri Apr 19 09:11:47 2013 +0300 62.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8TangentialProperPartFunc.java Fri Apr 19 14:37:09 2013 +0300 62.3 @@ -9,9 +9,10 @@ 62.4 */ 62.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.rcc8; 62.6 62.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 62.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 62.9 62.10 +import eu.earthobservatory.constants.GeoConstants; 62.11 + 62.12 /** 62.13 * 62.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
63.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8TangentialProperPartInverseFunc.java Fri Apr 19 09:11:47 2013 +0300 63.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/rcc8/RCC8TangentialProperPartInverseFunc.java Fri Apr 19 14:37:09 2013 +0300 63.3 @@ -9,9 +9,10 @@ 63.4 */ 63.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.rcc8; 63.6 63.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 63.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 63.9 63.10 +import eu.earthobservatory.constants.GeoConstants; 63.11 + 63.12 /** 63.13 * 63.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
64.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeatureTouchesFunc.java Fri Apr 19 09:11:47 2013 +0300 64.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeatureTouchesFunc.java Fri Apr 19 14:37:09 2013 +0300 64.3 @@ -9,9 +9,10 @@ 64.4 */ 64.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.sf; 64.6 64.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 64.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 64.9 64.10 +import eu.earthobservatory.constants.GeoConstants; 64.11 + 64.12 /** 64.13 * 64.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
65.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesContainsFunc.java Fri Apr 19 09:11:47 2013 +0300 65.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesContainsFunc.java Fri Apr 19 14:37:09 2013 +0300 65.3 @@ -9,9 +9,10 @@ 65.4 */ 65.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.sf; 65.6 65.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 65.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 65.9 65.10 +import eu.earthobservatory.constants.GeoConstants; 65.11 + 65.12 /** 65.13 * 65.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
66.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesCrossesFunc.java Fri Apr 19 09:11:47 2013 +0300 66.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesCrossesFunc.java Fri Apr 19 14:37:09 2013 +0300 66.3 @@ -9,9 +9,10 @@ 66.4 */ 66.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.sf; 66.6 66.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 66.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 66.9 66.10 +import eu.earthobservatory.constants.GeoConstants; 66.11 + 66.12 /** 66.13 * 66.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
67.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesDisjointFunc.java Fri Apr 19 09:11:47 2013 +0300 67.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesDisjointFunc.java Fri Apr 19 14:37:09 2013 +0300 67.3 @@ -9,9 +9,10 @@ 67.4 */ 67.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.sf; 67.6 67.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 67.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 67.9 67.10 +import eu.earthobservatory.constants.GeoConstants; 67.11 + 67.12 /** 67.13 * 67.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
68.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesEqualsFunc.java Fri Apr 19 09:11:47 2013 +0300 68.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesEqualsFunc.java Fri Apr 19 14:37:09 2013 +0300 68.3 @@ -9,9 +9,10 @@ 68.4 */ 68.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.sf; 68.6 68.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 68.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 68.9 68.10 +import eu.earthobservatory.constants.GeoConstants; 68.11 + 68.12 /** 68.13 * 68.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
69.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesIntersectsFunc.java Fri Apr 19 09:11:47 2013 +0300 69.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesIntersectsFunc.java Fri Apr 19 14:37:09 2013 +0300 69.3 @@ -9,9 +9,10 @@ 69.4 */ 69.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.sf; 69.6 69.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 69.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 69.9 69.10 +import eu.earthobservatory.constants.GeoConstants; 69.11 + 69.12 /** 69.13 * 69.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
70.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesOverlapsFunc.java Fri Apr 19 09:11:47 2013 +0300 70.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesOverlapsFunc.java Fri Apr 19 14:37:09 2013 +0300 70.3 @@ -9,9 +9,10 @@ 70.4 */ 70.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.sf; 70.6 70.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 70.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 70.9 70.10 +import eu.earthobservatory.constants.GeoConstants; 70.11 + 70.12 /** 70.13 * 70.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
71.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesWithinFunc.java Fri Apr 19 09:11:47 2013 +0300 71.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/sf/SimpleFeaturesWithinFunc.java Fri Apr 19 14:37:09 2013 +0300 71.3 @@ -9,9 +9,10 @@ 71.4 */ 71.5 package org.openrdf.query.algebra.evaluation.function.spatial.geosparql.sf; 71.6 71.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 71.8 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelation; 71.9 71.10 +import eu.earthobservatory.constants.GeoConstants; 71.11 + 71.12 /** 71.13 * 71.14 * @author Manos Karpathiotakis <mk@di.uoa.gr>
72.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/aggregate/DateTimeDiff.java Fri Apr 19 09:11:47 2013 +0300 72.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/aggregate/DateTimeDiff.java Fri Apr 19 14:37:09 2013 +0300 72.3 @@ -17,7 +17,8 @@ 72.4 import org.openrdf.model.ValueFactory; 72.5 import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 72.6 import org.openrdf.query.algebra.evaluation.function.Function; 72.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 72.8 + 72.9 +import eu.earthobservatory.constants.GeoConstants; 72.10 72.11 /** 72.12 * @author Garmpis Georgios <ggarbis@di.uoa.gr>
73.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/aggregate/ExtentFunc.java Fri Apr 19 09:11:47 2013 +0300 73.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/aggregate/ExtentFunc.java Fri Apr 19 14:37:09 2013 +0300 73.3 @@ -9,9 +9,10 @@ 73.4 */ 73.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.aggregate; 73.6 73.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 73.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 73.9 73.10 +import eu.earthobservatory.constants.GeoConstants; 73.11 + 73.12 /** 73.13 * 73.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 73.15 @@ -20,6 +21,6 @@ 73.16 73.17 @Override 73.18 public String getURI() { 73.19 - return GeoConstants.extent; 73.20 + return GeoConstants.stSPARQLextent; 73.21 } 73.22 }
74.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/BoundaryFunc.java Fri Apr 19 09:11:47 2013 +0300 74.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/BoundaryFunc.java Fri Apr 19 14:37:09 2013 +0300 74.3 @@ -9,8 +9,9 @@ 74.4 */ 74.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct; 74.6 74.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 74.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 74.9 + 74.10 +import eu.earthobservatory.constants.GeoConstants; 74.11 74.12 /** 74.13 * 74.14 @@ -20,6 +21,6 @@ 74.15 74.16 @Override 74.17 public String getURI() { 74.18 - return GeoConstants.boundary; 74.19 + return GeoConstants.stSPARQLboundary; 74.20 } 74.21 }
75.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/BufferFunc.java Fri Apr 19 09:11:47 2013 +0300 75.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/BufferFunc.java Fri Apr 19 14:37:09 2013 +0300 75.3 @@ -9,8 +9,9 @@ 75.4 */ 75.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct; 75.6 75.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 75.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 75.9 + 75.10 +import eu.earthobservatory.constants.GeoConstants; 75.11 75.12 /** 75.13 * @author Manos Karpathiotakis <mk@di.uoa.gr> 75.14 @@ -19,6 +20,6 @@ 75.15 75.16 @Override 75.17 public String getURI() { 75.18 - return GeoConstants.buffer; 75.19 + return GeoConstants.stSPARQLbuffer; 75.20 } 75.21 }
76.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/ConvexHullFunc.java Fri Apr 19 09:11:47 2013 +0300 76.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/ConvexHullFunc.java Fri Apr 19 14:37:09 2013 +0300 76.3 @@ -9,8 +9,9 @@ 76.4 */ 76.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct; 76.6 76.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 76.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 76.9 + 76.10 +import eu.earthobservatory.constants.GeoConstants; 76.11 76.12 /** 76.13 * 76.14 @@ -20,6 +21,6 @@ 76.15 76.16 @Override 76.17 public String getURI() { 76.18 - return GeoConstants.convexHull; 76.19 + return GeoConstants.stSPARQLconvexHull; 76.20 } 76.21 }
77.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/DifferenceFunc.java Fri Apr 19 09:11:47 2013 +0300 77.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/DifferenceFunc.java Fri Apr 19 14:37:09 2013 +0300 77.3 @@ -9,9 +9,10 @@ 77.4 */ 77.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct; 77.6 77.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 77.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 77.9 77.10 +import eu.earthobservatory.constants.GeoConstants; 77.11 + 77.12 /** 77.13 * 77.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 77.15 @@ -20,6 +21,6 @@ 77.16 77.17 @Override 77.18 public String getURI() { 77.19 - return GeoConstants.difference; 77.20 + return GeoConstants.stSPARQLdifference; 77.21 } 77.22 }
78.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/EnvelopeFunc.java Fri Apr 19 09:11:47 2013 +0300 78.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/EnvelopeFunc.java Fri Apr 19 14:37:09 2013 +0300 78.3 @@ -9,8 +9,9 @@ 78.4 */ 78.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct; 78.6 78.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 78.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 78.9 + 78.10 +import eu.earthobservatory.constants.GeoConstants; 78.11 78.12 /** 78.13 * 78.14 @@ -20,6 +21,6 @@ 78.15 78.16 @Override 78.17 public String getURI() { 78.18 - return GeoConstants.envelope; 78.19 + return GeoConstants.stSPARQLenvelope; 78.20 } 78.21 }
79.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/IntersectionFunc.java Fri Apr 19 09:11:47 2013 +0300 79.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/IntersectionFunc.java Fri Apr 19 14:37:09 2013 +0300 79.3 @@ -9,9 +9,10 @@ 79.4 */ 79.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct; 79.6 79.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 79.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 79.9 79.10 +import eu.earthobservatory.constants.GeoConstants; 79.11 + 79.12 /** 79.13 * 79.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 79.15 @@ -20,6 +21,6 @@ 79.16 79.17 @Override 79.18 public String getURI() { 79.19 - return GeoConstants.intersection; 79.20 + return GeoConstants.stSPARQLintersection; 79.21 } 79.22 }
80.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/SymDifferenceFunc.java Fri Apr 19 09:11:47 2013 +0300 80.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/SymDifferenceFunc.java Fri Apr 19 14:37:09 2013 +0300 80.3 @@ -9,9 +9,10 @@ 80.4 */ 80.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct; 80.6 80.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 80.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 80.9 80.10 +import eu.earthobservatory.constants.GeoConstants; 80.11 + 80.12 /** 80.13 * 80.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 80.15 @@ -20,6 +21,6 @@ 80.16 80.17 @Override 80.18 public String getURI() { 80.19 - return GeoConstants.symDifference; 80.20 + return GeoConstants.stSPARQLsymDifference; 80.21 } 80.22 }
81.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/TransformFunc.java Fri Apr 19 09:11:47 2013 +0300 81.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/TransformFunc.java Fri Apr 19 14:37:09 2013 +0300 81.3 @@ -9,8 +9,9 @@ 81.4 */ 81.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct; 81.6 81.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 81.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 81.9 + 81.10 +import eu.earthobservatory.constants.GeoConstants; 81.11 81.12 /** 81.13 * 81.14 @@ -20,6 +21,6 @@ 81.15 81.16 @Override 81.17 public String getURI() { 81.18 - return GeoConstants.transform; 81.19 + return GeoConstants.stSPARQLtransform; 81.20 } 81.21 }
82.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/UnionFunc.java Fri Apr 19 09:11:47 2013 +0300 82.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/construct/UnionFunc.java Fri Apr 19 14:37:09 2013 +0300 82.3 @@ -9,9 +9,10 @@ 82.4 */ 82.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct; 82.6 82.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 82.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 82.9 82.10 +import eu.earthobservatory.constants.GeoConstants; 82.11 + 82.12 /** 82.13 * 82.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 82.15 @@ -20,6 +21,6 @@ 82.16 82.17 @Override 82.18 public String getURI() { 82.19 - return GeoConstants.union; 82.20 + return GeoConstants.stSPARQLunion; 82.21 } 82.22 }
83.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/metric/AreaFunc.java Fri Apr 19 09:11:47 2013 +0300 83.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/metric/AreaFunc.java Fri Apr 19 14:37:09 2013 +0300 83.3 @@ -9,8 +9,9 @@ 83.4 */ 83.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric; 83.6 83.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 83.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 83.9 + 83.10 +import eu.earthobservatory.constants.GeoConstants; 83.11 83.12 /** 83.13 * A spatial function computing the area of a geometry. 83.14 @@ -21,6 +22,6 @@ 83.15 83.16 @Override 83.17 public String getURI() { 83.18 - return GeoConstants.area; 83.19 + return GeoConstants.stSPARQLarea; 83.20 } 83.21 }
84.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/metric/DistanceFunc.java Fri Apr 19 09:11:47 2013 +0300 84.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/metric/DistanceFunc.java Fri Apr 19 14:37:09 2013 +0300 84.3 @@ -9,9 +9,10 @@ 84.4 */ 84.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric; 84.6 84.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 84.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 84.9 84.10 +import eu.earthobservatory.constants.GeoConstants; 84.11 + 84.12 /** 84.13 * A spatial function computing the distance between two geometries. 84.14 * 84.15 @@ -21,6 +22,6 @@ 84.16 84.17 @Override 84.18 public String getURI() { 84.19 - return GeoConstants.distance; 84.20 + return GeoConstants.stSPARQLdistance; 84.21 } 84.22 }
85.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/AsGMLFunc.java Fri Apr 19 09:11:47 2013 +0300 85.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/AsGMLFunc.java Fri Apr 19 14:37:09 2013 +0300 85.3 @@ -9,9 +9,10 @@ 85.4 */ 85.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property; 85.6 85.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 85.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 85.9 85.10 +import eu.earthobservatory.constants.GeoConstants; 85.11 + 85.12 /** 85.13 * A spatial function returning a geometry in GML encoding. 85.14 * 85.15 @@ -21,6 +22,6 @@ 85.16 85.17 @Override 85.18 public String getURI() { 85.19 - return GeoConstants.asGML; 85.20 + return GeoConstants.stSPARQLasGML; 85.21 } 85.22 }
86.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/AsTextFunc.java Fri Apr 19 09:11:47 2013 +0300 86.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/AsTextFunc.java Fri Apr 19 14:37:09 2013 +0300 86.3 @@ -9,8 +9,9 @@ 86.4 */ 86.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property; 86.6 86.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 86.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 86.9 + 86.10 +import eu.earthobservatory.constants.GeoConstants; 86.11 86.12 /** 86.13 * A spatial function returning a geometry as text (in WKT format). 86.14 @@ -21,6 +22,6 @@ 86.15 86.16 @Override 86.17 public String getURI() { 86.18 - return GeoConstants.asText; 86.19 + return GeoConstants.stSPARQLasText; 86.20 } 86.21 }
87.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/DimensionFunc.java Fri Apr 19 09:11:47 2013 +0300 87.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/DimensionFunc.java Fri Apr 19 14:37:09 2013 +0300 87.3 @@ -9,8 +9,9 @@ 87.4 */ 87.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property; 87.6 87.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 87.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 87.9 + 87.10 +import eu.earthobservatory.constants.GeoConstants; 87.11 87.12 /** 87.13 * A spatial function returning the dimension of a geometry. 87.14 @@ -21,6 +22,6 @@ 87.15 87.16 @Override 87.17 public String getURI() { 87.18 - return GeoConstants.dimension; 87.19 + return GeoConstants.stSPARQLdimension; 87.20 } 87.21 }
88.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/GeometryTypeFunc.java Fri Apr 19 09:11:47 2013 +0300 88.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/GeometryTypeFunc.java Fri Apr 19 14:37:09 2013 +0300 88.3 @@ -9,8 +9,9 @@ 88.4 */ 88.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property; 88.6 88.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 88.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 88.9 + 88.10 +import eu.earthobservatory.constants.GeoConstants; 88.11 88.12 /** 88.13 * A spatial function returning the type of a geometry. 88.14 @@ -21,6 +22,6 @@ 88.15 88.16 @Override 88.17 public String getURI() { 88.18 - return GeoConstants.geometryType; 88.19 + return GeoConstants.stSPARQLgeometryType; 88.20 } 88.21 }
89.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/IsEmptyFunc.java Fri Apr 19 09:11:47 2013 +0300 89.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/IsEmptyFunc.java Fri Apr 19 14:37:09 2013 +0300 89.3 @@ -9,8 +9,9 @@ 89.4 */ 89.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property; 89.6 89.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 89.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 89.9 + 89.10 +import eu.earthobservatory.constants.GeoConstants; 89.11 89.12 /** 89.13 * A spatial function for testing whether a geometry is empty. 89.14 @@ -21,6 +22,6 @@ 89.15 89.16 @Override 89.17 public String getURI() { 89.18 - return GeoConstants.isEmpty; 89.19 + return GeoConstants.stSPARQLisEmpty; 89.20 } 89.21 }
90.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/IsSimpleFunc.java Fri Apr 19 09:11:47 2013 +0300 90.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/IsSimpleFunc.java Fri Apr 19 14:37:09 2013 +0300 90.3 @@ -9,8 +9,9 @@ 90.4 */ 90.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property; 90.6 90.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 90.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 90.9 + 90.10 +import eu.earthobservatory.constants.GeoConstants; 90.11 90.12 /** 90.13 * A spatial function for testing whether a geometry is simple. 90.14 @@ -21,6 +22,6 @@ 90.15 90.16 @Override 90.17 public String getURI() { 90.18 - return GeoConstants.isSimple; 90.19 + return GeoConstants.stSPARQLisSimple; 90.20 } 90.21 }
91.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/SridFunc.java Fri Apr 19 09:11:47 2013 +0300 91.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/property/SridFunc.java Fri Apr 19 14:37:09 2013 +0300 91.3 @@ -9,8 +9,9 @@ 91.4 */ 91.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property; 91.6 91.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 91.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 91.9 + 91.10 +import eu.earthobservatory.constants.GeoConstants; 91.11 91.12 /** 91.13 * A spatial function returning the SRID of a geometry. 91.14 @@ -21,6 +22,6 @@ 91.15 91.16 @Override 91.17 public String getURI() { 91.18 - return GeoConstants.srid.toString(); //changed this-constant 91.19 + return GeoConstants.stSPARQLsrid; //changed this-constant 91.20 } 91.21 }
92.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/AboveFunc.java Fri Apr 19 09:11:47 2013 +0300 92.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/AboveFunc.java Fri Apr 19 14:37:09 2013 +0300 92.3 @@ -9,8 +9,9 @@ 92.4 */ 92.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 92.6 92.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 92.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 92.9 + 92.10 +import eu.earthobservatory.constants.GeoConstants; 92.11 92.12 /** 92.13 * 92.14 @@ -20,6 +21,6 @@ 92.15 92.16 @Override 92.17 public String getURI() { 92.18 - return GeoConstants.above; 92.19 + return GeoConstants.stSPARQLabove; 92.20 } 92.21 }
93.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/BelowFunc.java Fri Apr 19 09:11:47 2013 +0300 93.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/BelowFunc.java Fri Apr 19 14:37:09 2013 +0300 93.3 @@ -9,8 +9,9 @@ 93.4 */ 93.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 93.6 93.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 93.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 93.9 + 93.10 +import eu.earthobservatory.constants.GeoConstants; 93.11 93.12 /** 93.13 * 93.14 @@ -20,6 +21,6 @@ 93.15 93.16 @Override 93.17 public String getURI() { 93.18 - return GeoConstants.below; 93.19 + return GeoConstants.stSPARQLbelow; 93.20 } 93.21 }
94.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/ContainsFunc.java Fri Apr 19 09:11:47 2013 +0300 94.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/ContainsFunc.java Fri Apr 19 14:37:09 2013 +0300 94.3 @@ -9,8 +9,9 @@ 94.4 */ 94.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 94.6 94.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 94.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 94.9 + 94.10 +import eu.earthobservatory.constants.GeoConstants; 94.11 94.12 /** 94.13 * 94.14 @@ -20,6 +21,6 @@ 94.15 94.16 @Override 94.17 public String getURI() { 94.18 - return GeoConstants.contains; 94.19 + return GeoConstants.stSPARQLcontains; 94.20 } 94.21 }
95.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/CrossesFunc.java Fri Apr 19 09:11:47 2013 +0300 95.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/CrossesFunc.java Fri Apr 19 14:37:09 2013 +0300 95.3 @@ -9,8 +9,9 @@ 95.4 */ 95.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 95.6 95.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 95.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 95.9 + 95.10 +import eu.earthobservatory.constants.GeoConstants; 95.11 95.12 /** 95.13 * 95.14 @@ -20,6 +21,6 @@ 95.15 95.16 @Override 95.17 public String getURI() { 95.18 - return GeoConstants.crosses; 95.19 + return GeoConstants.stSPARQLcrosses; 95.20 } 95.21 }
96.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/DisjointFunc.java Fri Apr 19 09:11:47 2013 +0300 96.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/DisjointFunc.java Fri Apr 19 14:37:09 2013 +0300 96.3 @@ -9,8 +9,9 @@ 96.4 */ 96.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 96.6 96.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 96.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 96.9 + 96.10 +import eu.earthobservatory.constants.GeoConstants; 96.11 96.12 /** 96.13 * 96.14 @@ -20,6 +21,6 @@ 96.15 96.16 @Override 96.17 public String getURI() { 96.18 - return GeoConstants.disjoint; 96.19 + return GeoConstants.stSPARQLdisjoint; 96.20 } 96.21 }
97.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/EqualsFunc.java Fri Apr 19 09:11:47 2013 +0300 97.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/EqualsFunc.java Fri Apr 19 14:37:09 2013 +0300 97.3 @@ -9,9 +9,10 @@ 97.4 */ 97.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 97.6 97.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 97.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 97.9 97.10 +import eu.earthobservatory.constants.GeoConstants; 97.11 + 97.12 /** 97.13 * 97.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 97.15 @@ -20,6 +21,6 @@ 97.16 97.17 @Override 97.18 public String getURI() { 97.19 - return GeoConstants.equals; 97.20 + return GeoConstants.stSPARQLequals; 97.21 } 97.22 }
98.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/IntersectsFunc.java Fri Apr 19 09:11:47 2013 +0300 98.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/IntersectsFunc.java Fri Apr 19 14:37:09 2013 +0300 98.3 @@ -9,9 +9,10 @@ 98.4 */ 98.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 98.6 98.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 98.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 98.9 98.10 +import eu.earthobservatory.constants.GeoConstants; 98.11 + 98.12 /** 98.13 * 98.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 98.15 @@ -20,7 +21,7 @@ 98.16 98.17 @Override 98.18 public String getURI() { 98.19 - return GeoConstants.intersects; 98.20 + return GeoConstants.stSPARQLintersects; 98.21 } 98.22 98.23 }
99.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/LeftFunc.java Fri Apr 19 09:11:47 2013 +0300 99.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/LeftFunc.java Fri Apr 19 14:37:09 2013 +0300 99.3 @@ -9,8 +9,9 @@ 99.4 */ 99.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 99.6 99.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 99.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 99.9 + 99.10 +import eu.earthobservatory.constants.GeoConstants; 99.11 99.12 /** 99.13 * 99.14 @@ -20,6 +21,6 @@ 99.15 99.16 @Override 99.17 public String getURI() { 99.18 - return GeoConstants.left; 99.19 + return GeoConstants.stSPARQLleft; 99.20 } 99.21 }
100.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/OverlapsFunc.java Fri Apr 19 09:11:47 2013 +0300 100.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/OverlapsFunc.java Fri Apr 19 14:37:09 2013 +0300 100.3 @@ -9,8 +9,9 @@ 100.4 */ 100.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 100.6 100.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 100.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 100.9 + 100.10 +import eu.earthobservatory.constants.GeoConstants; 100.11 100.12 /** 100.13 * 100.14 @@ -20,6 +21,6 @@ 100.15 100.16 @Override 100.17 public String getURI() { 100.18 - return GeoConstants.overlaps; 100.19 + return GeoConstants.stSPARQLoverlaps; 100.20 } 100.21 }
101.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/RelateFunc.java Fri Apr 19 09:11:47 2013 +0300 101.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/RelateFunc.java Fri Apr 19 14:37:09 2013 +0300 101.3 @@ -9,9 +9,10 @@ 101.4 */ 101.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 101.6 101.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 101.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 101.9 101.10 +import eu.earthobservatory.constants.GeoConstants; 101.11 + 101.12 /** 101.13 * @author Manos Karpathiotakis <mk@di.uoa.gr> 101.14 */ 101.15 @@ -19,7 +20,7 @@ 101.16 101.17 @Override 101.18 public String getURI() { 101.19 - return GeoConstants.relate; 101.20 + return GeoConstants.stSPARQLrelate; 101.21 } 101.22 101.23 // public Literal evaluate(ValueFactory valueFactory, Value... args)
102.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/RightFunc.java Fri Apr 19 09:11:47 2013 +0300 102.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/RightFunc.java Fri Apr 19 14:37:09 2013 +0300 102.3 @@ -9,8 +9,9 @@ 102.4 */ 102.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 102.6 102.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 102.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 102.9 + 102.10 +import eu.earthobservatory.constants.GeoConstants; 102.11 102.12 /** 102.13 * 102.14 @@ -20,6 +21,6 @@ 102.15 102.16 @Override 102.17 public String getURI() { 102.18 - return GeoConstants.right; 102.19 + return GeoConstants.stSPARQLright; 102.20 } 102.21 }
103.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/TouchesFunc.java Fri Apr 19 09:11:47 2013 +0300 103.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/TouchesFunc.java Fri Apr 19 14:37:09 2013 +0300 103.3 @@ -9,8 +9,9 @@ 103.4 */ 103.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 103.6 103.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 103.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 103.9 + 103.10 +import eu.earthobservatory.constants.GeoConstants; 103.11 103.12 /** 103.13 * 103.14 @@ -20,6 +21,6 @@ 103.15 103.16 @Override 103.17 public String getURI() { 103.18 - return GeoConstants.touches; 103.19 + return GeoConstants.stSPARQLtouches; 103.20 } 103.21 }
104.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/WithinFunc.java Fri Apr 19 09:11:47 2013 +0300 104.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/WithinFunc.java Fri Apr 19 14:37:09 2013 +0300 104.3 @@ -9,8 +9,9 @@ 104.4 */ 104.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 104.6 104.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 104.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 104.9 + 104.10 +import eu.earthobservatory.constants.GeoConstants; 104.11 104.12 /** 104.13 * 104.14 @@ -20,6 +21,6 @@ 104.15 104.16 @Override 104.17 public String getURI() { 104.18 - return GeoConstants.within; 104.19 + return GeoConstants.stSPARQLwithin; 104.20 } 104.21 }
105.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbContainsFunc.java Fri Apr 19 09:11:47 2013 +0300 105.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbContainsFunc.java Fri Apr 19 14:37:09 2013 +0300 105.3 @@ -9,9 +9,10 @@ 105.4 */ 105.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb; 105.6 105.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 105.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 105.9 105.10 +import eu.earthobservatory.constants.GeoConstants; 105.11 + 105.12 /** 105.13 * 105.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 105.15 @@ -20,7 +21,7 @@ 105.16 105.17 @Override 105.18 public String getURI() { 105.19 - return GeoConstants.mbbContains; 105.20 + return GeoConstants.stSPARQLmbbContains; 105.21 } 105.22 105.23 }
106.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbEqualsFunc.java Fri Apr 19 09:11:47 2013 +0300 106.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbEqualsFunc.java Fri Apr 19 14:37:09 2013 +0300 106.3 @@ -9,9 +9,10 @@ 106.4 */ 106.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb; 106.6 106.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 106.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 106.9 106.10 +import eu.earthobservatory.constants.GeoConstants; 106.11 + 106.12 /** 106.13 * 106.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 106.15 @@ -20,7 +21,7 @@ 106.16 106.17 @Override 106.18 public String getURI() { 106.19 - return GeoConstants.mbbEquals; 106.20 + return GeoConstants.stSPARQLmbbEquals; 106.21 } 106.22 106.23 }
107.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbIntersectsFunc.java Fri Apr 19 09:11:47 2013 +0300 107.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbIntersectsFunc.java Fri Apr 19 14:37:09 2013 +0300 107.3 @@ -9,9 +9,10 @@ 107.4 */ 107.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb; 107.6 107.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 107.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 107.9 107.10 +import eu.earthobservatory.constants.GeoConstants; 107.11 + 107.12 /** 107.13 * 107.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 107.15 @@ -20,7 +21,7 @@ 107.16 107.17 @Override 107.18 public String getURI() { 107.19 - return GeoConstants.mbbIntersects; 107.20 + return GeoConstants.stSPARQLmbbIntersects; 107.21 } 107.22 107.23 }
108.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbWithinFunc.java Fri Apr 19 09:11:47 2013 +0300 108.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbWithinFunc.java Fri Apr 19 14:37:09 2013 +0300 108.3 @@ -9,9 +9,10 @@ 108.4 */ 108.5 package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb; 108.6 108.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 108.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 108.9 108.10 +import eu.earthobservatory.constants.GeoConstants; 108.11 + 108.12 /** 108.13 * 108.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 108.15 @@ -20,7 +21,7 @@ 108.16 108.17 @Override 108.18 public String getURI() { 108.19 - return GeoConstants.mbbWithin; 108.20 + return GeoConstants.stSPARQLmbbWithin; 108.21 } 108.22 108.23 }
109.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/iterator/StSPARQLGroupIterator.java Fri Apr 19 09:11:47 2013 +0300 109.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/iterator/StSPARQLGroupIterator.java Fri Apr 19 14:37:09 2013 +0300 109.3 @@ -52,7 +52,6 @@ 109.4 import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 109.5 import org.openrdf.query.algebra.evaluation.function.Function; 109.6 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 109.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 109.8 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 109.9 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.aggregate.ExtentFunc; 109.10 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BoundaryFunc; 109.11 @@ -72,6 +71,8 @@ 109.12 109.13 import com.vividsolutions.jts.geom.Geometry; 109.14 109.15 +import eu.earthobservatory.constants.GeoConstants; 109.16 + 109.17 /** 109.18 * 109.19 * @author Manos Karpathiotakis <mk@di.uoa.gr>
110.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/StSPARQLOrderComparator.java Fri Apr 19 09:11:47 2013 +0300 110.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/StSPARQLOrderComparator.java Fri Apr 19 14:37:09 2013 +0300 110.3 @@ -21,10 +21,11 @@ 110.4 import org.openrdf.query.algebra.Var; 110.5 import org.openrdf.query.algebra.evaluation.EvaluationStrategy; 110.6 import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 110.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 110.8 import org.slf4j.Logger; 110.9 import org.slf4j.LoggerFactory; 110.10 110.11 +import eu.earthobservatory.constants.GeoConstants; 110.12 + 110.13 /** 110.14 * @author Manos Karpathiotakis <mk@di.uoa.gr> 110.15 */ 110.16 @@ -55,7 +56,7 @@ 110.17 if(element.getExpr() instanceof FunctionCall) 110.18 { 110.19 FunctionCall fc = (FunctionCall) element.getExpr(); 110.20 - if(fc.getURI().equals(GeoConstants.envelope) && fc.getArgs().size()==2) 110.21 + if(fc.getURI().equals(GeoConstants.stSPARQLenvelope) && fc.getArgs().size()==2) 110.22 { 110.23 mbbFlag = true; 110.24 FunctionCall expr = (FunctionCall) element.getExpr();
111.1 --- a/evaluation/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function Fri Apr 19 09:11:47 2013 +0300 111.2 +++ b/evaluation/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function Fri Apr 19 14:37:09 2013 +0300 111.3 @@ -33,8 +33,8 @@ 111.4 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.EnvelopeFunc 111.5 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.ConvexHullFunc 111.6 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BoundaryFunc 111.7 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc 111.8 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.DistanceFunc 111.9 -org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc 111.10 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.DimensionFunc 111.11 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.GeometryTypeFunc 111.12 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.AsTextFunc 111.13 @@ -53,6 +53,7 @@ 111.14 org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlIntersectionFunc 111.15 org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlSymmetricDifferenceFunc 111.16 org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlUnionFunc 111.17 +org.openrdf.query.algebra.evaluation.function.spatial.geosparql.property.GeoSparqlGetSRIDFunc 111.18 org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelateFunc 111.19 org.openrdf.query.algebra.evaluation.function.spatial.geosparql.egenhofer.EgenhoferContainsFunc 111.20 org.openrdf.query.algebra.evaluation.function.spatial.geosparql.egenhofer.EgenhoferCoveredByFunc
112.1 --- a/generaldb/pom.xml Fri Apr 19 09:11:47 2013 +0300 112.2 +++ b/generaldb/pom.xml Fri Apr 19 14:37:09 2013 +0300 112.3 @@ -78,6 +78,13 @@ 112.4 <artifactId>postgresql</artifactId> 112.5 <scope>provided</scope> 112.6 </dependency> 112.7 + 112.8 + <dependency> 112.9 + <groupId>monetdb</groupId> 112.10 + <artifactId>jdbcclient</artifactId> 112.11 + <scope>provided</scope> 112.12 + </dependency> 112.13 + 112.14 112.15 <dependency> 112.16 <groupId>junit</groupId>
113.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBConnection.java Fri Apr 19 09:11:47 2013 +0300 113.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBConnection.java Fri Apr 19 14:37:09 2013 +0300 113.3 @@ -1,7 +1,11 @@ 113.4 -/* 113.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 113.6 - * 113.7 - * Licensed under the Aduna BSD-style license. 113.8 +/** 113.9 + * This Source Code Form is subject to the terms of the Mozilla Public 113.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this 113.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 113.12 + * 113.13 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 113.14 + * 113.15 + * http://www.strabon.di.uoa.gr/ 113.16 */ 113.17 package org.openrdf.sail.generaldb; 113.18 113.19 @@ -41,7 +45,7 @@ 113.20 * Coordinates the triple store, namespace manager, optimizer, and evaluation 113.21 * strategy into the {@link SailConnection} interface. 113.22 * 113.23 - * @author James Leigh 113.24 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 113.25 * 113.26 */ 113.27 public class GeneralDBConnection extends SailConnectionBase { 113.28 @@ -112,7 +116,6 @@ 113.29 throws SailException 113.30 { 113.31 removeStatementsInternal(null, null, null, contexts); 113.32 - //XXX our code 113.33 // triples.clearGeoValues(); 113.34 } 113.35
114.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBConnectionFactory.java Fri Apr 19 09:11:47 2013 +0300 114.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBConnectionFactory.java Fri Apr 19 14:37:09 2013 +0300 114.3 @@ -5,45 +5,39 @@ 114.4 */ 114.5 package org.openrdf.sail.generaldb; 114.6 114.7 -import static java.sql.Connection.TRANSACTION_READ_COMMITTED; 114.8 +import info.aduna.concurrent.locks.ExclusiveLockManager; 114.9 +import info.aduna.concurrent.locks.Lock; 114.10 114.11 import java.sql.Connection; 114.12 import java.sql.SQLException; 114.13 114.14 import javax.sql.DataSource; 114.15 114.16 -import info.aduna.concurrent.locks.ExclusiveLockManager; 114.17 -import info.aduna.concurrent.locks.Lock; 114.18 - 114.19 import org.openrdf.model.impl.ValueFactoryImpl; 114.20 import org.openrdf.sail.SailConnection; 114.21 import org.openrdf.sail.SailException; 114.22 -import org.openrdf.sail.helpers.DefaultSailChangedEvent; 114.23 -import org.openrdf.sail.generaldb.evaluation.GeneralDBEvaluationFactory; 114.24 import org.openrdf.sail.generaldb.evaluation.GeneralDBQueryBuilderFactory; 114.25 -import org.openrdf.sail.generaldb.optimizers.GeneralDBQueryOptimizer; 114.26 -import org.openrdf.sail.generaldb.optimizers.GeneralDBSelectQueryOptimizerFactory; 114.27 -import org.openrdf.sail.rdbms.exceptions.RdbmsException; 114.28 import org.openrdf.sail.generaldb.managers.BNodeManager; 114.29 import org.openrdf.sail.generaldb.managers.HashManager; 114.30 import org.openrdf.sail.generaldb.managers.LiteralManager; 114.31 -import org.openrdf.sail.rdbms.managers.NamespaceManager; 114.32 import org.openrdf.sail.generaldb.managers.PredicateManager; 114.33 import org.openrdf.sail.generaldb.managers.TransTableManager; 114.34 -import org.openrdf.sail.generaldb.managers.TripleManager; 114.35 import org.openrdf.sail.generaldb.managers.TripleTableManager; 114.36 import org.openrdf.sail.generaldb.managers.UriManager; 114.37 +import org.openrdf.sail.generaldb.optimizers.GeneralDBQueryOptimizer; 114.38 +import org.openrdf.sail.generaldb.optimizers.GeneralDBSelectQueryOptimizerFactory; 114.39 import org.openrdf.sail.generaldb.schema.BNodeTable; 114.40 import org.openrdf.sail.generaldb.schema.HashTable; 114.41 import org.openrdf.sail.generaldb.schema.IdSequence; 114.42 import org.openrdf.sail.generaldb.schema.IntegerIdSequence; 114.43 import org.openrdf.sail.generaldb.schema.LiteralTable; 114.44 import org.openrdf.sail.generaldb.schema.LongIdSequence; 114.45 +import org.openrdf.sail.generaldb.schema.URITable; 114.46 +import org.openrdf.sail.generaldb.schema.ValueTableFactory; 114.47 +import org.openrdf.sail.rdbms.exceptions.RdbmsException; 114.48 +import org.openrdf.sail.rdbms.managers.NamespaceManager; 114.49 import org.openrdf.sail.rdbms.schema.NamespacesTable; 114.50 import org.openrdf.sail.rdbms.schema.TableFactory; 114.51 -import org.openrdf.sail.generaldb.schema.URITable; 114.52 -import org.openrdf.sail.generaldb.schema.ValueTableFactory; 114.53 -import org.openrdf.sail.rdbms.util.DatabaseLockManager; 114.54 import org.openrdf.sail.rdbms.util.Tracer; 114.55 114.56 /** 114.57 @@ -185,6 +179,7 @@ 114.58 literalManager = new LiteralManager(); 114.59 ValueTableFactory tables = createValueTableFactory(); 114.60 tables.setSequenced(sequenced); 114.61 + 114.62 if (sequenced) { 114.63 ids = new IntegerIdSequence(); 114.64 tables.setIdSequence(ids); 114.65 @@ -200,11 +195,14 @@ 114.66 hashManager.setUriManager(uriManager); 114.67 hashManager.setIdSequence(ids); 114.68 hashManager.init(); 114.69 + 114.70 } else { 114.71 ids = new LongIdSequence(); 114.72 ids.init(); 114.73 tables.setIdSequence(ids); 114.74 + 114.75 } 114.76 + 114.77 namespaces = new NamespaceManager(); 114.78 namespaces.setConnection(resourceInserts); 114.79 NamespacesTable nsTable = tables.createNamespacesTable(nsAndTableIndexes); 114.80 @@ -239,11 +237,15 @@ 114.81 tripleTableManager.setMaxNumberOfTripleTables(maxTripleTables); 114.82 tripleTableManager.setIndexingTriples(triplesIndexed); 114.83 tripleTableManager.initialize(); 114.84 + 114.85 if (triplesIndexed) { 114.86 tripleTableManager.createTripleIndexes(); 114.87 + 114.88 } else { 114.89 tripleTableManager.dropTripleIndexes(); 114.90 + 114.91 } 114.92 + 114.93 bnodeManager.setTable(bnodeTable); 114.94 bnodeManager.init(); 114.95 vf.setBNodeManager(bnodeManager); 114.96 @@ -252,6 +254,7 @@ 114.97 literalManager.init(); 114.98 vf.setLiteralManager(literalManager); 114.99 vf.setPredicateManager(predicateManager); 114.100 + 114.101 } catch (SQLException e) { 114.102 throw new RdbmsException(e); 114.103 }
115.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBProvider.java Fri Apr 19 09:11:47 2013 +0300 115.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBProvider.java Fri Apr 19 14:37:09 2013 +0300 115.3 @@ -1,18 +1,19 @@ 115.4 -/* 115.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 115.6 - * 115.7 - * Licensed under the Aduna BSD-style license. 115.8 +/** 115.9 + * This Source Code Form is subject to the terms of the Mozilla Public 115.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this 115.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 115.12 + * 115.13 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 115.14 + * 115.15 + * http://www.strabon.di.uoa.gr/ 115.16 */ 115.17 package org.openrdf.sail.generaldb; 115.18 - 115.19 -import org.openrdf.sail.rdbms.RdbmsProvider; 115.20 - 115.21 115.22 /** 115.23 * Checks the database product name and version to be compatible with this 115.24 * Sesame store. 115.25 * 115.26 - * @author James Leigh 115.27 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 115.28 * 115.29 */ 115.30 public abstract class GeneralDBProvider {
116.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBTripleRepository.java Fri Apr 19 09:11:47 2013 +0300 116.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBTripleRepository.java Fri Apr 19 14:37:09 2013 +0300 116.3 @@ -493,6 +493,7 @@ 116.4 116.5 /** 116.6 * @author Manos Karpathiotatis <mk@di.uoa.gr> 116.7 + * 116.8 * @throws RdbmsException 116.9 */ 116.10 public void clearGeoValues() throws RdbmsException
117.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBValueFactory.java Fri Apr 19 09:11:47 2013 +0300 117.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBValueFactory.java Fri Apr 19 14:37:09 2013 +0300 117.3 @@ -21,7 +21,6 @@ 117.4 import org.openrdf.model.impl.LiteralImpl; 117.5 import org.openrdf.model.impl.URIImpl; 117.6 import org.openrdf.model.impl.ValueFactoryBase; 117.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 117.8 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 117.9 import org.openrdf.sail.generaldb.managers.BNodeManager; 117.10 import org.openrdf.sail.generaldb.managers.LiteralManager; 117.11 @@ -42,6 +41,8 @@ 117.12 117.13 import com.vividsolutions.jts.io.ParseException; 117.14 117.15 +import eu.earthobservatory.constants.GeoConstants; 117.16 + 117.17 /** 117.18 * Provides basic value creation both for traditional values as well as values 117.19 * with an internal id. {@link RdbmsValue}s behaviour similar to the default
118.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoBuffer.java Fri Apr 19 09:11:47 2013 +0300 118.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoBuffer.java Fri Apr 19 14:37:09 2013 +0300 118.3 @@ -9,17 +9,16 @@ 118.4 import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 118.5 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 118.6 118.7 -public class GeneralDBSqlGeoBuffer extends GeneralDBSqlSpatialConstructBinary{ 118.8 +public class GeneralDBSqlGeoBuffer extends GeneralDBSqlSpatialConstructTriple { 118.9 118.10 - public GeneralDBSqlGeoBuffer(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 118.11 - super(left, right); 118.12 + public GeneralDBSqlGeoBuffer(GeneralDBSqlExpr left, GeneralDBSqlExpr right, GeneralDBSqlExpr third) 118.13 + { 118.14 + super(left, right, third); 118.15 } 118.16 118.17 @Override 118.18 - public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) 118.19 - throws X 118.20 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) throws X 118.21 { 118.22 visitor.meet(this); 118.23 } 118.24 - 118.25 } 118.26 \ No newline at end of file
119.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoDistance.java Fri Apr 19 09:11:47 2013 +0300 119.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoDistance.java Fri Apr 19 14:37:09 2013 +0300 119.3 @@ -9,17 +9,16 @@ 119.4 import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 119.5 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 119.6 119.7 -public class GeneralDBSqlGeoDistance extends GeneralDBSqlSpatialMetricBinary { 119.8 - 119.9 - public GeneralDBSqlGeoDistance(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 119.10 - super(left, right); 119.11 +public class GeneralDBSqlGeoDistance extends GeneralDBSqlSpatialMetricTriple 119.12 +{ 119.13 + public GeneralDBSqlGeoDistance(GeneralDBSqlExpr left, GeneralDBSqlExpr right, GeneralDBSqlExpr third) 119.14 + { 119.15 + super(left, right, third); 119.16 } 119.17 119.18 @Override 119.19 - public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) 119.20 - throws X 119.21 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) throws X 119.22 { 119.23 visitor.meet(this); 119.24 } 119.25 - 119.26 } 119.27 \ No newline at end of file
120.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 120.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlSpatialConstructTriple.java Fri Apr 19 14:37:09 2013 +0300 120.3 @@ -0,0 +1,23 @@ 120.4 +/* 120.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 120.6 + * 120.7 + * Licensed under the Aduna BSD-style license. 120.8 + */ 120.9 +package org.openrdf.sail.generaldb.algebra; 120.10 + 120.11 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 120.12 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 120.13 +import org.openrdf.sail.generaldb.algebra.base.TripleGeneralDBOperator; 120.14 + 120.15 +public class GeneralDBSqlSpatialConstructTriple extends TripleGeneralDBOperator { 120.16 + public GeneralDBSqlSpatialConstructTriple(GeneralDBSqlExpr left, GeneralDBSqlExpr right, GeneralDBSqlExpr third) 120.17 + { 120.18 + super(left, right, third); 120.19 + } 120.20 + 120.21 + @Override 120.22 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) throws X 120.23 + { 120.24 + visitor.meet(this); 120.25 + } 120.26 +}
121.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 121.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlSpatialMetricTriple.java Fri Apr 19 14:37:09 2013 +0300 121.3 @@ -0,0 +1,25 @@ 121.4 +/* 121.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 121.6 + * 121.7 + * Licensed under the Aduna BSD-style license. 121.8 + */ 121.9 +package org.openrdf.sail.generaldb.algebra; 121.10 + 121.11 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 121.12 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 121.13 +import org.openrdf.sail.generaldb.algebra.base.TripleGeneralDBOperator; 121.14 + 121.15 +public class GeneralDBSqlSpatialMetricTriple extends TripleGeneralDBOperator 121.16 +{ 121.17 + public GeneralDBSqlSpatialMetricTriple(GeneralDBSqlExpr left, GeneralDBSqlExpr right, GeneralDBSqlExpr third) 121.18 + { 121.19 + super(left, right, third); 121.20 + } 121.21 + 121.22 + @Override 121.23 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) throws X 121.24 + { 121.25 + visitor.meet(this); 121.26 + } 121.27 + 121.28 +}
122.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java Fri Apr 19 09:11:47 2013 +0300 122.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java Fri Apr 19 14:37:09 2013 +0300 122.3 @@ -110,9 +110,11 @@ 122.4 import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlPeriodUnion; 122.5 import org.openrdf.sail.generaldb.algebra.temporal.GeneralDBSqlStarts; 122.6 import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException; 122.7 + 122.8 /** 122.9 * Support method to create SQL expressions. 122.10 * 122.11 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 122.12 * @author James Leigh 122.13 * @author Manos Karpathiotakis <mk@di.uoa.gr> 122.14 * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> 122.15 @@ -290,12 +292,6 @@ 122.16 // no constructor 122.17 } 122.18 122.19 - /** 122.20 - * my addition 122.21 - * FIXME 122.22 - * 122.23 - */ 122.24 - 122.25 //XXX Spatial Relationship Functions - all 9 of them - stSPARQL++ 122.26 public static GeneralDBSqlExpr equalsGeo(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 122.27 return new GeneralDBSqlEqualsSpatial(left, right); 122.28 @@ -440,9 +436,9 @@ 122.29 return new GeneralDBSqlGeoUnion(left, right); 122.30 } 122.31 122.32 - public static GeneralDBSqlExpr geoBuffer(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 122.33 + public static GeneralDBSqlExpr geoBuffer(GeneralDBSqlExpr left, GeneralDBSqlExpr right, GeneralDBSqlExpr third) { 122.34 122.35 - return new GeneralDBSqlGeoBuffer(left, right); 122.36 + return new GeneralDBSqlGeoBuffer(left, right, third); 122.37 } 122.38 122.39 public static GeneralDBSqlExpr geoTransform(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 122.40 @@ -506,29 +502,23 @@ 122.41 122.42 //XXX Spatial Metric Functions 122.43 public static GeneralDBSqlExpr geoArea(GeneralDBSqlExpr expr) { 122.44 - 122.45 return new GeneralDBSqlGeoArea(expr); 122.46 } 122.47 122.48 - public static GeneralDBSqlExpr geoDistance(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 122.49 - 122.50 - return new GeneralDBSqlGeoDistance(left, right); 122.51 + public static GeneralDBSqlExpr geoDistance(GeneralDBSqlExpr left, GeneralDBSqlExpr right, GeneralDBSqlExpr third) { 122.52 + return new GeneralDBSqlGeoDistance(left, right,third); 122.53 } 122.54 122.55 - 122.56 //XXX Spatial Property Functions 122.57 public static GeneralDBSqlExpr dimension(GeneralDBSqlExpr expr) { 122.58 - 122.59 return new GeneralDBSqlGeoDimension(expr); 122.60 } 122.61 122.62 public static GeneralDBSqlExpr geometryType(GeneralDBSqlExpr expr) { 122.63 - 122.64 return new GeneralDBSqlGeoGeometryType(expr); 122.65 } 122.66 122.67 public static GeneralDBSqlExpr asText(GeneralDBSqlExpr expr) { 122.68 - 122.69 return new GeneralDBSqlGeoAsText(expr); 122.70 } 122.71 122.72 @@ -537,23 +527,19 @@ 122.73 } 122.74 122.75 public static GeneralDBSqlExpr srid(GeneralDBSqlExpr expr) { 122.76 - 122.77 return new GeneralDBSqlGeoSrid(expr); 122.78 } 122.79 122.80 public static GeneralDBSqlExpr isEmpty(GeneralDBSqlExpr expr) { 122.81 - 122.82 return new GeneralDBSqlGeoIsEmpty(expr); 122.83 } 122.84 122.85 public static GeneralDBSqlExpr isSimple(GeneralDBSqlExpr expr) { 122.86 - 122.87 return new GeneralDBSqlGeoIsSimple(expr); 122.88 } 122.89 122.90 122.91 - 122.92 - //XXX GeoSPARQL - Spatial Relations 122.93 + // GeoSPARQL - Spatial Relations 122.94 //Simple Features 122.95 public static GeneralDBSqlExpr sfContains(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 122.96 return new GeneralDBSqlSF_Contains(left, right); 122.97 @@ -652,10 +638,4 @@ 122.98 public static GeneralDBSqlExpr ehOverlap(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 122.99 return new GeneralDBSqlEgenhofer_Overlap(left, right); 122.100 } 122.101 - 122.102 - 122.103 - /** 122.104 - * end of my addition 122.105 - */ 122.106 - 122.107 }
123.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Fri Apr 19 09:11:47 2013 +0300 123.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Fri Apr 19 14:37:09 2013 +0300 123.3 @@ -5,7 +5,88 @@ 123.4 */ 123.5 package org.openrdf.sail.generaldb.algebra.factories; 123.6 123.7 -import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.*; 123.8 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.above; 123.9 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.abs; 123.10 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.and; 123.11 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.asGML; 123.12 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.asText; 123.13 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.below; 123.14 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.cmp; 123.15 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.concat; 123.16 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.contains; 123.17 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.crosses; 123.18 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.diffDateTime; 123.19 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.dimension; 123.20 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.disjoint; 123.21 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.ehContains; 123.22 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.ehCoveredBy; 123.23 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.ehCovers; 123.24 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.ehDisjoint; 123.25 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.ehEquals; 123.26 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.ehInside; 123.27 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.ehMeet; 123.28 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.ehOverlap; 123.29 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.eq; 123.30 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.eqComparingNull; 123.31 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.eqIfNotNull; 123.32 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.equalsGeo; 123.33 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoArea; 123.34 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoBoundary; 123.35 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoBuffer; 123.36 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoConvexHull; 123.37 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoDifference; 123.38 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoDistance; 123.39 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoEnvelope; 123.40 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoIntersection; 123.41 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoSymDifference; 123.42 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoTransform; 123.43 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoUnion; 123.44 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geometryType; 123.45 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.gt; 123.46 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.intersects; 123.47 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.isEmpty; 123.48 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.isNotNull; 123.49 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.isNull; 123.50 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.isSimple; 123.51 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.left; 123.52 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.like; 123.53 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.lowercase; 123.54 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.mbbContains; 123.55 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.mbbEqualsGeo; 123.56 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.mbbIntersects; 123.57 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.mbbWithin; 123.58 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.neq; 123.59 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.not; 123.60 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.num; 123.61 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.or; 123.62 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.overlaps; 123.63 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.rccDisconnected; 123.64 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.rccEquals; 123.65 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.rccExternallyConnected; 123.66 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.rccNonTangentialProperPart; 123.67 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.rccNonTangentialProperPartInverse; 123.68 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.rccPartiallyOverlapping; 123.69 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.rccTangentialProperPart; 123.70 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.rccTangentialProperPartInverse; 123.71 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.regex; 123.72 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.relate; 123.73 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.right; 123.74 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sfContains; 123.75 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sfCrosses; 123.76 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sfDisjoint; 123.77 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sfEquals; 123.78 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sfIntersects; 123.79 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sfOverlaps; 123.80 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sfTouches; 123.81 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sfWithin; 123.82 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.simple; 123.83 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sqlNull; 123.84 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.srid; 123.85 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.str; 123.86 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.sub; 123.87 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.touches; 123.88 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.unsupported; 123.89 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.within; 123.90 123.91 import org.openrdf.model.Literal; 123.92 import org.openrdf.model.Value; 123.93 @@ -31,9 +112,7 @@ 123.94 import org.openrdf.query.algebra.Var; 123.95 import org.openrdf.query.algebra.evaluation.function.Function; 123.96 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 123.97 -import org.openrdf.query.algebra.evaluation.function.link.AddDateTimeFunc; 123.98 import org.openrdf.query.algebra.evaluation.function.spatial.DateTimeMetricFunc; 123.99 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 123.100 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 123.101 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 123.102 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 123.103 @@ -43,6 +122,7 @@ 123.104 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlConvexHullFunc; 123.105 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlEnvelopeFunc; 123.106 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BoundaryFunc; 123.107 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BufferFunc; 123.108 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.ConvexHullFunc; 123.109 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.EnvelopeFunc; 123.110 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.UnionFunc; 123.111 @@ -78,6 +158,10 @@ 123.112 import org.openrdf.sail.generaldb.algebra.GeneralDBTrueValue; 123.113 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 123.114 import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException; 123.115 +import org.slf4j.Logger; 123.116 +import org.slf4j.LoggerFactory; 123.117 + 123.118 +import eu.earthobservatory.constants.GeoConstants; 123.119 123.120 /** 123.121 * Boolean SQL expression factory. This factory can convert a number of core 123.122 @@ -88,6 +172,8 @@ 123.123 */ 123.124 public class GeneralDBBooleanExprFactory extends QueryModelVisitorBase<UnsupportedRdbmsOperatorException> { 123.125 123.126 + private static final Logger logger = LoggerFactory.getLogger(org.openrdf.sail.generaldb.algebra.factories.GeneralDBBooleanExprFactory.class); 123.127 + 123.128 private static final double HR14 = 14 * 60 * 60 * 1000; 123.129 123.130 protected GeneralDBSqlExpr result; 123.131 @@ -201,7 +287,7 @@ 123.132 /***/ 123.133 else //spatial property 123.134 { 123.135 - System.out.println("SPATIAL PROPERTY!!!"); 123.136 + //System.out.println("SPATIAL PROPERTY!!!"); 123.137 rightSql = spatialPropertyFunction((FunctionCall) right, function); 123.138 rightIsSpatial = true; 123.139 } 123.140 @@ -216,10 +302,6 @@ 123.141 } 123.142 } 123.143 123.144 - /** 123.145 - * 123.146 - */ 123.147 - 123.148 switch (op) { 123.149 case EQ: 123.150 if( (!rightIsSpatial && !rightIsDateTime) && (!leftIsSpatial && !leftIsDateTime) ) 123.151 @@ -317,38 +399,33 @@ 123.152 } 123.153 123.154 @Override 123.155 - public void meet(IsBNode node) 123.156 - throws UnsupportedRdbmsOperatorException 123.157 - { 123.158 + public void meet(IsBNode node) throws UnsupportedRdbmsOperatorException 123.159 + { 123.160 result = isNotNull(sql.createBNodeExpr(node.getArg())); 123.161 - } 123.162 + } 123.163 123.164 @Override 123.165 - public void meet(IsLiteral node) 123.166 - throws UnsupportedRdbmsOperatorException 123.167 - { 123.168 + public void meet(IsLiteral node) throws UnsupportedRdbmsOperatorException 123.169 + { 123.170 result = isNotNull(sql.createLabelExpr(node.getArg())); 123.171 - } 123.172 + } 123.173 123.174 @Override 123.175 - public void meet(IsResource node) 123.176 - throws UnsupportedRdbmsOperatorException 123.177 - { 123.178 + public void meet(IsResource node) throws UnsupportedRdbmsOperatorException 123.179 + { 123.180 GeneralDBSqlExpr isBNode = isNotNull(sql.createBNodeExpr(node.getArg())); 123.181 result = or(isBNode, isNotNull(sql.createUriExpr(node.getArg()))); 123.182 - } 123.183 + } 123.184 123.185 @Override 123.186 - public void meet(IsURI node) 123.187 - throws UnsupportedRdbmsOperatorException 123.188 - { 123.189 + public void meet(IsURI node) throws UnsupportedRdbmsOperatorException 123.190 + { 123.191 result = isNotNull(sql.createUriExpr(node.getArg())); 123.192 - } 123.193 + } 123.194 123.195 @Override 123.196 - public void meet(LangMatches node) 123.197 - throws UnsupportedRdbmsOperatorException 123.198 - { 123.199 + public void meet(LangMatches node) throws UnsupportedRdbmsOperatorException 123.200 + { 123.201 ValueExpr left = node.getLeftArg(); 123.202 ValueExpr right = node.getRightArg(); 123.203 GeneralDBSqlCase sqlCase = new GeneralDBSqlCase(); 123.204 @@ -356,39 +433,36 @@ 123.205 GeneralDBSqlExpr pattern = concat(lowercase(label(right)), str("%")); 123.206 sqlCase.when(new GeneralDBTrueValue(), like(label(left), pattern)); 123.207 result = sqlCase; 123.208 - } 123.209 + } 123.210 123.211 @Override 123.212 - public void meet(Not node) 123.213 - throws UnsupportedRdbmsOperatorException 123.214 - { 123.215 + public void meet(Not node) throws UnsupportedRdbmsOperatorException 123.216 + { 123.217 result = not(bool(node.getArg())); 123.218 - } 123.219 + } 123.220 123.221 @Override 123.222 - public void meet(Or node) 123.223 - throws UnsupportedRdbmsOperatorException 123.224 - { 123.225 + public void meet(Or node) throws UnsupportedRdbmsOperatorException 123.226 + { 123.227 result = or(bool(node.getLeftArg()), bool(node.getRightArg())); 123.228 - } 123.229 + } 123.230 123.231 @Override 123.232 - public void meet(Regex node) 123.233 - throws UnsupportedRdbmsOperatorException 123.234 - { 123.235 + public void meet(Regex node) throws UnsupportedRdbmsOperatorException 123.236 + { 123.237 result = regex(label(node.getArg()), label(node.getPatternArg()), label(node.getFlagsArg())); 123.238 - } 123.239 + } 123.240 123.241 @Override 123.242 - public void meet(SameTerm node) 123.243 - throws UnsupportedRdbmsOperatorException 123.244 - { 123.245 + public void meet(SameTerm node) throws UnsupportedRdbmsOperatorException 123.246 + { 123.247 ValueExpr left = node.getLeftArg(); 123.248 ValueExpr right = node.getRightArg(); 123.249 boolean leftIsVar = left instanceof Var; 123.250 boolean rightIsVar = right instanceof Var; 123.251 boolean leftIsConst = left instanceof ValueConstant; 123.252 boolean rightIsConst = right instanceof ValueConstant; 123.253 + 123.254 if (leftIsVar && rightIsVar) { 123.255 result = eq(new GeneralDBRefIdColumn((Var)left), new GeneralDBRefIdColumn((Var)right)); 123.256 } 123.257 @@ -405,132 +479,116 @@ 123.258 GeneralDBSqlExpr literals = and(langs, and(datatype, labels)); 123.259 result = and(bnodes, and(uris, literals)); 123.260 } 123.261 - } 123.262 + } 123.263 123.264 @Override 123.265 - public void meet(ValueConstant vc) 123.266 - throws UnsupportedRdbmsOperatorException 123.267 - { 123.268 + public void meet(ValueConstant vc) throws UnsupportedRdbmsOperatorException 123.269 + { 123.270 result = valueOf(vc.getValue()); 123.271 - } 123.272 + } 123.273 123.274 @Override 123.275 - public void meet(Var var) 123.276 - throws UnsupportedRdbmsOperatorException 123.277 - { 123.278 + public void meet(Var var) throws UnsupportedRdbmsOperatorException 123.279 + { 123.280 if (var.getValue() == null) { 123.281 result = effectiveBooleanValue(var); 123.282 } 123.283 else { 123.284 result = valueOf(var.getValue()); 123.285 } 123.286 - } 123.287 + } 123.288 123.289 public void setSqlExprFactory(GeneralDBSqlExprFactory sql) { 123.290 this.sql = sql; 123.291 } 123.292 123.293 - protected GeneralDBSqlExpr bNode(ValueExpr arg) 123.294 - throws UnsupportedRdbmsOperatorException 123.295 - { 123.296 + protected GeneralDBSqlExpr bNode(ValueExpr arg) throws UnsupportedRdbmsOperatorException 123.297 + { 123.298 return sql.createBNodeExpr(arg); 123.299 - } 123.300 + } 123.301 123.302 - protected GeneralDBSqlExpr bool(ValueExpr arg) 123.303 - throws UnsupportedRdbmsOperatorException 123.304 - { 123.305 + protected GeneralDBSqlExpr bool(ValueExpr arg) throws UnsupportedRdbmsOperatorException 123.306 + { 123.307 return sql.createBooleanExpr(arg); 123.308 - } 123.309 + } 123.310 123.311 - protected GeneralDBSqlExpr label(ValueExpr arg) 123.312 - throws UnsupportedRdbmsOperatorException 123.313 - { 123.314 + protected GeneralDBSqlExpr label(ValueExpr arg) throws UnsupportedRdbmsOperatorException 123.315 + { 123.316 return sql.createLabelExpr(arg); 123.317 - } 123.318 + } 123.319 123.320 - protected GeneralDBSqlExpr lang(ValueExpr arg) 123.321 - throws UnsupportedRdbmsOperatorException 123.322 - { 123.323 + protected GeneralDBSqlExpr lang(ValueExpr arg) throws UnsupportedRdbmsOperatorException 123.324 + { 123.325 return sql.createLanguageExpr(arg); 123.326 - } 123.327 + } 123.328 123.329 - protected GeneralDBSqlExpr hash(ValueExpr arg) 123.330 - throws UnsupportedRdbmsOperatorException 123.331 - { 123.332 + protected GeneralDBSqlExpr hash(ValueExpr arg) throws UnsupportedRdbmsOperatorException 123.333 + { 123.334 return sql.createHashExpr(arg); 123.335 - } 123.336 + } 123.337 123.338 @Override 123.339 - protected void meetNode(QueryModelNode arg) 123.340 - throws UnsupportedRdbmsOperatorException 123.341 - { 123.342 + protected void meetNode(QueryModelNode arg) throws UnsupportedRdbmsOperatorException 123.343 + { 123.344 if (arg instanceof ValueExpr) { 123.345 result = effectiveBooleanValue((ValueExpr)arg); 123.346 } 123.347 else { 123.348 throw unsupported(arg); 123.349 } 123.350 - } 123.351 + } 123.352 123.353 - protected GeneralDBSqlExpr numeric(ValueExpr arg) 123.354 - throws UnsupportedRdbmsOperatorException 123.355 - { 123.356 + protected GeneralDBSqlExpr numeric(ValueExpr arg) throws UnsupportedRdbmsOperatorException 123.357 + { 123.358 return sql.createNumericExpr(arg); 123.359 - } 123.360 + } 123.361 123.362 - protected GeneralDBSqlExpr time(ValueExpr arg) 123.363 - throws UnsupportedRdbmsOperatorException 123.364 - { 123.365 + protected GeneralDBSqlExpr time(ValueExpr arg) throws UnsupportedRdbmsOperatorException 123.366 + { 123.367 return sql.createTimeExpr(arg); 123.368 - } 123.369 + } 123.370 123.371 - protected GeneralDBSqlExpr type(ValueExpr arg) 123.372 - throws UnsupportedRdbmsOperatorException 123.373 - { 123.374 + protected GeneralDBSqlExpr type(ValueExpr arg) throws UnsupportedRdbmsOperatorException 123.375 + { 123.376 return sql.createDatatypeExpr(arg); 123.377 - } 123.378 + } 123.379 123.380 - protected GeneralDBSqlExpr uri(ValueExpr arg) 123.381 - throws UnsupportedRdbmsOperatorException 123.382 - { 123.383 + protected GeneralDBSqlExpr uri(ValueExpr arg) throws UnsupportedRdbmsOperatorException 123.384 + { 123.385 return sql.createUriExpr(arg); 123.386 - } 123.387 + } 123.388 123.389 - protected GeneralDBSqlExpr zoned(ValueExpr arg) 123.390 - throws UnsupportedRdbmsOperatorException 123.391 - { 123.392 + protected GeneralDBSqlExpr zoned(ValueExpr arg) throws UnsupportedRdbmsOperatorException 123.393 + { 123.394 return sql.createZonedExpr(arg); 123.395 - } 123.396 + } 123.397 123.398 - private GeneralDBSqlExpr effectiveBooleanValue(ValueExpr v) 123.399 - throws UnsupportedRdbmsOperatorException 123.400 - { 123.401 + private GeneralDBSqlExpr effectiveBooleanValue(ValueExpr v) throws UnsupportedRdbmsOperatorException 123.402 + { 123.403 String bool = XMLSchema.BOOLEAN.stringValue(); 123.404 GeneralDBSqlCase sqlCase = new GeneralDBSqlCase(); 123.405 sqlCase.when(eq(type(v), str(bool)), eq(label(v), str("true"))); 123.406 sqlCase.when(simple(type(v)), not(eq(label(v), str("")))); 123.407 sqlCase.when(isNotNull(numeric(v)), not(eq(numeric(v), num(0)))); 123.408 return sqlCase; 123.409 - } 123.410 + } 123.411 123.412 - private GeneralDBSqlExpr equal(ValueExpr left, ValueExpr right) 123.413 - throws UnsupportedRdbmsOperatorException 123.414 - { 123.415 + private GeneralDBSqlExpr equal(ValueExpr left, ValueExpr right) throws UnsupportedRdbmsOperatorException 123.416 + { 123.417 GeneralDBSqlExpr bnodes = eq(bNode(left), bNode(right)); 123.418 GeneralDBSqlExpr uris = eq(uri(left), uri(right)); 123.419 GeneralDBSqlCase scase = new GeneralDBSqlCase(); 123.420 scase.when(or(isNotNull(bNode(left)), isNotNull(bNode(right))), bnodes); 123.421 scase.when(or(isNotNull(uri(left)), isNotNull(uri(right))), uris); 123.422 return literalEqual(left, right, scase); 123.423 - } 123.424 + } 123.425 123.426 private boolean isTerm(ValueExpr node) { 123.427 return node instanceof Var || node instanceof ValueConstant; 123.428 } 123.429 123.430 - private GeneralDBSqlExpr literalEqual(ValueExpr left, ValueExpr right, GeneralDBSqlCase scase) 123.431 - throws UnsupportedRdbmsOperatorException 123.432 - { 123.433 + private GeneralDBSqlExpr literalEqual(ValueExpr left, ValueExpr right, GeneralDBSqlCase scase) throws UnsupportedRdbmsOperatorException 123.434 + { 123.435 GeneralDBSqlExpr labels = eq(label(left), label(right)); 123.436 GeneralDBSqlExpr langs = and(eqIfNotNull(lang(left), lang(right)), labels.clone()); 123.437 GeneralDBSqlExpr numeric = eq(numeric(left), numeric(right)); 123.438 @@ -546,18 +604,17 @@ 123.439 scase.when(comparable, time); 123.440 scase.when(and(eq(type(left), type(right)), labels.clone()), new GeneralDBTrueValue()); 123.441 return scase; 123.442 - } 123.443 + } 123.444 123.445 - private GeneralDBSqlExpr termsEqual(ValueExpr left, ValueExpr right) 123.446 - throws UnsupportedRdbmsOperatorException 123.447 - { 123.448 + private GeneralDBSqlExpr termsEqual(ValueExpr left, ValueExpr right) throws UnsupportedRdbmsOperatorException 123.449 + { 123.450 GeneralDBSqlExpr bnodes = eqIfNotNull(bNode(left), bNode(right)); 123.451 GeneralDBSqlExpr uris = eqIfNotNull(uri(left), uri(right)); 123.452 GeneralDBSqlCase scase = new GeneralDBSqlCase(); 123.453 scase.when(or(isNotNull(bNode(left)), isNotNull(bNode(right))), bnodes); 123.454 scase.when(or(isNotNull(uri(left)), isNotNull(uri(right))), uris); 123.455 return literalEqual(left, right, scase); 123.456 - } 123.457 + } 123.458 123.459 private GeneralDBSqlExpr valueOf(Value value) { 123.460 if (value instanceof Literal) { 123.461 @@ -570,18 +627,18 @@ 123.462 } 123.463 123.464 /** 123.465 - * FIXME spatials 123.466 + * Spatials 123.467 */ 123.468 @Override 123.469 - public void meet(FunctionCall functionCall) 123.470 - throws UnsupportedRdbmsOperatorException 123.471 - { 123.472 + public void meet(FunctionCall functionCall) throws UnsupportedRdbmsOperatorException 123.473 + { 123.474 Function function = FunctionRegistry.getInstance().get(functionCall.getURI()); 123.475 123.476 if(function instanceof SpatialConstructFunc) 123.477 { 123.478 GeneralDBSqlExpr leftArg = null; 123.479 GeneralDBSqlExpr rightArg = null; 123.480 + GeneralDBSqlExpr thirdArg = null; 123.481 123.482 ValueExpr left = functionCall.getArgs().get(0); 123.483 123.484 @@ -610,12 +667,12 @@ 123.485 } 123.486 else 123.487 { 123.488 - if(function.getURI().equals(GeoConstants.buffer)) 123.489 + if(function.getURI().equals(GeoConstants.stSPARQLbuffer)) 123.490 { 123.491 //Be it a Var or a Value Constant, 'numeric' is the way to go 123.492 rightArg = numeric(right); 123.493 } 123.494 - else if(function.getURI().equals(GeoConstants.transform)) 123.495 + else if(function.getURI().equals(GeoConstants.stSPARQLtransform)) 123.496 { 123.497 //Another special case -> Second argument of this function is a URI 123.498 rightArg = uri(right); 123.499 @@ -627,9 +684,11 @@ 123.500 rightArg = label(right); 123.501 } 123.502 } 123.503 + if(function instanceof BufferFunc) 123.504 + thirdArg = uri(functionCall.getArgs().get(2)); 123.505 } 123.506 123.507 - result = spatialConstructPicker(function, leftArg, rightArg); 123.508 + result = spatialConstructPicker(function, leftArg, rightArg, thirdArg); 123.509 123.510 } 123.511 else if(function instanceof SpatialRelationshipFunc) 123.512 @@ -691,9 +750,9 @@ 123.513 else if(function instanceof SpatialMetricFunc) 123.514 //Argument # depending on the function selected 123.515 { 123.516 - //TODO 123.517 GeneralDBSqlExpr leftArg = null; 123.518 GeneralDBSqlExpr rightArg = null; 123.519 + GeneralDBSqlExpr thirdArg = null; 123.520 123.521 ValueExpr left = functionCall.getArgs().get(0); 123.522 123.523 @@ -706,7 +765,7 @@ 123.524 leftArg = label(left); 123.525 } 123.526 123.527 - //These two functions only have one argument!! 123.528 + //Area function has only one argument!! 123.529 if(!(function instanceof AreaFunc)) 123.530 { 123.531 ValueExpr right = functionCall.getArgs().get(1); 123.532 @@ -719,9 +778,10 @@ 123.533 { 123.534 rightArg = label(right); 123.535 } 123.536 + thirdArg = uri(functionCall.getArgs().get(2)); 123.537 } 123.538 123.539 - result = spatialMetricPicker(function, leftArg, rightArg); 123.540 + result = spatialMetricPicker(function, leftArg, rightArg, thirdArg); 123.541 } 123.542 else if(function instanceof TemporalRelationFunc) 123.543 { 123.544 @@ -756,8 +816,7 @@ 123.545 { 123.546 meetNode(functionCall); 123.547 } 123.548 - 123.549 - } 123.550 + } 123.551 123.552 /** 123.553 * Addition for datetime metric functions 123.554 @@ -774,8 +833,6 @@ 123.555 } 123.556 return null; 123.557 } 123.558 - 123.559 - /***/ 123.560 123.561 public GeneralDBSqlExpr spatialFunction(FunctionCall functionCall) throws UnsupportedRdbmsOperatorException 123.562 { 123.563 @@ -885,7 +942,6 @@ 123.564 ValueExpr left = functionCall.getArgs().get(0); 123.565 ValueExpr right = functionCall.getArgs().get(1); 123.566 123.567 - 123.568 GeneralDBSqlExpr leftArg = null; 123.569 GeneralDBSqlExpr rightArg = null; 123.570 GeneralDBSqlExpr thirdArg = null; 123.571 @@ -924,10 +980,10 @@ 123.572 { 123.573 GeneralDBSqlExpr leftArg = null; 123.574 GeneralDBSqlExpr rightArg = null; 123.575 + GeneralDBSqlExpr thirdArg = null; 123.576 123.577 ValueExpr left = functionCall.getArgs().get(0); 123.578 123.579 - 123.580 if(left instanceof FunctionCall) 123.581 { 123.582 leftArg = spatialFunction((FunctionCall) left); 123.583 @@ -937,9 +993,6 @@ 123.584 leftArg = label(left); 123.585 } 123.586 123.587 - 123.588 - 123.589 - 123.590 if(!(function instanceof EnvelopeFunc) 123.591 && !(function instanceof ConvexHullFunc) 123.592 && !(function instanceof BoundaryFunc) 123.593 @@ -955,12 +1008,12 @@ 123.594 } 123.595 else 123.596 { 123.597 - if(function.getURI().equals(GeoConstants.buffer)) 123.598 + if(function.getURI().equals(GeoConstants.stSPARQLbuffer)) 123.599 { 123.600 //Be it a Var or a Value Constant, 'numeric' is the way to go 123.601 rightArg = numeric(right); 123.602 } 123.603 - else if(function.getURI().equals(GeoConstants.transform)) 123.604 + else if(function.getURI().equals(GeoConstants.stSPARQLtransform)) 123.605 { 123.606 //Another special case -> Second argument of this function is a URI 123.607 rightArg = uri(right); 123.608 @@ -972,9 +1025,11 @@ 123.609 rightArg = label(right); 123.610 } 123.611 } 123.612 + if(function instanceof BufferFunc) 123.613 + thirdArg = uri(functionCall.getArgs().get(2)); 123.614 } 123.615 123.616 - return spatialConstructPicker(function, leftArg, rightArg); 123.617 + return spatialConstructPicker(function, leftArg, rightArg, thirdArg); 123.618 123.619 } 123.620 123.621 @@ -1015,12 +1070,11 @@ 123.622 123.623 } 123.624 123.625 - /***/ 123.626 - 123.627 GeneralDBSqlExpr spatialMetricFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException 123.628 { 123.629 GeneralDBSqlExpr leftArg = null; 123.630 GeneralDBSqlExpr rightArg = null; 123.631 + GeneralDBSqlExpr thirdArg = null; 123.632 123.633 ValueExpr left = functionCall.getArgs().get(0); 123.634 123.635 @@ -1034,8 +1088,6 @@ 123.636 leftArg = label(left); 123.637 } 123.638 123.639 - 123.640 - 123.641 if(!(function instanceof AreaFunc)) 123.642 { 123.643 ValueExpr right = functionCall.getArgs().get(1); 123.644 @@ -1047,9 +1099,10 @@ 123.645 { 123.646 rightArg = label(right); 123.647 } 123.648 + thirdArg = uri(functionCall.getArgs().get(2)); 123.649 } 123.650 123.651 - return spatialMetricPicker(function, leftArg, rightArg); 123.652 + return spatialMetricPicker(function, leftArg, rightArg, thirdArg); 123.653 123.654 } 123.655 123.656 @@ -1168,73 +1221,73 @@ 123.657 GeneralDBSqlExpr thirdArg) 123.658 { 123.659 //XXX stSPARQL 123.660 - if(function.getURI().equals(GeoConstants.equals)) 123.661 + if(function.getURI().equals(GeoConstants.stSPARQLequals)) 123.662 { 123.663 return equalsGeo(leftArg,rightArg); 123.664 } 123.665 - else if(function.getURI().equals(GeoConstants.disjoint)) 123.666 + else if(function.getURI().equals(GeoConstants.stSPARQLdisjoint)) 123.667 { 123.668 return disjoint(leftArg,rightArg); 123.669 } 123.670 - else if(function.getURI().equals(GeoConstants.intersects)) 123.671 + else if(function.getURI().equals(GeoConstants.stSPARQLintersects)) 123.672 { 123.673 return intersects(leftArg,rightArg); 123.674 } 123.675 - else if(function.getURI().equals(GeoConstants.touches)) 123.676 + else if(function.getURI().equals(GeoConstants.stSPARQLtouches)) 123.677 { 123.678 return touches(leftArg,rightArg); 123.679 } 123.680 - else if(function.getURI().equals(GeoConstants.crosses)) 123.681 + else if(function.getURI().equals(GeoConstants.stSPARQLcrosses)) 123.682 { 123.683 return crosses(leftArg,rightArg); 123.684 } 123.685 - else if(function.getURI().equals(GeoConstants.within)) 123.686 + else if(function.getURI().equals(GeoConstants.stSPARQLwithin)) 123.687 { 123.688 return within(leftArg,rightArg); 123.689 } 123.690 - else if(function.getURI().equals(GeoConstants.contains)) 123.691 + else if(function.getURI().equals(GeoConstants.stSPARQLcontains)) 123.692 { 123.693 return contains(leftArg,rightArg); 123.694 } 123.695 - else if(function.getURI().equals(GeoConstants.overlaps)) 123.696 + else if(function.getURI().equals(GeoConstants.stSPARQLoverlaps)) 123.697 { 123.698 return overlaps(leftArg,rightArg); 123.699 } 123.700 - else if(function.getURI().equals(GeoConstants.relate)) 123.701 + else if(function.getURI().equals(GeoConstants.stSPARQLrelate)) 123.702 { 123.703 return relate(leftArg,rightArg,thirdArg); 123.704 } 123.705 // directional 123.706 - else if(function.getURI().equals(GeoConstants.left)) 123.707 + else if(function.getURI().equals(GeoConstants.stSPARQLleft)) 123.708 { 123.709 return left(leftArg,rightArg); 123.710 } 123.711 - else if(function.getURI().equals(GeoConstants.right)) 123.712 + else if(function.getURI().equals(GeoConstants.stSPARQLright)) 123.713 { 123.714 return right(leftArg,rightArg); 123.715 } 123.716 - else if(function.getURI().equals(GeoConstants.above)) 123.717 + else if(function.getURI().equals(GeoConstants.stSPARQLabove)) 123.718 { 123.719 return above(leftArg,rightArg); 123.720 } 123.721 - else if(function.getURI().equals(GeoConstants.below)) 123.722 + else if(function.getURI().equals(GeoConstants.stSPARQLbelow)) 123.723 { 123.724 return below(leftArg,rightArg); 123.725 } 123.726 // mbb 123.727 - else if(function.getURI().equals(GeoConstants.mbbIntersects)) 123.728 + else if(function.getURI().equals(GeoConstants.stSPARQLmbbIntersects)) 123.729 { 123.730 return mbbIntersects(leftArg,rightArg); 123.731 } 123.732 - else if(function.getURI().equals(GeoConstants.mbbWithin)) 123.733 + else if(function.getURI().equals(GeoConstants.stSPARQLmbbWithin)) 123.734 { 123.735 return mbbWithin(leftArg,rightArg); 123.736 } 123.737 - else if(function.getURI().equals(GeoConstants.mbbContains)) 123.738 + else if(function.getURI().equals(GeoConstants.stSPARQLmbbContains)) 123.739 { 123.740 return mbbContains(leftArg,rightArg); 123.741 } 123.742 - else if(function.getURI().equals(GeoConstants.mbbEquals)) 123.743 + else if(function.getURI().equals(GeoConstants.stSPARQLmbbEquals)) 123.744 { 123.745 return mbbEqualsGeo(leftArg,rightArg); 123.746 } 123.747 @@ -1375,46 +1428,47 @@ 123.748 { 123.749 return relate(leftArg,rightArg,thirdArg); 123.750 } 123.751 - //Should never reach this place 123.752 + 123.753 + logger.error("[Strabon.spatialRelationshipPicker] No appropriate SQL expression was generated for extension function {}. This is probably a bug.", function.getURI()); 123.754 return null; 123.755 } 123.756 123.757 123.758 - GeneralDBSqlExpr spatialConstructPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) 123.759 + GeneralDBSqlExpr spatialConstructPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg) 123.760 { 123.761 - if(function.getURI().equals(GeoConstants.union)) 123.762 + if(function.getURI().equals(GeoConstants.stSPARQLunion)) 123.763 { 123.764 return geoUnion(leftArg, rightArg); 123.765 } 123.766 - else if(function.getURI().equals(GeoConstants.buffer)) 123.767 + else if(function.getURI().equals(GeoConstants.stSPARQLbuffer)) 123.768 { 123.769 - return geoBuffer(leftArg,rightArg); 123.770 + return geoBuffer(leftArg, rightArg, thirdArg); 123.771 } 123.772 - else if(function.getURI().equals(GeoConstants.transform)) 123.773 + else if(function.getURI().equals(GeoConstants.stSPARQLtransform)) 123.774 { 123.775 return geoTransform(leftArg,rightArg); 123.776 } 123.777 - else if(function.getURI().equals(GeoConstants.envelope)) 123.778 + else if(function.getURI().equals(GeoConstants.stSPARQLenvelope)) 123.779 { 123.780 return geoEnvelope(leftArg); 123.781 } 123.782 - else if(function.getURI().equals(GeoConstants.convexHull)) 123.783 + else if(function.getURI().equals(GeoConstants.stSPARQLconvexHull)) 123.784 { 123.785 return geoConvexHull(leftArg); 123.786 } 123.787 - else if(function.getURI().equals(GeoConstants.boundary)) 123.788 + else if(function.getURI().equals(GeoConstants.stSPARQLboundary)) 123.789 { 123.790 return geoBoundary(leftArg); 123.791 } 123.792 - else if(function.getURI().equals(GeoConstants.intersection)) 123.793 + else if(function.getURI().equals(GeoConstants.stSPARQLintersection)) 123.794 { 123.795 return geoIntersection(leftArg, rightArg); 123.796 } 123.797 - else if(function.getURI().equals(GeoConstants.difference)) 123.798 + else if(function.getURI().equals(GeoConstants.stSPARQLdifference)) 123.799 { 123.800 return geoDifference(leftArg, rightArg); 123.801 } 123.802 - else if(function.getURI().equals(GeoConstants.symDifference)) 123.803 + else if(function.getURI().equals(GeoConstants.stSPARQLsymDifference)) 123.804 { 123.805 return geoSymDifference(leftArg, rightArg); 123.806 } 123.807 @@ -1449,7 +1503,7 @@ 123.808 return geoBoundary(leftArg); 123.809 } 123.810 123.811 - //Should never reach this place 123.812 + logger.error("[Strabon.spatialConstructPicker] No appropriate SQL expression was generated for extension function {}. This is probably a bug.", function.getURI()); 123.813 return null; 123.814 } 123.815 123.816 @@ -1458,7 +1512,6 @@ 123.817 * @author George Garbis <ggarbis@di.uoa.gr> 123.818 * 123.819 */ 123.820 - 123.821 GeneralDBSqlExpr dateTimeMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) 123.822 { 123.823 if(function.getURI().equals(GeoConstants.diffDateTime)) 123.824 @@ -1466,60 +1519,60 @@ 123.825 return diffDateTime(leftArg, rightArg); 123.826 } 123.827 123.828 - //Should never reach this place 123.829 + logger.error("[Strabon.dateTimeMetricPicker] No appropriate SQL expression was generated for extension function {}. This is probably a bug.", function.getURI()); 123.830 return null; 123.831 } 123.832 123.833 - /***/ 123.834 - 123.835 //TODO more to be added here probably 123.836 - GeneralDBSqlExpr spatialMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) 123.837 + GeneralDBSqlExpr spatialMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg) 123.838 { 123.839 - if(function.getURI().equals(GeoConstants.distance)) 123.840 + if(function.getURI().equals(GeoConstants.stSPARQLdistance)) 123.841 { 123.842 - return geoDistance(leftArg, rightArg); 123.843 + return geoDistance(leftArg, rightArg, thirdArg); 123.844 } 123.845 - else if(function.getURI().equals(GeoConstants.area)) 123.846 + else if(function.getURI().equals(GeoConstants.stSPARQLarea)) 123.847 { 123.848 return geoArea(leftArg); 123.849 } 123.850 //GeoSPARQL's distance must be added at this place 123.851 123.852 - //Should never reach this place 123.853 + logger.error("[Strabon.spatialMetricPicker] No appropriate SQL expression was generated for extension function {}. This is probably a bug.", function.getURI()); 123.854 return null; 123.855 } 123.856 123.857 - GeneralDBSqlExpr spatialPropertyPicker(Function function,GeneralDBSqlExpr arg) 123.858 + GeneralDBSqlExpr spatialPropertyPicker(Function function, GeneralDBSqlExpr arg) 123.859 { 123.860 - if(function.getURI().equals(GeoConstants.dimension)) 123.861 + if(function.getURI().equals(GeoConstants.stSPARQLdimension)) 123.862 { 123.863 return dimension(arg); 123.864 } 123.865 - else if(function.getURI().equals(GeoConstants.geometryType)) 123.866 + else if(function.getURI().equals(GeoConstants.stSPARQLgeometryType)) 123.867 { 123.868 return geometryType(arg); 123.869 } 123.870 - else if(function.getURI().equals(GeoConstants.asText)) 123.871 + else if(function.getURI().equals(GeoConstants.stSPARQLasText)) 123.872 { 123.873 return asText(arg); 123.874 } 123.875 - else if(function.getURI().equals(GeoConstants.srid)) 123.876 + else if(function.getURI().equals(GeoConstants.stSPARQLsrid) || 123.877 + function.getURI().equals(GeoConstants.geoSparqlGetSRID)) 123.878 { 123.879 return srid(arg); 123.880 } 123.881 - else if(function.getURI().equals(GeoConstants.isEmpty)) 123.882 + else if(function.getURI().equals(GeoConstants.stSPARQLisEmpty)) 123.883 { 123.884 return isEmpty(arg); 123.885 } 123.886 - else if(function.getURI().equals(GeoConstants.isSimple)) 123.887 + else if(function.getURI().equals(GeoConstants.stSPARQLisSimple)) 123.888 { 123.889 return isSimple(arg); 123.890 123.891 - } else if (function.getURI().equals(GeoConstants.asGML)) { 123.892 + } else if (function.getURI().equals(GeoConstants.stSPARQLasGML)) { 123.893 return asGML(arg); 123.894 } 123.895 123.896 - //Should never reach this place 123.897 + logger.error("[Strabon.GeneralDBBooleanExprFactory] No appropriate SQL expression was generated for extension function {}. This is probably a bug.", function.getURI()); 123.898 + 123.899 return null; 123.900 } 123.901
124.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java Fri Apr 19 09:11:47 2013 +0300 124.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java Fri Apr 19 14:37:09 2013 +0300 124.3 @@ -43,7 +43,6 @@ 124.4 import org.openrdf.query.algebra.evaluation.function.Function; 124.5 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 124.6 import org.openrdf.query.algebra.evaluation.function.spatial.DateTimeMetricFunc; 124.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 124.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 124.9 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 124.10 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 124.11 @@ -51,6 +50,7 @@ 124.12 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlConvexHullFunc; 124.13 import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlEnvelopeFunc; 124.14 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BoundaryFunc; 124.15 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BufferFunc; 124.16 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.ConvexHullFunc; 124.17 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.EnvelopeFunc; 124.18 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc; 124.19 @@ -63,6 +63,8 @@ 124.20 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 124.21 import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException; 124.22 124.23 +import eu.earthobservatory.constants.GeoConstants; 124.24 + 124.25 /** 124.26 * Creates an SQL expression of a literal's numeric value. 124.27 * 124.28 @@ -214,6 +216,7 @@ 124.29 124.30 GeneralDBSqlExpr leftArg = null; 124.31 GeneralDBSqlExpr rightArg = null; 124.32 + GeneralDBSqlExpr thirdArg = null; 124.33 124.34 ValueExpr left = functionCall.getArgs().get(0); 124.35 124.36 @@ -227,8 +230,6 @@ 124.37 leftArg = label(left); 124.38 } 124.39 124.40 - 124.41 - 124.42 if((function instanceof DistanceFunc)) 124.43 { 124.44 ValueExpr right = functionCall.getArgs().get(1); 124.45 @@ -240,11 +241,13 @@ 124.46 { 124.47 rightArg = label(right); 124.48 } 124.49 + 124.50 + thirdArg = uri(functionCall.getArgs().get(2)); 124.51 } 124.52 124.53 if(function instanceof SpatialMetricFunc) 124.54 { 124.55 - return spatialMetricPicker(function, leftArg, rightArg); 124.56 + return spatialMetricPicker(function, leftArg, rightArg, thirdArg); 124.57 } 124.58 else //if(functionCall instanceof SpatialPropertyFunc) 124.59 { 124.60 @@ -295,6 +298,7 @@ 124.61 { 124.62 GeneralDBSqlExpr leftArg = null; 124.63 GeneralDBSqlExpr rightArg = null; 124.64 + GeneralDBSqlExpr thirdArg = null; 124.65 124.66 ValueExpr left = functionCall.getArgs().get(0); 124.67 124.68 @@ -308,8 +312,6 @@ 124.69 leftArg = label(left); 124.70 } 124.71 124.72 - 124.73 - 124.74 if(!(function instanceof EnvelopeFunc) 124.75 && !(function instanceof ConvexHullFunc) 124.76 && !(function instanceof BoundaryFunc) 124.77 @@ -324,12 +326,12 @@ 124.78 } 124.79 else 124.80 { 124.81 - if(function.getURI().equals(GeoConstants.buffer)) 124.82 + if(function.getURI().equals(GeoConstants.stSPARQLbuffer)) 124.83 { 124.84 //Be it a Var or a Value Constant, 'numeric' is the way to go 124.85 rightArg = this.createNumericExpr(right); 124.86 } 124.87 - else if(function.getURI().equals(GeoConstants.transform)) 124.88 + else if(function.getURI().equals(GeoConstants.stSPARQLtransform)) 124.89 { 124.90 //Another special case -> Second argument of this function is a URI 124.91 rightArg = uri(right); 124.92 @@ -340,14 +342,12 @@ 124.93 //thus the special treatment 124.94 rightArg = label(right); 124.95 } 124.96 - 124.97 - 124.98 - 124.99 - 124.100 } 124.101 + if(function instanceof BufferFunc) 124.102 + thirdArg = uri(functionCall.getArgs().get(2)); 124.103 } 124.104 124.105 - return spatialConstructPicker(function, leftArg, rightArg); 124.106 + return spatialConstructPicker(function, leftArg, rightArg, thirdArg); 124.107 124.108 } 124.109 124.110 @@ -380,6 +380,7 @@ 124.111 { 124.112 GeneralDBSqlExpr leftArg = null; 124.113 GeneralDBSqlExpr rightArg = null; 124.114 + GeneralDBSqlExpr thirdArg = null; 124.115 124.116 ValueExpr left = functionCall.getArgs().get(0); 124.117 124.118 @@ -393,8 +394,6 @@ 124.119 leftArg = label(left); 124.120 } 124.121 124.122 - 124.123 - 124.124 if(!(function instanceof AreaFunc)) 124.125 { 124.126 ValueExpr right = functionCall.getArgs().get(1); 124.127 @@ -406,10 +405,11 @@ 124.128 { 124.129 rightArg = label(right); 124.130 } 124.131 + 124.132 + thirdArg = uri(functionCall.getArgs().get(2)); 124.133 } 124.134 124.135 - return spatialMetricPicker(function, leftArg, rightArg); 124.136 - 124.137 + return spatialMetricPicker(function, leftArg, rightArg, thirdArg); 124.138 } 124.139 124.140 GeneralDBSqlExpr spatialPropertyFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException 124.141 @@ -433,41 +433,41 @@ 124.142 } 124.143 124.144 124.145 - GeneralDBSqlExpr spatialConstructPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) 124.146 + GeneralDBSqlExpr spatialConstructPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg) 124.147 { 124.148 - if(function.getURI().equals(GeoConstants.union)) 124.149 + if(function.getURI().equals(GeoConstants.stSPARQLunion)) 124.150 { 124.151 return geoUnion(leftArg, rightArg); 124.152 } 124.153 - else if(function.getURI().equals(GeoConstants.buffer)) 124.154 + else if(function.getURI().equals(GeoConstants.stSPARQLbuffer)) 124.155 { 124.156 - return geoBuffer(leftArg,rightArg); 124.157 + return geoBuffer(leftArg,rightArg, thirdArg); 124.158 } 124.159 - else if(function.getURI().equals(GeoConstants.transform)) 124.160 + else if(function.getURI().equals(GeoConstants.stSPARQLtransform)) 124.161 { 124.162 return geoTransform(leftArg,rightArg); 124.163 } 124.164 - else if(function.getURI().equals(GeoConstants.envelope)) 124.165 + else if(function.getURI().equals(GeoConstants.stSPARQLenvelope)) 124.166 { 124.167 return geoEnvelope(leftArg); 124.168 } 124.169 - else if(function.getURI().equals(GeoConstants.convexHull)) 124.170 + else if(function.getURI().equals(GeoConstants.stSPARQLconvexHull)) 124.171 { 124.172 return geoConvexHull(leftArg); 124.173 } 124.174 - else if(function.getURI().equals(GeoConstants.boundary)) 124.175 + else if(function.getURI().equals(GeoConstants.stSPARQLboundary)) 124.176 { 124.177 return geoBoundary(leftArg); 124.178 } 124.179 - else if(function.getURI().equals(GeoConstants.intersection)) 124.180 + else if(function.getURI().equals(GeoConstants.stSPARQLintersection)) 124.181 { 124.182 return geoIntersection(leftArg, rightArg); 124.183 } 124.184 - else if(function.getURI().equals(GeoConstants.difference)) 124.185 + else if(function.getURI().equals(GeoConstants.stSPARQLdifference)) 124.186 { 124.187 return geoDifference(leftArg, rightArg); 124.188 } 124.189 - else if(function.getURI().equals(GeoConstants.symDifference)) 124.190 + else if(function.getURI().equals(GeoConstants.stSPARQLsymDifference)) 124.191 { 124.192 return geoSymDifference(leftArg, rightArg); 124.193 } 124.194 @@ -524,13 +524,13 @@ 124.195 /***/ 124.196 124.197 //TODO more to be added here probably 124.198 - GeneralDBSqlExpr spatialMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) 124.199 + GeneralDBSqlExpr spatialMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg) 124.200 { 124.201 - if(function.getURI().equals(GeoConstants.distance)) 124.202 + if(function.getURI().equals(GeoConstants.stSPARQLdistance)) 124.203 { 124.204 - return geoDistance(leftArg, rightArg); 124.205 + return geoDistance(leftArg, rightArg, thirdArg); 124.206 } 124.207 - else if(function.getURI().equals(GeoConstants.area)) 124.208 + else if(function.getURI().equals(GeoConstants.stSPARQLarea)) 124.209 { 124.210 return geoArea(leftArg); 124.211 } 124.212 @@ -542,27 +542,27 @@ 124.213 124.214 GeneralDBSqlExpr spatialPropertyPicker(Function function,GeneralDBSqlExpr arg) 124.215 { 124.216 - if(function.getURI().equals(GeoConstants.dimension)) 124.217 + if(function.getURI().equals(GeoConstants.stSPARQLdimension)) 124.218 { 124.219 return dimension(arg); 124.220 } 124.221 - else if(function.getURI().equals(GeoConstants.geometryType)) 124.222 + else if(function.getURI().equals(GeoConstants.stSPARQLgeometryType)) 124.223 { 124.224 return geometryType(arg); 124.225 } 124.226 - else if(function.getURI().equals(GeoConstants.asText)) 124.227 + else if(function.getURI().equals(GeoConstants.stSPARQLasText)) 124.228 { 124.229 return asText(arg); 124.230 } 124.231 - else if(function.getURI().equals(GeoConstants.srid)) 124.232 + else if(function.getURI().equals(GeoConstants.stSPARQLsrid)) 124.233 { 124.234 return srid(arg); 124.235 } 124.236 - else if(function.getURI().equals(GeoConstants.isEmpty)) 124.237 + else if(function.getURI().equals(GeoConstants.stSPARQLisEmpty)) 124.238 { 124.239 return isEmpty(arg); 124.240 } 124.241 - else if(function.getURI().equals(GeoConstants.isSimple)) 124.242 + else if(function.getURI().equals(GeoConstants.stSPARQLisSimple)) 124.243 { 124.244 return isSimple(arg); 124.245 }
125.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Fri Apr 19 09:11:47 2013 +0300 125.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Fri Apr 19 14:37:09 2013 +0300 125.3 @@ -39,7 +39,6 @@ 125.4 import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 125.5 import org.openrdf.query.algebra.evaluation.function.Function; 125.6 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 125.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 125.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 125.9 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 125.10 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonInstant; 125.11 @@ -52,15 +51,14 @@ 125.12 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.CrossesFunc; 125.13 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.DisjointFunc; 125.14 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.EqualsFunc; 125.15 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.WithinFunc; 125.16 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.IntersectsFunc; 125.17 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.LeftFunc; 125.18 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.OverlapsFunc; 125.19 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.RightFunc; 125.20 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.TouchesFunc; 125.21 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.WithinFunc; 125.22 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbContainsFunc; 125.23 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbEqualsFunc; 125.24 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbWithinFunc; 125.25 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbIntersectsFunc; 125.26 import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.TemporalConstructFunc; 125.27 import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalConstants; 125.28 @@ -93,8 +91,10 @@ 125.29 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 125.30 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 125.31 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary; 125.32 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructTriple; 125.33 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructUnary; 125.34 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricBinary; 125.35 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricTriple; 125.36 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricUnary; 125.37 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialProperty; 125.38 import org.openrdf.sail.generaldb.algebra.GeneralDBURIColumn; 125.39 @@ -114,6 +114,8 @@ 125.40 125.41 import com.vividsolutions.jts.geom.Geometry; 125.42 125.43 +import eu.earthobservatory.constants.GeoConstants; 125.44 + 125.45 /** 125.46 * Extends the default strategy by accepting {@link GeneralDBSelectQuery} and evaluating 125.47 * them on a database. 125.48 @@ -122,7 +124,7 @@ 125.49 */ 125.50 public abstract class GeneralDBEvaluation extends EvaluationStrategyImpl { 125.51 125.52 - public Logger logger; 125.53 + private static final Logger logger = LoggerFactory.getLogger(org.openrdf.sail.generaldb.evaluation.GeneralDBEvaluation.class);; 125.54 125.55 protected GeneralDBQueryBuilderFactory factory; 125.56 125.57 @@ -153,11 +155,9 @@ 125.58 protected HashMap<Integer,String> temporalVars = new HashMap<Integer,String>(); 125.59 125.60 125.61 - public GeneralDBEvaluation(GeneralDBQueryBuilderFactory factory, GeneralDBTripleRepository triples, Dataset dataset, 125.62 - IdSequence ids) 125.63 + public GeneralDBEvaluation(GeneralDBQueryBuilderFactory factory, GeneralDBTripleRepository triples, Dataset dataset, IdSequence ids) 125.64 { 125.65 super(new GeneralDBTripleSource(triples), dataset); 125.66 - this.logger = LoggerFactory.getLogger(GeneralDBEvaluation.class); 125.67 this.factory = factory; 125.68 this.triples = triples; 125.69 this.vf = triples.getValueFactory(); 125.70 @@ -165,9 +165,7 @@ 125.71 } 125.72 125.73 @Override 125.74 - public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(TupleExpr expr, 125.75 - BindingSet bindings) 125.76 - throws QueryEvaluationException 125.77 + public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(TupleExpr expr, BindingSet bindings) throws QueryEvaluationException 125.78 { 125.79 if (expr instanceof GeneralDBSelectQuery) 125.80 return evaluate((GeneralDBSelectQuery)expr, bindings); 125.81 @@ -181,8 +179,7 @@ 125.82 } 125.83 125.84 @Override 125.85 - public Value evaluate(ValueExpr expr, BindingSet bindings) 125.86 - throws ValueExprEvaluationException, QueryEvaluationException 125.87 + public Value evaluate(ValueExpr expr, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException 125.88 { 125.89 if (expr instanceof Var) { 125.90 return evaluate((Var)expr, bindings); 125.91 @@ -263,6 +260,10 @@ 125.92 // get the function corresponding to the function call 125.93 Function function = FunctionRegistry.getInstance().get(fc.getURI()); 125.94 125.95 + if (function == null) { 125.96 + logger.warn("[Strabon.evaluation(FunctionCall)] Extension function <{}> is not supported.", fc.getURI()); 125.97 + return null; 125.98 + } 125.99 125.100 // get the first argument of the function call 125.101 ValueExpr left = fc.getArgs().get(0); 125.102 @@ -499,7 +500,7 @@ 125.103 return function.evaluate(tripleSource.getValueFactory(), argValues); 125.104 } 125.105 } catch (Exception e) { 125.106 - e.printStackTrace(); 125.107 + logger.error("Strabon.evaluate(FunctionCall)] Error during evaluation of extension function.", e); 125.108 return null; 125.109 } 125.110 125.111 @@ -616,12 +617,12 @@ 125.112 public StrabonPolyhedron spatialConstructPicker(Function function, Value left, Value right) throws Exception 125.113 { 125.114 StrabonPolyhedron leftArg = ((GeneralDBPolyhedron) left).getPolyhedron(); 125.115 - if(function.getURI().equals(GeoConstants.union)) 125.116 + if(function.getURI().equals(GeoConstants.stSPARQLunion)) 125.117 { 125.118 StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 125.119 return StrabonPolyhedron.union(leftArg, rightArg); 125.120 } 125.121 - else if(function.getURI().equals(GeoConstants.buffer)) 125.122 + else if(function.getURI().equals(GeoConstants.stSPARQLbuffer)) 125.123 { 125.124 if(right instanceof LiteralImpl) 125.125 { 125.126 @@ -635,7 +636,7 @@ 125.127 } 125.128 125.129 } 125.130 - else if(function.getURI().equals(GeoConstants.transform)) 125.131 + else if(function.getURI().equals(GeoConstants.stSPARQLtransform)) 125.132 { 125.133 if(right instanceof URIImpl) 125.134 { 125.135 @@ -651,29 +652,29 @@ 125.136 } 125.137 125.138 } 125.139 - else if(function.getURI().equals(GeoConstants.envelope)) 125.140 + else if(function.getURI().equals(GeoConstants.stSPARQLenvelope)) 125.141 { 125.142 return StrabonPolyhedron.envelope(leftArg); 125.143 } 125.144 - else if(function.getURI().equals(GeoConstants.convexHull)) 125.145 + else if(function.getURI().equals(GeoConstants.stSPARQLconvexHull)) 125.146 { 125.147 return StrabonPolyhedron.convexHull(leftArg); 125.148 } 125.149 - else if(function.getURI().equals(GeoConstants.boundary)) 125.150 + else if(function.getURI().equals(GeoConstants.stSPARQLboundary)) 125.151 { 125.152 return StrabonPolyhedron.boundary(leftArg); 125.153 } 125.154 - else if(function.getURI().equals(GeoConstants.intersection)) 125.155 + else if(function.getURI().equals(GeoConstants.stSPARQLintersection)) 125.156 { 125.157 StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 125.158 return StrabonPolyhedron.intersection(leftArg, rightArg); 125.159 } 125.160 - else if(function.getURI().equals(GeoConstants.difference)) 125.161 + else if(function.getURI().equals(GeoConstants.stSPARQLdifference)) 125.162 { 125.163 StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 125.164 return StrabonPolyhedron.difference(leftArg, rightArg); 125.165 } 125.166 - else if(function.getURI().equals(GeoConstants.symDifference)) 125.167 + else if(function.getURI().equals(GeoConstants.stSPARQLsymDifference)) 125.168 { 125.169 StrabonPolyhedron rightArg = ((GeneralDBPolyhedron) right).getPolyhedron(); 125.170 return StrabonPolyhedron.symDifference(leftArg, rightArg); 125.171 @@ -812,7 +813,7 @@ 125.172 } 125.173 } 125.174 125.175 - List<GeneralDBSelectProjection> projForOrderBy = new ArrayList<GeneralDBSelectProjection>(); 125.176 + //List<GeneralDBSelectProjection> projForOrderBy = new ArrayList<GeneralDBSelectProjection>(); 125.177 125.178 int index = 0; 125.179 for (GeneralDBSelectProjection proj : qb.getSqlSelectVar()) { 125.180 @@ -959,7 +960,7 @@ 125.181 */ 125.182 private void locateColumnVars(GeneralDBSqlExpr expr, Collection<GeneralDBColumnVar> allKnown) 125.183 { 125.184 - ArrayList<GeneralDBColumnVar> allVars = new ArrayList<GeneralDBColumnVar>(); 125.185 + //ArrayList<GeneralDBColumnVar> allVars = new ArrayList<GeneralDBColumnVar>(); 125.186 if(expr instanceof GeneralDBSqlSpatialProperty) //1 arg 125.187 { 125.188 125.189 @@ -977,6 +978,12 @@ 125.190 { 125.191 locateColumnVars(((GeneralDBSqlSpatialConstructUnary)expr).getArg(),allKnown); 125.192 } 125.193 + else if(expr instanceof GeneralDBSqlSpatialConstructTriple) 125.194 + { 125.195 + locateColumnVars(((GeneralDBSqlSpatialConstructTriple)expr).getLeftArg(),allKnown); 125.196 + locateColumnVars(((GeneralDBSqlSpatialConstructTriple)expr).getRightArg(),allKnown); 125.197 + locateColumnVars(((GeneralDBSqlSpatialConstructTriple)expr).getThirdArg(),allKnown); 125.198 + } 125.199 /** Addition for datetime metric functions 125.200 * 125.201 * @author George Garbis <ggarbis@di.uoa.gr> 125.202 @@ -993,6 +1000,14 @@ 125.203 locateColumnVars(((GeneralDBSqlSpatialMetricBinary)expr).getLeftArg(),allKnown); 125.204 locateColumnVars(((GeneralDBSqlSpatialMetricBinary)expr).getRightArg(),allKnown); 125.205 } 125.206 + 125.207 + else if(expr instanceof GeneralDBSqlSpatialMetricTriple) 125.208 + { 125.209 + locateColumnVars(((GeneralDBSqlSpatialMetricTriple)expr).getLeftArg(),allKnown); 125.210 + locateColumnVars(((GeneralDBSqlSpatialMetricTriple)expr).getRightArg(),allKnown); 125.211 + locateColumnVars(((GeneralDBSqlSpatialMetricTriple)expr).getThirdArg(),allKnown); 125.212 + } 125.213 + 125.214 else if(expr instanceof GeneralDBSqlSpatialMetricUnary) 125.215 { 125.216 locateColumnVars(((GeneralDBSqlSpatialMetricUnary)expr).getArg(),allKnown); 125.217 @@ -1063,7 +1078,6 @@ 125.218 } 125.219 else if(expr instanceof GeneralDBURIColumn)//Used for 2nd argument of Transform 125.220 { 125.221 - boolean found = false; 125.222 String name = ((GeneralDBURIColumn) expr).getVarName(); 125.223 125.224 for(GeneralDBColumnVar reference: allKnown) 125.225 @@ -1072,7 +1086,6 @@ 125.226 { 125.227 GeneralDBSqlExpr exprCopy = new GeneralDBURIColumn(reference); 125.228 expr.replaceWith(exprCopy); 125.229 - found = true; 125.230 } 125.231 } 125.232 125.233 @@ -1150,21 +1163,21 @@ 125.234 } 125.235 125.236 } 125.237 - else if(expr instanceof GeneralDBSqlSpatialConstructBinary || 125.238 - expr instanceof GeneralDBSqlSpatialConstructUnary) 125.239 + else if(expr instanceof GeneralDBSqlSpatialConstructBinary || expr instanceof GeneralDBSqlSpatialConstructUnary || expr instanceof GeneralDBSqlSpatialConstructTriple) 125.240 { 125.241 return ResultType.WKB; 125.242 } 125.243 else if(expr instanceof GeneralDBSqlSpatialMetricBinary || 125.244 expr instanceof GeneralDBSqlSpatialMetricUnary || 125.245 expr instanceof GeneralDBSqlMathExpr || 125.246 + expr instanceof GeneralDBSqlSpatialMetricTriple || 125.247 /** Addition for datetime metric functions 125.248 * 125.249 * @author George Garbis <ggarbis@di.uoa.gr> 125.250 - * 125.251 + * 125.252 */ 125.253 - expr instanceof GeneralDBSqlDateTimeMetricBinary 125.254 - /***/) 125.255 + expr instanceof GeneralDBSqlDateTimeMetricBinary 125.256 + /***/) 125.257 { 125.258 return ResultType.DOUBLE; 125.259 }
126.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java Fri Apr 19 09:11:47 2013 +0300 126.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java Fri Apr 19 14:37:09 2013 +0300 126.3 @@ -736,9 +736,6 @@ 126.4 else if (expr instanceof GeneralDBSqlGeoUnion) { 126.5 append((GeneralDBSqlGeoUnion)expr, filter); 126.6 } 126.7 - else if (expr instanceof GeneralDBSqlGeoBuffer) { 126.8 - append((GeneralDBSqlGeoBuffer)expr, filter); 126.9 - } 126.10 else if (expr instanceof GeneralDBSqlGeoTransform) { 126.11 append((GeneralDBSqlGeoTransform)expr, filter); 126.12 } 126.13 @@ -751,10 +748,6 @@ 126.14 else if (expr instanceof GeneralDBSqlGeoSymDifference) { 126.15 append((GeneralDBSqlGeoSymDifference)expr, filter); 126.16 } 126.17 - //Metrics 126.18 - else if (expr instanceof GeneralDBSqlGeoDistance) { 126.19 - append((GeneralDBSqlGeoDistance)expr, filter); 126.20 - } 126.21 else if (expr instanceof GeneralDBSqlDiffDateTime) { 126.22 append((GeneralDBSqlDiffDateTime)expr, filter); 126.23 } 126.24 @@ -767,22 +760,27 @@ 126.25 } 126.26 126.27 126.28 + protected void dispatchTripleSqlOperator(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 126.29 126.30 126.31 126.32 - protected void dispatchTripleSqlOperator(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter) 126.33 - throws UnsupportedRdbmsOperatorException 126.34 - { 126.35 + { 126.36 if (expr instanceof GeneralDBSqlRelate) { 126.37 append((GeneralDBSqlRelate)expr, filter); 126.38 } 126.39 + //Metrics 126.40 + else if (expr instanceof GeneralDBSqlGeoDistance) { 126.41 + append((GeneralDBSqlGeoDistance)expr, filter); 126.42 + } 126.43 + //Construct 126.44 + else if (expr instanceof GeneralDBSqlGeoBuffer) { 126.45 + append((GeneralDBSqlGeoBuffer)expr, filter); 126.46 + } 126.47 else 126.48 { 126.49 throw unsupported(expr); 126.50 } 126.51 - } 126.52 - 126.53 - 126.54 + } 126.55 126.56 protected void dispatchOther(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter) 126.57 throws UnsupportedRdbmsOperatorException 126.58 @@ -1263,9 +1261,8 @@ 126.59 126.60 protected abstract String appendWKT(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter); 126.61 126.62 - protected void appendConstructFunction(GeneralDBSqlExpr constr, GeneralDBSqlExprBuilder filter) 126.63 - throws UnsupportedRdbmsOperatorException 126.64 - { 126.65 + protected void appendConstructFunction(GeneralDBSqlExpr constr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 126.66 + { 126.67 if(constr instanceof GeneralDBSqlGeoUnion) 126.68 { 126.69 append((GeneralDBSqlGeoUnion)constr, filter); 126.70 @@ -1323,12 +1320,10 @@ 126.71 append((GeneralDBSqlPeriodEnd)constr, filter); 126.72 } 126.73 126.74 + } 126.75 126.76 - } 126.77 - 126.78 - protected void appendMetricFunction(GeneralDBSqlExpr constr, GeneralDBSqlExprBuilder filter) 126.79 - throws UnsupportedRdbmsOperatorException 126.80 - { 126.81 + protected void appendMetricFunction(GeneralDBSqlExpr constr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 126.82 + { 126.83 if(constr instanceof GeneralDBSqlGeoDistance) 126.84 { 126.85 append((GeneralDBSqlGeoDistance)constr, filter); 126.86 @@ -1337,9 +1332,7 @@ 126.87 { 126.88 append((GeneralDBSqlGeoArea)constr, filter); 126.89 } 126.90 - 126.91 - 126.92 - } 126.93 + } 126.94 126.95 /** Addition for datetime metric functions 126.96 *
127.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Fri Apr 19 09:11:47 2013 +0300 127.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/iteration/GeneralDBBindingIteration.java Fri Apr 19 14:37:09 2013 +0300 127.3 @@ -34,6 +34,8 @@ 127.4 import org.openrdf.sail.rdbms.model.RdbmsResource; 127.5 import org.openrdf.sail.rdbms.model.RdbmsValue; 127.6 127.7 +import eu.earthobservatory.constants.GeoConstants; 127.8 + 127.9 /** 127.10 * Converts a {@link ResultSet} into a {@link BindingSet} in an iteration. 127.11 *
128.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TransTableManager.java Fri Apr 19 09:11:47 2013 +0300 128.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TransTableManager.java Fri Apr 19 14:37:09 2013 +0300 128.3 @@ -244,7 +244,12 @@ 128.4 synchronized (tables) { 128.5 TransactionTable table = tables.get(pred); 128.6 if (table == null) { 128.7 - //triples.flushManagers();// charnik's addition (see flushManagers() method for details) 128.8 + /** 128.9 + * @author charnik 128.10 + * @see method {@link TripleTableManager#flushManagers()} for details 128.11 + */ 128.12 + triples.flushManagers(); 128.13 + 128.14 TripleTable predicate = triples.getPredicateTable(pred); 128.15 Number key = pred; 128.16 if (predicate.isPredColumnPresent()) {
129.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TripleManager.java Fri Apr 19 09:11:47 2013 +0300 129.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TripleManager.java Fri Apr 19 14:37:09 2013 +0300 129.3 @@ -1,7 +1,11 @@ 129.4 -/* 129.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 129.6 - * 129.7 - * Licensed under the Aduna BSD-style license. 129.8 +/** 129.9 + * This Source Code Form is subject to the terms of the Mozilla Public 129.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this 129.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 129.12 + * 129.13 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 129.14 + * 129.15 + * http://www.strabon.di.uoa.gr/ 129.16 */ 129.17 package org.openrdf.sail.generaldb.managers; 129.18 129.19 @@ -10,7 +14,7 @@ 129.20 import org.openrdf.generaldb.managers.base.ManagerBase; 129.21 /** 129.22 * 129.23 - * @author James Leigh 129.24 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 129.25 */ 129.26 public class TripleManager extends ManagerBase { 129.27
130.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TripleTableManager.java Fri Apr 19 09:11:47 2013 +0300 130.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/managers/TripleTableManager.java Fri Apr 19 14:37:09 2013 +0300 130.3 @@ -31,8 +31,8 @@ 130.4 /** 130.5 * Manages and delegates to the collection of {@link TripleTable}. 130.6 * 130.7 - * @author James Leigh 130.8 - * 130.9 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 130.10 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 130.11 */ 130.12 public class TripleTableManager { 130.13 130.14 @@ -466,7 +466,6 @@ 130.15 } 130.16 130.17 /** 130.18 - * my addition 130.19 * @return the hashmanager of the tripletablemanager 130.20 */ 130.21 public HashManager getHashManager() 130.22 @@ -483,21 +482,24 @@ 130.23 * creation of the table was making MonetDB to release all prepared statements 130.24 * that have already been created but not executed. 130.25 * 130.26 + * @see {@link TransTableManager#getTable(Number)} 130.27 + * 130.28 * FIXME: Should it throw those exceptions? 130.29 */ 130.30 public void flushManagers() { 130.31 - try { 130.32 - bnodes.flush(); 130.33 - uris.flush(); 130.34 - literals.flush(); 130.35 - 130.36 - } catch (SQLException e) { 130.37 - // TODO Auto-generated catch block 130.38 - e.printStackTrace(); 130.39 - } catch (InterruptedException e) { 130.40 - // TODO Auto-generated catch block 130.41 - e.printStackTrace(); 130.42 + if (conn instanceof nl.cwi.monetdb.jdbc.MonetConnection) { 130.43 + //if (! (conn instanceof org.postgresql.jdbc4.Jdbc4Connection)) { 130.44 + try { 130.45 + bnodes.flush(); 130.46 + uris.flush(); 130.47 + literals.flush(); 130.48 + 130.49 + } catch (SQLException e) { 130.50 + e.printStackTrace(); 130.51 + 130.52 + } catch (InterruptedException e) { 130.53 + e.printStackTrace(); 130.54 + } 130.55 } 130.56 - 130.57 } 130.58 }
131.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/model/GeneralDBPolyhedron.java Fri Apr 19 09:11:47 2013 +0300 131.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/model/GeneralDBPolyhedron.java Fri Apr 19 14:37:09 2013 +0300 131.3 @@ -3,12 +3,13 @@ 131.4 import java.io.IOException; 131.5 131.6 import org.openrdf.model.URI; 131.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 131.8 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 131.9 import org.openrdf.sail.rdbms.model.RdbmsValue; 131.10 131.11 import com.vividsolutions.jts.io.ParseException; 131.12 131.13 +import eu.earthobservatory.constants.GeoConstants; 131.14 + 131.15 /** 131.16 * 131.17 * @author Manos Karpathiotakis <mk@di.uoa.gr>
132.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/model/XMLGSDatatypeUtil.java Fri Apr 19 09:11:47 2013 +0300 132.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/model/XMLGSDatatypeUtil.java Fri Apr 19 14:37:09 2013 +0300 132.3 @@ -17,7 +17,8 @@ 132.4 import org.openrdf.model.vocabulary.XMLSchema; 132.5 132.6 import org.openrdf.sail.generaldb.model.GeneralDBPolyhedron; 132.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 132.8 + 132.9 +import eu.earthobservatory.constants.GeoConstants; 132.10 import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalConstants; 132.11 132.12
133.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Fri Apr 19 09:11:47 2013 +0300 133.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Fri Apr 19 14:37:09 2013 +0300 133.3 @@ -62,7 +62,6 @@ 133.4 import org.openrdf.query.algebra.evaluation.function.Function; 133.5 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 133.6 import org.openrdf.query.algebra.evaluation.function.spatial.DateTimeMetricFunc; 133.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 133.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 133.9 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 133.10 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 133.11 @@ -106,6 +105,8 @@ 133.12 import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException; 133.13 import org.openrdf.sail.rdbms.model.RdbmsResource; 133.14 133.15 +import eu.earthobservatory.constants.GeoConstants; 133.16 + 133.17 /** 133.18 * Rewrites the core algebra model with a relation optimised model, using SQL. 133.19 * 133.20 @@ -1356,7 +1357,7 @@ 133.21 String originalName = copy.getName(); 133.22 //((Var) expr).setName(originalName+"?spatial"); 133.23 133.24 - FunctionCall fc = new FunctionCall(GeoConstants.envelope,copy); 133.25 + FunctionCall fc = new FunctionCall(GeoConstants.stSPARQLenvelope,copy); 133.26 //XXX volatile - using an extra arg to 'hang' the name I need 133.27 fc.addArg(new Var("-mbb-"+originalName)); 133.28 ExtensionElem extElem = new ExtensionElem(fc,"-mbb-"+originalName); 133.29 @@ -1391,7 +1392,7 @@ 133.30 } 133.31 else //Function call met 133.32 { 133.33 - FunctionCall fc = new FunctionCall(GeoConstants.envelope,expr); 133.34 + FunctionCall fc = new FunctionCall(GeoConstants.stSPARQLenvelope,expr); 133.35 133.36 fc.addArg(new Var("-mbb-"+(++mbbCounter))); 133.37 ExtensionElem extElem = new ExtensionElem(fc,"-mbb-"+(mbbCounter));
134.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBConnectionFactory.java Fri Apr 19 09:11:47 2013 +0300 134.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBConnectionFactory.java Fri Apr 19 14:37:09 2013 +0300 134.3 @@ -1,7 +1,11 @@ 134.4 -/* 134.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 134.6 - * 134.7 - * Licensed under the Aduna BSD-style license. 134.8 +/** 134.9 + * This Source Code Form is subject to the terms of the Mozilla Public 134.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this 134.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 134.12 + * 134.13 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 134.14 + * 134.15 + * http://www.strabon.di.uoa.gr/ 134.16 */ 134.17 package org.openrdf.sail.monetdb; 134.18 134.19 @@ -31,7 +35,8 @@ 134.20 import org.openrdf.sail.rdbms.schema.TableFactory; 134.21 134.22 /** 134.23 - * @author George Garbis <ggarbis@di.uoa.gr> ?? 134.24 + * @author George Garbis <ggarbis@di.uoa.gr> 134.25 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 134.26 */ 134.27 public class MonetDBConnectionFactory extends GeneralDBConnectionFactory { 134.28 134.29 @@ -123,6 +128,7 @@ 134.30 bfactory.setValueFactory(vf); 134.31 bfactory.setUsingHashTable(hashManager != null); 134.32 s.setQueryBuilderFactory(bfactory); 134.33 + 134.34 GeneralDBConnection conn = new GeneralDBConnection(sail, s); 134.35 conn.setNamespaces(namespaces); 134.36 GeneralDBEvaluationFactory efactory = new MonetDBEvaluationFactory();
135.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBProvider.java Fri Apr 19 09:11:47 2013 +0300 135.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBProvider.java Fri Apr 19 14:37:09 2013 +0300 135.3 @@ -1,19 +1,21 @@ 135.4 -/* 135.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 135.6 - * 135.7 - * Licensed under the Aduna BSD-style license. 135.8 +/** 135.9 + * This Source Code Form is subject to the terms of the Mozilla Public 135.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this 135.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 135.12 + * 135.13 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 135.14 + * 135.15 + * http://www.strabon.di.uoa.gr/ 135.16 */ 135.17 package org.openrdf.sail.monetdb; 135.18 135.19 import org.openrdf.sail.generaldb.GeneralDBProvider; 135.20 - 135.21 - 135.22 135.23 /** 135.24 * Checks the database product name and version to be compatible with this 135.25 * Sesame store. 135.26 * 135.27 - * @author James Leigh 135.28 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 135.29 * 135.30 */ 135.31 public class MonetDBProvider extends GeneralDBProvider {
136.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBSqlTable.java Fri Apr 19 09:11:47 2013 +0300 136.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/MonetDBSqlTable.java Fri Apr 19 14:37:09 2013 +0300 136.3 @@ -7,9 +7,10 @@ 136.4 136.5 import java.sql.SQLException; 136.6 136.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 136.8 import org.openrdf.sail.generaldb.GeneralDBSqlTable; 136.9 136.10 +import eu.earthobservatory.constants.GeoConstants; 136.11 + 136.12 /** 136.13 * 136.14 * @author George Garbis <ggarbis@di.uoa.gr>
137.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java Fri Apr 19 09:11:47 2013 +0300 137.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java Fri Apr 19 14:37:09 2013 +0300 137.3 @@ -56,8 +56,10 @@ 137.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRelate; 137.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRight; 137.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary; 137.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructTriple; 137.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructUnary; 137.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricBinary; 137.10 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricTriple; 137.11 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricUnary; 137.12 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialProperty; 137.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouches; 137.14 @@ -121,6 +123,9 @@ 137.15 import org.openrdf.sail.rdbms.exceptions.RdbmsException; 137.16 import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException; 137.17 137.18 +import eu.earthobservatory.constants.GeoConstants; 137.19 +import eu.earthobservatory.constants.OGCConstants; 137.20 + 137.21 /** 137.22 * Constructs an SQL query from {@link GeneralDBSqlExpr}s and {@link GeneralDBFromItem}s. 137.23 * 137.24 @@ -128,7 +133,11 @@ 137.25 * 137.26 */ 137.27 public class MonetDBQueryBuilder extends GeneralDBQueryBuilder { 137.28 - 137.29 + 137.30 + public static final String ST_TRANSFORM = "ST_Transform"; 137.31 + public static final String GEOGRAPHY = "Geography"; 137.32 + public static final String GEOMETRY = "Geometry"; 137.33 + 137.34 /** 137.35 * If (spatial) label column met is null, I must not try to retrieve its srid. 137.36 * Opting to ask for 'null' instead 137.37 @@ -711,11 +720,10 @@ 137.38 } 137.39 137.40 @Override 137.41 - protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter) 137.42 - throws UnsupportedRdbmsOperatorException 137.43 - { 137.44 - appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Buffer); 137.45 - } 137.46 + protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 137.47 + { 137.48 + appendMonetDBBuffer(expr, filter, SpatialFunctionsMonetDB.ST_Buffer); 137.49 + } 137.50 137.51 //XXX Different Behavior 137.52 @Override 137.53 @@ -783,11 +791,10 @@ 137.54 137.55 @Override 137.56 //Spatial Metric Functions 137.57 - protected void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter) 137.58 - throws UnsupportedRdbmsOperatorException 137.59 - { 137.60 - appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Distance); 137.61 - } 137.62 + protected void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 137.63 + { 137.64 + appendMonetDBDistance(expr, filter, SpatialFunctionsMonetDB.ST_Distance); 137.65 + } 137.66 137.67 @Override 137.68 protected void append(GeneralDBSqlGeoArea expr, GeneralDBSqlExprBuilder filter) 137.69 @@ -939,7 +946,7 @@ 137.70 else 137.71 { 137.72 //4326 by default - Software House additions 137.73 - filter.append("4326"); 137.74 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 137.75 } 137.76 } 137.77 137.78 @@ -978,7 +985,7 @@ 137.79 e.printStackTrace(); 137.80 } 137.81 137.82 - filter.append(" GeomFromText('"+poly.toWKT() +"',4326)"); 137.83 + filter.append(" GeomFromText('"+poly.toWKT() +"',"+String.valueOf(GeoConstants.defaultSRID)+")"); 137.84 137.85 return raw; 137.86 } 137.87 @@ -1344,9 +1351,7 @@ 137.88 case ST_Difference: filter.appendFunction("Difference"); break; 137.89 case ST_Intersection: filter.appendFunction("Intersection"); break; 137.90 case ST_Union: filter.appendFunction("\"Union\""); break; 137.91 - case ST_SymDifference: filter.appendFunction("SymDifference"); break; 137.92 - case ST_Buffer: filter.appendFunction("Buffer"); break; 137.93 - case ST_Distance: filter.appendFunction("Distance"); break; 137.94 + case ST_SymDifference: filter.appendFunction("SymDifference"); break; 137.95 case ST_Touches: filter.appendFunction("Touches"); break; 137.96 case ST_Disjoint: filter.appendFunction("Disjoint"); break; 137.97 case ST_Crosses: filter.appendFunction("Crosses"); break; 137.98 @@ -1460,7 +1465,415 @@ 137.99 filter.appendComma(); 137.100 filter.append(sridExpr); 137.101 } 137.102 + } 137.103 + 137.104 + protected void appendMonetDBDistance(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func) throws UnsupportedRdbmsOperatorException 137.105 + { 137.106 + String units = null; 137.107 + 137.108 + filter.openBracket(); 137.109 + 137.110 + boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull"); 137.111 + boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull"); 137.112 + boolean check3 = expr.getThirdArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull"); 137.113 + 137.114 + if(check1) 137.115 + { 137.116 + this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 137.117 + } 137.118 + else if(check2) 137.119 + { 137.120 + this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 137.121 + } 137.122 + else if(check3) 137.123 + { 137.124 + this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 137.125 + } 137.126 + 137.127 + else 137.128 + { 137.129 + filter.appendFunction("Distance"); 137.130 + 137.131 + filter.openBracket(); 137.132 + 137.133 + if (expr.getThirdArg() instanceof GeneralDBStringValue) 137.134 + { 137.135 + units = ((GeneralDBStringValue)expr.getThirdArg()).getValue(); 137.136 + if(!OGCConstants.supportedUnitsOfMeasure.contains(units)) 137.137 + { 137.138 + throw new UnsupportedRdbmsOperatorException("No such unit of measure exists"); 137.139 + } 137.140 + 137.141 + if(units.equals(OGCConstants.OGCmetre)) 137.142 + { 137.143 + filter.appendFunction(GEOGRAPHY); 137.144 + filter.openBracket(); 137.145 + filter.appendFunction(ST_TRANSFORM); 137.146 + filter.openBracket(); 137.147 + } 137.148 + else if(units.equals(OGCConstants.OGCdegree)) 137.149 + { 137.150 + filter.appendFunction(ST_TRANSFORM); 137.151 + filter.openBracket(); 137.152 + } 137.153 + } 137.154 + 137.155 + if(expr.getLeftArg() instanceof GeneralDBStringValue) 137.156 + { 137.157 + appendWKT(expr.getLeftArg(),filter); 137.158 } 137.159 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructBinary) 137.160 + { 137.161 + appendConstructFunction(expr.getLeftArg(), filter); 137.162 + } 137.163 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructUnary) 137.164 + { 137.165 + appendConstructFunction(expr.getLeftArg(), filter); 137.166 + } 137.167 + else if(expr.getLeftArg() instanceof GeneralDBSqlCase) 137.168 + { 137.169 + GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult(); 137.170 + appendMBB(onlyLabel,filter); 137.171 + } 137.172 + else 137.173 + { 137.174 + appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter); 137.175 + } 137.176 + 137.177 + if(units.equals(OGCConstants.OGCmetre)) 137.178 + { 137.179 + filter.appendComma(); 137.180 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 137.181 + filter.closeBracket(); //close st_transform 137.182 + filter.closeBracket(); //close geography 137.183 + 137.184 + filter.appendComma(); 137.185 + 137.186 + filter.appendFunction(GEOGRAPHY); 137.187 + filter.openBracket(); 137.188 + filter.appendFunction(ST_TRANSFORM); 137.189 + filter.openBracket(); 137.190 + } 137.191 + else if(units.equals(OGCConstants.OGCdegree)) 137.192 + { 137.193 + filter.appendComma(); 137.194 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 137.195 + filter.closeBracket(); //close st_transform 137.196 + 137.197 + filter.appendComma(); 137.198 + 137.199 + filter.appendFunction(ST_TRANSFORM); 137.200 + filter.openBracket(); 137.201 + } 137.202 + else 137.203 + { 137.204 + filter.appendComma(); 137.205 + } 137.206 + 137.207 + if(expr.getRightArg() instanceof GeneralDBStringValue) 137.208 + { 137.209 + appendWKT(expr.getRightArg(),filter); 137.210 + } 137.211 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructUnary) 137.212 + { 137.213 + appendConstructFunction(expr.getRightArg(), filter); 137.214 + } 137.215 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructBinary) 137.216 + { 137.217 + appendConstructFunction(expr.getRightArg(), filter); 137.218 + } 137.219 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructTriple) 137.220 + { 137.221 + appendConstructFunction(expr.getRightArg(), filter); 137.222 + } 137.223 + else if(expr.getRightArg() instanceof GeneralDBSqlCase) 137.224 + { 137.225 + GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult(); 137.226 + appendMBB(onlyLabel,filter); 137.227 + } 137.228 + else if(expr.getRightArg() instanceof GeneralDBDoubleValue) //case met in buffer! 137.229 + { 137.230 + append(((GeneralDBDoubleValue)expr.getRightArg()), filter); 137.231 + } 137.232 + else if(expr.getRightArg() instanceof GeneralDBNumericColumn) //case met in buffer! 137.233 + { 137.234 + append(((GeneralDBNumericColumn)expr.getRightArg()), filter); 137.235 + } 137.236 + else if(expr.getRightArg() instanceof GeneralDBURIColumn) //case met in transform! 137.237 + { 137.238 + filter.keepSRID_part1(); 137.239 + append(((GeneralDBURIColumn)expr.getRightArg()), filter); 137.240 + filter.keepSRID_part2(); 137.241 + append(((GeneralDBURIColumn)expr.getRightArg()), filter); 137.242 + filter.keepSRID_part3(); 137.243 + } 137.244 + //case met in buffer when in select -> buffer(?spatial,?thematic) 137.245 + else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial()) 137.246 + { 137.247 + appendWithCastDouble(((GeneralDBLabelColumn)expr.getRightArg()),filter); 137.248 + // append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 137.249 + // appendCastToDouble(filter); 137.250 + } 137.251 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricBinary) 137.252 + { 137.253 + appendMetricFunction(expr.getRightArg(), filter); 137.254 + } 137.255 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricUnary) 137.256 + { 137.257 + appendMetricFunction(expr.getRightArg(), filter); 137.258 + } 137.259 + else 137.260 + { 137.261 + appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter); 137.262 + } 137.263 + 137.264 + if(units.equals(OGCConstants.OGCmetre)) 137.265 + { 137.266 + filter.appendComma(); 137.267 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 137.268 + filter.closeBracket(); 137.269 + filter.closeBracket(); 137.270 + } 137.271 + else if(units.equals(OGCConstants.OGCdegree)) 137.272 + { 137.273 + filter.appendComma(); 137.274 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 137.275 + filter.closeBracket(); 137.276 + } 137.277 + 137.278 + filter.closeBracket(); 137.279 + } 137.280 + 137.281 + filter.closeBracket(); 137.282 + } 137.283 + 137.284 + protected void appendMonetDBBuffer(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func) throws UnsupportedRdbmsOperatorException 137.285 + { 137.286 + boolean sridNeeded = true; 137.287 + //XXX Incorporating SRID 137.288 + String sridExpr = null; 137.289 + String units = null; 137.290 + 137.291 + filter.openBracket(); 137.292 + 137.293 + boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull"); 137.294 + boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull"); 137.295 + boolean check3 = expr.getThirdArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull"); 137.296 + 137.297 + if(check1) 137.298 + { 137.299 + this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 137.300 + } 137.301 + else if(check2) 137.302 + { 137.303 + this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 137.304 + } 137.305 + else if(check3) 137.306 + { 137.307 + this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 137.308 + } 137.309 + 137.310 + else 137.311 + { 137.312 + GeneralDBSqlExpr tmp = expr; 137.313 + if(tmp instanceof GeneralDBSqlSpatialConstructBinary && tmp.getParentNode() == null) 137.314 + { 137.315 + while(true) 137.316 + { 137.317 + GeneralDBSqlExpr child; 137.318 + 137.319 + if(tmp instanceof BinaryGeneralDBOperator) 137.320 + { 137.321 + child = ((BinaryGeneralDBOperator) tmp).getLeftArg(); 137.322 + } 137.323 + else //(tmp instanceof UnaryGeneralDBOperator) 137.324 + { 137.325 + child = ((UnaryGeneralDBOperator) tmp).getArg(); 137.326 + } 137.327 + 137.328 + tmp = child; 137.329 + if(tmp instanceof GeneralDBLabelColumn) 137.330 + { 137.331 + //Reached the innermost left var -> need to capture its SRID 137.332 + String alias; 137.333 + if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 137.334 + //Predicates used in triple patterns non-existent in db 137.335 + alias="NULL"; 137.336 + } 137.337 + else 137.338 + { 137.339 + //Reached the innermost left var -> need to capture its SRID 137.340 + alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar()); 137.341 + alias=alias+".srid"; 137.342 + } 137.343 + sridExpr = alias; 137.344 + break; 137.345 + } 137.346 + else if (tmp instanceof GeneralDBStringValue) //Constant!! 137.347 + { 137.348 + sridNeeded = false; 137.349 + break; 137.350 + } 137.351 + } 137.352 + if(sridNeeded) 137.353 + { 137.354 + filter.appendFunction("Transform"); 137.355 + filter.openBracket(); 137.356 + } 137.357 + 137.358 + if (expr.getThirdArg() instanceof GeneralDBStringValue) 137.359 + { 137.360 + units = ((GeneralDBStringValue)expr.getThirdArg()).getValue(); 137.361 + if(!OGCConstants.supportedUnitsOfMeasure.contains(units)) 137.362 + { 137.363 + throw new UnsupportedRdbmsOperatorException("No such unit of measure exists"); 137.364 + } 137.365 + 137.366 + if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0))) 137.367 + { 137.368 + filter.appendFunction("ST_Buffer"); 137.369 + filter.openBracket(); 137.370 + filter.appendFunction(ST_TRANSFORM); 137.371 + filter.openBracket(); 137.372 + } 137.373 + else 137.374 + { 137.375 + filter.appendFunction(GEOMETRY); 137.376 + filter.openBracket(); 137.377 + filter.appendFunction("ST_Buffer"); 137.378 + filter.openBracket(); 137.379 + filter.appendFunction(GEOGRAPHY); 137.380 + filter.openBracket(); 137.381 + filter.appendFunction(ST_TRANSFORM); 137.382 + filter.openBracket(); 137.383 + } 137.384 + } 137.385 + 137.386 + if(expr.getLeftArg() instanceof GeneralDBStringValue) 137.387 + { 137.388 + appendWKT(expr.getLeftArg(),filter); 137.389 + } 137.390 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructBinary) 137.391 + { 137.392 + appendConstructFunction(expr.getLeftArg(), filter); 137.393 + } 137.394 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructUnary) 137.395 + { 137.396 + appendConstructFunction(expr.getLeftArg(), filter); 137.397 + } 137.398 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple) 137.399 + { 137.400 + appendConstructFunction(expr.getLeftArg(), filter); 137.401 + } 137.402 + else if(expr.getLeftArg() instanceof GeneralDBSqlCase) 137.403 + { 137.404 + GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult(); 137.405 + appendMBB(onlyLabel,filter); 137.406 + } 137.407 + else 137.408 + { 137.409 + appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter); 137.410 + } 137.411 + 137.412 + if(units.equals(OGCConstants.OGCmetre)) 137.413 + { 137.414 + if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0))) 137.415 + { 137.416 + filter.appendComma(); 137.417 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 137.418 + filter.closeBracket(); //close st_transform 137.419 + filter.appendComma(); 137.420 + } 137.421 + else 137.422 + { 137.423 + filter.appendComma(); 137.424 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 137.425 + filter.closeBracket(); //close st_transform 137.426 + filter.closeBracket(); //close geography 137.427 + filter.appendComma(); 137.428 + } 137.429 + } 137.430 + else if(units.equals(OGCConstants.OGCdegree)) 137.431 + { 137.432 + filter.appendComma(); 137.433 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 137.434 + filter.closeBracket(); //close st_transform 137.435 + filter.appendComma(); 137.436 + } 137.437 + 137.438 + if(expr.getRightArg() instanceof GeneralDBStringValue) 137.439 + { 137.440 + appendWKT(expr.getRightArg(),filter); 137.441 + } 137.442 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructUnary) 137.443 + { 137.444 + appendConstructFunction(expr.getRightArg(), filter); 137.445 + } 137.446 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructBinary) 137.447 + { 137.448 + appendConstructFunction(expr.getRightArg(), filter); 137.449 + } 137.450 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple) 137.451 + { 137.452 + appendMetricFunction(expr.getRightArg(), filter); 137.453 + } 137.454 + else if(expr.getRightArg() instanceof GeneralDBSqlCase) 137.455 + { 137.456 + GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult(); 137.457 + appendMBB(onlyLabel,filter); 137.458 + } 137.459 + else if(expr.getRightArg() instanceof GeneralDBDoubleValue) 137.460 + { 137.461 + append(((GeneralDBDoubleValue)expr.getRightArg()), filter); 137.462 + } 137.463 + else if(expr.getRightArg() instanceof GeneralDBNumericColumn) 137.464 + { 137.465 + append(((GeneralDBNumericColumn)expr.getRightArg()), filter); 137.466 + } 137.467 + //case met in buffer when in select -> buffer(?spatial,?thematic) 137.468 + else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial()) 137.469 + { 137.470 + append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 137.471 + appendCastToDouble(filter); 137.472 + } 137.473 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricBinary) 137.474 + { 137.475 + appendMetricFunction(expr.getRightArg(), filter); 137.476 + } 137.477 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricUnary) 137.478 + { 137.479 + appendMetricFunction(expr.getRightArg(), filter); 137.480 + } 137.481 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple) 137.482 + { 137.483 + appendMetricFunction(expr.getRightArg(), filter); 137.484 + } 137.485 + else 137.486 + { 137.487 + appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter); 137.488 + } 137.489 + 137.490 + filter.closeBracket(); 137.491 + //SRID Support 137.492 + if(expr instanceof GeneralDBSqlSpatialConstructTriple && expr.getParentNode() == null) 137.493 + { 137.494 + filter.appendComma(); 137.495 + filter.append(sridExpr); 137.496 + filter.closeBracket(); 137.497 + } 137.498 + /// 137.499 + } 137.500 + if(units.equals(OGCConstants.OGCmetre) && !((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))) 137.501 + filter.closeBracket(); //close Geometry 137.502 + filter.closeBracket(); 137.503 + //Used to explicitly include SRID 137.504 + if(expr instanceof GeneralDBSqlSpatialConstructTriple && expr.getParentNode() == null) 137.505 + { 137.506 + filter.appendComma(); 137.507 + filter.append(sridExpr); 137.508 + } 137.509 + } 137.510 + } 137.511 137.512 //Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1) 137.513 protected void appendMonetDBSpatialFunctionUnary(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func)
138.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java Fri Apr 19 09:11:47 2013 +0300 138.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/iteration/MonetDBBindingIteration.java Fri Apr 19 14:37:09 2013 +0300 138.3 @@ -11,10 +11,11 @@ 138.4 import java.sql.SQLException; 138.5 138.6 import org.openrdf.query.BindingSet; 138.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 138.8 import org.openrdf.sail.generaldb.iteration.GeneralDBBindingIteration; 138.9 import org.openrdf.sail.rdbms.model.RdbmsValue; 138.10 138.11 +import eu.earthobservatory.constants.GeoConstants; 138.12 + 138.13 /** 138.14 * Converts a {@link ResultSet} into a {@link BindingSet} in an iteration. 138.15 *
139.1 --- a/pom.xml Fri Apr 19 09:11:47 2013 +0300 139.2 +++ b/pom.xml Fri Apr 19 14:37:09 2013 +0300 139.3 @@ -17,6 +17,113 @@ 139.4 <description>Strabon is a storage and query evaluation module for stRDF/stSPARQL.</description> 139.5 <url>http://www.strabon.di.uoa.gr/</url> 139.6 <inceptionYear>2008</inceptionYear> 139.7 + 139.8 + <organization> 139.9 + <name>Strabon Team - Team Pyravlos</name> 139.10 + <url>http://www.strabon.di.uoa.gr/</url> 139.11 + </organization> 139.12 + 139.13 + <licenses> 139.14 + <license> 139.15 + <name>Mozilla Public License, v. 2.0</name> 139.16 + <url>http://www.strabon.di.uoa.gr/license</url> 139.17 + <distribution>repo</distribution> 139.18 + </license> 139.19 + </licenses> 139.20 + 139.21 + <developers> 139.22 + <developer> 139.23 + <id>manolee</id> 139.24 + <name>Manos Karpathiotakis</name> 139.25 + <email>manos.karpathiotakis@epfl.ch</email> 139.26 + <url>http://people.epfl.ch/manos.karpathiotakis</url> 139.27 + <organization>Data-Intensive Applications and Systems Laboratory, Institute of Core Computing Science, School of Computer and Communication Sciences, Ecole polytechnique fédérale de Lausanne 139.28 + </organization> 139.29 + <organizationUrl>http://search.epfl.ch/ubrowse.action?acro=DIAS</organizationUrl> 139.30 + <timezone>+1</timezone> 139.31 + <properties> 139.32 + <picUrl>http://people.epfl.ch/cgi-bin/people/getPhoto?id=222383</picUrl> 139.33 + </properties> 139.34 + </developer> 139.35 + <developer> 139.36 + <id>kk</id> 139.37 + <name>Kostis Kyzirakos</name> 139.38 + <email>kk@di.uoa.gr</email> 139.39 + <url>http://www.di.uoa.gr/~kkyzir</url> 139.40 + <organization>Management of Data, Information and Knowledge Group, Dept. of Informatics and Telecommunications, School of Sciences, National and Kapodistrian University of Athens</organization> 139.41 + <organizationUrl>http://www.madgik.di.uoa.gr/</organizationUrl> 139.42 + <timezone>+2</timezone> 139.43 + <properties> 139.44 + <picUrl>http://cgi.di.uoa.gr/~kkyzir/images/me.jpg</picUrl> 139.45 + </properties> 139.46 + </developer> 139.47 + <developer> 139.48 + <id>charnik</id> 139.49 + <name>Charalampos Nikolaou</name> 139.50 + <email>charnik@di.uoa.gr</email> 139.51 + <url>http://www.di.uoa.gr/~charnik</url> 139.52 + <organization>Management of Data, Information and Knowledge Group, Dept. of Informatics and Telecommunications, School of Sciences, National and Kapodistrian University of Athens</organization> 139.53 + <organizationUrl>http://www.madgik.di.uoa.gr/</organizationUrl> 139.54 + <timezone>+2</timezone> 139.55 + <properties> 139.56 + <picUrl>http://www.madgik.di.uoa.gr/sites/default/files/imagecache/profile_image/madgik-photo-charnik_0.jpg</picUrl> 139.57 + </properties> 139.58 + </developer> 139.59 + <developer> 139.60 + <id>ggarbis</id> 139.61 + <name>Giorgos Garbis</name> 139.62 + <email>ggarbis@di.uoa.gr</email> 139.63 + <organization>Management of Data, Information and Knowledge Group, Dept. of Informatics and Telecommunications, School of Sciences, National and Kapodistrian University of Athens</organization> 139.64 + <organizationUrl>http://www.madgik.di.uoa.gr/</organizationUrl> 139.65 + <timezone>+2</timezone> 139.66 + </developer> 139.67 + <developer> 139.68 + <id>kbereta</id> 139.69 + <name>Konstantina Bereta</name> 139.70 + <email>konstantina.bereta@di.uoa.gr</email> 139.71 + <url>http://cgi.di.uoa.gr/~grad1110/</url> 139.72 + <organization>Management of Data, Information and Knowledge Group, Dept. of Informatics and Telecommunications, School of Sciences, National and Kapodistrian University of Athens</organization> 139.73 + <organizationUrl>http://www.madgik.di.uoa.gr/</organizationUrl> 139.74 + <timezone>+2</timezone> 139.75 + </developer> 139.76 + <developer> 139.77 + <id>sgian</id> 139.78 + <name>Stella Gianakopoulou</name> 139.79 + <email>sgian@di.uoa.gr</email> 139.80 + <organization>Management of Data, Information and Knowledge Group, Dept. of Informatics and Telecommunications, School of Sciences, National and Kapodistrian University of Athens</organization> 139.81 + <organizationUrl>http://www.madgik.di.uoa.gr/</organizationUrl> 139.82 + <timezone>+2</timezone> 139.83 + </developer> 139.84 + <developer> 139.85 + <id>psmeros</id> 139.86 + <name>Panagiotis Smeros</name> 139.87 + <email>psmeros@di.uoa.gr</email> 139.88 + <url>http://users.uoa.gr/~psmeros/</url> 139.89 + <organization>Management of Data, Information and Knowledge Group, Dept. of Informatics and Telecommunications, School of Sciences, National and Kapodistrian University of Athens</organization> 139.90 + <organizationUrl>http://www.madgik.di.uoa.gr/</organizationUrl> 139.91 + <timezone>+2</timezone> 139.92 + <properties> 139.93 + <picUrl>http://users.uoa.gr/~psmeros/images/me%20and%20plastic%20yiayia.JPG</picUrl> 139.94 + </properties> 139.95 + </developer> 139.96 + <developer> 139.97 + <id>roi</id> 139.98 + <name>Kallirroi Dogani</name> 139.99 + <email>kallirroi@di.uoa.gr</email><url>http://www.di.uoa.gr/~charnik</url> 139.100 + <organization>Management of Data, Information and Knowledge Group, Dept. of Informatics and Telecommunications, School of Sciences, National and Kapodistrian University of Athens</organization> 139.101 + <organizationUrl>http://www.madgik.di.uoa.gr/</organizationUrl> 139.102 + <timezone>+2</timezone> 139.103 + </developer> 139.104 + <developer> 139.105 + <id>koubarak</id> 139.106 + <name>Manolis Koubarakis</name> 139.107 + <email>koubarak@di.uoa.gr</email> 139.108 + <url>http://www.di.uoa.gr/~koubarak</url> 139.109 + <organization>Dept. of Informatics and Telecommunications, School of Sciences, National and Kapodistrian University of Athens</organization> 139.110 + <organizationUrl>http://www.di.uoa.gr/</organizationUrl> 139.111 + <timezone>+2</timezone> 139.112 + </developer> 139.113 + </developers> 139.114 139.115 <modules> 139.116 <module>evaluation</module> 139.117 @@ -28,6 +135,8 @@ 139.118 <module>endpoint</module> 139.119 <module>endpoint-client</module> 139.120 <module>endpoint-exec</module> 139.121 + <module>testsuite</module> 139.122 + <module>vocab</module> 139.123 </modules> 139.124 139.125 <properties> 139.126 @@ -43,7 +152,7 @@ 139.127 <xml.bind.version>2.1.7</xml.bind.version> 139.128 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 139.129 <project.build.targetEncoding>UTF-8</project.build.targetEncoding> 139.130 - <skipTests>true</skipTests> 139.131 + <skipTests>false</skipTests> 139.132 </properties> 139.133 139.134 <dependencyManagement> 139.135 @@ -105,6 +214,16 @@ 139.136 <artifactId>sesame-queryresultio-text</artifactId> 139.137 <version>${sesame.version}</version> 139.138 </dependency> 139.139 + <dependency> 139.140 + <groupId>org.openrdf.sesame</groupId> 139.141 + <artifactId>sesame-queryresultio-binary</artifactId> 139.142 + <version>${sesame.version}</version> 139.143 + </dependency> 139.144 + <dependency> 139.145 + <groupId>org.openrdf.sesame</groupId> 139.146 + <artifactId>sesame-queryresultio-sparqljson</artifactId> 139.147 + <version>${sesame.version}</version> 139.148 + </dependency> 139.149 <!-- sesame queryresultio dependencies --> 139.150 139.151 <dependency> 139.152 @@ -132,6 +251,12 @@ 139.153 </dependency> 139.154 139.155 <dependency> 139.156 + <groupId>eu.earthobservatory</groupId> 139.157 + <artifactId>strabon-vocabulary</artifactId> 139.158 + <version>${eu.earthobservatory.version}</version> 139.159 + </dependency> 139.160 + 139.161 + <dependency> 139.162 <groupId>org.openrdf.sesame</groupId> 139.163 <artifactId>sesame-sail-postgis</artifactId> 139.164 <version>${eu.earthobservatory.version}</version> 139.165 @@ -646,6 +771,31 @@ 139.166 <encoding>utf8</encoding> 139.167 </configuration> 139.168 </plugin> 139.169 + <!-- 139.170 + <plugin> 139.171 + <groupId>org.apache.maven.plugins</groupId> 139.172 + <artifactId>maven-javadoc-plugin</artifactId> 139.173 + <reportSets> 139.174 + <reportSet> 139.175 + <id>uml</id> 139.176 + <configuration> 139.177 + <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet> 139.178 + <docletArtifact> 139.179 + <groupId>org.umlgraph</groupId> 139.180 + <artifactId>doclet</artifactId> 139.181 + <version>5.1</version> 139.182 + </docletArtifact> 139.183 + <additionalparam>-views</additionalparam> 139.184 + <destDir>target/uml</destDir> 139.185 + <show>private</show> 139.186 + </configuration> 139.187 + <reports> 139.188 + <report>javadoc</report> 139.189 + </reports> 139.190 + </reportSet> 139.191 + </reportSets> 139.192 + </plugin> 139.193 + --> 139.194 </plugins> 139.195 </reporting> 139.196 139.197 @@ -669,10 +819,37 @@ 139.198 </pluginRepositories> 139.199 139.200 <scm> 139.201 - <connection>scm:hg:ssh://hg.strabon.di.uoa.gr//opt/hg/Strabon/</connection> 139.202 + <connection>scm:hg:http://hg.strabon.di.uoa.gr/Strabon/</connection> 139.203 <developerConnection>scm:hg:ssh://hg.strabon.di.uoa.gr//opt/hg/Strabon/</developerConnection> 139.204 <url>http://hg.strabon.di.uoa.gr/Strabon/</url> 139.205 </scm> 139.206 + 139.207 + <issueManagement> 139.208 + <system>Trac</system> 139.209 + <url>http://bug.strabon.di.uoa.gr/</url> 139.210 + </issueManagement> 139.211 + 139.212 + <ciManagement> 139.213 + <system>Jekins - Continuous Integration System</system> 139.214 + <url>http://test.strabon.di.uoa.gr/cis</url> 139.215 + </ciManagement> 139.216 + 139.217 + <mailingLists> 139.218 + <mailingList> 139.219 + <name>User List</name> 139.220 + <subscribe>strabon-users-request@di.uoa.gr</subscribe> 139.221 + <unsubscribe>strabon-users-request@di.uoa.gr</unsubscribe> 139.222 + <post>strabon-users@di.uoa.gr</post> 139.223 + <archive>http://cgi.di.uoa.gr/~mailman/pipermail/strabon-users/</archive> 139.224 + </mailingList> 139.225 + <mailingList> 139.226 + <name>Developers List</name> 139.227 + <subscribe>strabon-devel-request@di.uoa.gr</subscribe> 139.228 + <unsubscribe>strabon-devel-request@di.uoa.gr</unsubscribe> 139.229 + <post>strabon-devel@di.uoa.gr</post> 139.230 + <archive>http://cgi.di.uoa.gr/~mailman/pipermail/strabon-devel/</archive> 139.231 + </mailingList> 139.232 + </mailingLists> 139.233 139.234 <repositories> 139.235 <!-- 139.236 @@ -710,6 +887,18 @@ 139.237 <name>Strabon - maven repository - snapshots</name> 139.238 <url>http://maven.strabon.di.uoa.gr/content/repositories/snapshots</url> 139.239 </repository> 139.240 + <repository> 139.241 + <releases> 139.242 + <enabled>true</enabled> 139.243 + </releases> 139.244 + <snapshots> 139.245 + <enabled>false</enabled> 139.246 + </snapshots> 139.247 + <id>strabon.sesame</id> 139.248 + <name>Strabon - maven repository - sesame artifacts (temporary)</name> 139.249 + <url>http://maven.strabon.di.uoa.gr/content/repositories/strabon.sesame/</url> 139.250 + </repository> 139.251 + <!-- 139.252 <repository> 139.253 <releases> 139.254 <enabled>true</enabled> 139.255 @@ -753,6 +942,16 @@ 139.256 <name>OpenGeo Maven Repository</name> 139.257 <url>http://download.osgeo.org/webdav/geotools/</url> 139.258 </repository> 139.259 + <!-- 139.260 + <repository> 139.261 + <snapshots> 139.262 + <enabled>false</enabled> 139.263 + </snapshots> 139.264 + <id>umlgraph</id> 139.265 + <name>UMLGraph binaries provider</name> 139.266 + <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url> 139.267 + </repository> 139.268 + --> 139.269 </repositories> 139.270 139.271 <distributionManagement>
140.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/PostGISConnectionFactory.java Fri Apr 19 09:11:47 2013 +0300 140.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/PostGISConnectionFactory.java Fri Apr 19 14:37:09 2013 +0300 140.3 @@ -1,7 +1,11 @@ 140.4 -/* 140.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 140.6 - * 140.7 - * Licensed under the Aduna BSD-style license. 140.8 +/** 140.9 + * This Source Code Form is subject to the terms of the Mozilla Public 140.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this 140.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 140.12 + * 140.13 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 140.14 + * 140.15 + * http://www.strabon.di.uoa.gr/ 140.16 */ 140.17 package org.openrdf.sail.postgis; 140.18 140.19 @@ -34,7 +38,7 @@ 140.20 * Responsible to initialise and wire all components together that will be 140.21 * needed to satisfy any sail connection request. 140.22 * 140.23 - * @author James Leigh 140.24 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 140.25 */ 140.26 public class PostGISConnectionFactory extends GeneralDBConnectionFactory { 140.27 140.28 @@ -101,6 +105,7 @@ 140.29 bfactory.setValueFactory(vf); 140.30 bfactory.setUsingHashTable(hashManager != null); 140.31 s.setQueryBuilderFactory(bfactory); 140.32 + 140.33 GeneralDBConnection conn = new GeneralDBConnection(sail, s); 140.34 conn.setNamespaces(namespaces); 140.35 GeneralDBEvaluationFactory efactory = new PostGISEvaluationFactory();
141.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/PostGISProvider.java Fri Apr 19 09:11:47 2013 +0300 141.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/PostGISProvider.java Fri Apr 19 14:37:09 2013 +0300 141.3 @@ -1,19 +1,21 @@ 141.4 -/* 141.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 141.6 - * 141.7 - * Licensed under the Aduna BSD-style license. 141.8 +/** 141.9 + * This Source Code Form is subject to the terms of the Mozilla Public 141.10 + * License, v. 2.0. If a copy of the MPL was not distributed with this 141.11 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 141.12 + * 141.13 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 141.14 + * 141.15 + * http://www.strabon.di.uoa.gr/ 141.16 */ 141.17 package org.openrdf.sail.postgis; 141.18 141.19 import org.openrdf.sail.generaldb.GeneralDBProvider; 141.20 141.21 - 141.22 - 141.23 /** 141.24 * Checks the database product name and version to be compatible with this 141.25 * Sesame store. 141.26 * 141.27 - * @author James Leigh 141.28 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 141.29 * 141.30 */ 141.31 public class PostGISProvider extends GeneralDBProvider {
142.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/PostGISSqlTable.java Fri Apr 19 09:11:47 2013 +0300 142.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/PostGISSqlTable.java Fri Apr 19 14:37:09 2013 +0300 142.3 @@ -7,9 +7,10 @@ 142.4 142.5 import java.sql.SQLException; 142.6 142.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 142.8 import org.openrdf.sail.generaldb.GeneralDBSqlTable; 142.9 142.10 +import eu.earthobservatory.constants.GeoConstants; 142.11 + 142.12 /** 142.13 * Converts table names to lower-case and include the analyse optimisation. 142.14 *
143.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISEvaluation.java Fri Apr 19 09:11:47 2013 +0300 143.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISEvaluation.java Fri Apr 19 14:37:09 2013 +0300 143.3 @@ -29,6 +29,7 @@ 143.4 import org.openrdf.sail.rdbms.exceptions.RdbmsQueryEvaluationException; 143.5 import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException; 143.6 import org.openrdf.sail.generaldb.schema.IdSequence; 143.7 +import org.slf4j.Logger; 143.8 import org.slf4j.LoggerFactory; 143.9 143.10 /** 143.11 @@ -40,12 +41,11 @@ 143.12 */ 143.13 public class PostGISEvaluation extends GeneralDBEvaluation { 143.14 143.15 + private static final Logger logger = LoggerFactory.getLogger(org.openrdf.sail.postgis.evaluation.PostGISEvaluation.class); 143.16 143.17 - public PostGISEvaluation(GeneralDBQueryBuilderFactory factory, GeneralDBTripleRepository triples, Dataset dataset, 143.18 - IdSequence ids) 143.19 + public PostGISEvaluation(GeneralDBQueryBuilderFactory factory, GeneralDBTripleRepository triples, Dataset dataset, IdSequence ids) 143.20 { 143.21 super(factory, triples, dataset, ids); 143.22 - logger = LoggerFactory.getLogger(PostGISEvaluation.class); 143.23 this.factory = factory; 143.24 } 143.25 143.26 @@ -70,7 +70,7 @@ 143.27 result.setBindings(bindings); 143.28 result.setValueFactory(vf); 143.29 result.setIdSequence(ids); 143.30 - //XXX addition 143.31 + // addition 143.32 result.setGeoNames(this.geoNames); 143.33 result.setConstructIndexesAndNames(this.constructIndexesAndNames); 143.34 //XXX addition- constant
144.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Fri Apr 19 09:11:47 2013 +0300 144.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Fri Apr 19 14:37:09 2013 +0300 144.3 @@ -16,6 +16,7 @@ 144.4 144.5 import org.openrdf.query.algebra.evaluation.function.datetime.Timezone; 144.6 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 144.7 +import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 144.8 import org.openrdf.sail.generaldb.algebra.GeneralDBColumnVar; 144.9 import org.openrdf.sail.generaldb.algebra.GeneralDBDateTimeColumn; 144.10 import org.openrdf.sail.generaldb.algebra.GeneralDBDoubleValue; 144.11 @@ -63,8 +64,10 @@ 144.12 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRelate; 144.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRight; 144.14 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary; 144.15 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructTriple; 144.16 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructUnary; 144.17 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricBinary; 144.18 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricTriple; 144.19 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricUnary; 144.20 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialProperty; 144.21 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouches; 144.22 @@ -110,6 +113,9 @@ 144.23 import org.openrdf.sail.rdbms.exceptions.RdbmsException; 144.24 import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException; 144.25 144.26 +import eu.earthobservatory.constants.GeoConstants; 144.27 +import eu.earthobservatory.constants.OGCConstants; 144.28 + 144.29 /** 144.30 * Constructs an SQL query from {@link GeneralDBSqlExpr}s and {@link GeneralDBFromItem}s. 144.31 * 144.32 @@ -123,8 +129,9 @@ 144.33 public static final String SRID_FIELD = "srid"; 144.34 public static final String ST_TRANSFORM = "ST_Transform"; 144.35 public static final String ST_ASBINARY = "ST_AsBinary"; 144.36 - 144.37 - public static final String PERIOD_COLUMN = "period"; //this is the name of the period column in period_values table 144.38 + public static final String PERIOD_COLUMN = "period"; //this is the name of the period column in period_values table 144.39 + public static final String GEOGRAPHY = "Geography"; 144.40 + public static final String GEOMETRY = "Geometry"; 144.41 public static final String PERIOD_TO_CSTRING="period_out"; //postgres temporal functions for converting period to cstring 144.42 public static final String CSTRING_TO_TEXT="textin"; //postres function for converting cstring to text 144.43 /** 144.44 @@ -279,6 +286,7 @@ 144.45 filter.openBracket(); 144.46 System.out.println("267"); 144.47 // 144.48 + String alias = getLabelAlias(var.getRdbmsVar()); 144.49 144.50 filter.column(alias, STRDFGEO_FIELD); 144.51 //XXX SRID 144.52 @@ -366,6 +374,7 @@ 144.53 boolean isTemporalConstruct = false; 144.54 144.55 if(!(expr instanceof GeneralDBSqlSpatialMetricBinary) 144.56 + &&!(expr instanceof GeneralDBSqlSpatialMetricTriple) 144.57 &&!(expr instanceof GeneralDBSqlSpatialMetricUnary) 144.58 &&!(expr instanceof GeneralDBSqlMathExpr) 144.59 &&!(expr instanceof GeneralDBSqlSpatialProperty) 144.60 @@ -394,10 +403,37 @@ 144.61 { 144.62 dispatchUnarySqlOperator((UnaryGeneralDBOperator) expr, query.select); 144.63 } 144.64 + 144.65 +else if(expr instanceof GeneralDBSqlSpatialMetricTriple) 144.66 + { 144.67 + dispatchTripleSqlOperator((GeneralDBSqlSpatialMetricTriple) expr, query.select); 144.68 + } 144.69 + else if(expr instanceof GeneralDBSqlSpatialConstructTriple) 144.70 + { 144.71 + dispatchTripleSqlOperator((GeneralDBSqlSpatialConstructTriple) expr, query.select); 144.72 + } 144.73 + 144.74 + 144.75 + else if(expr instanceof GeneralDBSqlSpatialMetricTriple) 144.76 + { 144.77 + dispatchTripleSqlOperator((GeneralDBSqlSpatialMetricTriple) expr, query.select); 144.78 + } 144.79 + else if(expr instanceof GeneralDBSqlSpatialConstructTriple) 144.80 + { 144.81 + dispatchTripleSqlOperator((GeneralDBSqlSpatialConstructTriple) expr, query.select); 144.82 + } 144.83 + 144.84 + else if(expr instanceof GeneralDBSqlSpatialConstructTriple) 144.85 + { 144.86 + dispatchTripleSqlOperator((GeneralDBSqlSpatialConstructTriple) expr, query.select); 144.87 + } 144.88 + //SRID support must be explicitly added! 144.89 if(isTemporalConstruct) 144.90 { 144.91 - query.select.append("))"); } 144.92 - //SRID support must be explicitly added! 144.93 + query.select.append("))"); 144.94 + } 144.95 + 144.96 + 144.97 return this; 144.98 } 144.99 144.100 @@ -724,11 +760,10 @@ 144.101 } 144.102 144.103 @Override 144.104 - protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter) 144.105 - throws UnsupportedRdbmsOperatorException 144.106 - { 144.107 - appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Buffer); 144.108 - } 144.109 + protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 144.110 + { 144.111 + appendBuffer(expr, filter, SpatialFunctionsPostGIS.ST_Buffer); 144.112 + } 144.113 144.114 //XXX Different Behavior 144.115 @Override 144.116 @@ -795,11 +830,10 @@ 144.117 144.118 //Spatial Metric Functions 144.119 @Override 144.120 - protected void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter) 144.121 - throws UnsupportedRdbmsOperatorException 144.122 - { 144.123 - appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Distance); 144.124 - } 144.125 + protected void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 144.126 + { 144.127 + appendDistance(expr, filter, SpatialFunctionsPostGIS.ST_Distance); 144.128 + } 144.129 144.130 @Override 144.131 protected void append(GeneralDBSqlGeoArea expr, GeneralDBSqlExprBuilder filter) 144.132 @@ -948,6 +982,10 @@ 144.133 { 144.134 appendConstructFunction(expr.getArg(), filter); 144.135 } 144.136 + else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructTriple) 144.137 + { 144.138 + appendConstructFunction(expr.getArg(), filter); 144.139 + } 144.140 else if(expr.getArg() instanceof GeneralDBSqlCase) 144.141 { 144.142 GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getArg()).getEntries().get(0).getResult(); 144.143 @@ -962,8 +1000,8 @@ 144.144 } 144.145 else 144.146 { 144.147 - //4326 by default - Software House additions 144.148 - filter.append("4326"); 144.149 + // set default SRID ({@link GeoConstants#defaultSRID}) 144.150 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 144.151 } 144.152 } 144.153 144.154 @@ -1002,7 +1040,7 @@ 144.155 e.printStackTrace(); 144.156 } 144.157 144.158 - filter.append(" ST_GeomFromText('"+poly.toWKT() +"',4326)"); 144.159 + filter.append(" ST_GeomFromText('"+poly.toWKT() +"',"+String.valueOf(GeoConstants.defaultSRID)+")"); 144.160 144.161 return raw; 144.162 } 144.163 @@ -1323,6 +1361,10 @@ 144.164 { 144.165 appendConstructFunction(expr.getLeftArg(), filter); 144.166 } 144.167 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple) 144.168 + { 144.169 + appendConstructFunction(expr.getLeftArg(), filter); 144.170 + } 144.171 else 144.172 { 144.173 appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter); 144.174 @@ -1365,6 +1407,10 @@ 144.175 { 144.176 appendConstructFunction(expr.getRightArg(), filter); 144.177 } 144.178 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple) 144.179 + { 144.180 + appendConstructFunction(expr.getLeftArg(), filter); 144.181 + } 144.182 else 144.183 { 144.184 appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter); 144.185 @@ -1376,9 +1422,8 @@ 144.186 } 144.187 144.188 //Used in all the generaldb stsparql boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 144.189 - protected void appendTransformFunc(GeneralDBSqlGeoTransform expr, GeneralDBSqlExprBuilder filter) 144.190 - throws UnsupportedRdbmsOperatorException 144.191 - { 144.192 + protected void appendTransformFunc(GeneralDBSqlGeoTransform expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException 144.193 + { 144.194 //In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))") 144.195 boolean sridNeeded = true; 144.196 //XXX Incorporating SRID 144.197 @@ -1463,6 +1508,10 @@ 144.198 { 144.199 appendConstructFunction(expr.getLeftArg(), filter); 144.200 } 144.201 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple) 144.202 + { 144.203 + appendConstructFunction(expr.getLeftArg(), filter); 144.204 + } 144.205 else if(expr.getLeftArg() instanceof GeneralDBSqlCase) 144.206 { 144.207 GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult(); 144.208 @@ -1500,8 +1549,8 @@ 144.209 else if(expr.getRightArg() instanceof GeneralDBStringValue) 144.210 { 144.211 String unparsedSRID = ((GeneralDBStringValue)expr.getRightArg()).getValue(); 144.212 - // int srid = Integer.parseInt(unparsedSRID.substring(unparsedSRID.lastIndexOf('/')+1)); 144.213 - sridExpr = unparsedSRID.substring(unparsedSRID.lastIndexOf('/')+1); 144.214 + // TODO Check for other kinds of URIs (e.g., not only for EPSG) 144.215 + sridExpr = String.valueOf(WKTHelper.getSRID(unparsedSRID)); 144.216 filter.append(sridExpr); 144.217 filter.closeBracket(); 144.218 } 144.219 @@ -1516,8 +1565,7 @@ 144.220 filter.appendComma(); 144.221 filter.append(sridExpr); 144.222 } 144.223 - 144.224 - } 144.225 + } 144.226 144.227 /** Addition for datetime metric functions 144.228 * 144.229 @@ -1816,16 +1864,14 @@ 144.230 144.231 } 144.232 144.233 - protected void appendGeneralDBSpatialFunctionBinary(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) 144.234 - throws UnsupportedRdbmsOperatorException 144.235 - { 144.236 + { 144.237 //In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))") 144.238 boolean sridNeeded = true; 144.239 //XXX Incorporating SRID 144.240 String sridExpr = null; 144.241 144.242 filter.openBracket(); 144.243 - 144.244 + 144.245 boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 144.246 boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 144.247 144.248 @@ -1852,6 +1898,11 @@ 144.249 { 144.250 child = ((BinaryGeneralDBOperator) tmp).getLeftArg(); 144.251 } 144.252 + else if(tmp instanceof TripleGeneralDBOperator) 144.253 + { 144.254 + child = ((TripleGeneralDBOperator) tmp).getLeftArg(); 144.255 + } 144.256 + 144.257 else //(tmp instanceof UnaryGeneralDBOperator) 144.258 { 144.259 child = ((UnaryGeneralDBOperator) tmp).getArg(); 144.260 @@ -1901,7 +1952,6 @@ 144.261 case ST_Union: filter.appendFunction("ST_Union"); break; 144.262 case ST_SymDifference: filter.appendFunction("ST_SymDifference"); break; 144.263 case ST_Buffer: filter.appendFunction("ST_Buffer"); break; 144.264 - case ST_Distance: filter.appendFunction("ST_Distance"); break; 144.265 144.266 case ST_Equals: filter.appendFunction("ST_Equals"); break; 144.267 case ST_Disjoint: filter.appendFunction("ST_Disjoint"); break; 144.268 @@ -1911,9 +1961,8 @@ 144.269 case ST_Within: filter.appendFunction("ST_Within"); break; 144.270 case ST_Contains: filter.appendFunction("ST_Contains"); break; 144.271 case ST_Overlaps: filter.appendFunction("ST_Overlaps"); break; 144.272 - 144.273 } 144.274 - 144.275 + 144.276 filter.openBracket(); 144.277 if(expr.getLeftArg() instanceof GeneralDBStringValue) 144.278 { 144.279 @@ -1927,6 +1976,10 @@ 144.280 { 144.281 appendConstructFunction(expr.getLeftArg(), filter); 144.282 } 144.283 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple) 144.284 + { 144.285 + appendConstructFunction(expr.getLeftArg(), filter); 144.286 + } 144.287 else if(expr.getLeftArg() instanceof GeneralDBSqlCase) 144.288 { 144.289 GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult(); 144.290 @@ -1938,7 +1991,6 @@ 144.291 } 144.292 filter.appendComma(); 144.293 144.294 - 144.295 if(expr.getRightArg() instanceof GeneralDBStringValue) 144.296 { 144.297 appendWKT(expr.getRightArg(),filter); 144.298 @@ -1951,6 +2003,10 @@ 144.299 { 144.300 appendConstructFunction(expr.getRightArg(), filter); 144.301 } 144.302 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructTriple) 144.303 + { 144.304 + appendConstructFunction(expr.getRightArg(), filter); 144.305 + } 144.306 else if(expr.getRightArg() instanceof GeneralDBSqlCase) 144.307 { 144.308 GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult(); 144.309 @@ -1986,12 +2042,15 @@ 144.310 { 144.311 appendMetricFunction(expr.getRightArg(), filter); 144.312 } 144.313 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple) 144.314 + { 144.315 + appendMetricFunction(expr.getRightArg(), filter); 144.316 + } 144.317 else 144.318 { 144.319 appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter); 144.320 } 144.321 144.322 - 144.323 filter.closeBracket(); 144.324 //SRID Support 144.325 if(expr instanceof GeneralDBSqlSpatialConstructBinary && expr.getParentNode() == null) 144.326 @@ -2010,13 +2069,425 @@ 144.327 filter.appendComma(); 144.328 filter.append(sridExpr); 144.329 } 144.330 + } 144.331 144.332 + //Distance function 144.333 + protected void appendDistance(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) throws UnsupportedRdbmsOperatorException 144.334 + { 144.335 + String units = null; 144.336 + 144.337 + filter.openBracket(); 144.338 + 144.339 + boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 144.340 + boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 144.341 + boolean check3 = expr.getThirdArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 144.342 + 144.343 + if(check1) 144.344 + { 144.345 + this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 144.346 + 144.347 + } 144.348 + else if(check2) 144.349 + { 144.350 + this.append((GeneralDBSqlNull)expr.getRightArg(), filter); 144.351 + } 144.352 + else if(check3) 144.353 + { 144.354 + this.append((GeneralDBSqlNull)expr.getThirdArg(), filter); 144.355 + } 144.356 + else 144.357 + { 144.358 + filter.appendFunction("ST_Distance"); 144.359 + filter.openBracket(); 144.360 + 144.361 + if (expr.getThirdArg() instanceof GeneralDBStringValue) 144.362 + { 144.363 + units = ((GeneralDBStringValue)expr.getThirdArg()).getValue(); 144.364 + if(!OGCConstants.supportedUnitsOfMeasure.contains(units)) 144.365 + { 144.366 + throw new UnsupportedRdbmsOperatorException("No such unit of measure exists"); 144.367 + } 144.368 + 144.369 + if(units.equals(OGCConstants.OGCmetre)) 144.370 + { 144.371 + filter.appendFunction(GEOGRAPHY); 144.372 + filter.openBracket(); 144.373 + filter.appendFunction(ST_TRANSFORM); 144.374 + filter.openBracket(); 144.375 + } 144.376 + else if(units.equals(OGCConstants.OGCdegree)) 144.377 + { 144.378 + filter.appendFunction(ST_TRANSFORM); 144.379 + filter.openBracket(); 144.380 + } 144.381 + } 144.382 + 144.383 + if(expr.getLeftArg() instanceof GeneralDBStringValue) 144.384 + { 144.385 + appendWKT(expr.getLeftArg(),filter); 144.386 + } 144.387 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructBinary) 144.388 + { 144.389 + appendConstructFunction(expr.getLeftArg(), filter); 144.390 + } 144.391 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructUnary) 144.392 + { 144.393 + appendConstructFunction(expr.getLeftArg(), filter); 144.394 + } 144.395 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple) 144.396 + { 144.397 + appendConstructFunction(expr.getLeftArg(), filter); 144.398 + } 144.399 + else if(expr.getLeftArg() instanceof GeneralDBSqlCase) 144.400 + { 144.401 + GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult(); 144.402 + appendMBB(onlyLabel,filter); 144.403 + } 144.404 + else 144.405 + { 144.406 + appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter); 144.407 + } 144.408 + 144.409 + if(units.equals(OGCConstants.OGCmetre)) 144.410 + { 144.411 + filter.appendComma(); 144.412 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 144.413 + filter.closeBracket(); //close st_transform 144.414 + filter.closeBracket(); //close geography 144.415 + 144.416 + filter.appendComma(); 144.417 + 144.418 + filter.appendFunction(GEOGRAPHY); 144.419 + filter.openBracket(); 144.420 + filter.appendFunction(ST_TRANSFORM); 144.421 + filter.openBracket(); 144.422 + } 144.423 + else if(units.equals(OGCConstants.OGCdegree)) 144.424 + { 144.425 + filter.appendComma(); 144.426 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 144.427 + filter.closeBracket(); //close st_transform 144.428 + 144.429 + filter.appendComma(); 144.430 + 144.431 + filter.appendFunction(ST_TRANSFORM); 144.432 + filter.openBracket(); 144.433 + } 144.434 + else 144.435 + { 144.436 + filter.appendComma(); 144.437 + } 144.438 + 144.439 + if(expr.getRightArg() instanceof GeneralDBStringValue) 144.440 + { 144.441 + appendWKT(expr.getRightArg(),filter); 144.442 + } 144.443 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructUnary) 144.444 + { 144.445 + appendConstructFunction(expr.getRightArg(), filter); 144.446 + } 144.447 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructBinary) 144.448 + { 144.449 + appendConstructFunction(expr.getRightArg(), filter); 144.450 + } 144.451 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple) 144.452 + { 144.453 + appendConstructFunction(expr.getLeftArg(), filter); 144.454 + } 144.455 + else if(expr.getRightArg() instanceof GeneralDBSqlCase) 144.456 + { 144.457 + GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult(); 144.458 + appendMBB(onlyLabel,filter); 144.459 + } 144.460 + else if(expr.getRightArg() instanceof GeneralDBURIColumn) //case met in transform! 144.461 + { 144.462 + filter.keepSRID_part1(); 144.463 + append(((GeneralDBURIColumn)expr.getRightArg()), filter); 144.464 + filter.keepSRID_part2(); 144.465 + append(((GeneralDBURIColumn)expr.getRightArg()), filter); 144.466 + filter.keepSRID_part3(); 144.467 + } 144.468 + //case met in buffer when in select -> buffer(?spatial,?thematic) 144.469 + else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial()) 144.470 + { 144.471 + append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 144.472 + appendCastToDouble(filter); 144.473 + } 144.474 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricBinary) 144.475 + { 144.476 + appendMetricFunction(expr.getRightArg(), filter); 144.477 + } 144.478 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricUnary) 144.479 + { 144.480 + appendMetricFunction(expr.getRightArg(), filter); 144.481 + } 144.482 + else 144.483 + { 144.484 + appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter); 144.485 } 144.486 144.487 + if(units.equals(OGCConstants.OGCmetre)) 144.488 + { 144.489 + filter.appendComma(); 144.490 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 144.491 + filter.closeBracket(); 144.492 + filter.closeBracket(); 144.493 + } 144.494 + else if(units.equals(OGCConstants.OGCdegree)) 144.495 + { 144.496 + filter.appendComma(); 144.497 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 144.498 + filter.closeBracket(); 144.499 + } 144.500 + 144.501 + filter.closeBracket(); 144.502 + } 144.503 + filter.closeBracket(); 144.504 + } 144.505 + 144.506 + //Buffer function 144.507 + protected void appendBuffer(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) throws UnsupportedRdbmsOperatorException 144.508 + { 144.509 + boolean sridNeeded = true; 144.510 + //XXX Incorporating SRID 144.511 + String sridExpr = null; 144.512 + String units = null; 144.513 + 144.514 + filter.openBracket(); 144.515 + 144.516 + boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 144.517 + boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 144.518 + boolean check3 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 144.519 + 144.520 + if(check1) 144.521 + { 144.522 + this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 144.523 + 144.524 + } 144.525 + else if(check2) 144.526 + { 144.527 + this.append((GeneralDBSqlNull)expr.getRightArg(), filter); 144.528 + } 144.529 + else if(check3) 144.530 + { 144.531 + this.append((GeneralDBSqlNull)expr.getRightArg(), filter); 144.532 + } 144.533 + else 144.534 + { 144.535 + GeneralDBSqlExpr tmp = expr; 144.536 + if(tmp instanceof GeneralDBSqlSpatialConstructTriple && tmp.getParentNode() == null) 144.537 + { 144.538 + while(true) 144.539 + { 144.540 + GeneralDBSqlExpr child; 144.541 + 144.542 + if(tmp instanceof TripleGeneralDBOperator) 144.543 + { 144.544 + child = ((TripleGeneralDBOperator) tmp).getLeftArg(); 144.545 + } 144.546 + else if(tmp instanceof BinaryGeneralDBOperator) 144.547 + { 144.548 + child = ((BinaryGeneralDBOperator) tmp).getLeftArg(); 144.549 + } 144.550 + else //(tmp instanceof UnaryGeneralDBOperator) 144.551 + { 144.552 + child = ((UnaryGeneralDBOperator) tmp).getArg(); 144.553 + } 144.554 + 144.555 + tmp = child; 144.556 + if(tmp instanceof GeneralDBLabelColumn) 144.557 + { 144.558 + //Reached the innermost left var -> need to capture its SRID 144.559 + String alias; 144.560 + if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 144.561 + //Predicates used in triple patterns non-existent in db 144.562 + alias="NULL"; 144.563 + } 144.564 + else 144.565 + { 144.566 + //Reached the innermost left var -> need to capture its SRID 144.567 + alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar()); 144.568 + alias=alias+".srid"; 144.569 + } 144.570 + sridExpr = alias; 144.571 + break; 144.572 + } 144.573 + else if (tmp instanceof GeneralDBStringValue) //Constant!! 144.574 + { 144.575 + sridNeeded = false; 144.576 + break; 144.577 + } 144.578 + } 144.579 + if(sridNeeded) 144.580 + { 144.581 + filter.appendFunction(ST_TRANSFORM); 144.582 + filter.openBracket(); 144.583 + } 144.584 + } 144.585 + 144.586 + if (expr.getThirdArg() instanceof GeneralDBStringValue) 144.587 + { 144.588 + units = ((GeneralDBStringValue)expr.getThirdArg()).getValue(); 144.589 + 144.590 + if(!OGCConstants.supportedUnitsOfMeasure.contains(units)) 144.591 + { 144.592 + throw new UnsupportedRdbmsOperatorException("No such unit of measure exists"); 144.593 + } 144.594 + 144.595 + if(units.equals(OGCConstants.OGCmetre)) 144.596 + { 144.597 + if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0))) 144.598 + { 144.599 + filter.appendFunction("ST_Buffer"); 144.600 + filter.openBracket(); 144.601 + filter.appendFunction(ST_TRANSFORM); 144.602 + filter.openBracket(); 144.603 + } 144.604 + else 144.605 + { 144.606 + filter.appendFunction(GEOMETRY); 144.607 + filter.openBracket(); 144.608 + filter.appendFunction("ST_Buffer"); 144.609 + filter.openBracket(); 144.610 + filter.appendFunction(GEOGRAPHY); 144.611 + filter.openBracket(); 144.612 + filter.appendFunction(ST_TRANSFORM); 144.613 + filter.openBracket(); 144.614 + } 144.615 + } 144.616 + else if(units.equals(OGCConstants.OGCdegree)) 144.617 + { 144.618 + filter.appendFunction("ST_Buffer"); 144.619 + filter.openBracket(); 144.620 + filter.appendFunction(ST_TRANSFORM); 144.621 + filter.openBracket(); 144.622 + } 144.623 + } 144.624 + 144.625 + if(expr.getLeftArg() instanceof GeneralDBStringValue) 144.626 + { 144.627 + appendWKT(expr.getLeftArg(),filter); 144.628 + } 144.629 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructBinary) 144.630 + { 144.631 + appendConstructFunction(expr.getLeftArg(), filter); 144.632 + } 144.633 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructUnary) 144.634 + { 144.635 + appendConstructFunction(expr.getLeftArg(), filter); 144.636 + } 144.637 + else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple) 144.638 + { 144.639 + appendConstructFunction(expr.getLeftArg(), filter); 144.640 + } 144.641 + else if(expr.getLeftArg() instanceof GeneralDBSqlCase) 144.642 + { 144.643 + GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult(); 144.644 + appendMBB(onlyLabel,filter); 144.645 + } 144.646 + else 144.647 + { 144.648 + appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter); 144.649 + } 144.650 + 144.651 + if(units.equals(OGCConstants.OGCmetre)) 144.652 + { 144.653 + if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0))) 144.654 + { 144.655 + filter.appendComma(); 144.656 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 144.657 + filter.closeBracket(); //close st_transform 144.658 + filter.appendComma(); 144.659 + } 144.660 + else 144.661 + { 144.662 + filter.appendComma(); 144.663 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 144.664 + filter.closeBracket(); //close st_transform 144.665 + filter.closeBracket(); //close geography 144.666 + filter.appendComma(); 144.667 + } 144.668 + } 144.669 + else if(units.equals(OGCConstants.OGCdegree)) 144.670 + { 144.671 + filter.appendComma(); 144.672 + filter.append(String.valueOf(GeoConstants.defaultSRID)); 144.673 + filter.closeBracket(); //close st_transform 144.674 + filter.appendComma(); 144.675 + } 144.676 + 144.677 + if(expr.getRightArg() instanceof GeneralDBStringValue) 144.678 + { 144.679 + appendWKT(expr.getRightArg(),filter); 144.680 + } 144.681 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructUnary) 144.682 + { 144.683 + appendConstructFunction(expr.getRightArg(), filter); 144.684 + } 144.685 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructBinary) 144.686 + { 144.687 + appendConstructFunction(expr.getRightArg(), filter); 144.688 + } 144.689 + else if(expr.getRightArg() instanceof GeneralDBSqlCase) 144.690 + { 144.691 + GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult(); 144.692 + appendMBB(onlyLabel,filter); 144.693 + } 144.694 + else if(expr.getRightArg() instanceof GeneralDBDoubleValue) 144.695 + { 144.696 + append(((GeneralDBDoubleValue)expr.getRightArg()), filter); 144.697 + } 144.698 + else if(expr.getRightArg() instanceof GeneralDBNumericColumn) 144.699 + { 144.700 + append(((GeneralDBNumericColumn)expr.getRightArg()), filter); 144.701 + } 144.702 + //case met in buffer when in select -> buffer(?spatial,?thematic) 144.703 + else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial()) 144.704 + { 144.705 + append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 144.706 + appendCastToDouble(filter); 144.707 + } 144.708 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricBinary) 144.709 + { 144.710 + appendMetricFunction(expr.getRightArg(), filter); 144.711 + } 144.712 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricUnary) 144.713 + { 144.714 + appendMetricFunction(expr.getRightArg(), filter); 144.715 + } 144.716 + else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple) 144.717 + { 144.718 + appendMetricFunction(expr.getRightArg(), filter); 144.719 + } 144.720 + else 144.721 + { 144.722 + appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter); 144.723 + } 144.724 + 144.725 + if(units.equals(OGCConstants.OGCmetre) && !((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))) 144.726 + filter.closeBracket(); //close Geometry 144.727 + filter.closeBracket(); 144.728 + //SRID Support 144.729 + if(expr instanceof GeneralDBSqlSpatialConstructTriple && expr.getParentNode() == null) 144.730 + { 144.731 + filter.appendComma(); 144.732 + filter.append(sridExpr); 144.733 + filter.closeBracket(); 144.734 + } 144.735 + /// 144.736 + } 144.737 + filter.closeBracket(); 144.738 + //Used to explicitly include SRID 144.739 + if(expr instanceof GeneralDBSqlSpatialConstructTriple && expr.getParentNode() == null) 144.740 + { 144.741 + filter.appendComma(); 144.742 + filter.append(sridExpr); 144.743 + } 144.744 + } 144.745 + 144.746 //Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1) 144.747 - protected void appendGeneralDBSpatialFunctionUnary(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) 144.748 - throws UnsupportedRdbmsOperatorException 144.749 - { 144.750 + protected void appendGeneralDBSpatialFunctionUnary(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) throws UnsupportedRdbmsOperatorException 144.751 + { 144.752 //In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))") 144.753 boolean sridNeeded = true; 144.754 String sridExpr = null; 144.755 @@ -2301,9 +2772,8 @@ 144.756 144.757 //GeoSPARQL 144.758 //XXX 144.759 - protected void appendRelate(BinaryGeneralDBOperator expr, PostGISSqlExprBuilder filter, char[] intersectionPattern) 144.760 - throws UnsupportedRdbmsOperatorException 144.761 - { 144.762 + protected void appendRelate(BinaryGeneralDBOperator expr, PostGISSqlExprBuilder filter, char[] intersectionPattern) throws UnsupportedRdbmsOperatorException 144.763 + { 144.764 filter.openBracket(); 144.765 144.766 boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
145.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java Fri Apr 19 09:11:47 2013 +0300 145.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/iteration/PostGISBindingIteration.java Fri Apr 19 14:37:09 2013 +0300 145.3 @@ -15,12 +15,13 @@ 145.4 145.5 import org.openrdf.model.URI; 145.6 import org.openrdf.query.BindingSet; 145.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 145.8 import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalConstants; 145.9 import org.openrdf.sail.generaldb.iteration.GeneralDBBindingIteration; 145.10 import org.openrdf.sail.rdbms.model.RdbmsLiteral; 145.11 import org.openrdf.sail.rdbms.model.RdbmsValue; 145.12 145.13 +import eu.earthobservatory.constants.GeoConstants; 145.14 + 145.15 /** 145.16 * Converts a {@link ResultSet} into a {@link BindingSet} in an iteration. 145.17 *
146.1 --- a/resultio-spatial/api/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java Fri Apr 19 09:11:47 2013 +0300 146.2 +++ b/resultio-spatial/api/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java Fri Apr 19 14:37:09 2013 +0300 146.3 @@ -98,16 +98,16 @@ 146.4 } 146.5 146.6 /** 146.7 - * Gets the stSPARQLQueryResultFormat given its name. 146.8 + * Gets the TupleQueryResultFormat given its name. It may be an 146.9 + * stSPARQLQueryResultFormat. 146.10 * 146.11 * @param formatName 146.12 * @return 146.13 */ 146.14 - public static stSPARQLQueryResultFormat valueOf(String formatName) { 146.15 + public static TupleQueryResultFormat valueOf(String formatName) { 146.16 for (TupleQueryResultFormat format : values()) { 146.17 - if (format instanceof stSPARQLQueryResultFormat && 146.18 - format.getName().equalsIgnoreCase(formatName)) { 146.19 - return (stSPARQLQueryResultFormat) format; 146.20 + if (format.getName().equalsIgnoreCase(formatName)) { 146.21 + return format; 146.22 } 146.23 } 146.24
147.1 --- a/resultio-spatial/sparqlgeojson/src/main/java/org/openrdf/query/resultio/sparqlgeojson/stSPARQLResultsGeoJSONWriter.java Fri Apr 19 09:11:47 2013 +0300 147.2 +++ b/resultio-spatial/sparqlgeojson/src/main/java/org/openrdf/query/resultio/sparqlgeojson/stSPARQLResultsGeoJSONWriter.java Fri Apr 19 14:37:09 2013 +0300 147.3 @@ -29,7 +29,6 @@ 147.4 import org.openrdf.query.BindingSet; 147.5 import org.openrdf.query.TupleQueryResultHandlerException; 147.6 import org.openrdf.query.algebra.evaluation.function.spatial.AbstractWKT; 147.7 -import org.openrdf.query.algebra.evaluation.function.spatial.WKTHelper; 147.8 import org.openrdf.query.algebra.evaluation.util.JTSWrapper; 147.9 import org.openrdf.query.resultio.TupleQueryResultFormat; 147.10 import org.openrdf.query.resultio.TupleQueryResultWriter;
148.1 --- a/resultio-spatial/sparqlkml/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java Fri Apr 19 09:11:47 2013 +0300 148.2 +++ b/resultio-spatial/sparqlkml/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java Fri Apr 19 14:37:09 2013 +0300 148.3 @@ -26,7 +26,6 @@ 148.4 import org.openrdf.query.BindingSet; 148.5 import org.openrdf.query.TupleQueryResultHandlerException; 148.6 import org.openrdf.query.algebra.evaluation.function.spatial.AbstractWKT; 148.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 148.8 import org.openrdf.query.algebra.evaluation.util.JTSWrapper; 148.9 import org.openrdf.query.resultio.TupleQueryResultFormat; 148.10 import org.openrdf.query.resultio.TupleQueryResultWriter; 148.11 @@ -47,6 +46,8 @@ 148.12 import com.vividsolutions.jts.geom.Polygon; 148.13 import com.vividsolutions.jts.io.ParseException; 148.14 148.15 +import eu.earthobservatory.constants.GeoConstants; 148.16 + 148.17 /** 148.18 * @author Manos Karpathiotakis <mk@di.uoa.gr> 148.19 * @author Charalampos Nikolaou <charnik@di.uoa.gr>
149.1 --- a/resultio-spatial/sparqlxml/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLResultsXMLWriter.java Fri Apr 19 09:11:47 2013 +0300 149.2 +++ b/resultio-spatial/sparqlxml/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLResultsXMLWriter.java Fri Apr 19 14:37:09 2013 +0300 149.3 @@ -34,11 +34,12 @@ 149.4 import org.openrdf.query.Binding; 149.5 import org.openrdf.query.BindingSet; 149.6 import org.openrdf.query.TupleQueryResultHandlerException; 149.7 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 149.8 import org.openrdf.query.resultio.TupleQueryResultFormat; 149.9 import org.openrdf.query.resultio.TupleQueryResultWriter; 149.10 import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 149.11 149.12 +import eu.earthobservatory.constants.GeoConstants; 149.13 + 149.14 /** 149.15 * A {@link TupleQueryResultWriter} that writes tuple query results in the <a 149.16 * href="http://www.w3.org/TR/rdf-sparql-XMLres/">SPARQL Query Results XML
150.1 --- a/runtime/pom.xml Fri Apr 19 09:11:47 2013 +0300 150.2 +++ b/runtime/pom.xml Fri Apr 19 14:37:09 2013 +0300 150.3 @@ -44,6 +44,14 @@ 150.4 <groupId>org.openrdf.sesame</groupId> 150.5 <artifactId>sesame-queryresultio-spatial-text</artifactId> 150.6 </dependency> 150.7 + <dependency> 150.8 + <groupId>org.openrdf.sesame</groupId> 150.9 + <artifactId>sesame-queryresultio-sparqljson</artifactId> 150.10 + </dependency> 150.11 + <dependency> 150.12 + <groupId>org.openrdf.sesame</groupId> 150.13 + <artifactId>sesame-queryresultio-binary</artifactId> 150.14 + </dependency> 150.15 150.16 150.17 <dependency>
151.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 151.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeneralDBSailRepository.java Fri Apr 19 14:37:09 2013 +0300 151.3 @@ -0,0 +1,42 @@ 151.4 +/** 151.5 + * This Source Code Form is subject to the terms of the Mozilla Public 151.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 151.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 151.8 + * 151.9 + * Copyright (C) 2013, Pyravlos Team 151.10 + * 151.11 + * http://www.strabon.di.uoa.gr/ 151.12 + */ 151.13 +package eu.earthobservatory.runtime.generaldb; 151.14 + 151.15 +import org.openrdf.repository.RepositoryException; 151.16 +import org.openrdf.repository.sail.SailRepository; 151.17 +import org.openrdf.repository.sail.SailRepositoryConnection; 151.18 +import org.openrdf.sail.Sail; 151.19 +import org.openrdf.sail.SailException; 151.20 + 151.21 +/** 151.22 + * This class extends SailRepository only to be able to create 151.23 + * connections that are instances of our class {@link GeneralDBSailRepositoryConnection} 151.24 + * instead of Sesame's {@link SailRepositoryConnection}. See class 151.25 + * {@link GeneralDBSailRepositoryConnection} for the reason behind 151.26 + * this extension. 151.27 + * 151.28 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 151.29 + */ 151.30 +public class GeneralDBSailRepository extends SailRepository { 151.31 + 151.32 + public GeneralDBSailRepository(Sail sail) { 151.33 + super(sail); 151.34 + } 151.35 + 151.36 + @Override 151.37 + public SailRepositoryConnection getConnection() throws RepositoryException { 151.38 + try { 151.39 + return new GeneralDBSailRepositoryConnection(this, getSail().getConnection()); 151.40 + } 151.41 + catch (SailException e) { 151.42 + throw new RepositoryException(e); 151.43 + } 151.44 + } 151.45 +}
152.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 152.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeneralDBSailRepositoryConnection.java Fri Apr 19 14:37:09 2013 +0300 152.3 @@ -0,0 +1,116 @@ 152.4 +/** 152.5 + * This Source Code Form is subject to the terms of the Mozilla Public 152.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 152.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 152.8 + * 152.9 + * Copyright (C) 2013, Pyravlos Team 152.10 + * 152.11 + * http://www.strabon.di.uoa.gr/ 152.12 + */ 152.13 +package eu.earthobservatory.runtime.generaldb; 152.14 + 152.15 +import java.io.IOException; 152.16 +import java.io.InputStream; 152.17 +import java.io.Reader; 152.18 + 152.19 +import org.openrdf.OpenRDFUtil; 152.20 +import org.openrdf.model.Resource; 152.21 +import org.openrdf.repository.RepositoryException; 152.22 +import org.openrdf.repository.sail.SailRepository; 152.23 +import org.openrdf.repository.sail.SailRepositoryConnection; 152.24 +import org.openrdf.repository.util.RDFInserter; 152.25 +import org.openrdf.rio.RDFFormat; 152.26 +import org.openrdf.rio.RDFHandlerException; 152.27 +import org.openrdf.rio.RDFParseException; 152.28 +import org.openrdf.rio.RDFParser; 152.29 +import org.openrdf.rio.Rio; 152.30 +import org.openrdf.rio.UnsupportedRDFormatException; 152.31 +import org.openrdf.rio.helpers.ParseErrorLogger; 152.32 +import org.openrdf.sail.SailConnection; 152.33 + 152.34 +/** 152.35 + * This class extends {@link SailRepositoryConnection} only to allow 152.36 + * for overriding insertion of triples by invoking our implementation 152.37 + * of {@link RDFInserter} so that GeoSPARQL Entailment Extension is 152.38 + * incorporated there in a seamless way. 152.39 + * 152.40 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 152.41 + */ 152.42 +public class GeneralDBSailRepositoryConnection extends SailRepositoryConnection { 152.43 + 152.44 + protected GeneralDBSailRepositoryConnection(SailRepository repository, SailConnection sailConnection) { 152.45 + super(repository, sailConnection); 152.46 + } 152.47 + 152.48 + /** 152.49 + * Adds the data that can be read from the supplied InputStream or Reader to 152.50 + * this repository. 152.51 + * 152.52 + * This method is exactly like the one defined in class {@link RepositoryConnectionBase}, 152.53 + * except for the fact that uses ???? as the RDF handler to triple insertion instead of 152.54 + * the Sesame's default {@link RDFInserter}. 152.55 + * 152.56 + * @param inputStreamOrReader 152.57 + * An {@link InputStream} or {@link Reader} containing RDF data that 152.58 + * must be added to the repository. 152.59 + * @param baseURI 152.60 + * The base URI for the data. 152.61 + * @param dataFormat 152.62 + * The file format of the data. 152.63 + * @param contexts 152.64 + * The context(s) to which the data should be added. 152.65 + * @throws IOException 152.66 + * @throws UnsupportedRDFormatException 152.67 + * @throws RDFParseException 152.68 + * @throws RepositoryException 152.69 + */ 152.70 + @Override 152.71 + protected void addInputStreamOrReader(Object inputStreamOrReader, String baseURI, RDFFormat dataFormat, Resource... contexts) 152.72 + throws IOException, RDFParseException, RepositoryException { 152.73 + OpenRDFUtil.verifyContextNotNull(contexts); 152.74 + 152.75 + RDFParser rdfParser = Rio.createParser(dataFormat, getRepository().getValueFactory()); 152.76 + rdfParser.setParserConfig(getParserConfig()); 152.77 + rdfParser.setParseErrorListener(new ParseErrorLogger()); 152.78 + 152.79 + //RDFInserter rdfInserter = new RDFInserter(this); 152.80 + RDFInserter rdfInserter = new GeosparqlRDFHandlerBase(this); 152.81 + rdfInserter.enforceContext(contexts); 152.82 + rdfParser.setRDFHandler(rdfInserter); 152.83 + 152.84 + boolean autoCommit = isAutoCommit(); 152.85 + setAutoCommit(false); 152.86 + 152.87 + try { 152.88 + if (inputStreamOrReader instanceof InputStream) { 152.89 + rdfParser.parse((InputStream)inputStreamOrReader, baseURI); 152.90 + } 152.91 + else if (inputStreamOrReader instanceof Reader) { 152.92 + rdfParser.parse((Reader)inputStreamOrReader, baseURI); 152.93 + } 152.94 + else { 152.95 + throw new IllegalArgumentException( 152.96 + "inputStreamOrReader must be an InputStream or a Reader, is a: " 152.97 + + inputStreamOrReader.getClass()); 152.98 + } 152.99 + } 152.100 + catch (RDFHandlerException e) { 152.101 + if (autoCommit) { 152.102 + rollback(); 152.103 + } 152.104 + // RDFInserter only throws wrapped RepositoryExceptions 152.105 + throw (RepositoryException)e.getCause(); 152.106 + } 152.107 + catch (RuntimeException e) { 152.108 + if (autoCommit) { 152.109 + rollback(); 152.110 + } 152.111 + throw e; 152.112 + } 152.113 + finally { 152.114 + setAutoCommit(autoCommit); 152.115 + } 152.116 + } 152.117 + 152.118 + 152.119 +}
153.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeosparqlRDFHandlerBase.java Fri Apr 19 09:11:47 2013 +0300 153.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeosparqlRDFHandlerBase.java Fri Apr 19 14:37:09 2013 +0300 153.3 @@ -3,7 +3,7 @@ 153.4 * License, v. 2.0. If a copy of the MPL was not distributed with this 153.5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 153.6 * 153.7 - * Copyright (C) 2012, Pyravlos Team 153.8 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 153.9 * 153.10 * http://www.strabon.di.uoa.gr/ 153.11 * 153.12 @@ -17,346 +17,503 @@ 153.13 153.14 package eu.earthobservatory.runtime.generaldb; 153.15 153.16 -import java.io.StringReader; 153.17 -import java.util.List; 153.18 -import java.util.Arrays; 153.19 +import java.util.Hashtable; 153.20 153.21 +import org.openrdf.model.Resource; 153.22 import org.openrdf.model.Statement; 153.23 -import org.openrdf.rio.helpers.RDFHandlerBase; 153.24 -import org.openrdf.rio.ntriples.NTriplesParser; 153.25 +import org.openrdf.model.URI; 153.26 +import org.openrdf.model.Value; 153.27 +import org.openrdf.model.impl.ContextStatementImpl; 153.28 +import org.openrdf.model.impl.StatementImpl; 153.29 +import org.openrdf.model.impl.URIImpl; 153.30 +import org.openrdf.model.vocabulary.RDF; 153.31 +import org.openrdf.model.vocabulary.RDFS; 153.32 +import org.openrdf.repository.RepositoryConnection; 153.33 +import org.openrdf.repository.util.RDFInserter; 153.34 +import org.openrdf.rio.RDFHandlerException; 153.35 +import org.slf4j.Logger; 153.36 +import org.slf4j.LoggerFactory; 153.37 153.38 -public class GeosparqlRDFHandlerBase extends RDFHandlerBase { 153.39 +import eu.earthobservatory.vocabulary.GeoSPARQL; 153.40 +import eu.earthobservatory.vocabulary.SimpleFeatures; 153.41 + 153.42 +/** 153.43 + * This is the implementation of the RDFS Entailment Extension for 153.44 + * GeoSPARQL. All requirements of this extension are implemented 153.45 + * except for Requirement 25 identified by the URI 153.46 + * <a>http://www.opengis.net/spec/geosparql/1.0/req/rdfs-entailment-extension/bgp-rdfs-ent</a>. 153.47 + * 153.48 + * With respect to GML class hierarchy, the GML Simple Features Profile 2.0 is only supported. 153.49 + * 153.50 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 153.51 + * @author Konstantina Bereta <konstantina.bereta@di.uoa.gr> 153.52 + */ 153.53 +public class GeosparqlRDFHandlerBase extends RDFInserter { 153.54 153.55 - public static String geonamespace = "http://www.opengis.net/ont/geosparql#"; 153.56 - public static String gml="http://www.opengis.net/def/geometryType/OGC-GML/3.2/"; 153.57 - public static String sf="http://www.opengis.net/def/geometryType/OGC-SF/1.0/"; 153.58 - public static String type = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"; 153.59 - public static String SpatialObject= geonamespace + "SpatialObject"; 153.60 - public static String Feature = geonamespace + "Feature"; 153.61 - public static String Geometry= geonamespace + "Geometry"; 153.62 - public static String hasGeometry = geonamespace + "hasGeometry"; 153.63 - public static String defaultGeometry = geonamespace + "defaultGeometry"; 153.64 - public static String dimension= geonamespace + "dimension"; 153.65 - public static String coordinateDimension= geonamespace + "coordinateDimension"; 153.66 - public static String spatialdimension= geonamespace + "spatialdimension"; 153.67 - public static String isEmpty= geonamespace + "isEmpty"; 153.68 - public static String isSimple= geonamespace + "isSimple"; 153.69 - public static String is3D= geonamespace + "is3D"; 153.70 - public static String asWKT= geonamespace + "asWKT"; 153.71 - public static String asGML= geonamespace + "asGML"; 153.72 - public static List <String> ogc_sf= Arrays.asList("Geometry", "Point", "Curve", "Surface", "GeometryCollection", "LineString", "Polygon", "MultiSurface", "MultiCurve", 153.73 - "MultiPoint", "Line", "LinearRing", "MultiPolygon","MultiLineString"); 153.74 - public static List <String> GM_Objects= Arrays.asList("GM_Complex", "GM_Agreggate", "GM_Primitive", "GM_Composite", "GM_MultiPrimitive", 153.75 - "GM_Point", "GM_OrientablePrimitive","GM_OrientableCurve","GM_OrientableSurface", "GM_Curve","GM_Surface","GM_Solid", 153.76 - "GM_CompositeCurve", "GM_CompositeSurface", "GM_CompositeSolid", "GM_Multipoint", "GM_MultiCurve", "GM_MultiSurface", "GM_MultiSolid"); 153.77 - public static List <String> geometryDomainList = Arrays.asList(dimension, coordinateDimension, spatialdimension,isEmpty, isSimple, is3D,asWKT, asGML); 153.78 - public static String WKTLiteral= geonamespace + "WKTLiteral"; 153.79 - public static String GMLLiteral= geonamespace + "GMLLiteral"; 153.80 - public static List <String> rcc8 = Arrays.asList(geonamespace+"rcc8eq",geonamespace+"rcc8dc",geonamespace+"rcc8ec",geonamespace+"rcc8po", 153.81 - geonamespace+"rcc8tppi", geonamespace+"rcc8tpp",geonamespace+ "rcc8ntpp", geonamespace+"rcc8ntpp"); 153.82 + private static final Logger logger = LoggerFactory.getLogger(eu.earthobservatory.runtime.generaldb.GeosparqlRDFHandlerBase.class); 153.83 153.84 - //loose check: tha elegxw an arxizei apo eh- i apo sf- i apo rcc8- (den einai ola tou rcc8) 153.85 + private static final boolean ENABLE_INFERENCE = false; 153.86 153.87 - private StringBuffer triples = new StringBuffer(1024); 153.88 + /** 153.89 + * Keeps a String to URI mapping for the URIs of Simple Features and GML 153.90 + */ 153.91 + private Hashtable<String, URI> uriMap; 153.92 153.93 /** 153.94 - * The number of triples that the "triples" object above contains. 153.95 + * The number of triples that we inferred 153.96 */ 153.97 - private int ntriples = 0; 153.98 + private int numInfTriples = 0; 153.99 153.100 - public StringBuffer getTriples() 153.101 - { 153.102 - return triples; 153.103 - }; 153.104 - 153.105 - public List <String> getrcc8() 153.106 - { 153.107 - return rcc8; 153.108 - } 153.109 - 153.110 - public List <String> getgeometryDomainList() 153.111 - { 153.112 - return geometryDomainList; 153.113 - } 153.114 - 153.115 - public void startRDF() { triples.append("\n");}; 153.116 - 153.117 - public void endRDF() {}; 153.118 - 153.119 - public int getNumberOfTriples() { 153.120 - return ntriples; 153.121 - } 153.122 - 153.123 - public void handleStatement(Statement st) 153.124 - { 153.125 - String subject = st.getSubject().toString(); 153.126 - String predicate = st.getPredicate().toString(); 153.127 - String object = st.getObject().toString(); 153.128 + public GeosparqlRDFHandlerBase(RepositoryConnection con) { 153.129 + super(con); 153.130 153.131 - if(predicate.startsWith("http://www.opengis.net/ont/geosparql#sf")||predicate.startsWith(geonamespace+"eh")|| 153.132 - rcc8.contains(predicate)) 153.133 - { 153.134 - String triple = "<"+subject+ "> <"+ type +"> <"+ SpatialObject+ "> .\n" + 153.135 - "<"+object+ "> <"+ type +"> <"+ SpatialObject+ "> .\n" ; 153.136 - triples.append(triple); 153.137 - ntriples++; 153.138 - } 153.139 - if(predicate.equals(type)&&(object.equals(Feature) || object.equals(Geometry) )) 153.140 - { 153.141 - String triple = "<"+subject+ "> <"+ type +"> <"+ SpatialObject+ "> .\n"; 153.142 - triples.append(triple); 153.143 - ntriples++; 153.144 - } 153.145 - if(predicate.equals(hasGeometry)) 153.146 - { 153.147 - String triple = "<"+subject+ "> <"+ type +"> <"+ Feature+ "> .\n" + 153.148 - "<"+object+ "> <"+ type +"> <"+ Geometry+ "> .\n" + 153.149 - "<"+ subject+ "> <"+ type +"> <"+ SpatialObject + "> .\n" + 153.150 - "<"+ object+ "> <"+ type +"> <"+ SpatialObject + "> .\n"; 153.151 - triples.append(triple); 153.152 - ntriples++; 153.153 - } 153.154 - if(predicate.equals(defaultGeometry)) 153.155 - { 153.156 - String triple = "<"+subject+ "> <"+ type +"> <"+ Feature+ "> .\n" + 153.157 - "<"+object+ "> <"+ type +"> <"+ Geometry+ "> .\n" + 153.158 - "<"+ subject+ "> <"+ type +"> <"+ SpatialObject + "> .\n"+ 153.159 - "<"+ subject+ "> <"+ hasGeometry +"> <"+ object + "> .\n"; 153.160 - triples.append(triple); 153.161 - ntriples++; 153.162 - } 153.163 - if(geometryDomainList.contains(predicate)) 153.164 - { 153.165 - String triple = "<"+subject+ "> <"+ type +"> <"+ Geometry+ "> .\n" + 153.166 - "<"+subject+ "> <"+ type +"> <"+ SpatialObject+ "> .\n"; 153.167 - triples.append(triple); 153.168 - ntriples++; 153.169 - } 153.170 - if (predicate.equals(type)) { 153.171 - if (object.equals(gml + "GM_Complex") 153.172 - || object.equals(gml + "GM_Aggregate") 153.173 - || object.equals(gml + "GM_Primitive")) { 153.174 - String triple = "<" + subject + "> <" + type + "> <" + gml 153.175 - + "GM_Object" + "> .\n"; 153.176 - triples.append(triple); 153.177 - ntriples++; 153.178 - } 153.179 - if (object.equals(gml + "GM_Composite")) { 153.180 - String triple = "<" + subject + "> <" + type + "> <" + gml 153.181 - + "GM_Complex" + "> .\n" + "<" + subject + "> <" + type 153.182 - + "> <" + gml + "GM_Object" + "> .\n"; 153.183 - triples.append(triple); 153.184 - ntriples++; 153.185 - 153.186 - } 153.187 - if (object.equals(gml + "GM_MultiPrimitive")) { 153.188 - String triple = "<" + subject + "> <" + type + "> <" + gml 153.189 - + "GM_Aggregate" + "> .\n" + "<" + subject + "> <" 153.190 - + type + "> <" + gml + "GM_Object" + "> .\n"; 153.191 - triples.append(triple); 153.192 - ntriples++; 153.193 - 153.194 - } 153.195 - if (object.equals(gml + "GM_Point") 153.196 - || object.equals(gml + "GM_OrientablePrimitive") 153.197 - || object.equals(gml + "GM_Solid")) { 153.198 - String triple = "<" + subject + "> <" + type + "> <" + gml 153.199 - + "GM_Primitive" + "> .\n" + "<" + subject + "> <" 153.200 - + type + "> <" + gml + "GM_Object" + "> .\n"; 153.201 - triples.append(triple); 153.202 - ntriples++; 153.203 - 153.204 - } 153.205 - if (object.equals(gml + "GM_OrientableCurve") 153.206 - || object.equals(gml + "GM_OrientableSurface")) { 153.207 - String triple = "<" + subject + "> <" + type + "> <" + gml 153.208 - + "GM_OrientablePrimitive" + "> .\n" + "<" + subject 153.209 - + "> <" + type + "> <" + gml + "GM_Primitive" + "> .\n" 153.210 - + "<" + subject + "> <" + type + "> <" + gml 153.211 - + "GM_Object" + "> .\n"; 153.212 - triples.append(triple); 153.213 - ntriples++; 153.214 - 153.215 - } 153.216 - if (object.equals(gml + "GM_Curve")) { 153.217 - String triple = "<" + subject + "> <" + type + "> <" + gml 153.218 - + "GM_Aggregate" + "> .\n" 153.219 - + "<" + subject + "> <" + type +"> <" + gml + "GM_OrientableCurve" + "> .\n" 153.220 - + "<" + subject + "> <" + type + "> <" + gml + "GM_OrientablePrimitive" + "> .\n" 153.221 - + "<" + subject + "> <" + type + "> <" + gml + "GM_Primitive" + "> .\n" 153.222 - + "<" + subject + "> <" + type + "> <" + gml+ "GM_Object" + "> .\n"; 153.223 - triples.append(triple); 153.224 - ntriples++; 153.225 - 153.226 - } 153.227 - if (object.equals(gml + "GM_Surface")) { 153.228 - String triple = "<" + subject + "> <" + type + "> <" + gml+ "GM_Aggregate" + "> .\n" 153.229 - + "<" + subject + "> <" + type + "> <" + gml + "GM_OrientableSurface" + "> .\n" 153.230 - + "<" + subject + "> <" + type + "> <" + gml + "GM_OrientablePrimitive" + "> .\n" 153.231 - + "<" + subject + "> <" + type + "> <" + gml + "GM_Primitive" + "> .\n" 153.232 - + "<" + subject + "> <" + type + "> <" + gml 153.233 - + "GM_Object" + "> .\n"; 153.234 - triples.append(triple); 153.235 - ntriples++; 153.236 - 153.237 - } 153.238 - if (object.equals(gml + "GM_CompositeCurve")) { 153.239 - String triple = "<" + subject + "> <" + type + "> <" + gml 153.240 - + "GM_Aggregate" + "> .\n" + "<" + subject + "> <" 153.241 - + type + "> <" + gml + "GM_OrientableCurve" + "> .\n" 153.242 - + "<" + subject + "> <" + type + "> <" + gml 153.243 - + "GM_OrientablePrimitive" + "> .\n" + "<" + subject 153.244 - + "> <" + type + "> <" + gml + "GM_Primitive" + "> .\n" 153.245 - + "<" + subject + "> <" + type + "> <" + gml 153.246 - + "GM_Complex" + "> .\n" + "<" + subject + "> <" + type 153.247 - + "> <" + gml + "GM_Composite" + "> .\n" + "<" 153.248 - + subject + "> <" + type + "> <" + gml + "GM_Object" 153.249 - + "> .\n"; 153.250 - triples.append(triple); 153.251 - ntriples++; 153.252 - 153.253 - } 153.254 - if (object.equals(gml + "GM_CompositeSurface")) { 153.255 - String triple = "<" + subject + "> <" + type + "> <" + gml 153.256 - + "GM_OrientableSurface" + "> .\n" + 153.257 - 153.258 - "<" + subject + "> <" + type + "> <" + gml 153.259 - + "GM_OrientablePrimitive" + "> .\n" + "<" + subject 153.260 - + "> <" + type + "> <" + gml + "GM_Primitive" + "> .\n" 153.261 - + "<" + subject + "> <" + type + "> <" + gml 153.262 - + "GM_Complex" + "> .\n" + "<" + subject + "> <" + type 153.263 - + "> <" + gml + "GM_Composite" + "> .\n" + "<" 153.264 - + subject + "> <" + type + "> <" + gml + "GM_Object" 153.265 - + "> .\n"; 153.266 - triples.append(triple); 153.267 - ntriples++; 153.268 - 153.269 - } 153.270 - if (object.equals(gml + "GM_CompositeSolid")) { 153.271 - String triple = "<" + subject + "> <" + type + "> <" + gml 153.272 - + "GM_Solid" + "> .\n" + "<" + subject + "> <" + type 153.273 - + "> <" + gml + "GM_Primitive" + "> .\n" + "<" 153.274 - + subject + "> <" + type + "> <" + gml + "GM_Complex" 153.275 - + "> .\n" + "<" + subject + "> <" + type + "> <" + gml 153.276 - + "GM_Composite" + "> .\n" + "<" + subject + "> <" 153.277 - + type + "> <" + gml + "GM_Object" + "> .\n"; 153.278 - triples.append(triple); 153.279 - ntriples++; 153.280 - 153.281 - } 153.282 - if (object.equals(gml + "GM_MultiPoint") 153.283 - || object.equals(gml + "GM_MultiCurve") 153.284 - || object.equals(gml + "GM_MultiSurface") 153.285 - || object.equals(gml + "GM_MultiSolid")) { 153.286 - String triple = "<" + subject + "> <" + type + "> <" + gml 153.287 - + "GM_MultiPrimitive" + "> .\n" + "<" + subject + "> <" 153.288 - + type + "> <" + gml + "GM_Aggregate" + "> .\n" + "<" 153.289 - + subject + "> <" + type + "> <" + gml + "GM_Object" 153.290 - + "> .\n"; 153.291 - triples.append(triple); 153.292 - ntriples++; 153.293 - 153.294 - } 153.295 - if (object.equals(sf + "Point") || object.equals(sf + "Curve") 153.296 - || object.equals(sf + "Surface") 153.297 - || object.equals(sf + "GeometryCollection")) { 153.298 - String triple = "<" + subject + "> <" + type + "> <" + sf 153.299 - + "Geometry" + "> .\n"; 153.300 - triples.append(triple); 153.301 - ntriples++; 153.302 - } 153.303 - if (object.equals(sf + "LineString")) { 153.304 - String triple = "<" + subject + "> <" + type + "> <" + sf 153.305 - + "Geometry" + "> .\n" + "<" + subject + "> <" + type 153.306 - + "> <" + sf + "Curve" + "> .\n"; 153.307 - triples.append(triple); 153.308 - ntriples++; 153.309 - } 153.310 - if (object.equals(sf + "Line") || object.equals(sf + "LinearRing")) { 153.311 - String triple = "<" + subject + "> <" + type + "> <" + sf 153.312 - + "Geometry" + "> .\n" + "<" + subject + "> <" + type 153.313 - + "> <" + sf + "Curve" + "> .\n" + "<" + subject 153.314 - + "> <" + type + "> <" + sf + "LineString" + "> .\n"; 153.315 - triples.append(triple); 153.316 - ntriples++; 153.317 - } 153.318 - if (object.equals(sf + "Polygon")) { 153.319 - String triple = "<" + subject + "> <" + type + "> <" + sf 153.320 - + "Geometry" + "> .\n" + "<" + subject + "> <" + type 153.321 - + "> <" + sf + "Surface" + "> .\n"; 153.322 - triples.append(triple); 153.323 - ntriples++; 153.324 - } 153.325 - if (object.equals(sf + "MultiSurface") 153.326 - || object.equals(sf + "MultiCurve") 153.327 - || object.equals(sf + "MultiPoint")) { 153.328 - String triple = "<" + subject + "> <" + type + "> <" + sf 153.329 - + "Geometry" + "> .\n" + "<" + subject + "> <" + type 153.330 - + "> <" + sf + "GeometryCollection" + "> .\n"; 153.331 - triples.append(triple); 153.332 - ntriples++; 153.333 - } 153.334 - if (object.equals(sf + "MultiPolygon")) { 153.335 - String triple = "<" + subject + "> <" + type + "> <" + sf 153.336 - + "Geometry" + "> .\n" + "<" + subject + "> <" + type 153.337 - + "> <" + sf + "MultiSurface" + "> .\n" + "<" + subject 153.338 - + "> <" + type + "> <" + sf + "GeometryCollection" 153.339 - + "> .\n"; 153.340 - triples.append(triple); 153.341 - ntriples++; 153.342 - } 153.343 - if (object.equals(sf + "MultiLineString")) { 153.344 - String triple = "<" + subject + "> <" + type + "> <" + sf 153.345 - + "Geometry" + "> .\n" + "<" + subject + "> <" + type 153.346 - + "> <" + sf + "MultiCurve" + "> .\n" + "<" + subject 153.347 - + "> <" + type + "> <" + sf + "GeometryCollection" 153.348 - + "> .\n"; 153.349 - triples.append(triple); 153.350 - ntriples++; 153.351 - } 153.352 + this.uriMap = new Hashtable<String, URI>(); 153.353 + 153.354 + if (logger.isDebugEnabled()) { 153.355 + logger.debug("[Strabon.GeoSPARQLEntailment] RDFS Entailment Extension of GeoSPARQL started."); 153.356 } 153.357 } 153.358 153.359 - 153.360 - public static void main(String[] args) throws Exception { 153.361 - NTriplesParser parser = new NTriplesParser(); 153.362 - parser.setVerifyData(true); 153.363 - 153.364 - String text = 153.365 - "<http://example.org/rcc8Obj1> <http://www.opengis.net/ont/geosparql#rcc8eq> <http://example.org/rcc8Obj2> . " + 153.366 - "<http://example.org/simpleGeometry1> <http://www.opengis.net/ont/geosparql#isEmpty> _:nai . \n"+ 153.367 - "<http://example.org/ForestArea1> <http://www.opengis.net/ont/geosparql#defaultGeometry> _:b2 . \n"+ 153.368 - "<http://example.org/SpatialObject1> <http://www.opengis.net/ont/geosparql#ehIntersects> <http://example.org/SpatialObject2> . \n"; 153.369 - 153.370 - String gmltext= "<http://example.org/GM_MultiSolid> <"+type+"> <"+gml+"GM_Object> .\n"; 153.371 - String sftext= "<http://example.org/Line> <"+type+"> <"+sf+"Geometry> .\n"; 153.372 - 153.373 - StringReader reader = new StringReader(gmltext); 153.374 - 153.375 - GeosparqlRDFHandlerBase handler = new GeosparqlRDFHandlerBase(); 153.376 - 153.377 - handler.startRDF(); 153.378 - parser.setRDFHandler(handler); 153.379 - parser.parse(reader, ""); 153.380 - handler.endRDF(); 153.381 - 153.382 - reader.close(); 153.383 - 153.384 - System.out.println("Original triples: " + gmltext); 153.385 - //System.out.println("Geometry domain list: " + handler.getgeometryDomainList()); 153.386 - System.out.println("New triples: " + handler.getTriples()); 153.387 + @Override 153.388 + public void startRDF() throws RDFHandlerException { 153.389 + if (ENABLE_INFERENCE) { 153.390 + insertGeoSPARQLClassHierarchy(); 153.391 + insertSimpleFeaturesClassHierarchy(); 153.392 + } 153.393 } 153.394 153.395 + @Override 153.396 + public void endRDF() throws RDFHandlerException { 153.397 + if (ENABLE_INFERENCE) { 153.398 + logger.info("[Strabon.GeoSPARQLEntailment] Inferred {} triples.", numInfTriples); 153.399 + } 153.400 + } 153.401 153.402 + /** 153.403 + * Inserts an inferred statement using the underlying {@link RDFInserter#handleStatement} 153.404 + * method. 153.405 + * 153.406 + * @param subj 153.407 + * @param pred 153.408 + * @param obj 153.409 + * @param ctxt 153.410 + */ 153.411 + protected void handleInferredStatement(Resource subj, URI pred, Value obj, Resource ctxt) throws RDFHandlerException { 153.412 + Statement stmt; 153.413 + 153.414 + if (ctxt == null) { 153.415 + stmt = new StatementImpl(subj, pred, obj); 153.416 + 153.417 + } else { 153.418 + stmt = new ContextStatementImpl(subj, pred, obj, ctxt); 153.419 + 153.420 + } 153.421 + 153.422 + super.handleStatement(stmt); 153.423 + numInfTriples++; 153.424 + } 153.425 153.426 + @Override 153.427 + public void handleStatement(Statement st) throws RDFHandlerException 153.428 + { 153.429 + // pass it to RDFInserter first 153.430 + super.handleStatement(st); 153.431 + 153.432 + // now we do our play 153.433 + String pred = st.getPredicate().toString(); 153.434 + String obj = st.getObject().toString(); 153.435 + 153.436 + if (!ENABLE_INFERENCE) { 153.437 + return ; 153.438 + } 153.439 + 153.440 + /* Infer 153.441 + * subj rdf:type geo:SpatialObject 153.442 + * obj rdf:type geo:SpatialObject 153.443 + * from 153.444 + * subj {any topological property from the Topology Vocabulary Extension} obj 153.445 + */ 153.446 + if( pred.startsWith(GeoSPARQL.GEO+"sf") || 153.447 + pred.startsWith(GeoSPARQL.GEO+"eh") || 153.448 + pred.startsWith(GeoSPARQL.GEO+"rcc8")) { 153.449 + 153.450 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.451 + if (st.getObject() instanceof Resource) { // necessary check, because it could be a Literal 153.452 + handleInferredStatement((Resource) st.getObject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.453 + } 153.454 + } 153.455 + /* Infer 153.456 + * subj rdf:type geo:SpatialObject 153.457 + * from 153.458 + * subj rdf:type geo:Feature 153.459 + * or 153.460 + * subj rdf:type geo:Geometry 153.461 + */ 153.462 + else if(pred.equals(RDF.TYPE.stringValue()) && (obj.equals(GeoSPARQL.Feature) || obj.equals(GeoSPARQL.Geometry))) { 153.463 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.464 + } 153.465 + /* 153.466 + * Infer 153.467 + * subj rdf:type geo:Feature 153.468 + * subj rdf:type geo:SpatialObject 153.469 + * obj rdf:type geo:Feature 153.470 + * obj rdf:type geo:SpatialObject 153.471 + * from 153.472 + * subj geo:hasGeometry obj 153.473 + * or 153.474 + * sub geo:hasDefaultGeometry obj 153.475 + */ 153.476 + else if(pred.equals(GeoSPARQL.hasGeometry) || pred.equals(GeoSPARQL.hasDefaultGeometry)) 153.477 + { 153.478 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Feature), st.getContext()); 153.479 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.480 + 153.481 + if (st.getObject() instanceof Resource) { // necessary check, because it could be a Literal 153.482 + handleInferredStatement((Resource) st.getObject(), RDF.TYPE, getURI(GeoSPARQL.Feature), st.getContext()); 153.483 + handleInferredStatement((Resource) st.getObject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.484 + } 153.485 + } 153.486 + else if (pred.equals(RDF.TYPE.stringValue())) { 153.487 +/* THE FOLLOWING CORRESPONDS TO GML AND NEEDS REWRITING TO FIT THAT OF SIMPLE FEATURES */ 153.488 +// // GML class hierarchy 153.489 +// if (obj.equals(GeoConstants.GML_OGC + "GM_Complex") 153.490 +// || obj.equals(GeoConstants.GML_OGC + "GM_Aggregate") 153.491 +// || obj.equals(GeoConstants.GML_OGC + "GM_Primitive")) { 153.492 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.493 +// + "GM_Object" + "> .\n"; 153.494 +// } 153.495 +// if (obj.equals(GeoConstants.GML_OGC + "GM_Composite")) { 153.496 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.497 +// + "GM_Complex" + "> .\n" + "<" + subj + "> <" + TYPE 153.498 +// + "> <" + GeoConstants.GML_OGC + "GM_Object" + "> .\n"; 153.499 +// 153.500 +// } 153.501 +// if (obj.equals(GeoConstants.GML_OGC + "GM_MultiPrimitive")) { 153.502 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.503 +// + "GM_Aggregate" + "> .\n" + "<" + subj + "> <" 153.504 +// + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Object" + "> .\n"; 153.505 +// 153.506 +// } 153.507 +// if (obj.equals(GeoConstants.GML_OGC + "GM_Point") 153.508 +// || obj.equals(GeoConstants.GML_OGC + "GM_OrientablePrimitive") 153.509 +// || obj.equals(GeoConstants.GML_OGC + "GM_Solid")) { 153.510 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.511 +// + "GM_Primitive" + "> .\n" + "<" + subj + "> <" 153.512 +// + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Object" + "> .\n"; 153.513 +// 153.514 +// } 153.515 +// if (obj.equals(GeoConstants.GML_OGC + "GM_OrientableCurve") 153.516 +// || obj.equals(GeoConstants.GML_OGC + "GM_OrientableSurface")) { 153.517 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.518 +// + "GM_OrientablePrimitive" + "> .\n" + "<" + subj 153.519 +// + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Primitive" + "> .\n" 153.520 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.521 +// + "GM_Object" + "> .\n"; 153.522 +// triples.append(triple); 153.523 +// numTriples++; 153.524 +// 153.525 +// } 153.526 +// if (obj.equals(GeoConstants.GML_OGC + "GM_Curve")) { 153.527 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.528 +// + "GM_Aggregate" + "> .\n" 153.529 +// + "<" + subj + "> <" + TYPE +"> <" + GeoConstants.GML_OGC + "GM_OrientableCurve" + "> .\n" 153.530 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_OrientablePrimitive" + "> .\n" 153.531 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Primitive" + "> .\n" 153.532 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Object" + "> .\n"; 153.533 +// 153.534 +// } 153.535 +// if (obj.equals(GeoConstants.GML_OGC + "GM_Surface")) { 153.536 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC+ "GM_Aggregate" + "> .\n" 153.537 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_OrientableSurface" + "> .\n" 153.538 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_OrientablePrimitive" + "> .\n" 153.539 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Primitive" + "> .\n" 153.540 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.541 +// + "GM_Object" + "> .\n"; 153.542 +// 153.543 +// } 153.544 +// if (obj.equals(GeoConstants.GML_OGC + "GM_CompositeCurve")) { 153.545 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.546 +// + "GM_Aggregate" + "> .\n" + "<" + subj + "> <" 153.547 +// + TYPE + "> <" + GeoConstants.GML_OGC + "GM_OrientableCurve" + "> .\n" 153.548 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.549 +// + "GM_OrientablePrimitive" + "> .\n" + "<" + subj 153.550 +// + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Primitive" + "> .\n" 153.551 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.552 +// + "GM_Complex" + "> .\n" + "<" + subj + "> <" + TYPE 153.553 +// + "> <" + GeoConstants.GML_OGC + "GM_Composite" + "> .\n" + "<" 153.554 +// + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Object" 153.555 +// + "> .\n"; 153.556 +// 153.557 +// } 153.558 +// if (obj.equals(GeoConstants.GML_OGC + "GM_CompositeSurface")) { 153.559 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.560 +// + "GM_OrientableSurface" + "> .\n" + 153.561 +// 153.562 +// "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.563 +// + "GM_OrientablePrimitive" + "> .\n" + "<" + subj 153.564 +// + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Primitive" + "> .\n" 153.565 +// + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.566 +// + "GM_Complex" + "> .\n" + "<" + subj + "> <" + TYPE 153.567 +// + "> <" + GeoConstants.GML_OGC + "GM_Composite" + "> .\n" + "<" 153.568 +// + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Object" 153.569 +// + "> .\n"; 153.570 +// 153.571 +// } 153.572 +// if (obj.equals(GeoConstants.GML_OGC + "GM_CompositeSolid")) { 153.573 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.574 +// + "GM_Solid" + "> .\n" + "<" + subj + "> <" + TYPE 153.575 +// + "> <" + GeoConstants.GML_OGC + "GM_Primitive" + "> .\n" + "<" 153.576 +// + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Complex" 153.577 +// + "> .\n" + "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.578 +// + "GM_Composite" + "> .\n" + "<" + subj + "> <" 153.579 +// + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Object" + "> .\n"; 153.580 +// 153.581 +// } 153.582 +// if (obj.equals(GeoConstants.GML_OGC + "GM_MultiPoint") 153.583 +// || obj.equals(GeoConstants.GML_OGC + "GM_MultiCurve") 153.584 +// || obj.equals(GeoConstants.GML_OGC + "GM_MultiSurface") 153.585 +// || obj.equals(GeoConstants.GML_OGC + "GM_MultiSolid")) { 153.586 +// String triple = "<" + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC 153.587 +// + "GM_MultiPrimitive" + "> .\n" + "<" + subj + "> <" 153.588 +// + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Aggregate" + "> .\n" + "<" 153.589 +// + subj + "> <" + TYPE + "> <" + GeoConstants.GML_OGC + "GM_Object" 153.590 +// + "> .\n"; 153.591 +// } 153.592 + /* 153.593 + * Simple Features class hierarchy 153.594 + */ 153.595 + if (SimpleFeatures.Point.equals(obj) || 153.596 + SimpleFeatures.Curve.equals(obj) || 153.597 + SimpleFeatures.Surface.equals(obj) || 153.598 + SimpleFeatures.GeometryCollection.equals(obj)) {// first level 153.599 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Geometry), st.getContext()); 153.600 + 153.601 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Geometry), st.getContext()); 153.602 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.603 + 153.604 + } else if (SimpleFeatures.LineString.equals(obj)) { // second level 153.605 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Curve), st.getContext()); 153.606 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Geometry), st.getContext()); 153.607 + 153.608 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Geometry), st.getContext()); 153.609 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.610 + 153.611 + } else if (SimpleFeatures.Polygon.equals(obj) || 153.612 + SimpleFeatures.PolyhedralSurface.equals(obj)) { // second level 153.613 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Surface), st.getContext()); 153.614 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Geometry), st.getContext()); 153.615 + 153.616 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Geometry), st.getContext()); 153.617 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.618 + 153.619 + } else if (SimpleFeatures.MultiSurface.equals(obj) || 153.620 + SimpleFeatures.MultiCurve.equals(obj) || 153.621 + SimpleFeatures.MultiPoint.equals(obj)) { // second level 153.622 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.GeometryCollection), st.getContext()); 153.623 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Geometry), st.getContext()); 153.624 + 153.625 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Geometry), st.getContext()); 153.626 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.627 + 153.628 + } else if ( SimpleFeatures.Line.equals(obj) || 153.629 + SimpleFeatures.LinearRing.equals(obj)) { // third level 153.630 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.LineString), st.getContext()); 153.631 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Curve), st.getContext()); 153.632 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Geometry), st.getContext()); 153.633 + 153.634 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Geometry), st.getContext()); 153.635 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.636 + 153.637 + } else if (SimpleFeatures.Triangle.equals(obj)) { // third level 153.638 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Polygon), st.getContext()); 153.639 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Surface), st.getContext()); 153.640 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Geometry), st.getContext()); 153.641 + 153.642 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Geometry), st.getContext()); 153.643 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.644 + 153.645 + } else if (SimpleFeatures.TIN.equals(obj)) { // third level 153.646 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.PolyhedralSurface), st.getContext()); 153.647 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Surface), st.getContext()); 153.648 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Geometry), st.getContext()); 153.649 + 153.650 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Geometry), st.getContext()); 153.651 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.652 + 153.653 + } else if (SimpleFeatures.MultiPolygon.equals(obj)) { // third level 153.654 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.MultiSurface), st.getContext()); 153.655 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.GeometryCollection), st.getContext()); 153.656 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Geometry), st.getContext()); 153.657 + 153.658 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Geometry), st.getContext()); 153.659 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.660 + 153.661 + } else if (SimpleFeatures.MultiLineString.equals(obj)) {// third level 153.662 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.MultiCurve), st.getContext()); 153.663 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.GeometryCollection), st.getContext()); 153.664 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(SimpleFeatures.Geometry), st.getContext()); 153.665 + 153.666 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Geometry), st.getContext()); 153.667 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), st.getContext()); 153.668 + 153.669 + } 153.670 + /* Spatial properties 153.671 + * ~~~~~~~~~~~~~~~~~~~~ 153.672 + * Infer 153.673 + * subj rdf:type geo:Feature 153.674 + * subj rdf:type geo:SpatialObject 153.675 + * from 153.676 + * subj {any spatial property defined in Req. 9, 14, and 18} obj 153.677 + */ 153.678 + } else if ( GeoSPARQL.spatialDimension.equals(pred) || GeoSPARQL.dimension.equals(pred) || 153.679 + GeoSPARQL.coordinateDimension.equals(pred) || GeoSPARQL.isEmpty.equals(pred) || 153.680 + GeoSPARQL.isSimple.equals(pred) || GeoSPARQL.hasSerialization.equals(pred) || 153.681 + GeoSPARQL.asWKT.equals(pred) || GeoSPARQL.asGML.equals(pred)) { 153.682 + 153.683 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.Geometry), null); 153.684 + handleInferredStatement(st.getSubject(), RDF.TYPE, getURI(GeoSPARQL.SpatialObject), null); 153.685 + } 153.686 + } 153.687 + 153.688 + /** 153.689 + * Materializes the RDF class hierarchy of Simple Features 153.690 + */ 153.691 + protected void insertSimpleFeaturesClassHierarchy() throws RDFHandlerException { 153.692 + // insert rdf:type rdfs:Class 153.693 + handleInferredStatement(getURI(SimpleFeatures.Geometry), RDF.TYPE, RDFS.CLASS, null); 153.694 + handleInferredStatement(getURI(SimpleFeatures.Point), RDF.TYPE, RDFS.CLASS, null); 153.695 + handleInferredStatement(getURI(SimpleFeatures.Curve), RDF.TYPE, RDFS.CLASS, null); 153.696 + handleInferredStatement(getURI(SimpleFeatures.Surface), RDF.TYPE, RDFS.CLASS, null); 153.697 + handleInferredStatement(getURI(SimpleFeatures.GeometryCollection), RDF.TYPE, RDFS.CLASS, null); 153.698 + handleInferredStatement(getURI(SimpleFeatures.LineString), RDF.TYPE, RDFS.CLASS, null); 153.699 + handleInferredStatement(getURI(SimpleFeatures.Polygon), RDF.TYPE, RDFS.CLASS, null); 153.700 + handleInferredStatement(getURI(SimpleFeatures.PolyhedralSurface), RDF.TYPE, RDFS.CLASS, null); 153.701 + handleInferredStatement(getURI(SimpleFeatures.MultiSurface), RDF.TYPE, RDFS.CLASS, null); 153.702 + handleInferredStatement(getURI(SimpleFeatures.MultiCurve), RDF.TYPE, RDFS.CLASS, null); 153.703 + handleInferredStatement(getURI(SimpleFeatures.MultiPoint), RDF.TYPE, RDFS.CLASS, null); 153.704 + handleInferredStatement(getURI(SimpleFeatures.Line), RDF.TYPE, RDFS.CLASS, null); 153.705 + handleInferredStatement(getURI(SimpleFeatures.LinearRing), RDF.TYPE, RDFS.CLASS, null); 153.706 + handleInferredStatement(getURI(SimpleFeatures.Triangle), RDF.TYPE, RDFS.CLASS, null); 153.707 + handleInferredStatement(getURI(SimpleFeatures.TIN), RDF.TYPE, RDFS.CLASS, null); 153.708 + handleInferredStatement(getURI(SimpleFeatures.MultiPolygon), RDF.TYPE, RDFS.CLASS, null); 153.709 + handleInferredStatement(getURI(SimpleFeatures.MultiLineString), RDF.TYPE, RDFS.CLASS, null); 153.710 + 153.711 + // insert rdfs:subClassOf geo:Geometry 153.712 + handleInferredStatement(getURI(SimpleFeatures.Geometry), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.713 + handleInferredStatement(getURI(SimpleFeatures.Point), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.714 + handleInferredStatement(getURI(SimpleFeatures.Curve), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.715 + handleInferredStatement(getURI(SimpleFeatures.Surface), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.716 + handleInferredStatement(getURI(SimpleFeatures.GeometryCollection), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.717 + handleInferredStatement(getURI(SimpleFeatures.LineString), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.718 + handleInferredStatement(getURI(SimpleFeatures.Polygon), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.719 + handleInferredStatement(getURI(SimpleFeatures.PolyhedralSurface), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.720 + handleInferredStatement(getURI(SimpleFeatures.MultiSurface), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.721 + handleInferredStatement(getURI(SimpleFeatures.MultiCurve), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.722 + handleInferredStatement(getURI(SimpleFeatures.MultiPoint), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.723 + handleInferredStatement(getURI(SimpleFeatures.Line), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.724 + handleInferredStatement(getURI(SimpleFeatures.LinearRing), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.725 + handleInferredStatement(getURI(SimpleFeatures.Triangle), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.726 + handleInferredStatement(getURI(SimpleFeatures.TIN), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.727 + handleInferredStatement(getURI(SimpleFeatures.MultiPolygon), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.728 + handleInferredStatement(getURI(SimpleFeatures.MultiLineString), RDFS.SUBCLASSOF, getURI(GeoSPARQL.Geometry), null); 153.729 + 153.730 + // insert rdfs:subClassOf geo:SpatialObject 153.731 + handleInferredStatement(getURI(SimpleFeatures.Geometry), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.732 + handleInferredStatement(getURI(SimpleFeatures.Point), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.733 + handleInferredStatement(getURI(SimpleFeatures.Curve), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.734 + handleInferredStatement(getURI(SimpleFeatures.Surface), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.735 + handleInferredStatement(getURI(SimpleFeatures.GeometryCollection), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.736 + handleInferredStatement(getURI(SimpleFeatures.LineString), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.737 + handleInferredStatement(getURI(SimpleFeatures.Polygon), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.738 + handleInferredStatement(getURI(SimpleFeatures.PolyhedralSurface), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.739 + handleInferredStatement(getURI(SimpleFeatures.MultiSurface), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.740 + handleInferredStatement(getURI(SimpleFeatures.MultiCurve), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.741 + handleInferredStatement(getURI(SimpleFeatures.MultiPoint), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.742 + handleInferredStatement(getURI(SimpleFeatures.Line), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.743 + handleInferredStatement(getURI(SimpleFeatures.LinearRing), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.744 + handleInferredStatement(getURI(SimpleFeatures.Triangle), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.745 + handleInferredStatement(getURI(SimpleFeatures.TIN), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.746 + handleInferredStatement(getURI(SimpleFeatures.MultiPolygon), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.747 + handleInferredStatement(getURI(SimpleFeatures.MultiLineString), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.748 + 153.749 + // first level 153.750 + handleInferredStatement(getURI(SimpleFeatures.Point), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.751 + handleInferredStatement(getURI(SimpleFeatures.Curve), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.752 + handleInferredStatement(getURI(SimpleFeatures.Surface), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.753 + handleInferredStatement(getURI(SimpleFeatures.GeometryCollection), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.754 + 153.755 + // second level 153.756 + handleInferredStatement(getURI(SimpleFeatures.LineString), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Curve), null); 153.757 + handleInferredStatement(getURI(SimpleFeatures.LineString), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.758 + 153.759 + handleInferredStatement(getURI(SimpleFeatures.Polygon), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Surface), null); 153.760 + handleInferredStatement(getURI(SimpleFeatures.Polygon), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.761 + 153.762 + handleInferredStatement(getURI(SimpleFeatures.PolyhedralSurface), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Surface), null); 153.763 + handleInferredStatement(getURI(SimpleFeatures.PolyhedralSurface), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.764 + 153.765 + handleInferredStatement(getURI(SimpleFeatures.MultiSurface), RDFS.SUBCLASSOF, getURI(SimpleFeatures.GeometryCollection), null); 153.766 + handleInferredStatement(getURI(SimpleFeatures.MultiSurface), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.767 + 153.768 + handleInferredStatement(getURI(SimpleFeatures.MultiCurve), RDFS.SUBCLASSOF, getURI(SimpleFeatures.GeometryCollection), null); 153.769 + handleInferredStatement(getURI(SimpleFeatures.MultiCurve), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.770 + 153.771 + handleInferredStatement(getURI(SimpleFeatures.MultiPoint), RDFS.SUBCLASSOF, getURI(SimpleFeatures.GeometryCollection), null); 153.772 + handleInferredStatement(getURI(SimpleFeatures.MultiPoint), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.773 + 153.774 + // third level 153.775 + handleInferredStatement(getURI(SimpleFeatures.Line), RDFS.SUBCLASSOF, getURI(SimpleFeatures.LineString), null); 153.776 + handleInferredStatement(getURI(SimpleFeatures.Line), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Curve), null); 153.777 + handleInferredStatement(getURI(SimpleFeatures.Line), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.778 + 153.779 + handleInferredStatement(getURI(SimpleFeatures.LinearRing), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Polygon), null); 153.780 + handleInferredStatement(getURI(SimpleFeatures.LinearRing), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Surface), null); 153.781 + handleInferredStatement(getURI(SimpleFeatures.LinearRing), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.782 + 153.783 + handleInferredStatement(getURI(SimpleFeatures.Triangle), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Polygon), null); 153.784 + handleInferredStatement(getURI(SimpleFeatures.Triangle), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Surface), null); 153.785 + handleInferredStatement(getURI(SimpleFeatures.Triangle), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.786 + 153.787 + handleInferredStatement(getURI(SimpleFeatures.TIN), RDFS.SUBCLASSOF, getURI(SimpleFeatures.PolyhedralSurface), null); 153.788 + handleInferredStatement(getURI(SimpleFeatures.TIN), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Surface), null); 153.789 + handleInferredStatement(getURI(SimpleFeatures.TIN), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.790 + 153.791 + handleInferredStatement(getURI(SimpleFeatures.MultiPolygon), RDFS.SUBCLASSOF, getURI(SimpleFeatures.MultiSurface), null); 153.792 + handleInferredStatement(getURI(SimpleFeatures.MultiPolygon), RDFS.SUBCLASSOF, getURI(SimpleFeatures.GeometryCollection), null); 153.793 + handleInferredStatement(getURI(SimpleFeatures.MultiPolygon), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.794 + 153.795 + handleInferredStatement(getURI(SimpleFeatures.MultiLineString), RDFS.SUBCLASSOF, getURI(SimpleFeatures.MultiSurface), null); 153.796 + handleInferredStatement(getURI(SimpleFeatures.MultiLineString), RDFS.SUBCLASSOF, getURI(SimpleFeatures.GeometryCollection), null); 153.797 + handleInferredStatement(getURI(SimpleFeatures.MultiLineString), RDFS.SUBCLASSOF, getURI(SimpleFeatures.Geometry), null); 153.798 + } 153.799 153.800 - 153.801 - 153.802 - 153.803 - 153.804 - 153.805 - 153.806 - 153.807 - 153.808 + /** 153.809 + * Materializes the RDF class hierarchy of GeoSPARQL 153.810 + * @throws RDFHandlerException 153.811 + */ 153.812 + protected void insertGeoSPARQLClassHierarchy() throws RDFHandlerException { 153.813 + handleInferredStatement(getURI(GeoSPARQL.SpatialObject), RDF.TYPE, RDFS.CLASS, null); 153.814 + handleInferredStatement(getURI(GeoSPARQL.Feature), RDF.TYPE, RDFS.CLASS, null); 153.815 + handleInferredStatement(getURI(GeoSPARQL.Geometry), RDF.TYPE, RDFS.CLASS, null); 153.816 + 153.817 + handleInferredStatement(getURI(GeoSPARQL.Feature), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.818 + handleInferredStatement(getURI(GeoSPARQL.Geometry), RDFS.SUBCLASSOF, getURI(GeoSPARQL.SpatialObject), null); 153.819 + } 153.820 153.821 + /** 153.822 + * Inserts the given URI in the hashtable of URIs 153.823 + * and retrieves the instance of class URI. 153.824 + * 153.825 + * @param uri 153.826 + * @return 153.827 + */ 153.828 + private URI getURI(String uri) { 153.829 + URI ret = null; 153.830 + if ((ret = uriMap.get(uri)) == null) { 153.831 + ret = new URIImpl(uri); 153.832 + uriMap.put(uri, ret); 153.833 + } 153.834 + 153.835 + return ret; 153.836 + } 153.837 }
154.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java Fri Apr 19 09:11:47 2013 +0300 154.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java Fri Apr 19 14:37:09 2013 +0300 154.3 @@ -3,7 +3,7 @@ 154.4 * License, v. 2.0. If a copy of the MPL was not distributed with this 154.5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 154.6 * 154.7 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 154.8 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 154.9 * 154.10 * http://www.strabon.di.uoa.gr/ 154.11 * 154.12 @@ -17,8 +17,6 @@ 154.13 import java.io.ByteArrayInputStream; 154.14 import java.io.File; 154.15 import java.io.IOException; 154.16 -import java.io.InputStream; 154.17 -import java.io.InputStreamReader; 154.18 import java.io.OutputStream; 154.19 import java.io.StringReader; 154.20 import java.net.MalformedURLException; 154.21 @@ -54,8 +52,6 @@ 154.22 import org.openrdf.rio.RDFFormat; 154.23 import org.openrdf.rio.RDFHandlerException; 154.24 import org.openrdf.rio.RDFParseException; 154.25 -import org.openrdf.rio.RDFParser; 154.26 -import org.openrdf.rio.Rio; 154.27 import org.openrdf.sail.helpers.SailBase; 154.28 import org.slf4j.Logger; 154.29 import org.slf4j.LoggerFactory; 154.30 @@ -75,7 +71,7 @@ 154.31 public static final String FORMAT_KMZ = "KMZ"; 154.32 public static final String FORMAT_GEOJSON = "GeoJSON"; 154.33 public static final String FORMAT_EXP = "EXP"; 154.34 - public static final String FORMAT_HTML = "HTML"; 154.35 + public static final String FORMAT_HTML = "HTML"; 154.36 public static final int LINES_IN_BATCH = 100; 154.37 154.38 public static final String NEWLINE = "\n"; 154.39 @@ -90,8 +86,8 @@ 154.40 protected String serverName; 154.41 154.42 protected SailBase db_store; 154.43 - private SailRepository repo1; 154.44 - private SailRepositoryConnection con1 = null; 154.45 + private SailRepository repo; 154.46 + private SailRepositoryConnection con = null; 154.47 154.48 public Strabon(String databaseName, String user, String password, int port, String serverName, boolean checkForLockTable) throws Exception { 154.49 this.databaseName = databaseName; 154.50 @@ -145,17 +141,17 @@ 154.51 System.setProperty("org.geotools.referencing.forceXY", "true"); 154.52 154.53 //our repository 154.54 - repo1 = new SailRepository(db_store); 154.55 + repo = new GeneralDBSailRepository(db_store); 154.56 154.57 try { 154.58 - repo1.initialize(); 154.59 + repo.initialize(); 154.60 154.61 } catch (RepositoryException e) { 154.62 logger.error("[Strabon.init] initialize", e); 154.63 } 154.64 154.65 try { 154.66 - con1 = repo1.getConnection(); 154.67 + con = repo.getConnection(); 154.68 154.69 } catch (RepositoryException e) { 154.70 logger.error("[Strabon.init] getConnection", e); 154.71 @@ -173,11 +169,11 @@ 154.72 throws SQLException, ClassNotFoundException; 154.73 154.74 public SailRepositoryConnection getSailRepoConnection() { 154.75 - return con1; 154.76 + return con; 154.77 } 154.78 154.79 public void setCon1(SailRepositoryConnection con1) { 154.80 - this.con1 = con1; 154.81 + this.con = con1; 154.82 } 154.83 154.84 /** 154.85 @@ -187,15 +183,15 @@ 154.86 logger.info("[Strabon.close] Closing connection..."); 154.87 154.88 try { 154.89 - con1.commit(); 154.90 + con.commit(); 154.91 154.92 } catch (RepositoryException e) { 154.93 logger.error("[Strabon.close]", e); 154.94 154.95 } finally { 154.96 try { 154.97 - con1.close(); 154.98 - repo1.shutDown(); 154.99 + con.close(); 154.100 + repo.shutDown(); 154.101 154.102 // delete the lock as well 154.103 checkAndDeleteLock(databaseName, user, password, port, serverName); 154.104 @@ -448,11 +444,10 @@ 154.105 uriContext = null; 154.106 154.107 } else { 154.108 - ValueFactory f = repo1.getValueFactory(); 154.109 + ValueFactory f = repo.getValueFactory(); 154.110 uriContext = f.createURI(context); 154.111 } 154.112 154.113 - 154.114 if(format.equalsIgnoreCase("N3")) { 154.115 realFormat = RDFFormat.N3; 154.116 154.117 @@ -505,8 +500,6 @@ 154.118 logger.debug("[Strabon.storeURL] Format : {}", ((format == null) ? "null" : format)); 154.119 } 154.120 154.121 - InputStream in = (InputStream) url.openStream(); 154.122 - InputStreamReader reader = new InputStreamReader(in); 154.123 if(baseURI == null) 154.124 { 154.125 baseURI = url.toExternalForm(); 154.126 @@ -567,43 +560,25 @@ 154.127 */ 154.128 return; 154.129 } 154.130 - 154.131 - RDFParser parser = Rio.createParser(format); 154.132 - 154.133 - GeosparqlRDFHandlerBase handler = new GeosparqlRDFHandlerBase(); 154.134 - 154.135 - parser.setRDFHandler(handler); 154.136 - parser.parse(reader, ""); 154.137 - 154.138 - logger.info("[Strabon.storeURL] Inferred {} triples.", handler.getNumberOfTriples()); 154.139 - if (handler.getNumberOfTriples() > 0) { 154.140 - logger.info("[Strabon.storeURL] Triples inferred: {}", handler.getTriples()); 154.141 + if (context == null) { 154.142 + con.add(url, baseURI, format); 154.143 + 154.144 + } else { 154.145 + con.add(url, baseURI, format, context); 154.146 } 154.147 154.148 - StringReader georeader = new StringReader(handler.getTriples().toString()); 154.149 - handler.endRDF(); 154.150 - 154.151 - if (context == null) { 154.152 - con1.add(url, baseURI, format); 154.153 - 154.154 - } else { 154.155 - con1.add(url, baseURI, format, context); 154.156 - 154.157 - } 154.158 - 154.159 - con1.add(georeader, "", RDFFormat.NTRIPLES); 154.160 - georeader.close(); 154.161 logger.info("[Strabon.storeURL] Storing was successful."); 154.162 } 154.163 154.164 private void storeString(String text, String baseURI, URI context, RDFFormat format) throws RDFParseException, RepositoryException, IOException, RDFHandlerException 154.165 { 154.166 - if (baseURI == null) 154.167 + if (baseURI == null) { 154.168 baseURI = ""; 154.169 + } 154.170 154.171 logger.info("[Strabon.storeString] Storing triples."); 154.172 logger.info("[Strabon.storeString] Text : " + text); 154.173 - logger.info("[Strabon.storeString] Base URI : " + ((baseURI == null) ? "null" : baseURI)); 154.174 + logger.info("[Strabon.storeString] Base URI : " + baseURI); 154.175 logger.info("[Strabon.storeString] Context : " + ((context == null) ? "null" : context)); 154.176 logger.info("[Strabon.storeString] Format : " + ((format == null) ? "null" : format.toString())); 154.177 154.178 @@ -646,32 +621,15 @@ 154.179 return; 154.180 } 154.181 154.182 - RDFParser parser = Rio.createParser(format); 154.183 - 154.184 - GeosparqlRDFHandlerBase handler = new GeosparqlRDFHandlerBase(); 154.185 - 154.186 - parser.setRDFHandler(handler); 154.187 - parser.parse(reader, ""); 154.188 - 154.189 - logger.info("[Strabon.storeString] Inferred " + handler.getNumberOfTriples() + " triples."); 154.190 - if (handler.getNumberOfTriples() > 0) { 154.191 - logger.info("[Strabon.storeString] Triples inferred:"+ handler.getTriples().toString()); 154.192 - } 154.193 - StringReader georeader = new StringReader(handler.getTriples().toString()); 154.194 - handler.endRDF(); 154.195 - 154.196 if (context == null) { 154.197 - con1.add(reader, baseURI, format); 154.198 - reader.close(); 154.199 + con.add(reader, baseURI, format); 154.200 154.201 } else { 154.202 - con1.add(reader, baseURI, format, context); 154.203 - reader.close(); 154.204 + con.add(reader, baseURI, format, context); 154.205 154.206 } 154.207 + reader.close(); 154.208 154.209 - con1.add(georeader, "", RDFFormat.NTRIPLES); 154.210 - georeader.close(); 154.211 logger.info("[Strabon.storeString] Storing was successful."); 154.212 } 154.213
155.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/testCRS.java Fri Apr 19 09:11:47 2013 +0300 155.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 155.3 @@ -1,83 +0,0 @@ 155.4 -/** 155.5 - * This Source Code Form is subject to the terms of the Mozilla Public 155.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 155.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 155.8 - * 155.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 155.10 - * 155.11 - * http://www.strabon.di.uoa.gr/ 155.12 - */ 155.13 -package eu.earthobservatory.runtime.postgis; 155.14 - 155.15 -import java.io.IOException; 155.16 -import java.net.URL; 155.17 -import java.sql.SQLException; 155.18 - 155.19 -import org.openrdf.repository.RepositoryException; 155.20 -import org.openrdf.rio.RDFHandlerException; 155.21 -import org.openrdf.rio.RDFParseException; 155.22 - 155.23 -import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault; 155.24 - 155.25 -public class testCRS { 155.26 - 155.27 - public static Strabon strabon; 155.28 - 155.29 - public static void main(String[] args) throws RDFParseException, RepositoryException, IOException, InvalidDatasetFormatFault, RDFHandlerException { 155.30 - try { 155.31 - strabon = new Strabon("tut","postgres","p1r3as", 5432, "localhost", true); 155.32 - } catch (SQLException e) { 155.33 - // TODO Auto-generated catch block 155.34 - 155.35 - e.printStackTrace(); 155.36 - } catch (ClassNotFoundException e) { 155.37 - // TODO Auto-generated catch block 155.38 - e.printStackTrace(); 155.39 - } catch (Exception e) { 155.40 - e.printStackTrace(); 155.41 - } 155.42 - 155.43 - String text = 155.44 - "<http://example.org/rcc8Obj1> <http://www.opengis.net/def/function/geosparql/rcc8eq> <http://example.org/rcc8Obj2> . \n" + 155.45 - "<http://example.org/simpleGeometry1> <http://www.opengis.net/def/function/geosparql/isEmpty> <http://example.org/nai> . \n"+ 155.46 - "<http://example.org/ForestArea1> <http://www.opengis.net/def/function/geosparql/defaultGeometry> <http://example.org/defaultgeom> . \n"+ 155.47 - "<http://example.org/SpatialObject1> <http://www.opengis.net/def/function/geosparql/ehIntersects> <http://example.org/SpatialObject2> . \n"; 155.48 - 155.49 - String statement1= "<http://example.org/CoastLine4> <http://www.earthobservatory.eu/ontologies/noaOntology.owl#hasGeometry> " + 155.50 - "\"POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/4326" + 155.51 - "\"^^<http://strdf.di.uoa.gr/ontology#WKT> ."; 155.52 - String statement2= "<http://example.org/CoastLine5> <http://www.earthobservatory.eu/ontologies/noaOntology.owl#hasGeometry> " + 155.53 - "\"POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/32630" + 155.54 - "\"^^<http://strdf.di.uoa.gr/ontology#WKT> ."; 155.55 - String gml = "<http://example.org/rcc8Obj1> <http://example.org/hasGeometry> \"<gml:Point> <gml:coordinates>45.67, 88.56</gml:coordinates> </gml:Point>\"^^<http://strdf.di.uoa.gr/ontology#GML> ."; 155.56 - 155.57 - String file = "/home/konstantina/gmlread.nt"; 155.58 - URL url = new URL("http://www.di.uoa.gr/~pms509/rdf-data/streason.nt"); 155.59 - String fileBaseURI = "http://example#"; 155.60 - String fileRDFFormat = "NTRIPLES"; 155.61 - String stringBaseURI = "http://example#"; 155.62 - String stringRDFFormat = "NTRIPLES"; 155.63 - try { 155.64 - //strabon.storeInRepo(statement1, stringBaseURI, null, stringRDFFormat); 155.65 - //strabon.storeInRepo(statement2, stringBaseURI, null, stringRDFFormat); 155.66 - //strabon.storeInRepo(text, null, null, "NTRIPLES"); 155.67 - strabon.storeInRepo(file, fileRDFFormat); 155.68 - //strabon.storeInRepo(gml, null, null, stringRDFFormat); 155.69 - 155.70 - } catch (RDFParseException e) { 155.71 - e.printStackTrace(); 155.72 - } catch (RepositoryException e) { 155.73 - e.printStackTrace(); 155.74 - } catch (IOException e) { 155.75 - e.printStackTrace(); 155.76 - } catch (InvalidDatasetFormatFault e) { 155.77 - e.printStackTrace(); 155.78 - } 155.79 - finally{ 155.80 - strabon.close(); 155.81 - System.out.println("connection closed."); 155.82 - } 155.83 - 155.84 - } 155.85 - 155.86 -}
156.1 --- a/runtime/src/main/java/eu/earthobservatory/utils/Format.java Fri Apr 19 09:11:47 2013 +0300 156.2 +++ b/runtime/src/main/java/eu/earthobservatory/utils/Format.java Fri Apr 19 14:37:09 2013 +0300 156.3 @@ -62,6 +62,31 @@ 156.4 TSV("TSV"), 156.5 156.6 /** 156.7 + * Sesame's JSON format 156.8 + */ 156.9 + SESAME_JSON("SPARQL/JSON"), 156.10 + 156.11 + /** 156.12 + * Sesame's XML format 156.13 + */ 156.14 + SESAME_XML("SPARQL/XML"), 156.15 + 156.16 + /** 156.17 + * Sesame's Binary format 156.18 + */ 156.19 + SESAME_BINARY("BINARY"), 156.20 + 156.21 + /** 156.22 + * Sesame's CSV format 156.23 + */ 156.24 + SESAME_CSV("SPARQL/CSV"), 156.25 + 156.26 + /** 156.27 + * Sesame's TSV format 156.28 + */ 156.29 + SESAME_TSV("SPARQL/TSV"), 156.30 + 156.31 + /** 156.32 * Invalid format. 156.33 */ 156.34 INVALID("INVALID");
157.1 --- a/runtime/src/main/java/eu/earthobservatory/utils/stSPARQLQueryResultToFormatAdapter.java Fri Apr 19 09:11:47 2013 +0300 157.2 +++ b/runtime/src/main/java/eu/earthobservatory/utils/stSPARQLQueryResultToFormatAdapter.java Fri Apr 19 14:37:09 2013 +0300 157.3 @@ -11,6 +11,8 @@ 157.4 157.5 import java.io.OutputStream; 157.6 157.7 +import org.openrdf.query.resultio.QueryResultIO; 157.8 +import org.openrdf.query.resultio.TupleQueryResultFormat; 157.9 import org.openrdf.query.resultio.TupleQueryResultWriter; 157.10 import org.openrdf.query.resultio.TupleQueryResultWriterFactory; 157.11 import org.openrdf.query.resultio.sparqlgeojson.stSPARQLResultsGeoJSONWriterFactory; 157.12 @@ -70,6 +72,30 @@ 157.13 157.14 case TSV: 157.15 writer = tsv.getWriter(out); 157.16 + break; 157.17 + 157.18 + case SESAME_XML: 157.19 + writer = QueryResultIO.createWriter(TupleQueryResultFormat.SPARQL, out); 157.20 + break; 157.21 + 157.22 + case SESAME_BINARY: 157.23 + writer = QueryResultIO.createWriter(TupleQueryResultFormat.BINARY, out); 157.24 + break; 157.25 + 157.26 + case SESAME_JSON: 157.27 + writer = QueryResultIO.createWriter(TupleQueryResultFormat.JSON, out); 157.28 + break; 157.29 + 157.30 + case SESAME_CSV: 157.31 + writer = QueryResultIO.createWriter(TupleQueryResultFormat.CSV, out); 157.32 + break; 157.33 + 157.34 + case SESAME_TSV: 157.35 + writer = QueryResultIO.createWriter(TupleQueryResultFormat.TSV, out); 157.36 + break; 157.37 + 157.38 + default: 157.39 + // return NULL 157.40 } 157.41 157.42 return writer;
158.1 --- a/runtime/src/main/resources/log4j.properties Fri Apr 19 09:11:47 2013 +0300 158.2 +++ b/runtime/src/main/resources/log4j.properties Fri Apr 19 14:37:09 2013 +0300 158.3 @@ -7,7 +7,7 @@ 158.4 log4j.appender.CA=org.apache.log4j.ConsoleAppender 158.5 log4j.appender.CA.target=System.err 158.6 log4j.appender.CA.layout=org.apache.log4j.PatternLayout 158.7 -log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 158.8 +log4j.appender.CA.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n 158.9 158.10 # File Appender 158.11 #log4j.appender.FA=org.apache.log4j.FileAppender
159.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 159.2 +++ b/scripts/workaround/deploy-local-repo.sh Fri Apr 19 14:37:09 2013 +0300 159.3 @@ -0,0 +1,141 @@ 159.4 +#!/bin/bash 159.5 + 159.6 +# 159.7 +# This Source Code Form is subject to the terms of the Mozilla Public 159.8 +# License, v. 2.0. If a copy of the MPL was not distributed with this 159.9 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 159.10 +# 159.11 +# Copyright (C) 2010, 2011, 2012, Pyravlos Team 159.12 +# 159.13 +# http://www.strabon.di.uoa.gr/ 159.14 +# 159.15 + 159.16 +# 159.17 +# Script for deploying a local maven repository to a remote one 159.18 +# 159.19 +# Author: Kostis Kyzirakos <kk@di.uoa.gr> 159.20 +# 159.21 + 159.22 + 159.23 +# server id that maps on the <id> under <server> section of ~/.m2/settings.xml. 159.24 +# In most cases, this parameter will be required for authentication. 159.25 +DEPLOY_REPO_ID="strabon" 159.26 + 159.27 +# the url of the remote repository 159.28 +DEPLOY_REPO_URL="http://maven.strabon.di.uoa.gr/content/repositories/strabon.sesame/" 159.29 + 159.30 +# temporary folder 159.31 +TEMP_DIR="/tmp/deploy-local-repo-$$" 159.32 + 159.33 +# command name 159.34 +CMD="$(basename ${0})" 159.35 + 159.36 +function help() { 159.37 + echo "Usage: ${CMD} [OPTIONS] [DIR]" 159.38 + echo 159.39 + echo "Deploy a local maven repository to a remote one" 159.40 + echo 159.41 + echo " DIR : resume the deployment of the local repository, starting from this directory" 159.42 + echo 159.43 + echo "OPTIONS can be any of the following (variable names and values are case sensitive)" 159.44 + echo " --help : Print this menu" 159.45 + echo "" 159.46 +} 159.47 + 159.48 +if [[ ${#} -gt "0" ]] ; then 159.49 + ARRAY=(${@}) 159.50 + ELEMENTS=${#ARRAY[@]} 159.51 + for (( i = 0; i < ${ELEMENTS}; i++ )); do 159.52 + if [[ "${ARRAY[${i}]}" = "--help" ]] || [[ "${ARRAY[${i}]}" = "-help" ]] || [[ "${ARRAY[${i}]}" = "help" ]]; then 159.53 + help 159.54 + exit 0 159.55 + fi 159.56 + done 159.57 +fi 159.58 + 159.59 +mkdir ${TEMP_DIR} 159.60 +if [[ ! -d "${TEMP_DIR}" ]] ; then 159.61 + echo "Could not create temporary directory." 159.62 + echo "Aborting..." 159.63 + exit 159.64 +fi 159.65 + 159.66 +found=false; 159.67 +for d in `find ${HOME}/.m2/repository -type d|sort` ; 159.68 +do 159.69 + if [[ ! -z "$1" ]] && [[ "${found}" = "false" ]] && [[ "$d" != "$1" ]] ; then 159.70 + echo "Skipping ${d}" 159.71 + continue; 159.72 + fi 159.73 + # resuming 159.74 + found=true; 159.75 + 159.76 + #for each directory 159.77 + cd ${d} 159.78 + children=`find . -type d|grep -v '^.$'|wc -l` 159.79 + if [[ "${children}" -ne "0" ]] ; then 159.80 + # if the directory has more subdirectories, move one 159.81 + continue; 159.82 + fi 159.83 + 159.84 + countPoms=`ls -1 *.pom 2>/dev/null|wc -l` 159.85 + countJars=`ls -1 *.jar 2>/dev/null|wc -l` 159.86 + 159.87 + if [[ "${countPoms}" -gt "1" ]] && [[ "${countJars}" -gt "1" ]] ; then 159.88 + echo "Found ${countPoms} poms and ${countJars} jars in directory '${d}'." 159.89 + echo "Aborting..." 159.90 + exit; 159.91 + elif [[ "${countPoms}" -eq "0" ]] ; then 159.92 + echo "No .pom file found in directory '${d}' (${children} children)." 159.93 + echo "Aborting..." 159.94 + exit; 159.95 + fi 159.96 + 159.97 + if [[ "${countPoms}" -eq "1" ]] && [[ "${countJars}" -eq "1" ]] ; then 159.98 + pomFile=`ls -1 *.pom 2>/dev/null` 159.99 + jarFile=`ls -1 *.jar 2>/dev/null` 159.100 + cp ${pomFile} ${TEMP_DIR}/${pomFile} 2>/dev/null 159.101 + cp ${jarFile} ${TEMP_DIR}/${jarFile} 2>/dev/null 159.102 + # deploy the local jar file to the remote repo 159.103 + mvn deploy:deploy-file \ 159.104 + -DrepositoryId=${DEPLOY_REPO_ID} \ 159.105 + -Durl=${DEPLOY_REPO_URL} \ 159.106 + -DpomFile=${TEMP_DIR}/${pomFile} \ 159.107 + -Dfile=${TEMP_DIR}/${jarFile}; 159.108 + if [[ "$?" -ne "0" ]] ; then echo "Error occured while processing directory '${d}' (temp dir is '${TEMP_DIR}')"; exit; fi 159.109 + elif [[ "${countPoms}" -eq "1" ]] && [[ "${countJars}" -eq "0" ]] ; then 159.110 + pomFile=`ls -1 *.pom 2>/dev/null` 159.111 + cp ${pomFile} ${TEMP_DIR}/${pomFile} 2>/dev/null 159.112 + # deploy the local pom file to the remote repo 159.113 + mvn deploy:deploy-file \ 159.114 + -DrepositoryId=${DEPLOY_REPO_ID} \ 159.115 + -Durl=${DEPLOY_REPO_URL} \ 159.116 + -DpomFile=${TEMP_DIR}/${pomFile} \ 159.117 + -Dfile=${TEMP_DIR}/${pomFile}; 159.118 + if [[ "$?" -ne "0" ]] ; then echo "Error occured while processing directory '${d}' (temp dir is '${TEMP_DIR}'"; exit; fi 159.119 + elif [[ "${countPoms}" -gt "1" ]] && [[ "${countJars}" -eq "0" ]] ; then 159.120 + # deploy the local pom files to the remote repo 159.121 + for pom in `ls -1 *.pom` ; do 159.122 + pomFile=${pom}; 159.123 + cp ${pomFile} ${TEMP_DIR}/${pomFile} 2>/dev/null; 159.124 + mvn deploy:deploy-file \ 159.125 + -DrepositoryId=${DEPLOY_REPO_ID} \ 159.126 + -Durl=${DEPLOY_REPO_URL} \ 159.127 + -DpomFile=${TEMP_DIR}/${pomFile} \ 159.128 + -Dfile=${TEMP_DIR}/${pomFile}; 159.129 + if [[ "$?" -ne "0" ]] ; then echo "Error occured while processing directory '${d}' (temp dir is '${TEMP_DIR}'"; exit; fi 159.130 + done 159.131 + else 159.132 + echo "Found ${countPoms} poms and ${countJars} jars in directory '${d}' (temp dir is '${TEMP_DIR}')." 159.133 + echo "What should I do?" 159.134 + echo "Aborting..." 159.135 + exit; 159.136 + fi 159.137 + 159.138 + # grooming 159.139 + rm ${TEMP_DIR}/* 159.140 +done 159.141 + 159.142 + 159.143 +# grooming 159.144 +rm -rf ${TEMP_DIR}
160.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 160.2 +++ b/testsuite/pom.xml Fri Apr 19 14:37:09 2013 +0300 160.3 @@ -0,0 +1,31 @@ 160.4 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 160.5 + 160.6 + <modelVersion>4.0.0</modelVersion> 160.7 + 160.8 + <parent> 160.9 + <groupId>eu.earthobservatory</groupId> 160.10 + <artifactId>strabon</artifactId> 160.11 + <version>3.2.9-SNAPSHOT</version> 160.12 + </parent> 160.13 + 160.14 + <artifactId>strabon-testsuite</artifactId> 160.15 + 160.16 + <name>Strabon: Test Suite</name> 160.17 + <description>A test suite for Strabon</description> 160.18 + <packaging>jar</packaging> 160.19 + 160.20 + <dependencies> 160.21 + <dependency> 160.22 + <groupId>eu.earthobservatory</groupId> 160.23 + <artifactId>strabon-runtime</artifactId> 160.24 + </dependency> 160.25 + 160.26 + <!-- Testing: JUnit --> 160.27 + <dependency> 160.28 + <groupId>junit</groupId> 160.29 + <artifactId>junit</artifactId> 160.30 + <scope>test</scope> 160.31 + </dependency> 160.32 + </dependencies> 160.33 + 160.34 +</project> 160.35 \ No newline at end of file
161.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 161.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/bugs/StoreTest.java Fri Apr 19 14:37:09 2013 +0300 161.3 @@ -0,0 +1,20 @@ 161.4 +/** 161.5 + * This Source Code Form is subject to the terms of the Mozilla Public 161.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 161.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 161.8 + * 161.9 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 161.10 + * 161.11 + * http://www.strabon.di.uoa.gr/ 161.12 + */ 161.13 +package eu.earthobservatory.testsuite.bugs; 161.14 + 161.15 +import eu.earthobservatory.testsuite.utils.TemplateTest; 161.16 + 161.17 + 161.18 +/** 161.19 + * A simple store test. It tests if the input dataset is stored and retrieved correctly. 161.20 + * 161.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr 161.22 + */ 161.23 +public class StoreTest extends TemplateTest{}
162.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 162.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/StoreGMLTest.java Fri Apr 19 14:37:09 2013 +0300 162.3 @@ -0,0 +1,20 @@ 162.4 +/** 162.5 + * This Source Code Form is subject to the terms of the Mozilla Public 162.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 162.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 162.8 + * 162.9 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 162.10 + * 162.11 + * http://www.strabon.di.uoa.gr/ 162.12 + */ 162.13 +package eu.earthobservatory.testsuite.stSPARQL; 162.14 + 162.15 +import eu.earthobservatory.testsuite.utils.TemplateTest; 162.16 + 162.17 + 162.18 +/** 162.19 + * A simple store test. It tests if triples with GML serialization are stored and retrieved correctly. 162.20 + * 162.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr 162.22 + */ 162.23 +public class StoreGMLTest extends TemplateTest{}
163.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 163.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/StoreWKTTest.java Fri Apr 19 14:37:09 2013 +0300 163.3 @@ -0,0 +1,20 @@ 163.4 +/** 163.5 + * This Source Code Form is subject to the terms of the Mozilla Public 163.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 163.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 163.8 + * 163.9 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 163.10 + * 163.11 + * http://www.strabon.di.uoa.gr/ 163.12 + */ 163.13 +package eu.earthobservatory.testsuite.stSPARQL; 163.14 + 163.15 +import eu.earthobservatory.testsuite.utils.TemplateTest; 163.16 + 163.17 + 163.18 +/** 163.19 + * A simple store test. It tests if triples with WKT serialization are stored and retrieved correctly. 163.20 + * 163.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr 163.22 + */ 163.23 +public class StoreWKTTest extends TemplateTest{}
164.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 164.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/TemplateTest.java Fri Apr 19 14:37:09 2013 +0300 164.3 @@ -0,0 +1,93 @@ 164.4 +/** 164.5 + * This Source Code Form is subject to the terms of the Mozilla Public 164.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 164.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 164.8 + * 164.9 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 164.10 + * 164.11 + * http://www.strabon.di.uoa.gr/ 164.12 + */ 164.13 +package eu.earthobservatory.testsuite.utils; 164.14 + 164.15 +import java.io.File; 164.16 +import java.util.ArrayList; 164.17 +import java.util.Iterator; 164.18 + 164.19 +import org.junit.After; 164.20 +import org.junit.Before; 164.21 +import org.junit.Test; 164.22 + 164.23 + 164.24 +/** 164.25 + * A template test. It: 164.26 + * 1) creates a database 164.27 + * 2) stores a dataset 164.28 + * 3) poses a query 164.29 + * 4) checks if the results of the query are the expected 164.30 + * 5) drops the database 164.31 + * 164.32 + * @author Panayiotis Smeros <psmeros@di.uoa.gr 164.33 + */ 164.34 +public abstract class TemplateTest 164.35 +{ 164.36 + private String datasetFile; 164.37 + private ArrayList<String> queryFile; 164.38 + private ArrayList<String> resultsFile; 164.39 + 164.40 + public TemplateTest(String datasetFile, ArrayList<String> queryFile, ArrayList<String> resultsFile) 164.41 + { 164.42 + this.datasetFile = datasetFile; 164.43 + this.queryFile = queryFile; 164.44 + this.resultsFile = resultsFile; 164.45 + } 164.46 + 164.47 + public TemplateTest() 164.48 + { 164.49 + queryFile=new ArrayList<String>(); 164.50 + resultsFile=new ArrayList<String>(); 164.51 + 164.52 + String testname=this.getClass().getSimpleName(); 164.53 + String testpackage=this.getClass().getPackage().getName().substring(this.getClass().getPackage().getName().lastIndexOf('.')+1); 164.54 + File testfolder = new File(this.getClass().getResource("/"+testpackage+"/"+testname+"/").getPath()); 164.55 + 164.56 + String[] files = testfolder.list(); 164.57 + 164.58 + for(String file : files) 164.59 + { 164.60 + if(file.endsWith(".nt") || file.endsWith(".nq")) 164.61 + { 164.62 + this.datasetFile="/"+testpackage+"/"+testname+"/"+file; 164.63 + } 164.64 + else if(file.endsWith(".rq")) 164.65 + { 164.66 + this.queryFile.add("/"+testpackage+"/"+testname+"/"+file); 164.67 + this.resultsFile.add("/"+testpackage+"/"+testname+"/"+file.substring(0, file.length()-3)+".srx"); 164.68 + } 164.69 + } 164.70 + } 164.71 + 164.72 + @Before 164.73 + public void before() throws Exception 164.74 + { 164.75 + Utils.createdb(); 164.76 + Utils.storeDataset(datasetFile); 164.77 + } 164.78 + 164.79 + @Test 164.80 + public void test() throws Exception 164.81 + { 164.82 + Iterator<String> queryFileIterator = this.queryFile.iterator(); 164.83 + Iterator<String> resultsFileIterator = this.resultsFile.iterator(); 164.84 + 164.85 + while(queryFileIterator.hasNext() && resultsFileIterator.hasNext()) 164.86 + { 164.87 + Utils.testQuery(queryFileIterator.next(), resultsFileIterator.next()); 164.88 + } 164.89 + } 164.90 + 164.91 + @After 164.92 + public void after() throws Exception 164.93 + { 164.94 + Utils.dropdb(); 164.95 + } 164.96 +}
165.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 165.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/Utils.java Fri Apr 19 14:37:09 2013 +0300 165.3 @@ -0,0 +1,219 @@ 165.4 +/** 165.5 + * This Source Code Form is subject to the terms of the Mozilla Public 165.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 165.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 165.8 + * 165.9 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 165.10 + * 165.11 + * http://www.strabon.di.uoa.gr/ 165.12 + */ 165.13 +package eu.earthobservatory.testsuite.utils; 165.14 + 165.15 +import static org.junit.Assert.assertEquals; 165.16 +import static org.junit.Assert.assertFalse; 165.17 +import static org.junit.Assert.assertTrue; 165.18 +import java.io.ByteArrayInputStream; 165.19 +import java.io.ByteArrayOutputStream; 165.20 +import java.io.File; 165.21 +import java.io.IOException; 165.22 +import java.io.InputStream; 165.23 +import java.net.URISyntaxException; 165.24 +import java.sql.Connection; 165.25 +import java.sql.DriverManager; 165.26 +import java.sql.PreparedStatement; 165.27 +import java.sql.ResultSet; 165.28 +import java.sql.SQLException; 165.29 +import java.util.ArrayList; 165.30 +import java.util.Collections; 165.31 +import java.util.Iterator; 165.32 +import java.util.List; 165.33 +import java.util.Properties; 165.34 +import org.apache.commons.io.FileUtils; 165.35 +import org.openrdf.query.BindingSet; 165.36 +import org.openrdf.query.MalformedQueryException; 165.37 +import org.openrdf.query.QueryEvaluationException; 165.38 +import org.openrdf.query.TupleQueryResult; 165.39 +import org.openrdf.query.Tup