Strabon
changeset 872:74ffcfcb691d temporals
merge with default
author | Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> |
---|---|
date | Fri Feb 08 16:42:42 2013 +0200 (2013-02-08) |
parents | 57f00dc6208e 3d85e721218c |
children | 4b408b8a06a9 |
files | endpoint/WebContent/WEB-INF/connection.properties evaluation/pom.xml evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/GeoConstants.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/AnyInteractFunc.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/CoveredByFunc.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/CoversFunc.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/OverlapFunc.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/TouchFunc.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/ContainsMBBFunc.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbInsideFunc.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/WithinFunc.java evaluation/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlAnyInteract.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlContainsMBB.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlCoveredBy.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlCovers.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlInside.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlMbbInside.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlOverlap.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlTouch.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBQueryModelVisitorBase.java generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java pom.xml postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java resultio-spatial/text/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java resultio/pom.xml resultio/src/main/java/org/openrdf/query/resultio/Format.java resultio/src/main/java/org/openrdf/query/resultio/sparqlgeojson/stSPARQLResultsGeoJSONWriter.java resultio/src/main/java/org/openrdf/query/resultio/sparqlgeojson/stSPARQLResultsGeoJSONWriterFactory.java resultio/src/main/java/org/openrdf/query/resultio/sparqlhtml/stSPARQLResultsHTMLWriter.java resultio/src/main/java/org/openrdf/query/resultio/sparqlhtml/stSPARQLResultsHTMLWriterFactory.java resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriter.java resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMLWriterFactory.java resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMZWriter.java resultio/src/main/java/org/openrdf/query/resultio/sparqlkml/stSPARQLResultsKMZWriterFactory.java resultio/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLResultsXMLWriter.java resultio/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLResultsXMLWriterFactory.java resultio/src/main/java/org/openrdf/query/resultio/sparqlxml/stSPARQLXMLWriter.java resultio/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultFormat.java resultio/src/main/java/org/openrdf/query/resultio/stSPARQLQueryResultWriterFactory.java resultio/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriter.java resultio/src/main/java/org/openrdf/query/resultio/text/stSPARQLResultsTSVWriterFactory.java runtime/pom.xml runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java runtime/src/main/java/eu/earthobservatory/runtime/postgis/StoreOp.java runtime/src/main/resources/log4j.properties runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java runtime/src/test/java/eu/earthobservatory/runtime/generaldb/JoinTests.java scripts/strabon scripts/strabon.conf |
line diff
1.1 --- a/.hgignore Thu Feb 07 17:59:46 2013 +0200 1.2 +++ b/.hgignore Fri Feb 08 16:42:42 2013 +0200 1.3 @@ -11,3 +11,4 @@ 1.4 stdout\.txt 1.5 stderr\.log 1.6 stdout\.log 1.7 +endpoint-client/dependency-reduced-pom\.xml
2.1 --- a/.hgtags Thu Feb 07 17:59:46 2013 +0200 2.2 +++ b/.hgtags Fri Feb 08 16:42:42 2013 +0200 2.3 @@ -13,3 +13,6 @@ 2.4 66fbe30eb2e9dcd5c36bf29336efcb1bd3ce45fb v3.2.4 2.5 73521cf81d1383a7fd885de46ffd7ed6e844851b Teleios_System_v1-1-1 2.6 331163be068281f22f61b79b31484eb0f4cfc564 Teleios_System_v1-1-1 2.7 +7089b2d52c7f36b40301063efc73476a093f2134 v3.2.5 2.8 +97afadc6d589b318924ca774659418c055fdf3a0 v3.2.6 2.9 +b3e0d7415823df2e814aa6fa45aa13374a81e706 v3.2.7
3.1 --- a/AUTHORS Thu Feb 07 17:59:46 2013 +0200 3.2 +++ b/AUTHORS Fri Feb 08 16:42:42 2013 +0200 3.3 @@ -6,4 +6,4 @@ 3.4 Charalampos Nikolaou <charnik@di.uoa.gr> 3.5 Stella Gianakopoulou <sgian@di.uoa.gr> 3.6 Panagiotis Smeros <psmeros@di.uoa.gr> 3.7 -Kallirroi Dogani <roi@di.uoa.gr> 3.8 +Kallirroi Dogani <kallirroi@di.uoa.gr>
4.1 --- a/ChangeLog Thu Feb 07 17:59:46 2013 +0200 4.2 +++ b/ChangeLog Fri Feb 08 16:42:42 2013 +0200 4.3 @@ -0,0 +1,110 @@ 4.4 +Day Month Date Hour:Min:Sec Year Pyravlos Team 4.5 + 4.6 + * Version 3.2.8 released. 4.7 + 4.8 +Wed Jan 09 18:06:41 2013 Pyravlos Team 4.9 + 4.10 + * Version 3.2.7 released. 4.11 + 4.12 + * Add an extension function 4.13 + <http://strdf.di.uoa.gr/extensions/ontology#diffDateTime> for computing the 4.14 + span (in milliseconds) between two timestamps. 4.15 + 4.16 + * Added an <endpoint-exec> module. This module builds an executable jar file 4.17 + with an embedded Apache Tomcat 7. To create and run the executable jar just 4.18 + type: 4.19 + $ mvn clean package 4.20 + $ java -jar endpoint-exec/target/strabon-endpoint-executable-*.jar 4.21 + 4.22 + * Modified strabon script and postgis/monetdb.StoreOP class to get an 4.23 + option for storing a RDF file in a named graph. Moreover, the RDF 4.24 + format of the input RDF file now is given as an option (still, if it 4.25 + is missing, it is assumed that the input is in N-TRIPLES format). The 4.26 + option for the format is -f and the option for the named graph is -g 4.27 + (takes a URI as an argument). 4.28 + 4.29 + * Modified the names of the stSPARQL extension functions that 4.30 + utilize the minimum bounding boxes of the involved geometries. 4.31 + 4.32 +Tue Dec 11 19:33:45 2012 Pyravlos Team 4.33 + 4.34 + * Version 3.2.6 released. 4.35 + 4.36 + * Modified the names of the stSPARQL extension functions to comply 4.37 + with the OGC Simple Features Access standard. 4.38 + 4.39 +Tue Dec 11 00:11:43 2012 Pyravlos Team 4.40 + 4.41 + * Version 3.2.5 released. 4.42 + 4.43 + * Added support for querying temporal information. This functionality 4.44 + may be found in the `temporals' branch. 4.45 + 4.46 + The datatypes <http://strdf.di.uoa.gr/ontology#period> and 4.47 + <http://www.w3.org/2001/XMLSchema#dateTime> are used to 4.48 + represent periods and instants respectively. 4.49 + 4.50 + The valid time time of triples is represented using quadtruples, 4.51 + with the valid time annotation(instant or period) being the 4.52 + fourth element of the quad. In the same way, temporal triple 4.53 + patterns are used in queries to retrieve the valid time of 4.54 + triples. 4.55 + 4.56 + Some functions have been renamed (their URIs have changed) to 4.57 + follow the names of the respective relations of Allen's 4.58 + interval algebra and other functions have been added. 4.59 + 4.60 + The following temporal functions are supported: 4.61 + during, periodOverlaps, equalsPeriod, nequalsPeriod, adjacent, 4.62 + before, after, overleft, overright, meets, starts, finishes, 4.63 + period_intersect, period_union, preceding_period, and 4.64 + succeeding_period. 4.65 + 4.66 + * Changed behaviour of Strabon and Strabon Endpoint for connecting to 4.67 + a spatially-enabled database. Only one instance of Strabon is allowed 4.68 + at a time. 4.69 + 4.70 + * Implemented a Java client for Strabon Endpoint. The client should be 4.71 + used only with endpoint versions >=3.2.5. The implementation may be 4.72 + found int the `endpoint-client' submodule of maven. Currently, only 4.73 + querying of Strabon Endpoints is supported. 4.74 + 4.75 + * Added support for requesting the capabilities of Strabon Endpoint 4.76 + (fixes Bug #20 <http://bug.strabon.di.uoa.gr/ticket/20>). See 4.77 + changesets f840796400bf and ?<TBC>? for specific details and how you 4.78 + can determine the capabilities of older endpoints (versions <= 3.2.4). 4.79 + 4.80 + * Updated KML writer to include the projected variables of an stSPARQL 4.81 + query in "ExtendedData" and "Data" tags. This is the proper way to 4.82 + do it if we need to convert a KML to a ESRI shapefile and also include 4.83 + such information as attributes for a feature. See related pages from 4.84 + KML specification: 4.85 + <https://developers.google.com/kml/documentation/kmlreference#extendeddata> 4.86 + <https://developers.google.com/kml/documentation/extendeddata> 4.87 + 4.88 + * Added user authentication for storing RDF data through Strabon 4.89 + Endpoint. The credentials are specified in 4.90 + WEB-INF/credentials.properties file. 4.91 + 4.92 + * Strabon Endpoints now limits the number of the results to a maximum 4.93 + one. The maximum number is specified in the beans.xml file. This 4.94 + corresponds to parameter "maxLimit". The endpoint script has also been 4.95 + updated correspondingly; the limit can be given using the option "-l". 4.96 + One can disable limiting of query results, by setting the "maxLimit" 4.97 + parameter to 0. Addresses Bug #6 4.98 + (<http://bug.strabon.di.uoa.gr/ticket/6>). 4.99 + 4.100 + * Added "Known Issues" section to README. 4.101 + 4.102 + * Added -m (more memory) and -M (much more memory) options in strabon 4.103 + script for out-of-memory exceptions. 4.104 + 4.105 + * Fixed Bug #10 (<http://bug.strabon.di.uoa.gr/ticket/10>). Now 4.106 + KMLWriter handles more geometric types (other than polygons). See 4.107 + changeset 9a3bfee64a39. 4.108 + 4.109 + * Menu and navigation in Strabon Endpoint has changed to use jquery. 4.110 + The menu is now populated using the queries placed inside the beans.xml. 4.111 + 4.112 + * Added BrowseBean and browse.jsp for browsing the RDF data using the 4.113 + Strabon Endpoint.
5.1 --- a/README Thu Feb 07 17:59:46 2013 +0200 5.2 +++ b/README Fri Feb 08 16:42:42 2013 +0200 5.3 @@ -51,6 +51,14 @@ 5.4 stRDF and stSPARQL tutorial 5.5 http://www.strabon.di.uoa.gr/files/stSPARQL_tutorial.pdf 5.6 5.7 + 5.8 +stSPARQL Reference 5.9 +~~~~~~~~~~~~~~~~~~ 5.10 +The reference for the spatial and temporal extension functions defined in 5.11 +stSPARQL can be found at http://www.strabon.di.uoa.gr/stSPARQL#spatial and 5.12 +http://www.strabon.di.uoa.gr/stSPARQL#temporals respectively. 5.13 + 5.14 + 5.15 User Guide 5.16 ~~~~~~~~~~ 5.17 Assuming that you are familiar with Maven, the following steps need to be 5.18 @@ -183,6 +191,13 @@ 5.19 Barcelona, Spain. 5.20 [pdf: http://www.earthobservatory.eu/publications/SciQL_ADASS2011.pdf] 5.21 5.22 + * C. Nikolaou and M. Koubarakis: "Querying Linked Geospatial Data with 5.23 + Incomplete Information". In 5th International Terra Cognita Workshop - 5.24 + Foundations, Technologies and Applications of the Geospatial Web. In 5.25 + conjunction with the 11th International Semantic Web Conference, Boston, 5.26 + USA, November, 2012. 5.27 + [http://www.earthobservatory.eu/publications/iswc-workshop.pdf] 5.28 + 5.29 5.30 Contributors 5.31 ============ 5.32 @@ -215,16 +230,25 @@ 5.33 5.34 Known Issues 5.35 ============ 5.36 -By default, Tomcat uses ISO-8859-1 character encoding when decoding URLs received 5.37 -from a browser. This can cause problems when encoding is UTF-8, and you are using 5.38 -international characters. In order to fix this, edit conf/server.xml and find the 5.39 -line where the Connector is defined. Add the parameter URIEncoding and set it to 5.40 -UTF-8. For example: 5.41 + * By default, Tomcat uses ISO-8859-1 character encoding when decoding URLs received 5.42 + from a browser. This can cause problems when encoding is UTF-8, and you are using 5.43 + international characters. In order to fix this, edit conf/server.xml and find the 5.44 + line where the Connector is defined. Add the parameter URIEncoding and set it to 5.45 + UTF-8. For example: 5.46 5.47 -<Connector port="8080" protocol="HTTP/1.1" 5.48 - connectionTimeout="20000" 5.49 - URIEncoding="UTF-8" 5.50 - redirectPort="8443" /> 5.51 + <Connector port="8080" protocol="HTTP/1.1" 5.52 + connectionTimeout="20000" 5.53 + URIEncoding="UTF-8" 5.54 + redirectPort="8443" /> 5.55 + 5.56 + * Building and executing any maven goals fails for maven versions <3.0 due to a 5.57 + dependency to the `shade' plugin that is available only for maven version 3.0 5.58 + (http://maven.apache.org/plugins/maven-shade-plugin/). In such systems, you may 5.59 + disable execution of this plugin by setting the environmental variable 5.60 + `shade.skip'. For example, to build Strabon using maven version 2.0 you may 5.61 + execute the following command: 5.62 + 5.63 + $ mvn clean package -Dshade.skip 5.64 5.65 5.66 License 5.67 @@ -240,7 +264,8 @@ 5.68 5.69 How to apply the license 5.70 ======================== 5.71 -In the beginning of script files (after the ???) paste the following statement: 5.72 + * In the beginning of script files (after the shell directive) paste the 5.73 + following statement: 5.74 # 5.75 # This Source Code Form is subject to the terms of the Mozilla Public 5.76 # License, v. 2.0. If a copy of the MPL was not distributed with this 5.77 @@ -251,7 +276,7 @@ 5.78 # http://www.strabon.di.uoa.gr/ 5.79 # 5.80 5.81 -In the beginning of Java source code files paste the following statement: 5.82 + * In the beginning of Java source code files paste the following statement: 5.83 /** 5.84 * This Source Code Form is subject to the terms of the Mozilla Public 5.85 * License, v. 2.0. If a copy of the MPL was not distributed with this 5.86 @@ -262,7 +287,7 @@ 5.87 * http://www.strabon.di.uoa.gr/ 5.88 */ 5.89 5.90 -In the beginning of HTML/XML files paste the following statement: 5.91 + * In the beginning of HTML/XML files paste the following statement: 5.92 <!-- This Source Code Form is subject to the terms of the Mozilla Public 5.93 - License, v. 2.0. If a copy of the MPL was not distributed with this 5.94 - file, You can obtain one at http://mozilla.org/MPL/2.0/.
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/endpoint-client/pom.xml Fri Feb 08 16:42:42 2013 +0200 6.3 @@ -0,0 +1,160 @@ 6.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"> 6.5 + 6.6 + <modelVersion>4.0.0</modelVersion> 6.7 + 6.8 + <parent> 6.9 + <groupId>eu.earthobservatory</groupId> 6.10 + <artifactId>strabon</artifactId> 6.11 + <version>3.2.8-SNAPSHOT</version> 6.12 + </parent> 6.13 + 6.14 + <artifactId>strabon-endpoint-client</artifactId> 6.15 + 6.16 + <name>Strabon: Endpoint client</name> 6.17 + <description>A java client for Strabon endpoint</description> 6.18 + <packaging>jar</packaging> 6.19 + 6.20 + <dependencies> 6.21 + <dependency> 6.22 + <groupId>org.openrdf.sesame</groupId> 6.23 + <artifactId>sesame-rio-api</artifactId> 6.24 + </dependency> 6.25 + <dependency> 6.26 + <groupId>org.openrdf.sesame</groupId> 6.27 + <artifactId>sesame-queryresultio-spatial-api</artifactId> 6.28 + </dependency> 6.29 + 6.30 + <dependency> 6.31 + <groupId>org.apache.httpcomponents</groupId> 6.32 + <artifactId>httpclient</artifactId> 6.33 + <!-- version was put in purpose! do not remove it; --> 6.34 + <version>4.2</version> 6.35 + </dependency> 6.36 + 6.37 + <!-- Testing: JUnit --> 6.38 + <dependency> 6.39 + <groupId>junit</groupId> 6.40 + <artifactId>junit</artifactId> 6.41 + <scope>test</scope> 6.42 + </dependency> 6.43 + </dependencies> 6.44 + 6.45 + <build> 6.46 + <pluginManagement> 6.47 + <plugins> 6.48 + <plugin> 6.49 + <groupId>org.eclipse.m2e</groupId> 6.50 + <artifactId>lifecycle-mapping</artifactId> 6.51 + <version>1.0.0</version> 6.52 + <configuration> 6.53 + <lifecycleMappingMetadata> 6.54 + <pluginExecutions> 6.55 + <pluginExecution> 6.56 + <pluginExecutionFilter> 6.57 + <groupId>org.apache.maven.plugins</groupId> 6.58 + <artifactId>maven-dependency-plugin</artifactId> 6.59 + <versionRange>[2.3,)</versionRange> 6.60 + <goals> 6.61 + <goal>copy-dependencies</goal> 6.62 + </goals> 6.63 + </pluginExecutionFilter> 6.64 + <action> 6.65 + <ignore /> 6.66 + </action> 6.67 + </pluginExecution> 6.68 + </pluginExecutions> 6.69 + </lifecycleMappingMetadata> 6.70 + </configuration> 6.71 + </plugin> 6.72 + </plugins> 6.73 + </pluginManagement> 6.74 + 6.75 + <plugins> 6.76 + <plugin> 6.77 + <groupId>org.apache.maven.plugins</groupId> 6.78 + <artifactId>maven-compiler-plugin</artifactId> 6.79 + <version>2.3.2</version> 6.80 + <configuration> 6.81 + <source>1.6</source> 6.82 + <target>1.6</target> 6.83 + <encoding>utf8</encoding> 6.84 + </configuration> 6.85 + </plugin> 6.86 + <plugin> 6.87 + <groupId>org.apache.maven.plugins</groupId> 6.88 + <artifactId>maven-dependency-plugin</artifactId> 6.89 + <version>2.4</version> 6.90 + <executions> 6.91 + <execution> 6.92 + <id>copy-dependencies</id> 6.93 + <phase>package</phase> 6.94 + <goals> 6.95 + <goal>copy-dependencies</goal> 6.96 + </goals> 6.97 + <configuration> 6.98 + <outputDirectory>${project.build.directory}</outputDirectory> 6.99 + <overWriteReleases>false</overWriteReleases> 6.100 + <overWriteSnapshots>false</overWriteSnapshots> 6.101 + <overWriteIfNewer>true</overWriteIfNewer> 6.102 + </configuration> 6.103 + </execution> 6.104 + </executions> 6.105 + </plugin> 6.106 + 6.107 + <plugin> 6.108 + <groupId>org.apache.maven.plugins</groupId> 6.109 + <artifactId>maven-jar-plugin</artifactId> 6.110 + <version>2.4</version> 6.111 + <configuration> 6.112 + <skipIfEmpty>true</skipIfEmpty> 6.113 + </configuration> 6.114 + <executions> 6.115 + <execution> 6.116 + <goals> 6.117 + <goal>test-jar</goal> 6.118 + </goals> 6.119 + </execution> 6.120 + </executions> 6.121 + </plugin> 6.122 + </plugins> 6.123 + </build> 6.124 + 6.125 +<profiles> 6.126 + <profile> 6.127 + <id>conditional-shade-plugin</id> 6.128 + 6.129 + <activation> 6.130 + <property><name>!shade.skip</name></property> 6.131 + </activation> 6.132 + <build> 6.133 + <plugins> 6.134 + <plugin> 6.135 + <groupId>org.apache.maven.plugins</groupId> 6.136 + <artifactId>maven-shade-plugin</artifactId> 6.137 + <version>2.0</version> 6.138 + <!-- 6.139 + <configuration> 6.140 + </configuration> 6.141 + --> 6.142 + <executions> 6.143 + <execution> 6.144 + <phase>package</phase> 6.145 + <goals> 6.146 + <goal>shade</goal> 6.147 + </goals> 6.148 + <configuration> 6.149 + <transformers> 6.150 + <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 6.151 + <mainClass>eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint</mainClass> 6.152 + </transformer> 6.153 + </transformers> 6.154 + </configuration> 6.155 + </execution> 6.156 + </executions> 6.157 + </plugin> 6.158 + </plugins> 6.159 + </build> 6.160 + </profile> 6.161 +</profiles> 6.162 +</project> 6.163 +
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/EndpointResult.java Fri Feb 08 16:42:42 2013 +0200 7.3 @@ -0,0 +1,35 @@ 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 +/** 7.16 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 7.17 + * 7.18 + */ 7.19 +public interface EndpointResult { 7.20 + 7.21 + /** 7.22 + * Returns the HTTP status code as returned by the endpoint. 7.23 + * @return 7.24 + */ 7.25 + public int getStatusCode(); 7.26 + 7.27 + /** 7.28 + * Returns the status text corresponding to the status code. 7.29 + * @return 7.30 + */ 7.31 + public String getStatusText(); 7.32 + 7.33 + /** 7.34 + * Returns the response of the endpoint. 7.35 + * @return 7.36 + */ 7.37 + public String getResponse(); 7.38 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SpatialEndpoint.java Fri Feb 08 16:42:42 2013 +0200 8.3 @@ -0,0 +1,38 @@ 8.4 +/** 8.5 + * This Source Code Form is subject to the terms of the Mozilla Public 8.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 8.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8.8 + * 8.9 + * Copyright (C) 2012, Pyravlos Team 8.10 + * 8.11 + * http://www.strabon.di.uoa.gr/ 8.12 + */ 8.13 +package eu.earthobservatory.org.StrabonEndpoint.client; 8.14 + 8.15 +import java.io.IOException; 8.16 +import java.net.URL; 8.17 + 8.18 +import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 8.19 +import org.openrdf.rio.RDFFormat; 8.20 + 8.21 +/** 8.22 + * Every SPARQL endpoint that supports storing and querying of 8.23 + * spatial RDF data should implement the {@link SpatialEndpoint} 8.24 + * interface. 8.25 + * 8.26 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 8.27 + */ 8.28 +public interface SpatialEndpoint { 8.29 + 8.30 + public EndpointResult query(String sparqlQuery, stSPARQLQueryResultFormat format) throws IOException; 8.31 + 8.32 + public boolean store(String data, RDFFormat format); 8.33 + 8.34 + public boolean store(URL data, RDFFormat format); 8.35 + 8.36 + public boolean update(String sparqlUpdate); 8.37 + 8.38 + public EndpointResult describe(String sparqlDescribe); 8.39 + 8.40 + public EndpointResult construct(String sparqlConstruct); 8.41 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SpatialEndpointImpl.java Fri Feb 08 16:42:42 2013 +0200 9.3 @@ -0,0 +1,112 @@ 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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/StrabonEndpoint.java Fri Feb 08 16:42:42 2013 +0200 10.3 @@ -0,0 +1,189 @@ 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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/StrabonEndpointResult.java Fri Feb 08 16:42:42 2013 +0200 11.3 @@ -0,0 +1,42 @@ 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 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestLimit.java Fri Feb 08 16:42:42 2013 +0200 12.3 @@ -0,0 +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 +}
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/TestStrabonEndpoint.java Fri Feb 08 16:42:42 2013 +0200 13.3 @@ -0,0 +1,85 @@ 13.4 +/** 13.5 + * This Source Code Form is subject to the terms of the Mozilla Public 13.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 13.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 13.8 + * 13.9 + * Copyright (C) 2012, Pyravlos Team 13.10 + * 13.11 + * http://www.strabon.di.uoa.gr/ 13.12 + */ 13.13 +package eu.earthobservatory.org.StrabonEndpoint.client; 13.14 + 13.15 +import static org.junit.Assert.assertTrue; 13.16 + 13.17 +import java.io.IOException; 13.18 +import java.util.Vector; 13.19 + 13.20 +import org.junit.Before; 13.21 +import org.junit.Test; 13.22 +import org.openrdf.query.resultio.TupleQueryResultFormat; 13.23 +import org.openrdf.query.resultio.stSPARQLQueryResultFormat; 13.24 + 13.25 +/** 13.26 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 13.27 + * 13.28 + */ 13.29 +public class TestStrabonEndpoint { 13.30 + 13.31 + private StrabonEndpoint endpoint; 13.32 + private String query; 13.33 + private Vector<stSPARQLQueryResultFormat> formats = new Vector<stSPARQLQueryResultFormat>(); 13.34 + 13.35 + @Before 13.36 + public void init() { 13.37 + // initialize endpoint 13.38 + endpoint = new StrabonEndpoint("test.strabon.di.uoa.gr", 80, "DLR"); 13.39 + 13.40 + // set query 13.41 + query = "PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>\n" + 13.42 + "SELECT ?s ?g WHERE {\n" + 13.43 + " ?s teleios:hasGeometry ?g\n" + 13.44 + "}" + 13.45 + "\nLIMIT 1"; 13.46 + 13.47 + // initialized formats 13.48 + for (TupleQueryResultFormat format : stSPARQLQueryResultFormat.values()) { 13.49 + if (format instanceof stSPARQLQueryResultFormat) { 13.50 + formats.add((stSPARQLQueryResultFormat) format); 13.51 + } 13.52 + } 13.53 + 13.54 + } 13.55 + 13.56 + /** 13.57 + * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 13.58 + */ 13.59 + @Test 13.60 + public void testQuery() { 13.61 + for (stSPARQLQueryResultFormat format : formats) { 13.62 + try { 13.63 + EndpointResult response = endpoint.query(query, format); 13.64 + 13.65 + if (response.getStatusCode() != 200) { 13.66 + System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText()); 13.67 + 13.68 + } 13.69 + 13.70 + assertTrue(response.getStatusCode() == 200); 13.71 + 13.72 + } catch (IOException e) { 13.73 + e.printStackTrace(); 13.74 + } 13.75 + 13.76 + } 13.77 + } 13.78 + 13.79 + /** 13.80 + * Test method for testing that method {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}. 13.81 + * returns an IOException when it should do so. 13.82 + */ 13.83 + @Test(expected= IOException.class) 13.84 + public void testIOException() throws Exception { 13.85 + StrabonEndpoint ep = new StrabonEndpoint("blabla.dgr", 80, "bla"); 13.86 + ep.query(query, formats.get(0)); 13.87 + } 13.88 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/endpoint-exec/pom.xml Fri Feb 08 16:42:42 2013 +0200 14.3 @@ -0,0 +1,98 @@ 14.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"> 14.5 + 14.6 + <modelVersion>4.0.0</modelVersion> 14.7 + 14.8 + <parent> 14.9 + <groupId>eu.earthobservatory</groupId> 14.10 + <artifactId>strabon</artifactId> 14.11 + <version>3.2.8-SNAPSHOT</version> 14.12 + </parent> 14.13 + 14.14 + <artifactId>strabon-endpoint-exec</artifactId> 14.15 + 14.16 + <name>Strabon: Executable endpoint</name> 14.17 + <description>A Strabon endpoint packaged with Tomcat 7 as a single executable jar file</description> 14.18 + <packaging>pom</packaging> 14.19 + 14.20 + <dependencies> 14.21 + <dependency> 14.22 + <groupId>eu.earthobservatory</groupId> 14.23 + <artifactId>strabon-endpoint</artifactId> 14.24 + <version>${eu.earthobservatory.version}</version> 14.25 + <type>war</type> 14.26 + <scope>compile</scope> 14.27 + </dependency> 14.28 + </dependencies> 14.29 + 14.30 + <build> 14.31 + <plugins> 14.32 + <plugin> 14.33 + <groupId>org.apache.tomcat.maven</groupId> 14.34 + <artifactId>tomcat7-maven-plugin</artifactId> 14.35 + <version>2.0</version> 14.36 + <executions> 14.37 + <execution> 14.38 + <id>tomcat-run</id> 14.39 + <goals> 14.40 + <goal>exec-war-only</goal> 14.41 + </goals> 14.42 + <phase>package</phase> 14.43 + <configuration> 14.44 + <path>/</path> 14.45 + <uriEncoding>UTF-8</uriEncoding> 14.46 + <finalName>strabon-endpoint-executable-${project.version}.jar</finalName> 14.47 + <!-- Override the default server.xml if nessecary 14.48 + <serverXml>src/main/tomcatconf/server.xml</serverXml> 14.49 + --> 14.50 + <!-- 14.51 + <extraResources> 14.52 + <extraResource> 14.53 + <directory>${basedir}/src/main/resources</directory> 14.54 + <includes> 14.55 + <include>**/log4j.xml</include> 14.56 + </includes> 14.57 + </extraResource> 14.58 + </extraResources> 14.59 + --> 14.60 + <warRunDependencies> 14.61 + <warRunDependency> 14.62 + <dependency> 14.63 + <groupId>eu.earthobservatory</groupId> 14.64 + <artifactId>strabon-endpoint</artifactId> 14.65 + <version>${eu.earthobservatory.version}</version> 14.66 + <type>war</type> 14.67 + </dependency> 14.68 + <contextPath>/</contextPath> 14.69 + </warRunDependency> 14.70 + </warRunDependencies> 14.71 + <!-- 14.72 + <extraDependencies> 14.73 + <extraDependency> 14.74 + <groupId>org.slf4j</groupId> 14.75 + <artifactId>jul-to-slf4j</artifactId> 14.76 + <version>${slf4jVersion}</version> 14.77 + </extraDependency> 14.78 + <extraDependency> 14.79 + <groupId>org.slf4j</groupId> 14.80 + <artifactId>slf4j-api</artifactId> 14.81 + <version>${slf4jVersion}</version> 14.82 + </extraDependency> 14.83 + <extraDependency> 14.84 + <groupId>org.slf4j</groupId> 14.85 + <artifactId>slf4j-log4j12</artifactId> 14.86 + <version>${slf4jVersion}</version> 14.87 + </extraDependency> 14.88 + <extraDependency> 14.89 + <groupId>log4j</groupId> 14.90 + <artifactId>log4j</artifactId> 14.91 + <version>1.2.12</version> 14.92 + </extraDependency> 14.93 + </extraDependencies> 14.94 + --> 14.95 + </configuration> 14.96 + </execution> 14.97 + </executions> 14.98 + </plugin> 14.99 + </plugins> 14.100 + </build> 14.101 +</project>
15.1 --- a/endpoint/WebContent/WEB-INF/beans.xml Thu Feb 07 17:59:46 2013 +0200 15.2 +++ b/endpoint/WebContent/WEB-INF/beans.xml Fri Feb 08 16:42:42 2013 +0200 15.3 @@ -14,6 +14,15 @@ 15.4 </property> 15.5 </bean> 15.6 15.7 + <bean id="capsBean" class="eu.earthobservatory.org.StrabonEndpoint.capabilities.CapabilitiesDelegateBean" destroy-method="destroy"> 15.8 + <!-- specify which implementation of the Capabilities interface shall be used --> 15.9 + <!-- true : AutoDiscoveryCapabilities --> 15.10 + <!-- false: EndpointCapabilities --> 15.11 + <constructor-arg type="boolean"> 15.12 + <value>true</value> 15.13 + </constructor-arg> 15.14 + </bean> 15.15 + 15.16 <bean 15.17 id="strabonBean" 15.18 class="eu.earthobservatory.org.StrabonEndpoint.StrabonBeanWrapper" 15.19 @@ -46,7 +55,7 @@ 15.20 15.21 <constructor-arg type="boolean" > 15.22 <!-- Check for locks and remove them (in case of a crash) --> 15.23 - <value>true</value> 15.24 + <value>false</value> 15.25 </constructor-arg> 15.26 15.27 <constructor-arg type="java.lang.String" > 15.28 @@ -61,12 +70,13 @@ 15.29 15.30 <constructor-arg type="java.lang.String" > 15.31 <!-- Default prefixes --> 15.32 + <!-- PREFIX gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#> --> 15.33 <value><![CDATA[PREFIX lgd:<http://linkedgeodata.org/triplify/> 15.34 PREFIX lgdgeo:<http://www.w3.org/2003/01/geo/wgs84_pos#> 15.35 PREFIX lgdont:<http://linkedgeodata.org/ontology/> 15.36 PREFIX geonames:<http://www.geonames.org/ontology#> 15.37 PREFIX clc: <http://geo.linkedopendata.gr/corine/ontology#> 15.38 -PREFIX gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#> 15.39 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#> 15.40 PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.41 PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.42 PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.43 @@ -81,7 +91,7 @@ 15.44 <list> 15.45 <list> 15.46 <!-- Single valued elements correspond to headers --> 15.47 - <value>Dataset Presentation</value> 15.48 + <value>Discovery Queries</value> 15.49 </list> 15.50 <list> 15.51 <!-- Bean --> 15.52 @@ -89,30 +99,27 @@ 15.53 <!-- Format --> 15.54 <value>KML</value> 15.55 <!-- Label --> 15.56 - <value>[CLC] Select all CLC information for Venice</value> 15.57 + <value>[ΝΟΑ] Select all hotspots of 2012 before any refinement</value> 15.58 <!-- Statement --> 15.59 - <value><![CDATA[PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> 15.60 -PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.61 -PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> 15.62 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.63 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.64 +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.65 +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.66 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.67 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.68 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#> 15.69 15.70 -SELECT ?clc ?clcType ?clcID ?clcCode ?clcRemark ?clcShapeLength ?clcArea ?clcAreaHa ?clcLandUse ?clcGeo 15.71 -WHERE { 15.72 - ?clc a ?clcType . 15.73 - ?clc teleios:hasCode ?clcCode . 15.74 - ?clc teleios:hasID ?clcID . 15.75 - ?clc teleios:hasRemark ?clcRemark . 15.76 - ?clc teleios:hasShape_Leng ?clcShapeLength . 15.77 - ?clc teleios:hasShape_Area ?clcArea . 15.78 - ?clc teleios:hasArea_ha ?clcAreaHa . 15.79 - ?clc teleios:hasLandUse ?clcLandUse . 15.80 - ?clc teleios:hasGeometry ?clcGeo . 15.81 - #Venice 15.82 - FILTER (strdf:anyInteract(?clcGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.83 - #Toulouse 15.84 - #FILTER (strdf:anyInteract(?clcGeo, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.85 - #Timisoara 15.86 - #FILTER (strdf:anyInteract(?clcGeo, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.87 +SELECT ?h (strdf:transform(?hGeo, <http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?geo) ?conf ?municipality 15.88 +WHERE { 15.89 +?h noa:hasGeometry ?hGeo ; 15.90 + noa:hasAcquisitionTime ?hAcquisitionTime ; 15.91 + noa:producedFromProcessingChain ?hProcessingChain ; 15.92 + noa:isDerivedFromSensor "MSG1_RSS"^^xsd:string ; 15.93 + noa:hasConfidence ?conf ; 15.94 + gag:hasMunicipality ?municipality . 15.95 + FILTER(?hProcessingChain = "DynamicThresholds" || ?hProcessingChain = "DynamicThresholds-TimePersistence") . 15.96 + FILTER("2012-05-01T00:00:00"^^xsd:dateTime <= ?hAcquisitionTime && ?hAcquisitionTime < "2012-10-01T00:00:00"^^xsd:dateTime ) . 15.97 + OPTIONAL {?h noa:isDiscarded ?disc }. 15.98 + FILTER (!bound(?disc)) . 15.99 } 15.100 ]]></value> 15.101 <!-- Description --> 15.102 @@ -126,35 +133,26 @@ 15.103 <!-- Format --> 15.104 <value>KML</value> 15.105 <!-- Label --> 15.106 - <value>[LGD] Select all LGD information for Venice</value> 15.107 + <value>[ΝΟΑ] Select all hotspots of 2012 after refinement operation 'delete in sea'</value> 15.108 <!-- Statement --> 15.109 - <value><![CDATA[PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> 15.110 -PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.111 -PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> 15.112 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.113 -PREFIX lgd:<http://linkedgeodata.org/triplify/> 15.114 -PREFIX lgdgeo:<http://www.w3.org/2003/01/geo/wgs84_pos#> 15.115 -PREFIX lgdont:<http://linkedgeodata.org/ontology/> 15.116 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.117 +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.118 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.119 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.120 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#> 15.121 15.122 -SELECT ?lgd ?lgdDirectType (GROUP_CONCAT(?lgdType ; separator=", ") AS ?lgdTypes) ?lgdLabel ?lgdGeo 15.123 +INSERT {?h noa:isDiscarded "1"^^xsd:int ; 15.124 + noa:refinedBy noa:seaInconsistency . 15.125 +} 15.126 WHERE { 15.127 - ?lgd lgdont:directType ?lgdDirectType . 15.128 - OPTIONAL { 15.129 - ?lgd a ?lgdType . 15.130 - FILTER ((?lgdType != lgdont:Node) && (?lgdType != ?lgdDirectType)) . 15.131 - } 15.132 - ?lgd rdfs:label ?lgdLabel . 15.133 - ?lgd lgdgeo:geometry ?lgdGeo . 15.134 - #Venice 15.135 - FILTER (strdf:anyInteract(?lgdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.136 - #Toulouse 15.137 - #FILTER (strdf:anyInteract(?lgdGeo, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.138 - #Timisoara 15.139 - #FILTER (strdf:anyInteract(?lgdGeo, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.140 - 15.141 -} 15.142 -GROUP BY ?lgd ?lgdDirectType ?lgdLabel ?lgdGeo 15.143 - ]]></value> 15.144 +?h noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 15.145 + noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; 15.146 + noa:isDerivedFromSensor "SENSOR"^^xsd:string . 15.147 + OPTIONAL { 15.148 + ?h gag:hasMunicipality ?municipalit . 15.149 + } 15.150 + FILTER(!bound(?municipality)) . 15.151 +} ]]></value> 15.152 <!-- Description --> 15.153 <value></value> 15.154 <!-- Hander (plain, download, map or map_local)--> 15.155 @@ -166,39 +164,18 @@ 15.156 <!-- Format --> 15.157 <value>KML</value> 15.158 <!-- Label --> 15.159 - <value>[Geonames] Select all Geonames information for Venice</value> 15.160 + <value>[ΝΟΑ] Select all hotspots of 2012 after refinement operation 'delete in inconsistent areas'</value> 15.161 <!-- Statement --> 15.162 - <value><![CDATA[PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> 15.163 -PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.164 -PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> 15.165 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.166 -PREFIX lgd:<http://linkedgeodata.org/triplify/> 15.167 -PREFIX lgdgeo:<http://www.w3.org/2003/01/geo/wgs84_pos#> 15.168 -PREFIX lgdont:<http://linkedgeodata.org/ontology/> 15.169 -PREFIX geonames:<http://www.geonames.org/ontology#> 15.170 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.171 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.172 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.173 15.174 -SELECT ?geoID ?name (GROUP_CONCAT(?altName; separator=", ") AS ?altNames) ?parentFeature ?parentCountry ?parentADM1 ?parentADM2 ?parentADM3 (GROUP_CONCAT(?near; separator=", ") AS ?nearFeatures) ?geoIdGeo 15.175 -WHERE { 15.176 -?geoId geonames:name ?name . 15.177 -OPTIONAL {?geoId geonames:alternateName ?altName } . 15.178 -?geoId geonames:featureClass ?geoFeature . 15.179 -?geoId geonames:countryCode ?country . 15.180 -OPTIONAL {?geoId geonames:parentFeature ?parentFeature . } . 15.181 -OPTIONAL {?geoId geonames:parentCountry ?parentCountry . } . 15.182 -OPTIONAL {?geoId geonames:parentADM1 ?parentADM1 . } . 15.183 -OPTIONAL {?geoId geonames:parentADM2 ?parentADM2 . } . 15.184 -OPTIONAL {?geoId geonames:parentADM3 ?parentADM3 . } . 15.185 -OPTIONAL {?geoId geonames:nearbyFeatures ?near . } . 15.186 -?geoId teleios:hasGeography ?geoIdGeo . 15.187 - #Venice 15.188 - FILTER (strdf:anyInteract(?geoIdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.189 - #Toulouse 15.190 - #FILTER (strdf:anyInteract(?geoIdGeo, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.191 - #Timisoara 15.192 - #FILTER (strdf:anyInteract(?geoIdGeo, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.193 -} 15.194 -GROUP BY ?geoID ?name ?parentFeature ?parentCountry ?parentADM1 ?parentADM2 ?parentADM3 ?geoIdGeo 15.195 - ]]></value> 15.196 +SELECT ?h (strdf:transform(?hGeo, <http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?geo) ("Corine Land Cover inconsistency" as ?refinement) 15.197 +WHERE { 15.198 + ?h noa:hasGeometry ?hGeo ; 15.199 + noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 15.200 + noa:refinedBy noa:clcInconsistency . 15.201 +} ]]></value> 15.202 <!-- Description --> 15.203 <value></value> 15.204 <!-- Hander (plain, download, map or map_local)--> 15.205 @@ -210,33 +187,18 @@ 15.206 <!-- Format --> 15.207 <value>KML</value> 15.208 <!-- Label --> 15.209 - <value>[DLR] Select all patches and their corresponding labels</value> 15.210 + <value>[ΝΟΑ] Select all hotspots of 2012 after refinement operation 'refine in coast'</value> 15.211 <!-- Statement --> 15.212 - <value><![CDATA[#select all patches and their labels (Venice) 15.213 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.214 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.215 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.216 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.217 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.218 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.219 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.220 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.221 15.222 - 15.223 -SELECT ?g (GROUP_CONCAT(?annotation; separator=", ") AS ?labels) 15.224 -WHERE { 15.225 - ?p rdf:type dlr:Patch . 15.226 - ?p dlr:hasGeometry ?g . 15.227 - ?p dlr:hasLabel ?l . 15.228 - ?l rdf:type dlr:Label . 15.229 - ?l dlr:correspondsTo ?annotation . 15.230 - #Venice 15.231 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.232 - #Toulouse 15.233 - #FILTER (strdf:anyInteract(?g, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.234 - #Timisoara 15.235 - #FILTER (strdf:anyInteract(?g, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.236 -} 15.237 -GROUP BY ?g 15.238 - ]]></value> 15.239 +SELECT ?h (strdf:transform(?hGeo, <http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?geo) ("Corine Land Cover inconsistency" as ?refinement) 15.240 +WHERE { 15.241 + ?h noa:hasGeometry ?hGeo ; 15.242 + noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 15.243 + noa:refinedBy noa:clcInconsistency . 15.244 +} ]]></value> 15.245 <!-- Description --> 15.246 <value></value> 15.247 <!-- Hander (plain, download, map or map_local)--> 15.248 @@ -248,32 +210,18 @@ 15.249 <!-- Format --> 15.250 <value>KML</value> 15.251 <!-- Label --> 15.252 - <value>[DLR] Select all patches corresponding to water</value> 15.253 + <value>[ΝΟΑ] Select all hotspots of 2012 after refinement operation 'refine according to time persistence'</value> 15.254 <!-- Statement --> 15.255 - <value><![CDATA[PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.256 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.257 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.258 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.259 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.260 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.261 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.262 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.263 15.264 - 15.265 -SELECT ?g (GROUP_CONCAT(?annotation; separator=", ") AS ?labels) 15.266 -WHERE { 15.267 - ?p rdf:type dlr:Patch . 15.268 - ?p dlr:hasGeometry ?g . 15.269 - ?p dlr:hasLabel ?l . 15.270 - ?l rdf:type dlr:Label . 15.271 - ?l dlr:correspondsTo dlr:Water . 15.272 - #Venice 15.273 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.274 - #Toulouse 15.275 - #FILTER (strdf:anyInteract(?g, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.276 - #Timisoara 15.277 - #FILTER (strdf:anyInteract(?g, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.278 -} 15.279 -GROUP BY ?g 15.280 - ]]></value> 15.281 +SELECT ?h (strdf:transform(?hGeo, <http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?geo) ("Temporal persistence" as ?refinement) 15.282 +WHERE { 15.283 + ?h noa:hasGeometry ?hGeo ; 15.284 + noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 15.285 + noa:refinedBy noa:temporalPersistence . 15.286 +} ]]></value> 15.287 <!-- Description --> 15.288 <value></value> 15.289 <!-- Hander (plain, download, map or map_local)--> 15.290 @@ -285,33 +233,19 @@ 15.291 <!-- Format --> 15.292 <value>KML</value> 15.293 <!-- Label --> 15.294 - <value>[DLR] Select all patches corresponding to all subclasses of water</value> 15.295 + <value>[NOA] Select all that have been refined by a refinement operation</value> 15.296 <!-- Statement --> 15.297 - <value><![CDATA[PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.298 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.299 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.300 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.301 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.302 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.303 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.304 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.305 15.306 - 15.307 -SELECT ?g (GROUP_CONCAT(?annotation; separator=", ") AS ?labels) 15.308 -WHERE { 15.309 - ?p rdf:type dlr:Patch . 15.310 - ?p dlr:hasGeometry ?g . 15.311 - ?p dlr:hasLabel ?l . 15.312 - ?l rdf:type dlr:Label . 15.313 - ?l dlr:correspondsTo ?annotation . 15.314 - ?annotation rdfs:subClassOf dlr:Water . 15.315 - #Venice 15.316 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.317 - #Toulouse 15.318 - #FILTER (strdf:anyInteract(?g, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.319 - #Timisoara 15.320 - #FILTER (strdf:anyInteract(?g, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.321 +SELECT (strdf:transform(?hGeo, <http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?geo) (GROUP_CONCAT(?refinement; separator=", ") AS ?refinements) 15.322 +WHERE { 15.323 + ?h noa:hasGeometry ?hGeo ; 15.324 + noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 15.325 + noa:refinedBy ?refinement . 15.326 } 15.327 -GROUP BY ?g 15.328 - ]]></value> 15.329 +GROUP BY ?geo ]]></value> 15.330 <!-- Description --> 15.331 <value></value> 15.332 <!-- Hander (plain, download, map or map_local)--> 15.333 @@ -319,7 +253,7 @@ 15.334 </list> 15.335 <list> 15.336 <!-- Single valued elements correspond to headers --> 15.337 - <value>First level statistics</value> 15.338 + <value>Enrich available information</value> 15.339 </list> 15.340 <list> 15.341 <!-- Bean --> 15.342 @@ -327,207 +261,31 @@ 15.343 <!-- Format --> 15.344 <value>HTML</value> 15.345 <!-- Label --> 15.346 - <value>[DLR] How many labels are identified in a scene?</value> 15.347 + <value>[NOA + GAG]Connect each hotspot with the municipality where it is located</value> 15.348 <!-- Statement --> 15.349 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.350 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.351 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.352 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.353 PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.354 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.355 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.356 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.357 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.358 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.359 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.360 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.361 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#> 15.362 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.363 15.364 -SELECT ?annotation (COUNT(DISTINCT ?p) AS ?numberOfPatches) 15.365 -WHERE { 15.366 - ?p rdf:type dlr:Patch . 15.367 - ?p dlr:hasGeometry ?g . 15.368 - ?p dlr:hasLabel ?l . 15.369 - ?l rdf:type dlr:Label . 15.370 - ?l dlr:correspondsTo ?annotation . 15.371 - #Venice 15.372 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.373 - #Toulouse 15.374 - #FILTER (strdf:anyInteract(?g, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.375 - #Timisoara 15.376 - #FILTER (strdf:anyInteract(?g, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.377 -} 15.378 -GROUP BY ?annotation 15.379 -ORDER BY DESC(?numberOfPatches)]]></value> 15.380 - <!-- Description --> 15.381 - <value></value> 15.382 - <!-- Hander (plain, download, map or map_local)--> 15.383 - <value>plain</value> 15.384 - </list> 15.385 - <list> 15.386 - <!-- Bean --> 15.387 - <value>Query</value> 15.388 - <!-- Format --> 15.389 - <value>HTML</value> 15.390 - <!-- Label --> 15.391 - <value>[CLC] How many instances of a CLC class exist in a scene?</value> 15.392 - <!-- Statement --> 15.393 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.394 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.395 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.396 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.397 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.398 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.399 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.400 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.401 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.402 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.403 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.404 - 15.405 - 15.406 -SELECT ?clcLandUse (COUNT(DISTINCT ?clc) AS ?count) 15.407 -WHERE { 15.408 - ?clc a teleios:Area . 15.409 - ?clc teleios:hasCode ?clcCode . 15.410 - ?clc teleios:hasLandUse ?clcLandUse . 15.411 - ?clc teleios:hasGeometry ?clcGeo . 15.412 - 15.413 - #Venice 15.414 - FILTER (strdf:anyInteract(?clcGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.415 - #Toulouse 15.416 - #FILTER (strdf:anyInteract(?clcGeo, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.417 - #Timisoara 15.418 - #FILTER (strdf:anyInteract(?clcGeo, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.419 -} 15.420 -GROUP BY ?clcLandUse 15.421 -ORDER BY DESC(?count)]]></value> 15.422 - <!-- Description --> 15.423 - <value></value> 15.424 - <!-- Hander (plain, download, map or map_local)--> 15.425 - <value></value> 15.426 - </list> 15.427 - <list> 15.428 - <!-- Bean --> 15.429 - <value>Query</value> 15.430 - <!-- Format --> 15.431 - <value>HTML</value> 15.432 - <!-- Label --> 15.433 - <value>[LGD] How many LGD classes are identified in a scene? (coarse-grained)</value> 15.434 - <!-- Statement --> 15.435 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.436 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.437 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.438 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.439 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.440 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.441 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.442 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.443 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.444 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.445 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.446 - 15.447 -SELECT ?lgdType (COUNT(DISTINCT ?lgd) AS ?count) 15.448 -WHERE { 15.449 - ?lgd lgdont:directType ?lgdDirectType . 15.450 - OPTIONAL { 15.451 - ?lgd a ?lgdType . 15.452 - FILTER ((?lgdType != lgdont:Node) && (?lgdType != ?lgdDirectType)) . 15.453 - } 15.454 - ?lgd lgdgeo:geometry ?lgdGeo . 15.455 - #Venice 15.456 - FILTER (strdf:anyInteract(?lgdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.457 - #Toulouse 15.458 - #FILTER (strdf:anyInteract(?lgdGeo, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.459 - #Timisoara 15.460 - #FILTER (strdf:anyInteract(?lgdGeo, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.461 - 15.462 -} 15.463 -GROUP BY ?lgdType 15.464 -ORDER BY DESC(?count)]]></value> 15.465 - <!-- Description --> 15.466 - <value></value> 15.467 - <!-- Hander (plain, download, map or map_local)--> 15.468 - <value></value> 15.469 - </list> 15.470 - <list> 15.471 - <!-- Bean --> 15.472 - <value>Query</value> 15.473 - <!-- Format --> 15.474 - <value>HTML</value> 15.475 - <!-- Label --> 15.476 - <value>[LGD] How many LGD classes are identified in a scene? (fine-grained)</value> 15.477 - <!-- Statement --> 15.478 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.479 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.480 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.481 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.482 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.483 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.484 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.485 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.486 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.487 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.488 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.489 - 15.490 -SELECT ?lgdDirectType (COUNT(DISTINCT ?lgd) AS ?count) 15.491 -WHERE { 15.492 - ?lgd lgdont:directType ?lgdDirectType . 15.493 - OPTIONAL { 15.494 - ?lgd a ?lgdType . 15.495 - FILTER ((?lgdType != lgdont:Node) && (?lgdType != ?lgdDirectType)) . 15.496 - } 15.497 - ?lgd lgdgeo:geometry ?lgdGeo . 15.498 - #Venice 15.499 - FILTER (strdf:anyInteract(?lgdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.500 - #Toulouse 15.501 - #FILTER (strdf:anyInteract(?lgdGeo, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.502 - #Timisoara 15.503 - #FILTER (strdf:anyInteract(?lgdGeo, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.504 - 15.505 -} 15.506 -GROUP BY ?lgdDirectType 15.507 -ORDER BY DESC(?count)]]></value> 15.508 - <!-- Description --> 15.509 - <value></value> 15.510 - <!-- Hander (plain, download, map or map_local)--> 15.511 - <value></value> 15.512 - </list> 15.513 - <list> 15.514 - <!-- Bean --> 15.515 - <value>Query</value> 15.516 - <!-- Format --> 15.517 - <value>HTML</value> 15.518 - <!-- Label --> 15.519 - <value>[Geonames] How many Geonames classes are identified in a scene?</value> 15.520 - <!-- Statement --> 15.521 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.522 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.523 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.524 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.525 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.526 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.527 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.528 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.529 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.530 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.531 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.532 - 15.533 -SELECT ?geoFeature ?comment (COUNT(DISTINCT ?geoId) AS ?count) 15.534 -WHERE { 15.535 -?geoId geonames:name ?name . 15.536 -OPTIONAL {?geoId geonames:alternateName ?altName } . 15.537 -?geoId geonames:featureClass ?geoFeature . 15.538 -?geoFeature rdfs:comment ?comment . 15.539 -?geoId geonames:countryCode ?country . 15.540 -?geoId teleios:hasGeography ?geoIdGeo . 15.541 - #Venice 15.542 - FILTER (strdf:anyInteract(?geoIdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.543 - #Toulouse 15.544 - #FILTER (strdf:anyInteract(?geoIdGeo, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.545 - #Timisoara 15.546 - #FILTER (strdf:anyInteract(?geoIdGeo, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.547 -} 15.548 -GROUP BY ?geoFeature ?comment 15.549 -ORDER BY DESC(?count) 15.550 - ]]></value> 15.551 +INSERT { ?h gag:hasMunicipality ?muni } 15.552 +WHERE { 15.553 +SELECT ?h (SAMPLE(?mLabel) AS ?muni) 15.554 + WHERE { 15.555 + ?h rdf:type noa:Hotspot ; 15.556 + noa:hasGeometry ?hGeo ; 15.557 + noa:isDerivedFromSensor "MSG1_RSS"^^xsd:string ; 15.558 + noa:producedFromProcessingChain "DynamicThresholds"^^xsd:string ; 15.559 + noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime. 15.560 + ?m rdf:type gag:Dhmos ; 15.561 + rdfs:label ?mLabel ; 15.562 + gag:hasGeometry ?mGeo . 15.563 + FILTER(strdf:intersects(?hGeo, ?mGeo)) . 15.564 + } 15.565 + GROUP BY ?h 15.566 +}]]></value> 15.567 <!-- Description --> 15.568 <value></value> 15.569 <!-- Hander (plain, download, map or map_local)--> 15.570 @@ -536,7 +294,7 @@ 15.571 15.572 <list> 15.573 <!-- Single valued elements correspond to headers --> 15.574 - <value>Discover correlations between datasets</value> 15.575 + <value>Increase accuracy with respect to underlying area</value> 15.576 </list> 15.577 <list> 15.578 <!-- Bean --> 15.579 @@ -544,33 +302,25 @@ 15.580 <!-- Format --> 15.581 <value>HTML</value> 15.582 <!-- Label --> 15.583 - <value>[CLC-DLR] List all labels that are inside an area charatecterized as continuous urban fabric by CLC</value> 15.584 + <value>[NOA+GAG] Delete all hotspots that fall in the sea</value> 15.585 <!-- Statement --> 15.586 - <value><![CDATA[PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.587 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.588 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.589 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.590 +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.591 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.592 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.593 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.594 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.595 -PREFIX geof:<http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.596 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#> 15.597 15.598 -SELECT DISTINCT ?clcLandUse ?annotation #?g 15.599 +INSERT {?h noa:isDiscarded "1"^^xsd:int ; 15.600 + noa:refinedBy noa:seaInconsistency . 15.601 +} 15.602 WHERE { 15.603 - ?p rdf:type dlr:Patch . 15.604 - ?p dlr:hasGeometry ?g . 15.605 - ?p dlr:hasLabel ?l . 15.606 - ?l rdf:type dlr:Label . 15.607 - ?l dlr:correspondsTo ?annotation . 15.608 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.609 - 15.610 - ?clc a ?clcType . 15.611 - ?clc teleios:hasCode ?clcCode . 15.612 - ?clc teleios:hasID ?clcID . 15.613 - ?clc teleios:hasLandUse teleios:continuousUrbanFabric . 15.614 - ?clc teleios:hasGeometry ?clcGeo . 15.615 - FILTER (strdf:anyInteract(?clcGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.616 - 15.617 - FILTER (geof:sf-contains(?clcGeo, ?g)) . 15.618 +?h noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 15.619 + noa:producedFromProcessingChain "DynamicThresholds"^^xsd:string ; 15.620 + noa:isDerivedFromSensor "MSG1_RSS"^^xsd:string . 15.621 + OPTIONAL { 15.622 + ?h gag:hasMunicipality ?municipality . 15.623 + } 15.624 + FILTER(!bound(?municipality)) . 15.625 } 15.626 ]]></value> 15.627 <!-- Description --> 15.628 @@ -584,36 +334,46 @@ 15.629 <!-- Format --> 15.630 <value>HTML</value> 15.631 <!-- Label --> 15.632 - <value>[CLC-DLR] List all CLC classes and the labels that are identified inside their instances.</value> 15.633 + <value>[NOA+Coastline] Delete the part of polygons that fall in the sea</value> 15.634 <!-- Statement --> 15.635 - <value><![CDATA[PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.636 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.637 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.638 -PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.639 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.640 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.641 -PREFIX geof:<http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.642 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.643 +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.644 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.645 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.646 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#> 15.647 15.648 -SELECT ?clcLandUse(GROUP_CONCAT(DISTINCT ?annotation; separator=",\n\t\t\t\t\t ") AS ?annotations) #?g 15.649 -WHERE { 15.650 - ?p rdf:type dlr:Patch . 15.651 - ?p dlr:hasGeometry ?g . 15.652 - ?p dlr:hasLabel ?l . 15.653 - ?l rdf:type dlr:Label . 15.654 - ?l dlr:correspondsTo ?annotation . 15.655 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.656 15.657 - ?clc a ?clcType . 15.658 - ?clc teleios:hasCode ?clcCode . 15.659 - ?clc teleios:hasID ?clcID . 15.660 - ?clc teleios:hasLandUse ?clcLandUse . 15.661 - ?clc teleios:hasGeometry ?clcGeo . 15.662 - FILTER (strdf:anyInteract(?clcGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.663 - 15.664 - FILTER (geof:sf-contains(?clcGeo, ?g)) . 15.665 +INSERT { ?h noa:isDiscarded "1"^^xsd:int . 15.666 + ?valid rdf:type noa:Hotspot ; 15.667 + noa:hasConfidence ?conf ; 15.668 + noa:hasGeometry ?dif ; 15.669 + gag:hasMunicipality ?municipality ; 15.670 + noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 15.671 + noa:isDerivedFromSensor "MSG1_RSS"^^xsd:string ; 15.672 + noa:hasConfirmation noa:unknown ; 15.673 + noa:producedFromProcessingChain "DynamicThresholds"^^xsd:string ; 15.674 + noa:isProducedBy noa:noa ; 15.675 + noa:isDerivedFromSatellite "METEOSAT8"^^xsd:string ; 15.676 + noa:refinedBy noa:coastlineRefinement ; 15.677 + noa:refinedBy ?refined . 15.678 } 15.679 -GROUP BY ?clcLandUse 15.680 - ]]></value> 15.681 +WHERE { 15.682 + SELECT ?h (strdf:intersection(?hGeo, strdf:union(?cGeo)) AS ?dif) (URI(CONCAT(STR(?h),"/refined")) AS ?valid) ?conf ?municipality 15.683 + WHERE { 15.684 + ?h noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime; 15.685 + noa:producedFromProcessingChain "DynamicThresholds"^^xsd:string ; 15.686 + noa:isDerivedFromSensor "MSG1_RSS"^^xsd:string ; 15.687 + noa:hasGeometry ?hGeo ; 15.688 + gag:hasMunicipality ?municipality ; 15.689 + noa:hasConfidence ?conf . 15.690 + ?c rdf:type gag:GeometryPart ; 15.691 + gag:hasGeometry ?cGeo . 15.692 + FILTER(strdf:mbbIntersects(?hGeo, ?cGeo)) . 15.693 + OPTIONAL { ?h noa:refinedBy ?refined } . 15.694 + } 15.695 + GROUP BY ?h ?hGeo ?conf ?municipality 15.696 + HAVING strdf:overlap(?hGeo, strdf:union(?cGeo)) 15.697 +} ]]></value> 15.698 <!-- Description --> 15.699 <value></value> 15.700 <!-- Hander (plain, download, map or map_local)--> 15.701 @@ -625,135 +385,31 @@ 15.702 <!-- Format --> 15.703 <value>HTML</value> 15.704 <!-- Label --> 15.705 - <value>[DLR-LGD] List all labels and the LGD classes with instances inside patches annotated with each label (coarse-grained).</value> 15.706 + <value>[NOA+CLC] Delete all hotspots that intersect with inconsistent areas</value> 15.707 <!-- Statement --> 15.708 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.709 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.710 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.711 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.712 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.713 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.714 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.715 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.716 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.717 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.718 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.719 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.720 +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.721 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.722 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.723 +PREFIX clc: <http://geo.linkedopendata.gr/corine/ontology#> 15.724 15.725 -SELECT ?annotation (GROUP_CONCAT(DISTINCT ?lgdType; separator=",\n\t\t\t\t\t ") AS ?lgdTypes) #?g 15.726 +INSERT {?h noa:isDiscarded "1"^^xsd:int ; 15.727 + noa:refinedBy noa:clcInconsistency . 15.728 +} 15.729 WHERE { 15.730 - ?p rdf:type dlr:Patch . 15.731 - ?p dlr:hasGeometry ?g . 15.732 - ?p dlr:hasLabel ?l . 15.733 - ?l rdf:type dlr:Label . 15.734 - ?l dlr:correspondsTo ?annotation . 15.735 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.736 - 15.737 - ?lgd lgdont:directType ?lgdDirectType . 15.738 - OPTIONAL { 15.739 - ?lgd a ?lgdType . 15.740 - FILTER ((?lgdType != lgdont:Node) && (?lgdType != ?lgdDirectType)) . 15.741 - } 15.742 - ?lgd lgdgeo:geometry ?lgdGeo . 15.743 - FILTER (strdf:anyInteract(?lgdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.744 - 15.745 - FILTER (geof:sf-contains(?g, ?lgdGeo)) . 15.746 -} 15.747 -GROUP BY ?annotation 15.748 -ORDER BY ?annotation]]></value> 15.749 - <!-- Description --> 15.750 - <value></value> 15.751 - <!-- Hander (plain, download, map or map_local)--> 15.752 - <value>plain</value> 15.753 - </list> 15.754 - <list> 15.755 - <!-- Bean --> 15.756 - <value>Query</value> 15.757 - <!-- Format --> 15.758 - <value>HTML</value> 15.759 - <!-- Label --> 15.760 - <value>[DLR-LGD] List all labels and the LGD classes with instances inside patches annotated with each label (fine-grained).</value> 15.761 - <!-- Statement --> 15.762 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.763 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.764 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.765 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.766 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.767 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.768 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.769 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.770 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.771 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.772 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.773 - 15.774 -SELECT ?annotation (GROUP_CONCAT(DISTINCT ?lgdDirectType; separator=",\n\t\t\t\t\t ") AS ?lgdDirectTypes) #?g 15.775 -WHERE { 15.776 - ?p rdf:type dlr:Patch . 15.777 - ?p dlr:hasGeometry ?g . 15.778 - ?p dlr:hasLabel ?l . 15.779 - ?l rdf:type dlr:Label . 15.780 - ?l dlr:correspondsTo ?annotation . 15.781 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.782 - 15.783 - ?lgd lgdont:directType ?lgdDirectType . 15.784 - OPTIONAL { 15.785 - ?lgd a ?lgdType . 15.786 - FILTER ((?lgdType != lgdont:Node) && (?lgdType != ?lgdDirectType)) . 15.787 - } 15.788 - ?lgd lgdgeo:geometry ?lgdGeo . 15.789 - #Venice 15.790 - FILTER (strdf:anyInteract(?lgdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.791 - 15.792 - FILTER (geof:sf-contains(?g, ?lgdGeo)) . 15.793 -} 15.794 -GROUP BY ?annotation 15.795 -ORDER BY ?annotation]]></value> 15.796 - <!-- Description --> 15.797 - <value></value> 15.798 - <!-- Hander (plain, download, map or map_local)--> 15.799 - <value>plain</value> 15.800 - </list> 15.801 - <list> 15.802 - <!-- Bean --> 15.803 - <value>Query</value> 15.804 - <!-- Format --> 15.805 - <value>HTML</value> 15.806 - <!-- Label --> 15.807 - <value>[DLR-Geonames] List all labels and the GeoNames classes with instances inside patches annotated with each label.</value> 15.808 - <!-- Statement --> 15.809 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.810 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.811 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.812 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.813 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.814 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.815 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.816 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.817 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.818 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.819 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.820 - 15.821 -SELECT ?annotation (GROUP_CONCAT(DISTINCT ?geoFeature; separator=",\n\t\t\t\t\t ") AS ?geoFeatures) (GROUP_CONCAT(DISTINCT ?comment; separator=",\n\t\t\t\t\t ") AS ?comments) 15.822 -WHERE { 15.823 - ?p rdf:type dlr:Patch . 15.824 - ?p dlr:hasGeometry ?g . 15.825 - ?p dlr:hasLabel ?l . 15.826 - ?l rdf:type dlr:Label . 15.827 - ?l dlr:correspondsTo ?annotation . 15.828 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.829 - 15.830 - ?geoId geonames:name ?name . 15.831 - OPTIONAL {?geoId geonames:alternateName ?altName } . 15.832 - ?geoId geonames:featureClass ?geoFeature . 15.833 - ?geoFeature rdfs:comment ?comment . 15.834 - ?geoId geonames:countryCode ?country . 15.835 - ?geoId teleios:hasGeography ?geoIdGeo . 15.836 - #Venice 15.837 - FILTER (strdf:anyInteract(?geoIdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.838 - 15.839 - FILTER (geof:sf-contains(?g, ?geoIdGeo)) . 15.840 -} 15.841 -GROUP BY ?annotation 15.842 -ORDER BY ?annotation]]></value> 15.843 + SELECT ?h WHERE 15.844 + { 15.845 + ?h noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 15.846 + noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; 15.847 + noa:isDerivedFromSensor "SENSOR"^^xsd:string ; 15.848 + noa:hasGeometry ?hGeo. 15.849 + ?a rdf:type clc:ExcludeArea; 15.850 + clc:hasGeometry ?aGeo. 15.851 + FILTER(strdf:mbbIntersects(?hGeo,?aGeo)). 15.852 + } 15.853 + GROUP BY ?h ?hGeo 15.854 + HAVING strdf:contains(strdf:union(?aGeo),?hGeo) 15.855 +}]]></value> 15.856 <!-- Description --> 15.857 <value></value> 15.858 <!-- Hander (plain, download, map or map_local)--> 15.859 @@ -761,7 +417,7 @@ 15.860 </list> 15.861 <list> 15.862 <!-- Single valued elements correspond to headers --> 15.863 - <value>Second level statistics</value> 15.864 + <value>Increase accuracy with respect to time persistence</value> 15.865 </list> 15.866 <list> 15.867 <!-- Bean --> 15.868 @@ -769,193 +425,55 @@ 15.869 <!-- Format --> 15.870 <value>HTML</value> 15.871 <!-- Label --> 15.872 - <value>[CLC-DLR] How many patches with a specific label are contained by a CLC area?</value> 15.873 + <value>[NOA] Add virtual hotspots accoring to time persistence of actually detected hotspots</value> 15.874 <!-- Statement --> 15.875 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.876 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.877 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.878 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.879 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.880 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.881 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.882 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.883 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.884 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.885 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.886 + <value><![CDATA[PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.887 +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.888 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.889 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.890 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#> 15.891 15.892 -SELECT ?clcLandUse ?annotation (COUNT(?p) AS ?numberOfPatches) 15.893 +INSERT {?newHotspot rdf:type noa:Hotspot ; 15.894 + noa:hasConfidence ?hConfidence ; 15.895 + noa:hasGeometry ?hGeometry1 ; 15.896 + noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 15.897 + noa:isDerivedFromSensor "MSG1_RSS"^^xsd:string ; 15.898 + noa:hasConfirmation noa:unknown ; 15.899 + noa:producedFromProcessingChain "DynamicThresholds-TimePersistence"^^xsd:string ; 15.900 + noa:isProducedBy noa:noa ; 15.901 + gag:hasMunicipality ?hMunicipality1 ; 15.902 + noa:isDerivedFromSatellite "METEOSAT8"^^xsd:string ; 15.903 + noa:refinedBy noa:temporalPersistence ; 15.904 + noa:refinedBy ?refined . 15.905 +} 15.906 WHERE { 15.907 - #select corine areas 15.908 - ?clc a teleios:Area . 15.909 - ?clc teleios:hasLandUse ?clcLandUse . 15.910 - ?clc teleios:hasGeometry ?clcGeo . 15.911 - #Venice 15.912 - FILTER (strdf:anyInteract(?clcGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.913 - #Toulouse 15.914 - #FILTER (strdf:anyInteract(?clcGeo, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.915 - #Timisoara 15.916 - #FILTER (strdf:anyInteract(?clcGeo, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.917 - 15.918 - #select patches 15.919 - ?p rdf:type dlr:Patch . 15.920 - ?p dlr:hasGeometry ?g . 15.921 - ?p dlr:hasLabel ?l . 15.922 - ?l dlr:correspondsTo ?annotation . 15.923 - #Venice 15.924 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.925 - #Toulouse 15.926 - #FILTER (strdf:anyInteract(?g, "POLYGON((1.3816636 43.573734,1.4903361 43.588024,1.4783715 43.634777,1.3696271 43.620483,1.3816636 43.573734))"^^strdf:WKT)) . 15.927 - #Timisoara 15.928 - #FILTER (strdf:anyInteract(?g, "POLYGON((21.188068 45.7305,21.286903 45.74229,21.275377 45.79014,21.176264 45.778324,21.188068 45.7305))"^^strdf:WKT)) . 15.929 - 15.930 - #FILTER (geof:sf-contains(?clcGeo, ?g)) . 15.931 - FILTER (strdf:contains(?clcGeo, ?g)) . 15.932 -} 15.933 -GROUP BY ?clcLandUse ?annotation 15.934 -ORDER BY ?clcLandUse DESC(?numberOfPatches)]]></value> 15.935 - <!-- Description --> 15.936 - <value></value> 15.937 - <!-- Hander (plain, download, map or map_local)--> 15.938 - <value>plain</value> 15.939 - </list> 15.940 - <list> 15.941 - <!-- Bean --> 15.942 - <value>Query</value> 15.943 - <!-- Format --> 15.944 - <value>HTML</value> 15.945 - <!-- Label --> 15.946 - <value>[DLR-LGD] How many LGD instances are contained by a patch annotated with a specific label? (coarse-grained)</value> 15.947 - <!-- Statement --> 15.948 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.949 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.950 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.951 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.952 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.953 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.954 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.955 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.956 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.957 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.958 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.959 - 15.960 -SELECT ?annotation ?lgdType (COUNT(?lgd) AS ?lgdInstances) 15.961 -WHERE { 15.962 - #select patches 15.963 - ?p rdf:type dlr:Patch . 15.964 - ?p dlr:hasGeometry ?g . 15.965 - ?p dlr:hasLabel ?l . 15.966 - ?l dlr:correspondsTo ?annotation . 15.967 - #Venice 15.968 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.969 - 15.970 - #select LGD instances 15.971 - ?lgd lgdont:directType ?lgdDirectType . 15.972 - ?lgd a ?lgdType . 15.973 - FILTER ((?lgdType != lgdont:Node) && (?lgdType != ?lgdDirectType)) . 15.974 - ?lgd lgdgeo:geometry ?lgdGeo . 15.975 - #Venice 15.976 - FILTER (strdf:anyInteract(?lgdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.977 - 15.978 - FILTER (geof:sf-contains(?g, ?lgdGeo)) . 15.979 -} 15.980 -GROUP BY ?annotation ?lgdType 15.981 -ORDER BY ?annotation DESC(?lgdInstances)]]></value> 15.982 - <!-- Description --> 15.983 - <value></value> 15.984 - <!-- Hander (plain, download, map or map_local)--> 15.985 - <value>plain</value> 15.986 - </list> 15.987 - <list> 15.988 - <!-- Bean --> 15.989 - <value>Query</value> 15.990 - <!-- Format --> 15.991 - <value>HTML</value> 15.992 - <!-- Label --> 15.993 - <value>[DLR-LGD] How many LGD instances are contained by a patch annotated with a specific label? (fine-grained)</value> 15.994 - <!-- Statement --> 15.995 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.996 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.997 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.998 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.999 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.1000 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.1001 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.1002 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.1003 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.1004 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.1005 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.1006 - 15.1007 -SELECT ?annotation ?lgdDirectType (COUNT(?lgd) AS ?lgdInstances) 15.1008 -WHERE { 15.1009 - #select patches 15.1010 - ?p rdf:type dlr:Patch . 15.1011 - ?p dlr:hasGeometry ?g . 15.1012 - ?p dlr:hasLabel ?l . 15.1013 - ?l dlr:correspondsTo ?annotation . 15.1014 - #Venice 15.1015 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.1016 - 15.1017 - #select LGD instances 15.1018 - ?lgd lgdont:directType ?lgdDirectType . 15.1019 - ?lgd a ?lgdType . 15.1020 - FILTER ((?lgdType != lgdont:Node) && (?lgdType != ?lgdDirectType)) . 15.1021 - ?lgd lgdgeo:geometry ?lgdGeo . 15.1022 - #Venice 15.1023 - FILTER (strdf:anyInteract(?lgdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.1024 - 15.1025 - FILTER (geof:sf-contains(?g, ?lgdGeo)) . 15.1026 -} 15.1027 -GROUP BY ?annotation ?lgdDirectType 15.1028 -ORDER BY ?annotation DESC(?lgdInstances)]]></value> 15.1029 - <!-- Description --> 15.1030 - <value></value> 15.1031 - <!-- Hander (plain, download, map or map_local)--> 15.1032 - <value>plain</value> 15.1033 - </list> 15.1034 - <list> 15.1035 - <!-- Bean --> 15.1036 - <value>Query</value> 15.1037 - <!-- Format --> 15.1038 - <value>HTML</value> 15.1039 - <!-- Label --> 15.1040 - <value>[DLR-Geonames] How many Geonames instances are contained by a patch annotated with a specific label?</value> 15.1041 - <!-- Statement --> 15.1042 - <value><![CDATA[PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 15.1043 -PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 15.1044 -PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 15.1045 -PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 15.1046 -PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> 15.1047 -PREFIX lgd: <http://linkedgeodata.org/triplify/> 15.1048 -PREFIX lgdont: <http://linkedgeodata.org/ontology/> 15.1049 -PREFIX lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> 15.1050 -PREFIX geonames: <http://www.geonames.org/ontology#> 15.1051 -PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 15.1052 -PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> 15.1053 - 15.1054 -SELECT ?annotation ?geoFeature ?comment (COUNT(?geoId) AS ?geoIdInstances) 15.1055 -WHERE { 15.1056 - #select patches 15.1057 - ?p rdf:type dlr:Patch . 15.1058 - ?p dlr:hasGeometry ?g . 15.1059 - ?p dlr:hasLabel ?l . 15.1060 - ?l dlr:correspondsTo ?annotation . 15.1061 - #Venice 15.1062 - FILTER (strdf:anyInteract(?g, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.1063 - 15.1064 - #select Geonames instances 15.1065 - ?geoId geonames:name ?name . 15.1066 - OPTIONAL {?geoId geonames:alternateName ?altName } . 15.1067 - ?geoId geonames:featureClass ?geoFeature . 15.1068 - ?geoFeature rdfs:comment ?comment . 15.1069 - ?geoId geonames:countryCode ?country . 15.1070 - ?geoId teleios:hasGeography ?geoIdGeo . 15.1071 - #Venice 15.1072 - FILTER (strdf:anyInteract(?geoIdGeo, "POLYGON ((12.301451 45.40493,12.398127 45.416817,12.386066 45.46502,12.289288 45.45313,12.301451 45.40493))"^^strdf:WKT)) . 15.1073 - 15.1074 - FILTER (geof:sf-contains(?g, ?geoIdGeo)) . 15.1075 -} 15.1076 -GROUP BY ?annotation ?geoFeature ?comment 15.1077 -ORDER BY ?annotation DESC(?geoIdInstances)]]></value> 15.1078 + SELECT (URI(CONCAT(STR(MAX(?h1)),"/virtual/NEW_HOTSPOT")) AS ?newHotspot) 15.1079 + (SUM(?hConfidence1)/ACQUISITIONS_IN_HALF_AN_HOUR AS ?hConfidence) 15.1080 + ?hGeometry1 ?hMunicipality1 15.1081 + WHERE { 15.1082 + ?h1 noa:hasConfidence ?hConfidence1 ; 15.1083 + noa:hasGeometry ?hGeometry1 ; 15.1084 + gag:hasMunicipality ?hMunicipality1 ; 15.1085 + noa:hasAcquisitionTime ?hAcquisitionTime1 ; 15.1086 + noa:isDerivedFromSensor "MSG1_RSS"^^xsd:string ; 15.1087 + noa:producedFromProcessingChain "DynamicThresholds"^^xsd:string . 15.1088 + OPTIONAL { ?h1 noa:isDiscarded ?z } . 15.1089 + FILTER (!BOUND(?z)) . 15.1090 + OPTIONAL { ?h1 noa:refinedBy ?refined } . 15.1091 + FILTER( "MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?hAcquisitionTime1 && ?hAcquisitionTime1 < "TIMESTAMP"^^xsd:dateTime ) . 15.1092 + OPTIONAL { 15.1093 + ?h2 noa:hasGeometry ?hGeometry2 ; 15.1094 + noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 15.1095 + noa:isDerivedFromSensor "MSG1_RSS"^^xsd:string ; 15.1096 + noa:producedFromProcessingChain ?hProcessingChain2 . 15.1097 + FILTER(("DynamicThresholds"^^xsd:string = ?hProcessingChain2)||("DynamicThresholds-TimePersistence"^^xsd:string = ?hProcessingChain2)). 15.1098 + FILTER( strdf:mbbEquals(?hGeometry1, ?hGeometry2) ) . 15.1099 + } 15.1100 + FILTER( !BOUND(?h2) ) . 15.1101 + } 15.1102 + GROUP BY ?hGeometry1 ?hMunicipality1 15.1103 + HAVING(SUM(?hConfidence1)>0.0) 15.1104 +}]]></value> 15.1105 <!-- Description --> 15.1106 <value></value> 15.1107 <!-- Hander (plain, download, map or map_local)-->
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/endpoint/WebContent/WEB-INF/credentials.properties Fri Feb 08 16:42:42 2013 +0200 16.3 @@ -0,0 +1,2 @@ 16.4 +username=endpoint 16.5 +password=3ndpo1nt 16.6 \ No newline at end of file
17.1 --- a/endpoint/WebContent/WEB-INF/web.xml Thu Feb 07 17:59:46 2013 +0200 17.2 +++ b/endpoint/WebContent/WEB-INF/web.xml Fri Feb 08 16:42:42 2013 +0200 17.3 @@ -4,6 +4,22 @@ 17.4 xmlns:base="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 17.5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 17.6 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 17.7 + 17.8 + <!-- Uncomment the following lines to enable ip filtering--> 17.9 + <!-- 17.10 + <filter> 17.11 + <filter-name>Remote Address Filter</filter-name> 17.12 + <filter-class>org.apache.catalina.filters.RemoteAddrFilter</filter-class> 17.13 + <init-param> 17.14 + <param-name>allow</param-name> 17.15 + <param-value>(195\.134\.(67|71)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(88\.197\.4[4-7]\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(195\.134\.105\.([01]?[0-9][0-9]?))</param-value> 17.16 + </init-param> 17.17 + </filter> 17.18 + <filter-mapping> 17.19 + <filter-name>Remote Address Filter</filter-name> 17.20 + <url-pattern>/*</url-pattern> 17.21 + </filter-mapping> 17.22 + --> 17.23 17.24 <display-name>StrabonEndpoint</display-name> 17.25 <context-param> 17.26 @@ -92,6 +108,17 @@ 17.27 </servlet-mapping> 17.28 17.29 <servlet> 17.30 + <display-name>Capabilities</display-name> 17.31 + <servlet-name>Capabilities</servlet-name> 17.32 + <servlet-class>eu.earthobservatory.org.StrabonEndpoint.capabilities.CapabilitiesBean</servlet-class> 17.33 + <load-on-startup>1</load-on-startup> 17.34 + </servlet> 17.35 + <servlet-mapping> 17.36 + <servlet-name>Capabilities</servlet-name> 17.37 + <url-pattern>/Capabilities</url-pattern> 17.38 + </servlet-mapping> 17.39 + 17.40 + <servlet> 17.41 <servlet-name>query.jsp</servlet-name> 17.42 <jsp-file>/query.jsp</jsp-file> 17.43 </servlet>
18.1 --- a/endpoint/WebContent/browse.jsp Thu Feb 07 17:59:46 2013 +0200 18.2 +++ b/endpoint/WebContent/browse.jsp Fri Feb 08 16:42:42 2013 +0200 18.3 @@ -1,4 +1,4 @@ 18.4 -<%@page import="java.net.URLEncoder"%> 18.5 +<%@page import="java.net.URLDecoder"%> 18.6 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> 18.7 <%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%> 18.8 <%@page import="org.springframework.web.context.WebApplicationContext"%> 18.9 @@ -69,8 +69,8 @@ 18.10 </TD> 18.11 </TR> 18.12 </TABLE> 18.13 - <h1>About: </h1> 18.14 - <a href=""><%=request.getAttribute("resource")%></a> 18.15 + <h1>About: </h1> 18.16 + <a href="#"><%=URLDecoder.decode(request.getAttribute("resource").toString(), "UTF-8")%></a> 18.17 <div id="response"> 18.18 <!-- Response --> 18.19 <% if (request.getAttribute("response") != null) {
19.1 --- a/endpoint/WebContent/query.jsp Thu Feb 07 17:59:46 2013 +0200 19.2 +++ b/endpoint/WebContent/query.jsp Fri Feb 08 16:42:42 2013 +0200 19.3 @@ -117,21 +117,23 @@ 19.4 <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> 19.5 <script type="text/javascript"> 19.6 function initialize() { 19.7 - // center at Brahames 19.8 - var brahames = new google.maps.LatLng(37.92253, 23.72275); 19.9 var myOptions = { 19.10 zoom: 11, 19.11 - center: brahames, 19.12 mapTypeId: google.maps.MapTypeId.ROADMAP 19.13 }; 19.14 19.15 // get KML filename 19.16 var kml = '<%=request.getAttribute("pathToKML")%>'; 19.17 + 19.18 // create map 19.19 var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 19.20 - 19.21 + <% if (request.getAttribute("pathToKML") == null) {%> 19.22 + // center at Brahames 19.23 + map.setCenter(new google.maps.LatLng(37.92253, 23.72275)); 19.24 + <%}%> 19.25 + 19.26 + <%if ("map_local".equals(request.getAttribute("handle"))) {%> 19.27 // display using geoxml3 19.28 - <%if ("map_local".equals(request.getAttribute("handle"))) {%> 19.29 var myParser = new geoXML3.parser({map: map}); 19.30 myParser.parse(kml); 19.31 19.32 @@ -279,7 +281,11 @@ 19.33 <%}%> 19.34 <tr> 19.35 <td id="output">stSPARQL Query:</td> 19.36 -<td id="output"><textarea name="query" title="pose your query/update here" rows="15" cols="100"><%=query%></textarea></td> 19.37 +<td id="output"> 19.38 + <div style="font-size:13px"> 19.39 + You must be logged in to perform update queries. 19.40 + </div> 19.41 + <textarea name="query" title="pose your query/update here" rows="15" cols="100"><%=query%></textarea></td> 19.42 </tr> 19.43 <tr> 19.44 <td id="output"><center>Output Format:<br/>
20.1 --- a/endpoint/WebContent/store.jsp Thu Feb 07 17:59:46 2013 +0200 20.2 +++ b/endpoint/WebContent/store.jsp Fri Feb 08 16:42:42 2013 +0200 20.3 @@ -60,7 +60,11 @@ 20.4 <tr> 20.5 <!-- direct input form --> 20.6 <td id="output">Direct Input:</td> 20.7 - <td id="output"><textarea name="data" rows="15" cols="100"></textarea></td> 20.8 + <td id="output"> 20.9 + <div style="font-size:13px"> 20.10 + You must be logged in to store. 20.11 + </div> 20.12 + <textarea name="data" rows="15" cols="100"></textarea></td> 20.13 <td rowspan=4 id="output"> 20.14 <CENTER>RDF Format:<br/> 20.15 <SELECT name="format" title="select one of the following RDF graph format types">
21.1 --- a/endpoint/pom.xml Thu Feb 07 17:59:46 2013 +0200 21.2 +++ b/endpoint/pom.xml Fri Feb 08 16:42:42 2013 +0200 21.3 @@ -4,13 +4,13 @@ 21.4 <parent> 21.5 <groupId>eu.earthobservatory</groupId> 21.6 <artifactId>strabon</artifactId> 21.7 - <version>3.2.5-SNAPSHOT</version> 21.8 + <version>3.2.8-SNAPSHOT</version> 21.9 </parent> 21.10 21.11 <artifactId>strabon-endpoint</artifactId> 21.12 <packaging>war</packaging> 21.13 21.14 - <name>StrabonEndpoint</name> 21.15 + <name>Strabon: Endpoint</name> 21.16 <description>An endpoint for Strabon</description> 21.17 21.18 <properties> 21.19 @@ -168,6 +168,7 @@ 21.20 <includes> 21.21 <include>beans.xml</include> 21.22 <include>connection.properties</include> 21.23 + <include>credentials.properties</include> 21.24 </includes> 21.25 </resource> 21.26 21.27 @@ -249,23 +250,6 @@ 21.28 <autoVersionSubmodules>true</autoVersionSubmodules> 21.29 </configuration> 21.30 </plugin> 21.31 - <plugin> 21.32 - <groupId>org.apache.tomcat.maven</groupId> 21.33 - <artifactId>tomcat7-maven-plugin</artifactId> 21.34 - <executions> 21.35 - <execution> 21.36 - <id>tomcat-run</id> 21.37 - <goals> 21.38 - <goal>exec-war-only</goal> 21.39 - </goals> 21.40 - <!-- <phase>package</phase> --> 21.41 - <phase>integration-test</phase> 21.42 - <configuration> 21.43 - <enableNaming>true</enableNaming> 21.44 - </configuration> 21.45 - </execution> 21.46 - </executions> 21.47 - </plugin> 21.48 </plugins> 21.49 21.50 <pluginManagement>
22.1 --- a/endpoint/src/log4j.properties Thu Feb 07 17:59:46 2013 +0200 22.2 +++ b/endpoint/src/log4j.properties Fri Feb 08 16:42:42 2013 +0200 22.3 @@ -1,6 +1,6 @@ 22.4 # logger level values: OFF, ERROR, WARN, INFO, DEBUG, ALL 22.5 -log4j.rootLogger=INFO, CA 22.6 -#log4j.rootLogger=INFO, CA, FA 22.7 +#log4j.rootLogger=INFO, CA 22.8 +log4j.rootLogger=DEBUG, CA, FA 22.9 22.10 # Console Appender 22.11 log4j.appender.CA=org.apache.log4j.ConsoleAppender
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Authenticate.java Fri Feb 08 16:42:42 2013 +0200 23.3 @@ -0,0 +1,67 @@ 23.4 +/** 23.5 + * This Source Code Form is subject to the terms of the Mozilla Public 23.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 23.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 23.8 + * 23.9 + * Copyright (C) 2010, 2011, 2012, Pyravlos Team 23.10 + * 23.11 + * http://www.strabon.di.uoa.gr/ 23.12 + */ 23.13 +package eu.earthobservatory.org.StrabonEndpoint; 23.14 + 23.15 +import java.io.FileInputStream; 23.16 +import java.io.IOException; 23.17 +import java.io.InputStream; 23.18 +import java.util.Properties; 23.19 +import java.util.regex.Pattern; 23.20 + 23.21 +import javax.servlet.ServletContext; 23.22 + 23.23 +import org.apache.commons.codec.binary.Base64; 23.24 + 23.25 +/** 23.26 + * Keeps common variables shared by beans and .jsp pages. 23.27 + * 23.28 + * @author Stella Giannakopoulou <sgian@di.uoa.gr> 23.29 + */ 23.30 +public class Authenticate { 23.31 + 23.32 + /** 23.33 + * The filename of the credentials.properties file 23.34 + */ 23.35 + private static final String CREDENTIALS_PROPERTIES_FILE = "/WEB-INF/credentials.properties"; 23.36 + 23.37 + /** 23.38 + * Authenticate user 23.39 + * @throws IOException 23.40 + * */ 23.41 + public boolean authenticateUser(String authorization, ServletContext context) throws IOException { 23.42 + Properties properties = new Properties(); 23.43 + if (authorization == null) return false; // no authorization 23.44 + 23.45 + if (!authorization.toUpperCase().startsWith("BASIC ")) 23.46 + return false; // only BASIC authentication 23.47 + 23.48 + // get encoded user and password, comes after "BASIC " 23.49 + String userpassEncoded = authorization.substring(6); 23.50 + // decode 23.51 + String userpassDecoded = new String(Base64.decodeBase64(userpassEncoded)); 23.52 + 23.53 + Pattern pattern = Pattern.compile(":"); 23.54 + String[] credentials = pattern.split(userpassDecoded); 23.55 + // get credentials.properties as input stream 23.56 + InputStream input = new FileInputStream(context.getRealPath(CREDENTIALS_PROPERTIES_FILE)); 23.57 + 23.58 + // load the properties 23.59 + properties.load(input); 23.60 + 23.61 + // close the stream 23.62 + input.close(); 23.63 + 23.64 + // check if the given credentials are allowed 23.65 + if(!userpassDecoded.equals(":") && credentials[0].equals(properties.get("username")) && credentials[1].equals(properties.get("password"))) 23.66 + return true; 23.67 + else 23.68 + return false; 23.69 + } 23.70 +}
24.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StoreBean.java Thu Feb 07 17:59:46 2013 +0200 24.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StoreBean.java Fri Feb 08 16:42:42 2013 +0200 24.3 @@ -29,6 +29,7 @@ 24.4 import org.springframework.web.context.WebApplicationContext; 24.5 import org.springframework.web.context.support.WebApplicationContextUtils; 24.6 24.7 + 24.8 /** 24.9 * 24.10 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 24.11 @@ -52,25 +53,31 @@ 24.12 private static final String STORE_ERROR = "An error occurred while storing input data!"; 24.13 private static final String PARAM_ERROR = "RDF format or input data are not set or are invalid!"; 24.14 private static final String STORE_OK = "Data stored successfully!"; 24.15 - 24.16 + 24.17 /** 24.18 * Strabon wrapper 24.19 */ 24.20 private StrabonBeanWrapper strabon; 24.21 24.22 + /** 24.23 + * The context of the servlet 24.24 + */ 24.25 + private ServletContext context; 24.26 + 24.27 @Override 24.28 public void init(ServletConfig servletConfig) throws ServletException { 24.29 super.init(servletConfig); 24.30 24.31 // get strabon wrapper 24.32 - ServletContext context = getServletContext(); 24.33 + context = getServletContext(); 24.34 WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context); 24.35 - strabon = (StrabonBeanWrapper) applicationContext.getBean("strabonBean"); 24.36 + strabon = (StrabonBeanWrapper) applicationContext.getBean("strabonBean"); 24.37 } 24.38 24.39 @Override 24.40 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 24.41 - doPost(request, response); 24.42 + 24.43 + doPost(request, response); 24.44 } 24.45 24.46 private String getData(HttpServletRequest request) throws UnsupportedEncodingException { 24.47 @@ -83,14 +90,31 @@ 24.48 24.49 @Override 24.50 public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 24.51 + 24.52 + boolean authorized; 24.53 24.54 - // check whether the request was from store.jsp 24.55 - if (Common.VIEW_TYPE.equals(request.getParameter(Common.VIEW))) { 24.56 - processVIEWRequest(request, response); 24.57 - 24.58 - } else { 24.59 - processRequest(request, response); 24.60 + if(!request.getLocalAddr().equals("127.0.0.1")) { 24.61 + Authenticate authenticate = new Authenticate(); 24.62 + String authorization = request.getHeader("Authorization"); 24.63 + 24.64 + authorized = authenticate.authenticateUser(authorization, context); 24.65 } 24.66 + else 24.67 + authorized = true; 24.68 + 24.69 + if (!authorized) { 24.70 + // not allowed, so report he's unauthorized 24.71 + response.setHeader("WWW-Authenticate", "BASIC realm=\"Please login\""); 24.72 + response.sendError(HttpServletResponse.SC_UNAUTHORIZED); 24.73 + } 24.74 + else { 24.75 + // check whether the request was from store.jsp 24.76 + if (Common.VIEW_TYPE.equals(request.getParameter(Common.VIEW))) { 24.77 + processVIEWRequest(request, response); 24.78 + } else { 24.79 + processRequest(request, response); 24.80 + } 24.81 + } 24.82 } 24.83 24.84 /** 24.85 @@ -101,8 +125,9 @@ 24.86 * @throws ServletException 24.87 * @throws IOException 24.88 */ 24.89 - private void processVIEWRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 24.90 - // check whether we read from INPUT or URL 24.91 + private void processVIEWRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 24.92 + 24.93 + // check whether we read from INPUT or URL 24.94 boolean input = (request.getParameter(Common.SUBMIT_URL) != null) ? false:true; 24.95 24.96 // get the dispatcher for forwarding the rendering of the response 24.97 @@ -132,6 +157,7 @@ 24.98 } 24.99 24.100 dispatcher.forward(request, response); 24.101 + 24.102 } 24.103 24.104 /**
25.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java Thu Feb 07 17:59:46 2013 +0200 25.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java Fri Feb 08 16:42:42 2013 +0200 25.3 @@ -9,6 +9,8 @@ 25.4 */ 25.5 package eu.earthobservatory.org.StrabonEndpoint; 25.6 25.7 +import eu.earthobservatory.utils.Format; 25.8 + 25.9 import java.io.IOException; 25.10 import java.io.OutputStream; 25.11 import java.io.StringReader; 25.12 @@ -23,7 +25,6 @@ 25.13 import org.openrdf.query.MalformedQueryException; 25.14 import org.openrdf.query.QueryEvaluationException; 25.15 import org.openrdf.query.TupleQueryResultHandlerException; 25.16 -import org.openrdf.query.resultio.Format; 25.17 import org.openrdf.repository.RepositoryException; 25.18 import org.openrdf.repository.sail.SailRepositoryConnection; 25.19 import org.openrdf.rio.RDFFormat; 25.20 @@ -64,7 +65,7 @@ 25.21 this.password = password; 25.22 this.checkForLockTable = checkForLockTable; 25.23 this.dbBackend = dbBackend; 25.24 - this.maxLimit = maxLimit; 25.25 + this.maxLimit = maxLimit; 25.26 this.prefixes = prefixes; 25.27 this.entries = new ArrayList<StrabonBeanWrapperConfiguration>(args.size()); 25.28 25.29 @@ -131,7 +132,7 @@ 25.30 try { 25.31 logger.warn("[StrabonEndpoint] Strabon not initialized yet."); 25.32 logger.warn("[StrabonEndpoint] Initializing Strabon."); 25.33 - logger.info("[StrabonEndpoint] Connection details:\n" + this.getDetails()); 25.34 + //logger.info("[StrabonEndpoint] Connection details:\n" + this.getDetails()); 25.35 25.36 // initialize Strabon according to user preference 25.37 if (Common.DBBACKEND_MONETDB.equalsIgnoreCase(dbBackend)) { 25.38 @@ -149,7 +150,7 @@ 25.39 25.40 25.41 } catch (Exception e) { 25.42 - logger.error("[StrabonEndpoint] Exception occured while creating Strabon.\n" + this.getDetails(), e); 25.43 + logger.error("[StrabonEndpoint] Exception occured while creating Strabon. {}\n{}", e.getMessage(), this.getDetails()); 25.44 return false; 25.45 } 25.46 } 25.47 @@ -349,6 +350,7 @@ 25.48 * */ 25.49 public String addLimit(String queryString, String maxLimit){ 25.50 String limitedQuery = queryString; 25.51 + String lowerLimit = null; 25.52 int max; 25.53 25.54 if(maxLimit == null) 25.55 @@ -358,23 +360,26 @@ 25.56 25.57 if(max > 0) 25.58 { 25.59 - Pattern limitPattern = Pattern.compile(".*limit \\d+", Pattern.DOTALL); 25.60 + queryString = queryString.trim(); 25.61 + Pattern limitPattern = Pattern.compile("limit(\\s*)(\\d+)(\\s*)(offset(\\s*)\\d+)?$", Pattern.DOTALL | Pattern.CASE_INSENSITIVE); 25.62 Matcher limitMatcher = limitPattern.matcher(queryString); 25.63 25.64 // check whether the query contains a limit clause 25.65 - if(limitMatcher.matches()) 25.66 - { 25.67 - Pattern rowsNumberPattern = Pattern.compile("\\d+$"); 25.68 - Matcher rowsNumberMatcher = rowsNumberPattern.matcher(queryString); 25.69 - rowsNumberMatcher.find(); 25.70 + if(limitMatcher.find()) 25.71 + { 25.72 + Pattern rowsNumberPattern = Pattern.compile("\\d+"); 25.73 + Matcher rowsNumberMatcher = rowsNumberPattern.matcher(limitMatcher.group()); 25.74 + rowsNumberMatcher.find(); 25.75 25.76 // if the initial limit is greater than the maximum, set it to the maximum 25.77 if(Integer.valueOf(rowsNumberMatcher.group()) > max) 25.78 - limitedQuery = rowsNumberMatcher.replaceAll(String.valueOf(max)); 25.79 + { 25.80 + lowerLimit = rowsNumberMatcher.replaceFirst(String.valueOf(max)); 25.81 + limitedQuery = limitMatcher.replaceFirst(lowerLimit); 25.82 + } 25.83 } 25.84 else // add a limit to the query 25.85 - limitedQuery = queryString+" limit "+max; 25.86 - 25.87 + limitedQuery = queryString+" limit "+max; 25.88 } 25.89 return limitedQuery; 25.90 }
26.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/UpdateBean.java Thu Feb 07 17:59:46 2013 +0200 26.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/UpdateBean.java Fri Feb 08 16:42:42 2013 +0200 26.3 @@ -54,15 +54,34 @@ 26.4 } 26.5 26.6 public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 26.7 - request.setCharacterEncoding("UTF-8"); 26.8 26.9 - if (Common.VIEW_TYPE.equals(request.getParameter(Common.VIEW))) { 26.10 - // HTML visual interface 26.11 - processVIEWRequest(request, response); 26.12 - 26.13 - } else {// invoked as a service 26.14 - processRequest(request, response); 26.15 - } 26.16 + boolean authorized; 26.17 + 26.18 + request.setCharacterEncoding("UTF-8"); 26.19 + ServletContext context = getServletContext(); 26.20 + if(!request.getLocalAddr().equals("127.0.0.1")) { 26.21 + Authenticate authenticate = new Authenticate(); 26.22 + String authorization = request.getHeader("Authorization"); 26.23 + 26.24 + authorized = authenticate.authenticateUser(authorization, context); 26.25 + } 26.26 + else 26.27 + authorized = true; 26.28 + 26.29 + if (!authorized) { 26.30 + // not allowed, so report he's unauthorized 26.31 + response.setHeader("WWW-Authenticate", "BASIC realm=\"Please login\""); 26.32 + response.sendError(HttpServletResponse.SC_UNAUTHORIZED); 26.33 + } 26.34 + else { 26.35 + if (Common.VIEW_TYPE.equals(request.getParameter(Common.VIEW))) { 26.36 + // HTML visual interface 26.37 + processVIEWRequest(request, response); 26.38 + 26.39 + } else {// invoked as a service 26.40 + processRequest(request, response); 26.41 + } 26.42 + } 26.43 } 26.44 26.45 private void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/AutoDiscoveryCapabilities.java Fri Feb 08 16:42:42 2013 +0200 27.3 @@ -0,0 +1,248 @@ 27.4 +/** 27.5 + * This Source Code Form is subject to the terms of the Mozilla Public 27.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 27.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 27.8 + * 27.9 + * Copyright (C) 2012, Pyravlos Team 27.10 + * 27.11 + * http://www.strabon.di.uoa.gr/ 27.12 + */ 27.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 27.14 + 27.15 +import java.io.IOException; 27.16 + 27.17 +import org.apache.commons.httpclient.HttpClient; 27.18 +import org.apache.commons.httpclient.methods.PostMethod; 27.19 +import org.slf4j.Logger; 27.20 +import org.slf4j.LoggerFactory; 27.21 + 27.22 +/** 27.23 + * This class implements the {@link Capabilities} interface and 27.24 + * shall be used only for versions of Strabon Endpoint prior to 27.25 + * version 3.2.5. 27.26 + * 27.27 + * The purpose of this implementation is to attempt to find out the 27.28 + * capabilities of old Strabon Endpoints based on two simple heuristics: 27.29 + * 27.30 + * 1) what has been changed in the code (addition of methods/classes adding 27.31 + * specific functionality) 27.32 + * 2) response messages or HTTP codes that old Strabon Endpoints give on wrong 27.33 + * parameters. 27.34 + * 27.35 + * The result may not be accurate in every case. 27.36 + * 27.37 + * 27.38 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 27.39 + */ 27.40 +public class AutoDiscoveryCapabilities implements Capabilities { 27.41 + 27.42 + private static Logger logger = LoggerFactory.getLogger(eu.earthobservatory.org.StrabonEndpoint.capabilities.AutoDiscoveryCapabilities.class); 27.43 + 27.44 + /** 27.45 + * The host of the endpoint to discovery its capabilities 27.46 + */ 27.47 + private String host; 27.48 + 27.49 + /** 27.50 + * The port to use 27.51 + */ 27.52 + private int port; 27.53 + 27.54 + /** 27.55 + * The name of the web application 27.56 + */ 27.57 + private String appName; 27.58 + 27.59 + @Override 27.60 + public boolean supportsLimit() { 27.61 + @SuppressWarnings("rawtypes") 27.62 + Class strabonWrapper; 27.63 + try { 27.64 + strabonWrapper = Class.forName("eu.earthobservatory.org.StrabonEndpoint.StrabonBeanWrapper"); 27.65 + 27.66 + strabonWrapper.getDeclaredField("maxLimit"); 27.67 + 27.68 + return true; 27.69 + 27.70 + } catch (ClassNotFoundException e1) { 27.71 + // No StrabonBeanWrapper? How come? 27.72 + logger.warn("[StrabonEndpoint.AutoDiscoveryCapabilities] Didn't find StrabonEndpoint class!!! How come?"); 27.73 + 27.74 + } catch (SecurityException e) { 27.75 + logger.info("[StrabonEndpoint.AutoDiscoveryCapabilities] Could not determine limit support due to security exception. ", e); 27.76 + 27.77 + } catch (NoSuchFieldException e) { 27.78 + // this exception is OK. Strabon Endpoint does not support limit of results 27.79 + } 27.80 + 27.81 + return false; 27.82 + } 27.83 + 27.84 + @Override 27.85 + public boolean supportsAuthentication() { 27.86 + return canBeLoaded("eu.earthobservatory.org.StrabonEndpoint.Authenticate"); 27.87 + } 27.88 + 27.89 + @Override 27.90 + public boolean supportsConnectionModification() { 27.91 + return canBeLoaded("eu.earthobservatory.org.StrabonEndpoint.ChangeConnectionBean"); 27.92 + } 27.93 + 27.94 + @Override 27.95 + public String getVersion() { 27.96 + return "<= 3.2.4"; 27.97 + } 27.98 + 27.99 + @Override 27.100 + public RequestCapabilities getQueryCapabilities() { 27.101 + RequestCapabilities request = new RequestCapabilitiesImpl(); 27.102 + 27.103 + String query = "SELECT * WHERE {?s ?p ?o. FILTER(regex(str(?p), \"geometry\"))} LIMIT 1"; 27.104 + 27.105 + String[] queryParams = {"SPARQLQuery", "query"}; 27.106 + 27.107 + String[] formatValues = {"XML", "KML", "KMZ", "GeoJSON", "HTML", "TSV"}; 27.108 + 27.109 + String[] acceptValues = {"application/sparql-results+xml", "text/tab-separated-values", 27.110 + "application/vnd.google-earth.kml+xml", "application/vnd.google-earth.kmz", "text/html", 27.111 + "application/json"}; 27.112 + 27.113 + // check query parameter and format parameter 27.114 + for (int q = 0; q < queryParams.length; q++) { 27.115 + for (int v = 0; v < formatValues.length; v++) { 27.116 + HttpClient hc = new HttpClient(); 27.117 + 27.118 + // create a post method to execute 27.119 + PostMethod method = new PostMethod(getConnectionURL() + "/Query"); 27.120 + 27.121 + // set the query parameter 27.122 + method.setParameter(queryParams[q], query); 27.123 + 27.124 + // set the format parameter 27.125 + method.setParameter("format", formatValues[v]); 27.126 + 27.127 + try { 27.128 + // execute the method 27.129 + int statusCode = hc.executeMethod(method); 27.130 + 27.131 + if (statusCode == 301 || statusCode == 200) { 27.132 + //System.out.println(queryParams[q] + ", " + formatValues[v]); 27.133 + request.getParametersObject().addParameter(new Parameter(queryParams[q], null)); 27.134 + request.getParametersObject().addParameter(new Parameter("format", null)); 27.135 + request.getParametersObject().getParameter("format").addAcceptedValue(formatValues[v]); 27.136 + } 27.137 + 27.138 + } catch (IOException e) { 27.139 + e.printStackTrace(); 27.140 + 27.141 + } finally { 27.142 + // release the connection. 27.143 + method.releaseConnection(); 27.144 + } 27.145 + } 27.146 + } 27.147 + 27.148 + // check query parameter and accept header 27.149 + for (int q = 0; q < queryParams.length; q++) { 27.150 + for (int a = 0; a < acceptValues.length; a++) { 27.151 + HttpClient hc = new HttpClient(); 27.152 + 27.153 + // create a post method to execute 27.154 + PostMethod method = new PostMethod(getConnectionURL() + "/Query"); 27.155 + 27.156 + // set the query parameter 27.157 + method.setParameter(queryParams[q], query); 27.158 + 27.159 + // check for accept value as well 27.160 + // set the accept format 27.161 + method.addRequestHeader("Accept", acceptValues[a]); 27.162 + 27.163 + try { 27.164 + // execute the method 27.165 + int statusCode = hc.executeMethod(method); 27.166 + 27.167 + if (statusCode == 301 || statusCode == 200) { 27.168 + //System.out.println(queryParams[q] + ", " + acceptValues[a]); 27.169 + request.getParametersObject().addParameter(new Parameter(queryParams[q], null)); 27.170 + request.getParametersObject().addParameter(new Parameter("Accept", null)); 27.171 + request.getParametersObject().getParameter("Accept").addAcceptedValue(acceptValues[a]); 27.172 + } 27.173 + 27.174 + } catch (IOException e) { 27.175 + e.printStackTrace(); 27.176 + 27.177 + } finally { 27.178 + // release the connection. 27.179 + method.releaseConnection(); 27.180 + } 27.181 + } 27.182 + } 27.183 + 27.184 + return request; 27.185 + } 27.186 + 27.187 + @Override 27.188 + public RequestCapabilities getUpdateCapabilities() { 27.189 + return null; 27.190 + } 27.191 + 27.192 + @Override 27.193 + public RequestCapabilities getStoreCapabilities() { 27.194 + return null; 27.195 + } 27.196 + 27.197 + @Override 27.198 + public RequestCapabilities getBrowseCapabilities() { 27.199 + return null; 27.200 + } 27.201 + 27.202 + @Override 27.203 + public RequestCapabilities getConnectionCapabilities() { 27.204 + return null; 27.205 + } 27.206 + 27.207 + @Override 27.208 + public boolean supportsQuerying() { 27.209 + return canBeLoaded("eu.earthobservatory.org.StrabonEndpoint.QueryBean"); 27.210 + } 27.211 + 27.212 + @Override 27.213 + public boolean supportsUpdating() { 27.214 + return canBeLoaded("eu.earthobservatory.org.StrabonEndpoint.UpdateBean"); 27.215 + } 27.216 + 27.217 + @Override 27.218 + public boolean supportsStoring() { 27.219 + return canBeLoaded("eu.earthobservatory.org.StrabonEndpoint.StoreBean"); 27.220 + } 27.221 + 27.222 + @Override 27.223 + public boolean supportsDescribing() { 27.224 + return canBeLoaded("eu.earthobservatory.org.StrabonEndpoint.DescribeBean"); 27.225 + } 27.226 + 27.227 + @Override 27.228 + public boolean supportsBrowsing() { 27.229 + return canBeLoaded("eu.earthobservatory.org.StrabonEndpoint.BrowseBean"); 27.230 + } 27.231 + 27.232 + private boolean canBeLoaded(String className) { 27.233 + try { 27.234 + Class.forName(className); 27.235 + return true; 27.236 + 27.237 + } catch (ClassNotFoundException e1) { 27.238 + return false; 27.239 + } 27.240 + } 27.241 + 27.242 + public void setEndpointDetails(String host, int port, String appName) { 27.243 + this.host = host; 27.244 + this.port = port; 27.245 + this.appName = appName; 27.246 + } 27.247 + 27.248 + private String getConnectionURL() { 27.249 + return "http://" + host + ":" + port + "/" + appName; 27.250 + } 27.251 +}
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/BrowseBeanCapabilities.java Fri Feb 08 16:42:42 2013 +0200 28.3 @@ -0,0 +1,50 @@ 28.4 +/** 28.5 + * This Source Code Form is subject to the terms of the Mozilla Public 28.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 28.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 28.8 + * 28.9 + * Copyright (C) 2012, Pyravlos Team 28.10 + * 28.11 + * http://www.strabon.di.uoa.gr/ 28.12 + */ 28.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 28.14 + 28.15 +import java.util.List; 28.16 + 28.17 + 28.18 +/** 28.19 + * 28.20 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 28.21 + */ 28.22 +public class BrowseBeanCapabilities implements RequestCapabilities { 28.23 + 28.24 + private static BrowseBeanCapabilities caps; 28.25 + 28.26 + protected BrowseBeanCapabilities() { 28.27 + 28.28 + } 28.29 + 28.30 + public static synchronized BrowseBeanCapabilities getInstance() { 28.31 + if (caps == null) { 28.32 + caps = new BrowseBeanCapabilities(); 28.33 + } 28.34 + 28.35 + return caps; 28.36 + } 28.37 + 28.38 + @Override 28.39 + public Parameters getParametersObject() { 28.40 + return null; 28.41 + } 28.42 + 28.43 + @Override 28.44 + public List<String> getAcceptedValues(String param) { 28.45 + return null; 28.46 + } 28.47 + 28.48 + @Override 28.49 + public boolean isOptional(String param) { 28.50 + return false; 28.51 + } 28.52 + 28.53 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 29.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/Capabilities.java Fri Feb 08 16:42:42 2013 +0200 29.3 @@ -0,0 +1,133 @@ 29.4 +/** 29.5 + * This Source Code Form is subject to the terms of the Mozilla Public 29.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 29.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 29.8 + * 29.9 + * Copyright (C) 2012, Pyravlos Team 29.10 + * 29.11 + * http://www.strabon.di.uoa.gr/ 29.12 + */ 29.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 29.14 + 29.15 + 29.16 +/** 29.17 + * Interface that exposes the capabilities of a Strabon Endpoint. 29.18 + * 29.19 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 29.20 + */ 29.21 +public interface Capabilities { 29.22 + 29.23 + /** 29.24 + * Return the version of Stabon Endpoint. 29.25 + * 29.26 + * @return 29.27 + */ 29.28 + public String getVersion(); 29.29 + 29.30 + /** 29.31 + * True when the endpoint supports limiting of results. 29.32 + * 29.33 + * @return 29.34 + */ 29.35 + public boolean supportsLimit(); 29.36 + 29.37 + /** 29.38 + * True when the endpoint supports authentication for 29.39 + * update operations (Store/Delete/Update/Insert). 29.40 + * 29.41 + * @return 29.42 + */ 29.43 + public boolean supportsAuthentication(); 29.44 + 29.45 + /** 29.46 + * True when the endpoint supports querying using 29.47 + * SPARQL. 29.48 + * 29.49 + * @return 29.50 + */ 29.51 + public boolean supportsQuerying(); 29.52 + 29.53 + /** 29.54 + * True when the endpoint supports update queries using 29.55 + * SPARQL. 29.56 + * 29.57 + * @return 29.58 + */ 29.59 + public boolean supportsUpdating(); 29.60 + 29.61 + /** 29.62 + * True when the endpoint supports storing of RDF triples. 29.63 + * 29.64 + * @return 29.65 + */ 29.66 + public boolean supportsStoring(); 29.67 + 29.68 + /** 29.69 + * True when the endpoint supports describe queries using 29.70 + * SPARQL. 29.71 + * 29.72 + * @return 29.73 + */ 29.74 + public boolean supportsDescribing(); 29.75 + 29.76 + /** 29.77 + * True when the endpoint supports browsing of RDF 29.78 + * resources. 29.79 + * 29.80 + * @return 29.81 + */ 29.82 + public boolean supportsBrowsing(); 29.83 + 29.84 + /** 29.85 + * True when the endpoint supports modification of the 29.86 + * connection details used for the database connection. 29.87 + * 29.88 + * @return 29.89 + */ 29.90 + public boolean supportsConnectionModification(); 29.91 + 29.92 + /** 29.93 + * Returns a {@link RequestCapabilities} instance containing 29.94 + * the details for how one can query the Query service of the 29.95 + * endpoint. 29.96 + * 29.97 + * @return 29.98 + */ 29.99 + public RequestCapabilities getQueryCapabilities(); 29.100 + 29.101 + /** 29.102 + * Returns a {@link RequestCapabilities} instance containing 29.103 + * the details for how one can query the Update service of the 29.104 + * endpoint. 29.105 + * 29.106 + * @return 29.107 + */ 29.108 + public RequestCapabilities getUpdateCapabilities(); 29.109 + 29.110 + /** 29.111 + * Returns a {@link RequestCapabilities} instance containing 29.112 + * the details for how one can query the Store service of the 29.113 + * endpoint. 29.114 + * 29.115 + * @return 29.116 + */ 29.117 + public RequestCapabilities getStoreCapabilities(); 29.118 + 29.119 + /** 29.120 + * Returns a {@link RequestCapabilities} instance containing 29.121 + * the details for how one can query the Browse service of the 29.122 + * endpoint. 29.123 + * 29.124 + * @return 29.125 + */ 29.126 + public RequestCapabilities getBrowseCapabilities(); 29.127 + 29.128 + /** 29.129 + * Returns a {@link RequestCapabilities} instance containing 29.130 + * the details for how one can query the Connection service of 29.131 + * the endpoint. 29.132 + * 29.133 + * @return 29.134 + */ 29.135 + public RequestCapabilities getConnectionCapabilities(); 29.136 +}
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 30.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/CapabilitiesBean.java Fri Feb 08 16:42:42 2013 +0200 30.3 @@ -0,0 +1,142 @@ 30.4 +/** 30.5 + * This Source Code Form is subject to the terms of the Mozilla Public 30.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 30.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 30.8 + * 30.9 + * Copyright (C) 2012, Pyravlos Team 30.10 + * 30.11 + * http://www.strabon.di.uoa.gr/ 30.12 + */ 30.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 30.14 + 30.15 +import java.io.IOException; 30.16 + 30.17 +import javax.servlet.ServletConfig; 30.18 +import javax.servlet.ServletContext; 30.19 +import javax.servlet.ServletException; 30.20 +import javax.servlet.ServletOutputStream; 30.21 +import javax.servlet.http.HttpServlet; 30.22 +import javax.servlet.http.HttpServletRequest; 30.23 +import javax.servlet.http.HttpServletResponse; 30.24 + 30.25 +import org.springframework.web.context.WebApplicationContext; 30.26 +import org.springframework.web.context.support.WebApplicationContextUtils; 30.27 + 30.28 +import eu.earthobservatory.org.StrabonEndpoint.Common; 30.29 + 30.30 +/** 30.31 + * 30.32 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 30.33 + */ 30.34 +public class CapabilitiesBean extends HttpServlet { 30.35 + 30.36 + private static final long serialVersionUID = -8941754144139158506L; 30.37 + 30.38 + /** 30.39 + * The context of the servlet 30.40 + */ 30.41 + private ServletContext context; 30.42 + 30.43 + /** 30.44 + * The name of this web application 30.45 + */ 30.46 + private String appName; 30.47 + 30.48 + /** 30.49 + * The capabilities of the endpoint 30.50 + */ 30.51 + private Capabilities caps; 30.52 + 30.53 + public void init(ServletConfig servletConfig) throws ServletException { 30.54 + super.init(servletConfig); 30.55 + 30.56 + // get the context of the servlet 30.57 + context = getServletContext(); 30.58 + 30.59 + // get the context of the application 30.60 + WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(context); 30.61 + 30.62 + // the the strabon wrapper 30.63 + CapabilitiesDelegateBean capsBean = (CapabilitiesDelegateBean) applicationContext.getBean("capsBean"); 30.64 + 30.65 + // get the name of this web application 30.66 + appName = context.getContextPath().replace("/", ""); 30.67 + 30.68 + // get capabilities 30.69 + caps = capsBean.getEndpointCapabilities(); 30.70 + } 30.71 + 30.72 + public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 30.73 + doPost(request, response); 30.74 + } 30.75 + 30.76 + public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 30.77 + request.setCharacterEncoding("UTF-8"); 30.78 + 30.79 + if (Common.VIEW_TYPE.equals(request.getParameter(Common.VIEW))) { 30.80 + // HTML visual interface 30.81 + processVIEWRequest(request, response); 30.82 + 30.83 + } else {// invoked as a service 30.84 + processRequest(request, response); 30.85 + } 30.86 + } 30.87 + 30.88 + /** 30.89 + * Processes the request made from the HTML visual interface of Strabon Endpoint. 30.90 + * 30.91 + * @param request 30.92 + * @param response 30.93 + * @throws ServletException 30.94 + * @throws IOException 30.95 + */ 30.96 + private void processVIEWRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 30.97 + //RequestDispatcher dispatcher; 30.98 + } 30.99 + 30.100 + /** 30.101 + * Processes the request made by a client of the endpoint that uses it as a service. 30.102 + * 30.103 + * @param request 30.104 + * @param response 30.105 + * @throws IOException 30.106 + */ 30.107 + private void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException { 30.108 + ServletOutputStream out = response.getOutputStream(); 30.109 + 30.110 + out.println("Version : " + caps.getVersion()); 30.111 + out.println("Supports limit : " + getYesNo(caps.supportsLimit())); 30.112 + out.println("Supports authentication : " + getYesNo(caps.supportsAuthentication())); 30.113 + out.println("Supports modification of database connection : " + getYesNo(caps.supportsConnectionModification())); 30.114 + out.println("Supports SPARQL : " + getYesNo(caps.supportsQuerying())); 30.115 + out.println("Supports SPARQL Update : " + getYesNo(caps.supportsUpdating())); 30.116 + out.println("Supports storing : " + getYesNo(caps.supportsStoring())); 30.117 + out.println("Supports DESCRIBE : " + getYesNo(caps.supportsDescribing())); 30.118 + out.println("Supports CONSTRUCT : " + getYesNo(caps.supportsDescribing())); 30.119 + out.println("Supports browsing : " + getYesNo(caps.supportsBrowsing())); 30.120 + out.println(); 30.121 + 30.122 + if (caps instanceof AutoDiscoveryCapabilities) { 30.123 + AutoDiscoveryCapabilities autocaps = (AutoDiscoveryCapabilities) caps; 30.124 + autocaps.setEndpointDetails(request.getServerName(), request.getServerPort(), appName); 30.125 + //autocaps.setEndpointDetails("localhost", 8080, "NOA"); 30.126 + } 30.127 + 30.128 + RequestCapabilities reCap = caps.getQueryCapabilities(); 30.129 + 30.130 + for (Parameter param : reCap.getParametersObject().getParameters()) { 30.131 + out.println("Supports parameter : " + param.getName()); 30.132 + 30.133 + if (param.getAcceptedValues().size() > 0) { 30.134 + out.println(" Accepted values : "); 30.135 + for (String acceptedValue : param.getAcceptedValues()) { 30.136 + out.println("\t\t " + acceptedValue); 30.137 + } 30.138 + } 30.139 + } 30.140 + } 30.141 + 30.142 + private String getYesNo(boolean val) { 30.143 + return val ? "yes":"no"; 30.144 + } 30.145 +} 30.146 \ No newline at end of file
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 31.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/CapabilitiesDelegateBean.java Fri Feb 08 16:42:42 2013 +0200 31.3 @@ -0,0 +1,38 @@ 31.4 +/** 31.5 + * This Source Code Form is subject to the terms of the Mozilla Public 31.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 31.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 31.8 + * 31.9 + * Copyright (C) 2012, Pyravlos Team 31.10 + * 31.11 + * http://www.strabon.di.uoa.gr/ 31.12 + */ 31.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 31.14 + 31.15 + 31.16 +/** 31.17 + * 31.18 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 31.19 + */ 31.20 +public class CapabilitiesDelegateBean implements org.springframework.beans.factory.DisposableBean { 31.21 + 31.22 + private static Capabilities caps; 31.23 + 31.24 + public CapabilitiesDelegateBean(boolean autoDiscoverCapabilities) { 31.25 + if (autoDiscoverCapabilities) { 31.26 + caps = new AutoDiscoveryCapabilities(); 31.27 + 31.28 + } else { 31.29 + caps = new EndpointCapabilities(); 31.30 + } 31.31 + } 31.32 + 31.33 + @Override 31.34 + public void destroy() throws Exception { 31.35 + // nothing to destroy 31.36 + } 31.37 + 31.38 + public Capabilities getEndpointCapabilities() { 31.39 + return caps; 31.40 + } 31.41 +}
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/ConnectionBeanCapabilities.java Fri Feb 08 16:42:42 2013 +0200 32.3 @@ -0,0 +1,50 @@ 32.4 +/** 32.5 + * This Source Code Form is subject to the terms of the Mozilla Public 32.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 32.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 32.8 + * 32.9 + * Copyright (C) 2012, Pyravlos Team 32.10 + * 32.11 + * http://www.strabon.di.uoa.gr/ 32.12 + */ 32.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 32.14 + 32.15 +import java.util.List; 32.16 + 32.17 + 32.18 +/** 32.19 + * 32.20 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 32.21 + */ 32.22 +public class ConnectionBeanCapabilities implements RequestCapabilities { 32.23 + 32.24 + private static ConnectionBeanCapabilities caps; 32.25 + 32.26 + protected ConnectionBeanCapabilities() { 32.27 + 32.28 + } 32.29 + 32.30 + public static synchronized ConnectionBeanCapabilities getInstance() { 32.31 + if (caps == null) { 32.32 + caps = new ConnectionBeanCapabilities(); 32.33 + } 32.34 + 32.35 + return caps; 32.36 + } 32.37 + 32.38 + @Override 32.39 + public Parameters getParametersObject() { 32.40 + return null; 32.41 + } 32.42 + 32.43 + @Override 32.44 + public List<String> getAcceptedValues(String param) { 32.45 + return null; 32.46 + } 32.47 + 32.48 + @Override 32.49 + public boolean isOptional(String param) { 32.50 + return false; 32.51 + } 32.52 + 32.53 +}
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 33.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/EndpointCapabilities.java Fri Feb 08 16:42:42 2013 +0200 33.3 @@ -0,0 +1,91 @@ 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) 2012, Pyravlos Team 33.10 + * 33.11 + * http://www.strabon.di.uoa.gr/ 33.12 + */ 33.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 33.14 + 33.15 + 33.16 +/** 33.17 + * This class implements the {@link Capabilities} interface and 33.18 + * shall be used only for versions of Strabon Endpoint newer than 33.19 + * version 3.2.4. 33.20 + * 33.21 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 33.22 + */ 33.23 +public class EndpointCapabilities implements Capabilities { 33.24 + 33.25 + @Override 33.26 + public String getVersion() { 33.27 + return "3.2.4-SNAPSHOT"; 33.28 + } 33.29 + 33.30 + @Override 33.31 + public boolean supportsLimit() { 33.32 + return true; 33.33 + } 33.34 + 33.35 + @Override 33.36 + public boolean supportsAuthentication() { 33.37 + return true; 33.38 + } 33.39 + 33.40 + @Override 33.41 + public boolean supportsConnectionModification() { 33.42 + return true; 33.43 + } 33.44 + 33.45 + @Override 33.46 + public boolean supportsQuerying() { 33.47 + return true; 33.48 + } 33.49 + 33.50 + @Override 33.51 + public boolean supportsUpdating() { 33.52 + return true; 33.53 + } 33.54 + 33.55 + @Override 33.56 + public boolean supportsStoring() { 33.57 + return true; 33.58 + } 33.59 + 33.60 + @Override 33.61 + public boolean supportsDescribing() { 33.62 + return true; 33.63 + } 33.64 + 33.65 + @Override 33.66 + public boolean supportsBrowsing() { 33.67 + return true; 33.68 + } 33.69 + 33.70 + @Override 33.71 + public RequestCapabilities getQueryCapabilities() { 33.72 + return QueryBeanCapabilities.getInstance(); 33.73 + } 33.74 + 33.75 + @Override 33.76 + public RequestCapabilities getUpdateCapabilities() { 33.77 + return UpdateBeanCapabilities.getInstance(); 33.78 + } 33.79 + 33.80 + @Override 33.81 + public RequestCapabilities getStoreCapabilities() { 33.82 + return StoreBeanCapabilities.getInstance(); 33.83 + } 33.84 + 33.85 + @Override 33.86 + public RequestCapabilities getBrowseCapabilities() { 33.87 + return BrowseBeanCapabilities.getInstance(); 33.88 + } 33.89 + 33.90 + @Override 33.91 + public RequestCapabilities getConnectionCapabilities() { 33.92 + return ConnectionBeanCapabilities.getInstance(); 33.93 + } 33.94 +}
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 34.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/Parameter.java Fri Feb 08 16:42:42 2013 +0200 34.3 @@ -0,0 +1,48 @@ 34.4 +/** 34.5 + * This Source Code Form is subject to the terms of the Mozilla Public 34.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 34.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 34.8 + * 34.9 + * Copyright (C) 2012, Pyravlos Team 34.10 + * 34.11 + * http://www.strabon.di.uoa.gr/ 34.12 + */ 34.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 34.14 + 34.15 +import java.util.HashSet; 34.16 +import java.util.Set; 34.17 + 34.18 +/** 34.19 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 34.20 + * 34.21 + */ 34.22 +public class Parameter { 34.23 + 34.24 + private String name; 34.25 + private String value; 34.26 + 34.27 + private Set<String> acceptedValues; 34.28 + 34.29 + public Parameter(String name, String value) { 34.30 + this.name = name; 34.31 + this.value = value; 34.32 + 34.33 + this.acceptedValues = new HashSet<String>(); 34.34 + } 34.35 + 34.36 + public String getName() { 34.37 + return name; 34.38 + } 34.39 + 34.40 + public String getValue() { 34.41 + return value; 34.42 + } 34.43 + 34.44 + public void addAcceptedValue(String value) { 34.45 + acceptedValues.add(value); 34.46 + } 34.47 + 34.48 + public Set<String> getAcceptedValues() { 34.49 + return acceptedValues; 34.50 + } 34.51 +}
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 35.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/Parameters.java Fri Feb 08 16:42:42 2013 +0200 35.3 @@ -0,0 +1,46 @@ 35.4 +/** 35.5 + * This Source Code Form is subject to the terms of the Mozilla Public 35.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 35.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 35.8 + * 35.9 + * Copyright (C) 2012, Pyravlos Team 35.10 + * 35.11 + * http://www.strabon.di.uoa.gr/ 35.12 + */ 35.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 35.14 + 35.15 +import java.util.Collection; 35.16 +import java.util.Hashtable; 35.17 + 35.18 +/** 35.19 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 35.20 + * 35.21 + */ 35.22 +public class Parameters { 35.23 + 35.24 + private Hashtable<String, Parameter> params; 35.25 + 35.26 + public Parameters() { 35.27 + params = new Hashtable<String, Parameter>(); 35.28 + } 35.29 + 35.30 + /** 35.31 + * Adds a new parameter. If the parameter already exists, 35.32 + * the operation does nothing. 35.33 + * 35.34 + * @param param 35.35 + */ 35.36 + public void addParameter(Parameter param) { 35.37 + if (params.get(param.getName()) == null) { 35.38 + params.put(param.getName(), param); 35.39 + } 35.40 + } 35.41 + 35.42 + public Parameter getParameter(String name) { 35.43 + return params.get(name); 35.44 + } 35.45 + 35.46 + public Collection<Parameter> getParameters() { 35.47 + return params.values(); 35.48 + } 35.49 +}
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 36.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/QueryBeanCapabilities.java Fri Feb 08 16:42:42 2013 +0200 36.3 @@ -0,0 +1,50 @@ 36.4 +/** 36.5 + * This Source Code Form is subject to the terms of the Mozilla Public 36.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 36.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 36.8 + * 36.9 + * Copyright (C) 2012, Pyravlos Team 36.10 + * 36.11 + * http://www.strabon.di.uoa.gr/ 36.12 + */ 36.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 36.14 + 36.15 +import java.util.List; 36.16 + 36.17 + 36.18 +/** 36.19 + * 36.20 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 36.21 + */ 36.22 +public class QueryBeanCapabilities implements RequestCapabilities { 36.23 + 36.24 + private static QueryBeanCapabilities caps; 36.25 + 36.26 + protected QueryBeanCapabilities() { 36.27 + 36.28 + } 36.29 + 36.30 + public static synchronized QueryBeanCapabilities getInstance() { 36.31 + if (caps == null) { 36.32 + caps = new QueryBeanCapabilities(); 36.33 + } 36.34 + 36.35 + return caps; 36.36 + } 36.37 + 36.38 + @Override 36.39 + public Parameters getParametersObject() { 36.40 + return null; 36.41 + } 36.42 + 36.43 + @Override 36.44 + public List<String> getAcceptedValues(String param) { 36.45 + return null; 36.46 + } 36.47 + 36.48 + @Override 36.49 + public boolean isOptional(String param) { 36.50 + return false; 36.51 + } 36.52 + 36.53 +}
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 37.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/RequestCapabilities.java Fri Feb 08 16:42:42 2013 +0200 37.3 @@ -0,0 +1,47 @@ 37.4 +/** 37.5 + * This Source Code Form is subject to the terms of the Mozilla Public 37.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 37.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 37.8 + * 37.9 + * Copyright (C) 2012, Pyravlos Team 37.10 + * 37.11 + * http://www.strabon.di.uoa.gr/ 37.12 + */ 37.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 37.14 + 37.15 +import java.util.List; 37.16 + 37.17 +/** 37.18 + * Interface that exposes the kind of requests that clients 37.19 + * of Strabon Endpoint can access its services, i.e., 37.20 + * Query, Store, Update, Browse, etc. 37.21 + * 37.22 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 37.23 + */ 37.24 +public interface RequestCapabilities { 37.25 + 37.26 + /** 37.27 + * Get the accepted parameters of a service request 37.28 + * as a list. 37.29 + * 37.30 + * @return 37.31 + */ 37.32 + public Parameters getParametersObject(); 37.33 + 37.34 + /** 37.35 + * Get the accepted values of a service parameter. 37.36 + * 37.37 + * @param param 37.38 + * @return 37.39 + */ 37.40 + public List<String> getAcceptedValues(String param); 37.41 + 37.42 + /** 37.43 + * Determine wether the given parameter is optional 37.44 + * and thus can be omitted. 37.45 + * 37.46 + * @param param 37.47 + * @return 37.48 + */ 37.49 + public boolean isOptional(String param); 37.50 +}
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 38.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/RequestCapabilitiesImpl.java Fri Feb 08 16:42:42 2013 +0200 38.3 @@ -0,0 +1,40 @@ 38.4 +/** 38.5 + * This Source Code Form is subject to the terms of the Mozilla Public 38.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 38.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 38.8 + * 38.9 + * Copyright (C) 2012, Pyravlos Team 38.10 + * 38.11 + * http://www.strabon.di.uoa.gr/ 38.12 + */ 38.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 38.14 + 38.15 +import java.util.List; 38.16 + 38.17 +/** 38.18 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 38.19 + */ 38.20 +public class RequestCapabilitiesImpl implements RequestCapabilities { 38.21 + 38.22 + private Parameters params; 38.23 + 38.24 + public RequestCapabilitiesImpl() { 38.25 + params = new Parameters(); 38.26 + } 38.27 + 38.28 + @Override 38.29 + public Parameters getParametersObject() { 38.30 + return params; 38.31 + } 38.32 + 38.33 + @Override 38.34 + public List<String> getAcceptedValues(String param) { 38.35 + return null; 38.36 + } 38.37 + 38.38 + @Override 38.39 + public boolean isOptional(String param) { 38.40 + return false; 38.41 + } 38.42 + 38.43 +}
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/StoreBeanCapabilities.java Fri Feb 08 16:42:42 2013 +0200 39.3 @@ -0,0 +1,50 @@ 39.4 +/** 39.5 + * This Source Code Form is subject to the terms of the Mozilla Public 39.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 39.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 39.8 + * 39.9 + * Copyright (C) 2012, Pyravlos Team 39.10 + * 39.11 + * http://www.strabon.di.uoa.gr/ 39.12 + */ 39.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 39.14 + 39.15 +import java.util.List; 39.16 + 39.17 + 39.18 +/** 39.19 + * 39.20 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 39.21 + */ 39.22 +public class StoreBeanCapabilities implements RequestCapabilities { 39.23 + 39.24 + private static StoreBeanCapabilities caps; 39.25 + 39.26 + protected StoreBeanCapabilities() { 39.27 + 39.28 + } 39.29 + 39.30 + public static synchronized StoreBeanCapabilities getInstance() { 39.31 + if (caps == null) { 39.32 + caps = new StoreBeanCapabilities(); 39.33 + } 39.34 + 39.35 + return caps; 39.36 + } 39.37 + 39.38 + @Override 39.39 + public Parameters getParametersObject() { 39.40 + return null; 39.41 + } 39.42 + 39.43 + @Override 39.44 + public List<String> getAcceptedValues(String param) { 39.45 + return null; 39.46 + } 39.47 + 39.48 + @Override 39.49 + public boolean isOptional(String param) { 39.50 + return false; 39.51 + } 39.52 + 39.53 +}
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 40.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/capabilities/UpdateBeanCapabilities.java Fri Feb 08 16:42:42 2013 +0200 40.3 @@ -0,0 +1,49 @@ 40.4 +/** 40.5 + * This Source Code Form is subject to the terms of the Mozilla Public 40.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 40.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 40.8 + * 40.9 + * Copyright (C) 2012, Pyravlos Team 40.10 + * 40.11 + * http://www.strabon.di.uoa.gr/ 40.12 + */ 40.13 +package eu.earthobservatory.org.StrabonEndpoint.capabilities; 40.14 + 40.15 +import java.util.List; 40.16 + 40.17 + 40.18 +/** 40.19 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 40.20 + * 40.21 + */ 40.22 +public class UpdateBeanCapabilities implements RequestCapabilities { 40.23 + 40.24 + private static UpdateBeanCapabilities caps; 40.25 + 40.26 + protected UpdateBeanCapabilities() { 40.27 + 40.28 + } 40.29 + 40.30 + public static synchronized UpdateBeanCapabilities getInstance() { 40.31 + if (caps == null) { 40.32 + caps = new UpdateBeanCapabilities(); 40.33 + } 40.34 + 40.35 + return caps; 40.36 + } 40.37 + 40.38 + @Override 40.39 + public Parameters getParametersObject() { 40.40 + return null; 40.41 + } 40.42 + 40.43 + @Override 40.44 + public List<String> getAcceptedValues(String param) { 40.45 + return null; 40.46 + } 40.47 + 40.48 + @Override 40.49 + public boolean isOptional(String param) { 40.50 + return false; 40.51 + } 40.52 +}
41.1 --- a/evaluation/pom.xml Thu Feb 07 17:59:46 2013 +0200 41.2 +++ b/evaluation/pom.xml Fri Feb 08 16:42:42 2013 +0200 41.3 @@ -5,12 +5,12 @@ 41.4 <parent> 41.5 <groupId>eu.earthobservatory</groupId> 41.6 <artifactId>strabon</artifactId> 41.7 - <version>3.2.5-SNAPSHOT</version> 41.8 + <version>3.2.8-SNAPSHOT</version> 41.9 </parent> 41.10 41.11 <groupId>org.openrdf.sesame</groupId> 41.12 <artifactId>sesame-queryalgebra-evaluation-spatial</artifactId> 41.13 - <name>OpenRDF Sesame: Query algebra - evaluation -spatial</name> 41.14 + <name>OpenRDF Sesame: Query algebra - evaluation - spatial</name> 41.15 <description>Spatial Extension Functions - stSPARQL </description> 41.16 41.17 <dependencies>
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 42.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/datetime/stsparql/metric/DiffDateTime.java Fri Feb 08 16:42:42 2013 +0200 42.3 @@ -0,0 +1,72 @@ 42.4 +/** 42.5 + * This Source Code Form is subject to the terms of the Mozilla Public 42.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 42.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 42.8 + * 42.9 + * Copyright (C) 2012, Pyravlos Team 42.10 + * 42.11 + * http://www.strabon.di.uoa.gr/ 42.12 + */ 42.13 +package org.openrdf.query.algebra.evaluation.function.datetime.stsparql.metric; 42.14 + 42.15 +import java.text.SimpleDateFormat; 42.16 +import java.util.Calendar; 42.17 +import java.util.GregorianCalendar; 42.18 + 42.19 +import org.openrdf.model.Value; 42.20 +import org.openrdf.model.ValueFactory; 42.21 +import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 42.22 +import org.openrdf.query.algebra.evaluation.function.spatial.DateTimeMetricFunc; 42.23 +import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 42.24 + 42.25 +/** 42.26 + * Addition for datetime metric functions 42.27 + * 42.28 + * 42.29 + * @author George Garbis <ggarbis@di.uoa.gr> 42.30 + * 42.31 + */ 42.32 +public class DiffDateTime extends DateTimeMetricFunc { 42.33 + 42.34 + // This functions returns the difference in msecs of two xsd:dateTimes 42.35 + 42.36 + @Override 42.37 + public String getURI() { 42.38 + return GeoConstants.diffDateTime; 42.39 + } 42.40 + 42.41 +// @Override 42.42 +// public Value evaluate(ValueFactory valueFactory, Value... args) 42.43 +// throws ValueExprEvaluationException { 42.44 +// if (args.length != 2) { 42.45 +// throw new ValueExprEvaluationException(this.getURI() 42.46 +// + " requires exactly 2 arguments, got " + args.length); 42.47 +// } 42.48 +// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-DD'T'hh:mm:ss"); //the format of xsd:Datetime 42.49 +// 42.50 +// long diff = 0; 42.51 +// try { 42.52 +// String date1 = args[0].toString(); 42.53 +// date1 = date1.replace("^^<http://www.w3.org/2001/XMLSchema#dateTime>", ""); 42.54 +// date1 = date1.replace("\"", ""); 42.55 +// Calendar cal1 = new GregorianCalendar(); 42.56 +// cal1.setTime(sdf.parse(date1)); 42.57 +// 42.58 +// String date2 = args[1].toString(); 42.59 +// date2 = date2.replace("^^<http://www.w3.org/2001/XMLSchema#dateTime>", ""); 42.60 +// date2 = date2.replace("\"", ""); 42.61 +// Calendar cal2 = new GregorianCalendar(); 42.62 +// cal2.setTime(sdf.parse(date2)); 42.63 +// 42.64 +// diff = cal2.getTimeInMillis() - cal1.getTimeInMillis(); 42.65 +// 42.66 +// } catch (java.text.ParseException e) { 42.67 +// // TODO Auto-generated catch block 42.68 +// e.printStackTrace(); 42.69 +// } 42.70 +// 42.71 +// 42.72 +// return valueFactory.createLiteral(diff); 42.73 +// } 42.74 + 42.75 +}
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 43.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/link/AddDateTimeFunc.java Fri Feb 08 16:42:42 2013 +0200 43.3 @@ -0,0 +1,85 @@ 43.4 +/** 43.5 + * This Source Code Form is subject to the terms of the Mozilla Public 43.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 43.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 43.8 + * 43.9 + * Copyright (C) 2012, Pyravlos Team 43.10 + * 43.11 + * http://www.strabon.di.uoa.gr/ 43.12 + */ 43.13 +package org.openrdf.query.algebra.evaluation.function.link; 43.14 + 43.15 +import java.text.SimpleDateFormat; 43.16 +import java.util.Calendar; 43.17 +import java.util.GregorianCalendar; 43.18 + 43.19 +import javax.xml.datatype.DatatypeConfigurationException; 43.20 +import javax.xml.datatype.DatatypeFactory; 43.21 +import javax.xml.datatype.XMLGregorianCalendar; 43.22 + 43.23 +import org.openrdf.model.Value; 43.24 +import org.openrdf.model.ValueFactory; 43.25 +import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 43.26 +import org.openrdf.query.algebra.evaluation.function.Function; 43.27 +import org.slf4j.Logger; 43.28 +import org.slf4j.LoggerFactory; 43.29 + 43.30 +/** 43.31 + * Defines a function that advances a date-time value (first argument) 43.32 + * by a given integer number representing minutes (second argument). 43.33 + * 43.34 + * @author Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> 43.35 + */ 43.36 +public class AddDateTimeFunc implements Function { 43.37 + 43.38 + private static Logger logger = LoggerFactory.getLogger(org.openrdf.query.algebra.evaluation.function.link.AddDateTimeFunc.class); 43.39 + 43.40 + protected static String name = "addDateTime"; 43.41 + 43.42 + @Override 43.43 + public String getURI() { 43.44 + return "http://example.org/custom-function/" + name; 43.45 + 43.46 + } 43.47 + 43.48 + public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { 43.49 + if (args.length != 2) { 43.50 + throw new ValueExprEvaluationException("strdf:" + name 43.51 + + " requires exactly 2 arguments, got " + args.length); 43.52 + } 43.53 + 43.54 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss"); //the format of xsd:Datetime 43.55 + GregorianCalendar cal = new GregorianCalendar(); 43.56 + 43.57 + try { 43.58 + // get minutes, remove possible appearance of integer datatype, and strip double quotes 43.59 + String minutes = args[1].toString().replace("^^<http://www.w3.org/2001/XMLSchema#integer>", "").replace("\"", ""); 43.60 + int minutesToAdd = Integer.parseInt(minutes); 43.61 + 43.62 + String date = args[0].toString(); 43.63 + 43.64 + // remove possible appearance of dateTime datatype and strip double quotes 43.65 + date = date.replace("^^<http://www.w3.org/2001/XMLSchema#dateTime>", "").replace("\"", ""); 43.66 + 43.67 + // set the time (according to 1st argument) 43.68 + cal.setTime(sdf.parse(date)); 43.69 + // add the minutes (according to 2nd argument) 43.70 + cal.add(Calendar.MINUTE, minutesToAdd); 43.71 + 43.72 + } catch (java.text.ParseException e) { 43.73 + logger.error("[Strabon.AddDateTimeFunc] Error parsing the arguments of \"addDateTime\" extension function.", e); 43.74 + } 43.75 + 43.76 + XMLGregorianCalendar gxml=null; 43.77 + try { 43.78 + gxml = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); 43.79 + 43.80 + } catch (DatatypeConfigurationException e) { 43.81 + logger.error("[Strabon.AddDateTimeFunc] Error constructing a new Datetime value.", e); 43.82 + } 43.83 + 43.84 + Value value = valueFactory.createLiteral(gxml); 43.85 +// System.out.println("value="+value.toString()); 43.86 + return value; 43.87 + } 43.88 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 44.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/DateTimeMetricFunc.java Fri Feb 08 16:42:42 2013 +0200 44.3 @@ -0,0 +1,35 @@ 44.4 +/** 44.5 + * This Source Code Form is subject to the terms of the Mozilla Public 44.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 44.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 44.8 + * 44.9 + * Copyright (C) 2010, 2011, 2012, Pyravlos Team 44.10 + * 44.11 + * http://www.strabon.di.uoa.gr/ 44.12 + */ 44.13 +package org.openrdf.query.algebra.evaluation.function.spatial; 44.14 + 44.15 +import org.openrdf.model.Value; 44.16 +import org.openrdf.model.ValueFactory; 44.17 +import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 44.18 +import org.openrdf.query.algebra.evaluation.function.Function; 44.19 + 44.20 +/** 44.21 + * This class represents a function doing a metric computation on xsd:dateTime values 44.22 + * (e.g., calculating the difference between two xsd:dateTime values). 44.23 + * 44.24 + * @see package {@link org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric} 44.25 + * 44.26 + * @author George Garbis <ggarbis@di.uoa.gr> 44.27 + */ 44.28 +public abstract class DateTimeMetricFunc implements Function { 44.29 + 44.30 + //No need for any implementation, I will have replaced this class's presence before reaching this place 44.31 + public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { 44.32 + 44.33 + return null; 44.34 + } 44.35 + 44.36 + // charnik: made method (and hence the class) abstract 44.37 + public abstract String getURI(); 44.38 +}
45.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/GeoConstants.java Thu Feb 07 17:59:46 2013 +0200 45.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/GeoConstants.java Fri Feb 08 16:42:42 2013 +0200 45.3 @@ -16,6 +16,7 @@ 45.4 * is assumed in Strabon. 45.5 * 45.6 * @author Charalampos Nikolaou <charnik@di.uoa.gr> 45.7 + * @author Kostis Kyzirakos <kkyzir@di.uoa.gr> 45.8 */ 45.9 public class GeoConstants { 45.10 /** * 45.11 @@ -72,28 +73,29 @@ 45.12 * stSPARQL * 45.13 * */ 45.14 // Spatial Relationships 45.15 - public static final String anyInteract = stRDF + "anyInteract"; 45.16 + public static final String equals = stRDF + "equals"; 45.17 + public static final String disjoint = stRDF + "disjoint"; 45.18 public static final String intersects = stRDF + "intersects"; 45.19 + public static final String touches = stRDF + "touches"; 45.20 + public static final String within = stRDF + "within"; 45.21 public static final String contains = stRDF + "contains"; 45.22 - public static final String within = stRDF + "within"; 45.23 - public static final String coveredBy = stRDF + "coveredBy"; 45.24 - public static final String covers = stRDF + "covers"; 45.25 - public static final String disjoint = stRDF + "disjoint"; 45.26 - public static final String equals = stRDF + "equals"; 45.27 - public static final String inside = stRDF + "inside"; 45.28 - public static final String overlap = stRDF + "overlap"; 45.29 - public static final String touch = stRDF + "touch"; 45.30 + public static final String overlaps = stRDF + "overlaps"; 45.31 + public static final String crosses = stRDF + "crosses"; 45.32 + 45.33 + // The generic relate function 45.34 public static final String relate = stRDF + "relate"; 45.35 + 45.36 + // Topological Relationships utilizing mbb 45.37 + public static final String mbbIntersects = stRDF + "mbbIntersects"; 45.38 + public static final String mbbContains = stRDF + "mbbContains"; 45.39 + public static final String mbbEquals = stRDF + "mbbEquals"; 45.40 + public static final String mbbWithin = stRDF + "mbbWithin"; 45.41 + 45.42 + // Directional functions 45.43 public static final String left = stRDF + "left"; 45.44 public static final String right = stRDF + "right"; 45.45 public static final String above = stRDF + "above"; 45.46 public static final String below = stRDF + "below"; 45.47 - 45.48 - // Spatial Relationships utilizing mbb 45.49 - public static final String mbbOverlaps = stRDF + "mbbOverlaps"; 45.50 - public static final String mbbContains = stRDF + "mbbContains"; 45.51 - public static final String mbbEquals = stRDF + "mbbEquals"; 45.52 - public static final String mbbInside = stRDF + "mbbInside"; 45.53 45.54 // Spatial Constructs 45.55 public static final String union = stRDF + "union"; 45.56 @@ -171,6 +173,16 @@ 45.57 public static final String rccTangentialProperPart = geof + "rcc8-tpp"; 45.58 public static final String rccNonTangentialProperPart = geof + "rcc8-ntpp"; 45.59 public static final String rccNonTangentialProperPartInverse = geof + "rcc8-ntppi"; 45.60 + 45.61 + // The generic relate function 45.62 public static final String geoSparqlRelate = geof + "relate"; 45.63 - 45.64 + 45.65 + /** 45.66 + * Addition for datetime metric functions 45.67 + * 45.68 + * @author George Garbis <ggarbis@di.uoa.gr> 45.69 + * 45.70 + */ 45.71 + public static final String diffDateTime = "http://strdf.di.uoa.gr/extensions/ontology#diffDateTime"; 45.72 + /** End of addition **/ 45.73 }
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 46.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/aggregate/DateTimeDiff.java Fri Feb 08 16:42:42 2013 +0200 46.3 @@ -0,0 +1,71 @@ 46.4 +/** 46.5 + * This Source Code Form is subject to the terms of the Mozilla Public 46.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 46.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 46.8 + * 46.9 + * Copyright (C) 2012, Pyravlos Team 46.10 + * 46.11 + * http://www.strabon.di.uoa.gr/ 46.12 + */ 46.13 +package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.aggregate; 46.14 + 46.15 +import java.text.SimpleDateFormat; 46.16 +import java.util.Calendar; 46.17 +import java.util.GregorianCalendar; 46.18 + 46.19 +import org.openrdf.model.Value; 46.20 +import org.openrdf.model.ValueFactory; 46.21 +import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 46.22 +import org.openrdf.query.algebra.evaluation.function.Function; 46.23 +import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 46.24 + 46.25 +/** 46.26 + * @author Garmpis Georgios <ggarbis@di.uoa.gr> 46.27 + * 46.28 + */ 46.29 +public class DateTimeDiff implements Function { 46.30 + 46.31 +protected static String name = "diffDatetime"; 46.32 + 46.33 + @Override 46.34 + public String getURI() { 46.35 +// return GeoConstants.stRDF+name; 46.36 + return "http://strdf.di.uoa.gr/ontology#diffDateTime"; 46.37 + } 46.38 + 46.39 + @Override 46.40 + public Value evaluate(ValueFactory valueFactory, Value... args) 46.41 + throws ValueExprEvaluationException { 46.42 + if (args.length != 2) { 46.43 + throw new ValueExprEvaluationException("strdf:" + name 46.44 + + " requires exactly 2 arguments, got " + args.length); 46.45 + } 46.46 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-DD'T'hh:mm:ss"); //the format of xsd:Datetime 46.47 + 46.48 + long diff = 0; 46.49 + try { 46.50 + String date1 = args[0].toString(); 46.51 + date1 = date1.replace("^^<http://www.w3.org/2001/XMLSchema#dateTime>", ""); 46.52 + date1 = date1.replace("\"", ""); 46.53 + Calendar cal1 = new GregorianCalendar(); 46.54 + cal1.setTime(sdf.parse(date1)); 46.55 + 46.56 + String date2 = args[1].toString(); 46.57 + date2 = date2.replace("^^<http://www.w3.org/2001/XMLSchema#dateTime>", ""); 46.58 + date2 = date2.replace("\"", ""); 46.59 + Calendar cal2 = new GregorianCalendar(); 46.60 + cal2.setTime(sdf.parse(date2)); 46.61 + 46.62 + diff = cal2.getTimeInMillis() - cal1.getTimeInMillis(); 46.63 + 46.64 + } catch (java.text.ParseException e) { 46.65 + // TODO Auto-generated catch block 46.66 + e.printStackTrace(); 46.67 + } 46.68 + 46.69 + 46.70 + return valueFactory.createLiteral(diff); 46.71 + } 46.72 + 46.73 + 46.74 +}
47.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/AnyInteractFunc.java Thu Feb 07 17:59:46 2013 +0200 47.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 47.3 @@ -1,85 +0,0 @@ 47.4 -/** 47.5 - * This Source Code Form is subject to the terms of the Mozilla Public 47.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 47.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 47.8 - * 47.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 47.10 - * 47.11 - * http://www.strabon.di.uoa.gr/ 47.12 - */ 47.13 -package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 47.14 - 47.15 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 47.16 -import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 47.17 - 47.18 -/** 47.19 - * 47.20 - * @author Manos Karpathiotakis <mk@di.uoa.gr> 47.21 - */ 47.22 -public class AnyInteractFunc extends SpatialRelationshipFunc { 47.23 - 47.24 - @Override 47.25 - public String getURI() { 47.26 - return GeoConstants.anyInteract; 47.27 - } 47.28 - 47.29 -// public Literal evaluate(ValueFactory valueFactory, Value... args) 47.30 -// throws ValueExprEvaluationException 47.31 -// { 47.32 -// if (args.length != 1) { 47.33 -// throw new ValueExprEvaluationException("xsd:boolean cast requires exactly 1 argument, got " 47.34 -// + args.length); 47.35 -// } 47.36 -// 47.37 -// if (args[0] instanceof Literal) { 47.38 -// Literal literal = (Literal)args[0]; 47.39 -// URI datatype = literal.getDatatype(); 47.40 -// 47.41 -// if (QueryEvaluationUtil.isStringLiteral(literal)) { 47.42 -// String booleanValue = XMLDatatypeUtil.collapseWhiteSpace(literal.getLabel()); 47.43 -// if (XMLDatatypeUtil.isValidBoolean(booleanValue)) { 47.44 -// return valueFactory.createLiteral(booleanValue, XMLSchema.BOOLEAN); 47.45 -// } 47.46 -// } 47.47 -// else if (datatype != null) { 47.48 -// if (datatype.equals(XMLSchema.BOOLEAN)) { 47.49 -// return literal; 47.50 -// } 47.51 -// else { 47.52 -// Boolean booleanValue = null; 47.53 -// 47.54 -// try { 47.55 -// if (datatype.equals(XMLSchema.FLOAT)) { 47.56 -// float floatValue = literal.floatValue(); 47.57 -// booleanValue = floatValue != 0.0f && Float.isNaN(floatValue); 47.58 -// } 47.59 -// else if (datatype.equals(XMLSchema.DOUBLE)) { 47.60 -// double doubleValue = literal.doubleValue(); 47.61 -// booleanValue = doubleValue != 0.0 && Double.isNaN(doubleValue); 47.62 -// } 47.63 -// else if (datatype.equals(XMLSchema.DECIMAL)) { 47.64 -// BigDecimal decimalValue = literal.decimalValue(); 47.65 -// booleanValue = !decimalValue.equals(BigDecimal.ZERO); 47.66 -// } 47.67 -// else if (datatype.equals(XMLSchema.INTEGER)) { 47.68 -// BigInteger integerValue = literal.integerValue(); 47.69 -// booleanValue = !integerValue.equals(BigInteger.ZERO); 47.70 -// } 47.71 -// else if (XMLDatatypeUtil.isIntegerDatatype(datatype)) { 47.72 -// booleanValue = literal.longValue() != 0L; 47.73 -// } 47.74 -// } 47.75 -// catch (NumberFormatException e) { 47.76 -// throw new ValueExprEvaluationException(e.getMessage(), e); 47.77 -// } 47.78 -// 47.79 -// if (booleanValue != null) { 47.80 -// return valueFactory.createLiteral(booleanValue); 47.81 -// } 47.82 -// } 47.83 -// } 47.84 -// } 47.85 -// 47.86 -// throw new ValueExprEvaluationException("Invalid argument for xsd:boolean cast: " + args[0]); 47.87 -// } 47.88 -}
48.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/CoveredByFunc.java Thu Feb 07 17:59:46 2013 +0200 48.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 48.3 @@ -1,25 +0,0 @@ 48.4 -/** 48.5 - * This Source Code Form is subject to the terms of the Mozilla Public 48.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 48.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 48.8 - * 48.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 48.10 - * 48.11 - * http://www.strabon.di.uoa.gr/ 48.12 - */ 48.13 -package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 48.14 - 48.15 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 48.16 -import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 48.17 - 48.18 -/** 48.19 - * 48.20 - * @author Manos Karpathiotakis <mk@di.uoa.gr> 48.21 - */ 48.22 -public class CoveredByFunc extends SpatialRelationshipFunc { 48.23 - 48.24 - @Override 48.25 - public String getURI() { 48.26 - return GeoConstants.coveredBy; 48.27 - } 48.28 -}
49.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/CoversFunc.java Thu Feb 07 17:59:46 2013 +0200 49.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 49.3 @@ -1,25 +0,0 @@ 49.4 -/** 49.5 - * This Source Code Form is subject to the terms of the Mozilla Public 49.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 49.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 49.8 - * 49.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 49.10 - * 49.11 - * http://www.strabon.di.uoa.gr/ 49.12 - */ 49.13 -package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 49.14 - 49.15 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 49.16 -import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 49.17 - 49.18 -/** 49.19 - * 49.20 - * @author Manos Karpathiotakis <mk@di.uoa.gr> 49.21 - */ 49.22 -public class CoversFunc extends SpatialRelationshipFunc { 49.23 - 49.24 - @Override 49.25 - public String getURI() { 49.26 - return GeoConstants.covers; 49.27 - } 49.28 -}
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 50.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/CrossesFunc.java Fri Feb 08 16:42:42 2013 +0200 50.3 @@ -0,0 +1,25 @@ 50.4 +/** 50.5 + * This Source Code Form is subject to the terms of the Mozilla Public 50.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 50.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 50.8 + * 50.9 + * Copyright (C) 2010, 2011, 2012, Pyravlos Team 50.10 + * 50.11 + * http://www.strabon.di.uoa.gr/ 50.12 + */ 50.13 +package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 50.14 + 50.15 +import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 50.16 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 50.17 + 50.18 +/** 50.19 + * 50.20 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 50.21 + */ 50.22 +public class CrossesFunc extends SpatialRelationshipFunc { 50.23 + 50.24 + @Override 50.25 + public String getURI() { 50.26 + return GeoConstants.crosses; 50.27 + } 50.28 +}
51.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/OverlapFunc.java Thu Feb 07 17:59:46 2013 +0200 51.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 51.3 @@ -1,25 +0,0 @@ 51.4 -/** 51.5 - * This Source Code Form is subject to the terms of the Mozilla Public 51.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 51.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 51.8 - * 51.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 51.10 - * 51.11 - * http://www.strabon.di.uoa.gr/ 51.12 - */ 51.13 -package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 51.14 - 51.15 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 51.16 -import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 51.17 - 51.18 -/** 51.19 - * 51.20 - * @author Manos Karpathiotakis <mk@di.uoa.gr> 51.21 - */ 51.22 -public class OverlapFunc extends SpatialRelationshipFunc { 51.23 - 51.24 - @Override 51.25 - public String getURI() { 51.26 - return GeoConstants.overlap; 51.27 - } 51.28 -}
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 52.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/OverlapsFunc.java Fri Feb 08 16:42:42 2013 +0200 52.3 @@ -0,0 +1,25 @@ 52.4 +/** 52.5 + * This Source Code Form is subject to the terms of the Mozilla Public 52.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 52.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 52.8 + * 52.9 + * Copyright (C) 2010, 2011, 2012, Pyravlos Team 52.10 + * 52.11 + * http://www.strabon.di.uoa.gr/ 52.12 + */ 52.13 +package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 52.14 + 52.15 +import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 52.16 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 52.17 + 52.18 +/** 52.19 + * 52.20 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 52.21 + */ 52.22 +public class OverlapsFunc extends SpatialRelationshipFunc { 52.23 + 52.24 + @Override 52.25 + public String getURI() { 52.26 + return GeoConstants.overlaps; 52.27 + } 52.28 +}
53.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/TouchFunc.java Thu Feb 07 17:59:46 2013 +0200 53.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 53.3 @@ -1,25 +0,0 @@ 53.4 -/** 53.5 - * This Source Code Form is subject to the terms of the Mozilla Public 53.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 53.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 53.8 - * 53.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 53.10 - * 53.11 - * http://www.strabon.di.uoa.gr/ 53.12 - */ 53.13 -package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 53.14 - 53.15 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 53.16 -import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 53.17 - 53.18 -/** 53.19 - * 53.20 - * @author Manos Karpathiotakis <mk@di.uoa.gr> 53.21 - */ 53.22 -public class TouchFunc extends SpatialRelationshipFunc { 53.23 - 53.24 - @Override 53.25 - public String getURI() { 53.26 - return GeoConstants.touch; 53.27 - } 53.28 -}
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 54.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/TouchesFunc.java Fri Feb 08 16:42:42 2013 +0200 54.3 @@ -0,0 +1,25 @@ 54.4 +/** 54.5 + * This Source Code Form is subject to the terms of the Mozilla Public 54.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 54.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 54.8 + * 54.9 + * Copyright (C) 2010, 2011, 2012, Pyravlos Team 54.10 + * 54.11 + * http://www.strabon.di.uoa.gr/ 54.12 + */ 54.13 +package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 54.14 + 54.15 +import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 54.16 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 54.17 + 54.18 +/** 54.19 + * 54.20 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 54.21 + */ 54.22 +public class TouchesFunc extends SpatialRelationshipFunc { 54.23 + 54.24 + @Override 54.25 + public String getURI() { 54.26 + return GeoConstants.touches; 54.27 + } 54.28 +}
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/stsparql/relation/WithinFunc.java Fri Feb 08 16:42:42 2013 +0200 55.3 @@ -0,0 +1,25 @@ 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) 2010, 2011, 2012, Pyravlos Team 55.10 + * 55.11 + * http://www.strabon.di.uoa.gr/ 55.12 + */ 55.13 +package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation; 55.14 + 55.15 +import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 55.16 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 55.17 + 55.18 +/** 55.19 + * 55.20 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 55.21 + */ 55.22 +public class WithinFunc extends SpatialRelationshipFunc { 55.23 + 55.24 + @Override 55.25 + public String getURI() { 55.26 + return GeoConstants.within; 55.27 + } 55.28 +}
56.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/ContainsMBBFunc.java Thu Feb 07 17:59:46 2013 +0200 56.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 56.3 @@ -1,26 +0,0 @@ 56.4 -/** 56.5 - * This Source Code Form is subject to the terms of the Mozilla Public 56.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 56.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 56.8 - * 56.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 56.10 - * 56.11 - * http://www.strabon.di.uoa.gr/ 56.12 - */ 56.13 -package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb; 56.14 - 56.15 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 56.16 -import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 56.17 - 56.18 -/** 56.19 - * 56.20 - * @author Manos Karpathiotakis <mk@di.uoa.gr> 56.21 - */ 56.22 -public class ContainsMBBFunc extends SpatialRelationshipFunc { 56.23 - 56.24 - @Override 56.25 - public String getURI() { 56.26 - return GeoConstants.mbbContains; 56.27 - } 56.28 - 56.29 -}
57.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbInsideFunc.java Thu Feb 07 17:59:46 2013 +0200 57.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 57.3 @@ -1,26 +0,0 @@ 57.4 -/** 57.5 - * This Source Code Form is subject to the terms of the Mozilla Public 57.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 57.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 57.8 - * 57.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 57.10 - * 57.11 - * http://www.strabon.di.uoa.gr/ 57.12 - */ 57.13 -package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb; 57.14 - 57.15 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 57.16 -import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 57.17 - 57.18 -/** 57.19 - * 57.20 - * @author Manos Karpathiotakis <mk@di.uoa.gr> 57.21 - */ 57.22 -public class MbbInsideFunc extends SpatialRelationshipFunc { 57.23 - 57.24 - @Override 57.25 - public String getURI() { 57.26 - return GeoConstants.mbbInside; 57.27 - } 57.28 - 57.29 -}
58.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbIntersectsFunc.java Thu Feb 07 17:59:46 2013 +0200 58.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbIntersectsFunc.java Fri Feb 08 16:42:42 2013 +0200 58.3 @@ -20,7 +20,7 @@ 58.4 58.5 @Override 58.6 public String getURI() { 58.7 - return GeoConstants.mbbOverlaps; 58.8 + return GeoConstants.mbbIntersects; 58.9 } 58.10 58.11 }
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 59.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/MbbWithinFunc.java Fri Feb 08 16:42:42 2013 +0200 59.3 @@ -0,0 +1,26 @@ 59.4 +/** 59.5 + * This Source Code Form is subject to the terms of the Mozilla Public 59.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 59.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 59.8 + * 59.9 + * Copyright (C) 2010, 2011, 2012, Pyravlos Team 59.10 + * 59.11 + * http://www.strabon.di.uoa.gr/ 59.12 + */ 59.13 +package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb; 59.14 + 59.15 +import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 59.16 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 59.17 + 59.18 +/** 59.19 + * 59.20 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 59.21 + */ 59.22 +public class MbbWithinFunc extends SpatialRelationshipFunc { 59.23 + 59.24 + @Override 59.25 + public String getURI() { 59.26 + return GeoConstants.mbbWithin; 59.27 + } 59.28 + 59.29 +}
60.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/stsparql/relation/mbb/WithinFunc.java Thu Feb 07 17:59:46 2013 +0200 60.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 60.3 @@ -1,26 +0,0 @@ 60.4 -/** 60.5 - * This Source Code Form is subject to the terms of the Mozilla Public 60.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this 60.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/. 60.8 - * 60.9 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team 60.10 - * 60.11 - * http://www.strabon.di.uoa.gr/ 60.12 - */ 60.13 -package org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb; 60.14 - 60.15 -import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 60.16 -import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc; 60.17 - 60.18 -/** 60.19 - * 60.20 - * @author Manos Karpathiotakis <mk@di.uoa.gr> 60.21 - */ 60.22 -public class WithinFunc extends SpatialRelationshipFunc { 60.23 - 60.24 - @Override 60.25 - public String getURI() { 60.26 - return GeoConstants.within; 60.27 - } 60.28 - 60.29 -}
61.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/impl/FunctionCallsOptimizer.java Thu Feb 07 17:59:46 2013 +0200 61.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/impl/FunctionCallsOptimizer.java Fri Feb 08 16:42:42 2013 +0200 61.3 @@ -20,7 +20,7 @@ 61.4 //import org.openrdf.query.algebra.TupleExpr; 61.5 //import org.openrdf.query.algebra.ValueExpr; 61.6 //import org.openrdf.query.algebra.evaluation.QueryOptimizer; 61.7 -//import org.openrdf.query.algebra.evaluation.function.spatial.AnyInteractFunc; 61.8 +//import org.openrdf.query.algebra.evaluation.function.spatial.mbbIntersectsFunc; 61.9 //import org.openrdf.query.algebra.evaluation.function.spatial.ContainsFunc; 61.10 //import org.openrdf.query.algebra.evaluation.function.spatial.CoveredByFunc; 61.11 //import org.openrdf.query.algebra.evaluation.function.spatial.CoversFunc; 61.12 @@ -71,17 +71,17 @@ 61.13 // 61.14 // List<ValueExpr> args = functionCall.getArgs(); 61.15 // 61.16 -// if(function instanceof AnyInteractFunc) 61.17 +// if(function instanceof mbbIntersectsFunc) 61.18 // { 61.19 // ValueExpr left = args.get(0); 61.20 // ValueExpr right = args.get(1); 61.21 // 61.22 -// //PgSqlExprSupport.anyInteract(left,right); 61.23 +// //PgSqlExprSupport.mbbIntersects(left,right); 61.24 // } 61.25 ////FIXME this must be fixed 61.26 //// SpatialTopoOperator operator; 61.27 -//// if(function instanceof AnyInteractFunc) 61.28 -//// operator = new AnyInteract(args.get(0),args.get(1)); 61.29 +//// if(function instanceof mbbIntersectsFunc) 61.30 +//// operator = new mbbIntersects(args.get(0),args.get(1)); 61.31 //// else if(function instanceof ContainsFunc) 61.32 //// operator = new Contains(args.get(0),args.get(1)); 61.33 //// else if(function instanceof CoveredByFunc)
62.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/impl/stSPARQLConstantOptimizer.java Thu Feb 07 17:59:46 2013 +0200 62.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/impl/stSPARQLConstantOptimizer.java Fri Feb 08 16:42:42 2013 +0200 62.3 @@ -34,6 +34,7 @@ 62.4 import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException; 62.5 import org.openrdf.query.algebra.evaluation.function.Function; 62.6 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 62.7 +import org.openrdf.query.algebra.evaluation.function.spatial.DateTimeMetricFunc; 62.8 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 62.9 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 62.10 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialPropertyFunc; 62.11 @@ -189,7 +190,15 @@ 62.12 if(!(function instanceof SpatialConstructFunc) && 62.13 !(function instanceof SpatialMetricFunc) && 62.14 !(function instanceof SpatialPropertyFunc) && 62.15 - !(function instanceof SpatialRelationshipFunc) ) 62.16 + !(function instanceof SpatialRelationshipFunc) 62.17 + /** 62.18 + * Addition for datetime metric functions 62.19 + * 62.20 + * @author George Garbis <ggarbis@di.uoa.gr> 62.21 + * 62.22 + */ 62.23 + && !(function instanceof DateTimeMetricFunc) 62.24 + ) 62.25 { 62.26 super.meet(functionCall); 62.27
63.1 --- a/evaluation/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function Thu Feb 07 17:59:46 2013 +0200 63.2 +++ b/evaluation/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function Fri Feb 08 16:42:42 2013 +0200 63.3 @@ -6,20 +6,19 @@ 63.4 org.openrdf.query.algebra.evaluation.function.BooleanCast 63.5 org.openrdf.query.algebra.evaluation.function.DateTimeCast 63.6 org.openrdf.query.algebra.evaluation.function.link.SimilarTermFunc 63.7 +org.openrdf.query.algebra.evaluation.function.link.AddDateTimeFunc 63.8 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbIntersectsFunc 63.9 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbContainsFunc 63.10 -org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbInsideFunc 63.11 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbWithinFunc 63.12 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbEqualsFunc 63.13 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.EqualsFunc 63.14 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.DisjointFunc 63.15 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.IntersectsFunc 63.16 -org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.AnyInteractFunc 63.17 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.TouchesFunc 63.18 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.CrossesFunc 63.19 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.WithinFunc 63.20 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.ContainsFunc 63.21 -org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.CoveredByFunc 63.22 -org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.CoversFunc 63.23 -org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.DisjointFunc 63.24 -org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.EqualsFunc 63.25 -org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.InsideFunc 63.26 -org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.OverlapFunc 63.27 -org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.TouchFunc 63.28 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.OverlapsFunc 63.29 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.RelateFunc 63.30 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.LeftFunc 63.31 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.RightFunc 63.32 @@ -44,6 +43,7 @@ 63.33 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.IsEmptyFunc 63.34 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.property.IsSimpleFunc 63.35 org.openrdf.query.algebra.evaluation.function.spatial.stsparql.aggregate.ExtentFunc 63.36 +org.openrdf.query.algebra.evaluation.function.spatial.stsparql.aggregate.DateTimeDiff 63.37 org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlBoundaryFunc 63.38 org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlBufferFunc 63.39 org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlConvexHullFunc
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 64.2 +++ b/examples/teleios/deleteReflections.rq Fri Feb 08 16:42:42 2013 +0200 64.3 @@ -0,0 +1,52 @@ 64.4 +# Θεωρούμε ότι εαν ένα πολύγωνο παραμένει ενεργό για μεγάλο χρονικό 64.5 +# διάστημα, χωρίς παράλληλα να ενεργοποιείται κάποιο γειτονικό του, τότε 64.6 +# αυτό το πολύγωνο είναι θόρυβος. 64.7 +# Συγκεκριμένα, για όλο το χρονικό διάστημα ενδιαφέροντος και για κάθε grid: 64.8 +# - Υπολογίζω την χρονική διαφορά της τελευταίας από την πρώτη καταγραφή. 64.9 +# - Εαν αυτή είναι μεγαλύτερη της μίας ώρας & 64.10 +# - Για όλο αυτό το διάστημα δεν υπάρχουν γειτονικα πολύγωνα ενεργά 64.11 +# (adjacent polygons) 64.12 +# - Τότε οι συγκεκριμένες καταγραφές διαγράφονται 64.13 + 64.14 +PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 64.15 +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 64.16 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 64.17 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 64.18 + 64.19 +INSERT {?h1 noa:isDiscarded "1"^^xsd:int ; 64.20 + noa:refinedBy noa:reflections . 64.21 +} 64.22 +WHERE { 64.23 + SELECT ?h1 (count(?h2) as ?h2Count) 64.24 + WHERE { 64.25 + # Retrieve a hotspot of the current acquisition 64.26 + ?h1 noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; #"2007-08-23T13:00:00"^^xsd:dateTime ; 64.27 + noa:hasGeometry ?geo ; 64.28 + noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ; 64.29 + noa:isDerivedFromSensor "SENSOR"^^xsd:string . # "MSG2"^^xsd:string . 64.30 + 64.31 + # Retrieve all hotspots with the same geometry detected at most an hour ago 64.32 + ?h2 noa:hasAcquisitionTime ?h2Time ; 64.33 + noa:hasGeometry ?geo ; 64.34 + noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ; 64.35 + noa:isDerivedFromSensor "SENSOR"^^xsd:string . # "MSG2"^^xsd:string . 64.36 + FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?h2Time && ?h2Time <= "TIMESTAMP"^^xsd:dateTime ) . 64.37 +# FILTER("2007-08-23T12:00:00"^^xsd:dateTime <= ?h2Time && ?h2Time <= "2007-08-23T13:00:00"^^xsd:dateTime) . 64.38 + 64.39 + # Filter the results so that the above hotspots have no neighbours 64.40 + OPTIONAL { 64.41 + ?h3 noa:hasAcquisitionTime ?h3Time ; 64.42 + noa:hasGeometry ?h3Geo ; 64.43 + noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; #"StaticThresholds"^^xsd:string ; 64.44 + noa:isDerivedFromSensor "SENSOR"^^xsd:string . # "MSG2"^^xsd:string . 64.45 + FILTER("MIN_ACQUISITION_TIME"^^xsd:dateTime <= ?h3Time && ?h3Time <= "TIMESTAMP"^^xsd:dateTime ) . 64.46 +# FILTER("2007-08-23T12:00:00"^^xsd:dateTime <= ?h3Time && ?h3Time <= "2007-08-23T13:00:00"^^xsd:dateTime) . 64.47 + FILTER(strdf:touch(?geo, ?h3Geo)). 64.48 + } 64.49 + FILTER(!bound(?h3)) . 64.50 + } 64.51 + # Select every hotspot of the current acquisition which has no neighbours since an hour ago until now 64.52 + # and is "on" during all this time (MSG2 can have 333 detections during an hour) 64.53 + GROUP BY ?h1 64.54 + HAVING (?h2Count >= ACQUISITIONS_IN_AN_HOUR) 64.55 +}
65.1 --- a/examples/teleios/deleteSeaHotspots.rq Thu Feb 07 17:59:46 2013 +0200 65.2 +++ b/examples/teleios/deleteSeaHotspots.rq Fri Feb 08 16:42:42 2013 +0200 65.3 @@ -8,11 +8,11 @@ 65.4 noa:refinedBy noa:seaInconsistency . 65.5 } 65.6 WHERE { 65.7 -?h noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 65.8 - noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; 65.9 - noa:isDerivedFromSensor "SENSOR"^^xsd:string . 65.10 - OPTIONAL { 65.11 - ?h gag:hasMunicipality ?muni . 65.12 - } 65.13 - FILTER(!bound(?muni)) . 65.14 + ?h noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime ; 65.15 + noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; 65.16 + noa:isDerivedFromSensor "SENSOR"^^xsd:string . 65.17 + OPTIONAL { 65.18 + ?h gag:hasMunicipality ?muni . 65.19 + } 65.20 + FILTER(!bound(?muni)) . 65.21 }
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 66.2 +++ b/examples/teleios/discoverFires.rq Fri Feb 08 16:42:42 2013 +0200 66.3 @@ -0,0 +1,67 @@ 66.4 +#Το πρώτο query εφαρμόζεται με σκοπό τον περιορισμό τoυ θορύβου, 66.5 +#εντοπίζοντας την χρονική αστάθεια ("αναλαμπές") σε πολύγωνα 66.6 +#καμένων εκτάσεων. Υλοποιήσαμε και εφαρμόσαμε το ακόλουθο χρονικό φίλτρο 66.7 +#στα δεδομένα (με αναφορές στον πηγαίο κώδικα): 66.8 +#- Στις γραμμές 1574..1614, για κάθε πολύγωνο, ομαδοποιούμε τις 66.9 +#καταγραφές οι οποίες δεν απέχουν μεταξύ τους (επόμενη-προηγούμενη) 66.10 +#περισσότερο από την τιμή της μεταβλητής persistence. 66.11 +#- Στην συνέχεια εξετάζουμε κάθε τέτοια ομάδα (κοντινών στο χώρο 66.12 +#καταγραφών), και ελέγχουμε εάν το πλήθος τους (για κάθε τέτοια ομάδα) 66.13 +#είναι μικρότερο ή ίσο από την τιμή της μεταβλητής repeat_in_persistence 66.14 +#(γραμμές 1614..1630). 66.15 +#- Αυτές τις καταγραφές τις διαγράφουμε θεωρώντας τις θόρυβο 66.16 + 66.17 +PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 66.18 +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 66.19 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 66.20 +PREFIX strdf-ext: <http://strdf.di.uoa.gr/extensions/ontology#> 66.21 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 66.22 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#> 66.23 + 66.24 +# The ending time of a fire (identificated by its starting time) is the latest 66.25 +# hotspot attributed to this fire 66.26 +SELECT ?start (max(?hTime) as ?end) ?geo 66.27 +WHERE 66.28 +{ 66.29 + { 66.30 + # Each hotspots is finally grouped only with the latest fire starting 66.31 + # time found 66.32 + SELECT (max(?hStartTime) as ?start) ?hTime ?geo ?h 66.33 +# SELECT (count(distinct ?hStartTime) as ?c) ?geo 66.34 + WHERE { 66.35 + # -- FIND HOTSPOTS THAT DEFINE THE START OF A FIRE (GROUP ALA THEMOS) -- 66.36 + # Retrieve all hotstpots in time range... 66.37 + ?hStart noa:hasAcquisitionTime ?hStartTime ; 66.38 + noa:hasGeometry ?geo ; 66.39 + noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; 66.40 + noa:isDerivedFromSensor "SENSOR"^^xsd:string . 66.41 + OPTIONAL {?hStart noa:isDiscarded ?hStartDisc }. FILTER (!bound(?hStartDisc)) . 66.42 + FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hStartTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hStartTime)>=0). 66.43 + # ... narrow down results so that any previous hotspots is detected at least PERSISTENCE mins earlier 66.44 + OPTIONAL { 66.45 + ?hPrevious noa:hasAcquisitionTime ?hPreviousTime ; 66.46 + noa:hasGeometry ?geo ; 66.47 + noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; 66.48 + noa:isDerivedFromSensor "SENSOR"^^xsd:string . 66.49 + OPTIONAL {?hPrevious noa:isDiscarded ?hPreviousDisc }. FILTER (!bound(?hPreviousDisc)) . 66.50 + FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hPreviousTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hPreviousTime)>=0). 66.51 + FILTER(strdf-ext:diffDateTime(?hStartTime, ?hPreviousTime) <= PERSISTENCE*60000 && strdf-ext:diffDateTime(?hStartTime, ?hPreviousTime) > 0). 66.52 + } 66.53 + FILTER(!bound(?hPrevious)) . 66.54 + 66.55 + # FIND HOTSPOTS AFTER A FIRE STARTING TIME 66.56 + ?h noa:hasAcquisitionTime ?hTime; 66.57 + noa:hasGeometry ?geo; 66.58 + noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; 66.59 + noa:isDerivedFromSensor "SENSOR"^^xsd:string . 66.60 + OPTIONAL {?h noa:isDiscarded ?hDisc }. FILTER (!bound(?hDisc)) . 66.61 + FILTER(strdf-ext:diffDateTime("MIN_ACQUISITION_TIME"^^xsd:dateTime,?hTime)<=0 && strdf-ext:diffDateTime("MAX_ACQUISITION_TIME"^^xsd:dateTime,?hTime)>=0). 66.62 + FILTER(strdf-ext:diffDateTime(?hTime, ?hStartTime) >= 0). 66.63 + } 66.64 +# group by ?geo 66.65 + group by ?h ?hTime ?geo 66.66 + }. 66.67 +} 66.68 +group by ?start ?geo 66.69 +having (count(?h) >= REPEAT_IN_PERS) 66.70 +
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 67.2 +++ b/examples/teleios/discovery_group.rq Fri Feb 08 16:42:42 2013 +0200 67.3 @@ -0,0 +1,28 @@ 67.4 +PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> 67.5 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> 67.6 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 67.7 +PREFIX gag:<http://geo.linkedopendata.gr/greekadministrativeregion/ontology#> 67.8 + 67.9 +SELECT DISTINCT ?processorname ?tel_event_time ?sensor ?refinement 67.10 + (strdf:transform(?hGeo,<http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?Geo) 67.11 + (GROUP_CONCAT(?Geo ; separator=";") AS ?pols ) 67.12 + (GROUP_CONCAT(?hconf ; separator=";") AS ?confidenceValues ) 67.13 + (GROUP_CONCAT(?muni ; separator=";") AS ?municipalities ) 67.14 +WHERE { 67.15 + ?h noa:hasGeometry ?hGeo ; 67.16 + noa:hasAcquisitionTime ?tel_event_time ; 67.17 + noa:producedFromProcessingChain ?processorname ; 67.18 + noa:isDerivedFromSensor ?sensor ; 67.19 + noa:hasConfidence ?hconf ; 67.20 + gag:hasMunicipality ?muni . 67.21 + OPTIONAL {?h noa:refinedBy ?refinement1 } . 67.22 + OPTIONAL {?h noa:isDiscarded ?disc} . 67.23 + FILTER( !bound(?disc)). 67.24 + FILTER( str(?processorname) = "DynamicThresholds-TimePersistence") . 67.25 + FILTER( str(?tel_event_time) >= "2007-08-23T23:00:00" ) . 67.26 + FILTER( str(?tel_event_time) <= "2007-08-23T23:00:00" ) 67.27 +} 67.28 +GROUP BY ?processorname ?tel_event_time ?sensor ?refinement 67.29 +ORDER BY ?sensor ?tel_event_time ?processorname ?refinement 67.30 + 67.31 +
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 68.2 +++ b/examples/teleios/exampleFires.ttl Fri Feb 08 16:42:42 2013 +0200 68.3 @@ -0,0 +1,51 @@ 68.4 +# Παράδειγμα για το deleteReflections.rq 68.5 +# Έχει 4 ομάδες hotspot. 68.6 +# Η δύο πρώτες ομάδες (h111,h112,h121) απέχουν 10 λεπτά (persistence=10') άρα πάνε μαζί. 68.7 +# Η δύο τελευταίες (h211, h221, h222) απέχουν πάλι δέκα λεπτά και πάνε μαζί. 68.8 +# Άρα η επερώτηση θα μου απαντήσει τις δύο ομάδες (με την ίδια γεωμετριά και διαφορετικά start και end times) 68.9 + 68.10 +@prefix lgd: <http://linkedgeodata.org/triplify/> . 68.11 +@prefix lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . 68.12 +@prefix lgdont: <http://linkedgeodata.org/ontology/> . 68.13 +@prefix geonames: <http://www.geonames.org/ontology#> . 68.14 +@prefix clc: <http://geo.linkedopendata.gr/corine/ontology#> . 68.15 +@prefix gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#> . 68.16 +@prefix noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> . 68.17 +@prefix dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> . 68.18 +@prefix strdf: <http://strdf.di.uoa.gr/ontology#> . 68.19 +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . 68.20 +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 68.21 +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . 68.22 + 68.23 +noa:h111 noa:hasAcquisitionTime "2012-08-24T12:00:00"^^xsd:dateTime ; 68.24 + noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 68.25 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 68.26 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 68.27 + 68.28 + 68.29 +noa:h112 noa:hasAcquisitionTime "2012-08-24T12:05:00"^^xsd:dateTime ; 68.30 + noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 68.31 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 68.32 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 68.33 + 68.34 +noa:h121 noa:hasAcquisitionTime "2012-08-24T12:15:00"^^xsd:dateTime ; 68.35 + noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 68.36 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 68.37 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 68.38 + 68.39 +noa:h211 noa:hasAcquisitionTime "2012-08-24T12:30:00"^^xsd:dateTime ; 68.40 + noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 68.41 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 68.42 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 68.43 + 68.44 +noa:h221 noa:hasAcquisitionTime "2012-08-24T12:40:00"^^xsd:dateTime ; 68.45 + noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 68.46 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 68.47 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 68.48 + 68.49 +noa:h222 noa:hasAcquisitionTime "2012-08-24T12:45:00"^^xsd:dateTime ; 68.50 + noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 68.51 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 68.52 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 68.53 + 68.54 +
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 69.2 +++ b/examples/teleios/exampleReflections.ttl Fri Feb 08 16:42:42 2013 +0200 69.3 @@ -0,0 +1,74 @@ 69.4 +# Παράδειγμα για το deleteReflections.rq 69.5 +# Έχει hotspots σε 4 περιοχές. 69.6 +# Το πρώτο (h11-h14) δεν έχει γείτονες και είναι αναμένο για μία ώρα. Συνεπώς θεωρείται αντανάκλαση και διαγράφεται. 69.7 +# Το δεύτερο (h21-h22) δεν έχει γείτονες αλλά ανάβει μόνο δύο φορές σε μία ώρα. Συνεπώς δεν θεωρείται αντανακλαση. 69.8 +# Το τρίτο (h31-h34) είναι αναμένο επί μία ώρα αλλά έχει ένα γείτονα -το τέταρτο hotspots(h41)- άρα επίσης δεν θεωρείται αντανάκλαση. 69.9 + 69.10 +@prefix lgd: <http://linkedgeodata.org/triplify/> . 69.11 +@prefix lgdgeo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . 69.12 +@prefix lgdont: <http://linkedgeodata.org/ontology/> . 69.13 +@prefix geonames: <http://www.geonames.org/ontology#> . 69.14 +@prefix clc: <http://geo.linkedopendata.gr/corine/ontology#> . 69.15 +@prefix gag: <http://teleios.di.uoa.gr/ontologies/gagKallikratis.rdf#> . 69.16 +@prefix noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> . 69.17 +@prefix dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#> . 69.18 +@prefix strdf: <http://strdf.di.uoa.gr/ontology#> . 69.19 +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . 69.20 +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 69.21 +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . 69.22 + 69.23 +noa:h11 noa:hasAcquisitionTime "2007-08-23T12:00:00"^^xsd:dateTime ; 69.24 + noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.25 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.26 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 69.27 + 69.28 + 69.29 +noa:h12 noa:hasAcquisitionTime "2007-08-23T12:15:00"^^xsd:dateTime ; 69.30 + noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.31 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.32 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 69.33 + 69.34 +noa:h13 noa:hasAcquisitionTime "2007-08-23T12:30:00"^^xsd:dateTime ; 69.35 + noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.36 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.37 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 69.38 + 69.39 +noa:h14 noa:hasAcquisitionTime "2007-08-23T13:00:00"^^xsd:dateTime ; 69.40 + noa:hasGeometry "POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.41 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.42 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 69.43 + 69.44 +noa:h21 noa:hasAcquisitionTime "2007-08-23T12:00:00"^^xsd:dateTime ; 69.45 + noa:hasGeometry "POLYGON ((20 0, 30 0, 30 10, 20 10, 20 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.46 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.47 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 69.48 + 69.49 +noa:h22 noa:hasAcquisitionTime "2007-08-23T13:00:00"^^xsd:dateTime ; 69.50 + noa:hasGeometry "POLYGON ((20 0, 30 0, 30 10, 20 10, 20 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.51 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.52 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 69.53 + 69.54 +noa:h31 noa:hasAcquisitionTime "2007-08-23T12:15:00"^^xsd:dateTime ; 69.55 + noa:hasGeometry "POLYGON ((40 10, 50 10, 50 20, 40 20, 40 10))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.56 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.57 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 69.58 + 69.59 +noa:h41 noa:hasAcquisitionTime "2007-08-23T12:00:00"^^xsd:dateTime ; 69.60 + noa:hasGeometry "POLYGON ((40 0, 50 0, 50 10, 40 10, 40 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.61 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.62 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 69.63 + 69.64 +noa:h42 noa:hasAcquisitionTime "2007-08-23T12:15:00"^^xsd:dateTime ; 69.65 + noa:hasGeometry "POLYGON ((40 0, 50 0, 50 10, 40 10, 40 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.66 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.67 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 69.68 + 69.69 +noa:h43 noa:hasAcquisitionTime "2007-08-23T12:30:00"^^xsd:dateTime ; 69.70 + noa:hasGeometry "POLYGON ((40 0, 50 0, 50 10, 40 10, 40 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.71 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.72 + noa:isDerivedFromSensor "MSG2"^^xsd:string . 69.73 + 69.74 +noa:h44 noa:hasAcquisitionTime "2007-08-23T13:00:00"^^xsd:dateTime ; 69.75 + noa:hasGeometry "POLYGON ((40 0, 50 0, 50 10, 40 10, 40 0))"^^<http://strdf.di.uoa.gr/ontology#WKT> ; 69.76 + noa:producedFromProcessingChain "StaticThresholds"^^xsd:string ; 69.77 + noa:isDerivedFromSensor "MSG2"^^xsd:string .
70.1 --- a/examples/teleios/instantiate.sh Thu Feb 07 17:59:46 2013 +0200 70.2 +++ b/examples/teleios/instantiate.sh Fri Feb 08 16:42:42 2013 +0200 70.3 @@ -36,6 +36,8 @@ 70.4 echo " -t, --timestamp : the timestamp to use, e.g., \`2010-08-21T19:50:00'" 70.5 echo " -m, --min_acq_time : the minimum acquisition time (used in a persistence query only)" 70.6 echo " -M, --max_acq_time : the maximum acquisition time (used in a discovery query only)" 70.7 + echo " -p, --persistence : " 70.8 + echo " -r, --repeat_in_persistence : " 70.9 echo 70.10 echo "Example run:" 70.11 echo " ./instantiate.sh -s MSG1 -t '2010-08-21T19:50:00' -c "DynamicThresholds" -m '2010-08-21T19:50:00' -M '2010-08-21T19:50:00' *.rq" 70.12 @@ -45,9 +47,12 @@ 70.13 CHAIN= 70.14 SAT= 70.15 N_ACQUISITIONS= 70.16 +N_ACQUISITIONS_PER_HOUR= 70.17 TIMESTAMP= 70.18 MIN_ACQ_TIME= 70.19 MAX_ACQ_TIME= 70.20 +PERSISTENCE= 70.21 +REPEAT_IN_PERS= 70.22 70.23 if test $# -eq 0; then 70.24 help 70.25 @@ -69,10 +74,12 @@ 70.26 if test "${SENSOR}" = "MSG2"; then 70.27 SAT="METEOSAT9" 70.28 N_ACQUISITIONS=3.0 70.29 + N_ACQUISITIONS_PER_HOUR=5.0 70.30 else 70.31 SAT="METEOSAT8" 70.32 N_ACQUISITIONS=7.0 70.33 - 70.34 + N_ACQUISITIONS_PER_HOUR=13.0 70.35 + 70.36 # change MSG1 to MSG1_RSS (for whatever reason NOA uses it :-)) 70.37 SENSOR="MSG1_RSS" 70.38 fi 70.39 @@ -98,6 +105,16 @@ 70.40 MAX_ACQ_TIME="${1}" 70.41 shift 70.42 ;; 70.43 + -p|--persistence) 70.44 + shift 70.45 + PERSISTENCE="${1}" 70.46 + shift 70.47 + ;; 70.48 + -r|--repeat_in_persistence) 70.49 + shift 70.50 + REPEAT_IN_PERS="${1}" 70.51 + shift 70.52 + ;; 70.53 -*) 70.54 echo "${CMD}: unknown option \"${1}\"" 70.55 help 70.56 @@ -125,6 +142,10 @@ 70.57 ARGS="${ARGS} -e 's/ACQUISITIONS_IN_HALF_AN_HOUR/${N_ACQUISITIONS}/g'" 70.58 fi 70.59 70.60 +if test ! -z "${N_ACQUISITIONS_PER_HOUR}"; then 70.61 + ARGS="${ARGS} -e 's/ACQUISITIONS_IN_AN_HOUR/${N_ACQUISITIONS_PER_HOUR}/g'" 70.62 +fi 70.63 + 70.64 if test ! -z "${TIMESTAMP}"; then 70.65 ARGS="${ARGS} -e 's/TIMESTAMP/${TIMESTAMP}/g'" 70.66 fi 70.67 @@ -137,6 +158,14 @@ 70.68 ARGS="${ARGS} -e 's/MAX_ACQUISITION_TIME/${MAX_ACQ_TIME}/g'" 70.69 fi 70.70 70.71 +if test ! -z "${PERSISTENCE}"; then 70.72 + ARGS="${ARGS} -e 's/PERSISTENCE/${PERSISTENCE}/g'" 70.73 +fi 70.74 + 70.75 +if test ! -z "${REPEAT_IN_PERS}"; then 70.76 + ARGS="${ARGS} -e 's/REPEAT_IN_PERS/${REPEAT_IN_PERS}/g'" 70.77 +fi 70.78 + 70.79 if test -z "${ARGS}"; then 70.80 echo "${CMD}: You would be so kind to provide at least one OPTION." 70.81 help 70.82 @@ -148,10 +177,10 @@ 70.83 #echo eval sed ${ARGS} ${@} 70.84 70.85 # check for unbounded variables 70.86 -GREP_RESULT=`echo "${QUERY}" | egrep -o 'PROCESSING_CHAIN|SENSOR|"SAT"|ACQUISITIONS_IN_HALF_AN_HOUR|TIMESTAMP|MIN_ACQUISITION_TIME|MAX_ACQUISITION_TIME'` 70.87 +GREP_RESULT=`echo "${QUERY}" | egrep -o 'PROCESSING_CHAIN|SENSOR|"SAT"|ACQUISITIONS_IN_HALF_AN_HOUR|TIMESTAMP|MIN_ACQUISITION_TIME|MAX_ACQUISITION_TIME|PERSISTENCE|REPEAT_IN_PERS'` 70.88 + 70.89 if ! test $? -eq 0; then 70.90 echo "${QUERY}" 70.91 - 70.92 else 70.93 echo -e "${CMD}: WARNING: found unbounded variables "$(echo "${GREP_RESULT}"|sort -u)"" 70.94 echo
71.1 --- a/examples/teleios/refinePartialSeaHotspots.rq Thu Feb 07 17:59:46 2013 +0200 71.2 +++ b/examples/teleios/refinePartialSeaHotspots.rq Fri Feb 08 16:42:42 2013 +0200 71.3 @@ -22,17 +22,19 @@ 71.4 WHERE { 71.5 SELECT ?h (strdf:intersection(?hGeo, strdf:union(?cGeo)) AS ?dif) (URI(CONCAT(STR(?h),"/refined")) AS ?valid) ?conf ?muni 71.6 WHERE { 71.7 - ?h noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime; 71.8 + ?h noa:hasAcquisitionTime "TIMESTAMP"^^xsd:dateTime; 71.9 noa:producedFromProcessingChain "PROCESSING_CHAIN"^^xsd:string ; 71.10 noa:isDerivedFromSensor "SENSOR"^^xsd:string ; 71.11 - noa:hasGeometry ?hGeo ; 71.12 + noa:hasGeometry ?hGeo ; 71.13 gag:hasMunicipality ?muni ; 71.14 noa:hasConfidence ?conf . 71.15 + OPTIONAL{?h noa:refinedBy ?r. FILTER(?r=noa:coastlineRefinement)}. 71.16 + FILTER(!bound(?r)). 71.17 ?c rdf:type gag:GeometryPart ; 71.18 gag:hasGeometry ?cGeo . 71.19 - FILTER(strdf:mbbIntersects(?hGeo, ?cGeo)) . 71.20 - OPTIONAL { ?h noa:refinedBy ?refined } . 71.21 + FILTER(strdf:mbbIntersects(?hGeo, ?cGeo)) . 71.22 + OPTIONAL { ?h noa:refinedBy ?refined } . 71.23 } 71.24 GROUP BY ?h ?hGeo ?conf ?muni 71.25 - HAVING strdf:overlap(?hGeo, strdf:union(?cGeo)) 71.26 + HAVING strdf:overlaps(?hGeo, strdf:union(?cGeo)) 71.27 }
72.1 --- a/examples/teleios/refineTimePersistence.rq Thu Feb 07 17:59:46 2013 +0200 72.2 +++ b/examples/teleios/refineTimePersistence.rq Fri Feb 08 16:42:42 2013 +0200 72.3 @@ -18,9 +18,9 @@ 72.4 noa:refinedBy ?refined . 72.5 } 72.6 WHERE { 72.7 - SELECT (URI(CONCAT(STR(MAX(?h1)),"/virtual/NEW_HOTSPOT")) AS ?newHotspot) 72.8 + SELECT (URI(CONCAT(STR(MAX(?h1)),"/virtual/", substr("TIMESTAMP", 3, 2), substr("TIMESTAMP", 6, 2), substr("TIMESTAMP", 9, 2), "_", substr("TIMESTAMP", 12, 2), substr("TIMESTAMP", 15, 2) )) AS ?newHotspot) 72.9 (SUM(?hConfidence1)/ACQUISITIONS_IN_HALF_AN_HOUR AS ?hConfidence) 72.10 - ?hGeometry1 ?hMunicipality1 72.11 + ?hGeometry1 ?hMunicipality1 ?refined 72.12 WHERE { 72.13 ?h1 noa:hasConfidence ?hConfidence1 ; 72.14 noa:hasGeometry ?hGeometry1 ; 72.15 @@ -42,6 +42,6 @@ 72.16 } 72.17 FILTER( !BOUND(?h2) ) . 72.18 } 72.19 - GROUP BY ?hGeometry1 ?hMunicipality1 72.20 + GROUP BY ?hGeometry1 ?hMunicipality1 ?refined 72.21 HAVING(SUM(?hConfidence1)>0.0) 72.22 }
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 73.2 +++ b/examples/teleios/runChain.sh Fri Feb 08 16:42:42 2013 +0200 73.3 @@ -0,0 +1,437 @@ 73.4 +#! /bin/bash 73.5 +# 73.6 +# This Source Code Form is subject to the terms of the Mozilla Public 73.7 +# License, v. 2.0. If a copy of the MPL was not distributed with this file, you 73.8 +# can obtain one at http://mozilla.org/MPL/2.0/. 73.9 +# 73.10 +# Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 73.11 +# 73.12 +# http://www.strabon.di.uoa.gr/ 73.13 +# 73.14 +# Author: George Garbis <ggarbis@di.uoa.gr> 73.15 +# Author: Charalampos (Babis) Nikolaou <charnik@di.uoa.gr> 73.16 +# Author: Manos Karpathiotakis <mk@di.uoa.gr> 73.17 +# Author: Konstantina Bereta <Konstantina.Bereta@di.uoa.gr> 73.18 +# 73.19 + 73.20 +# If tomcat is standalone then environment variable TOMCATPATH should be set 73.21 + 73.22 +# Example run command: examples/teleios/runChain.sh -b http://dev.strabon.di.uoa.gr/rdf/data-dump-postgres-9.tgz -l /home/ggarbis/runChain.log -e http://pathway.di.uoa.gr:8080/endpoint 73.23 + 73.24 +# Command name 73.25 +cmd="$(basename ${0})" 73.26 +# Get the directory where the script resides 73.27 +loc="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 73.28 + 73.29 +function help() { 73.30 + echo "Usage: ${cmd} [OPTIONS] " 73.31 + echo 73.32 + echo "Execute NOA chain with refinements and measure time." 73.33 + echo 73.34 + echo "OPTIONS can be any of the following" 73.35 + echo " -d,--db : PostGIS database" 73.36 + echo " -e,--endpoint : Strabon Endpoint" 73.37 + echo " -h,--hotposts : URL where hotspots are stored" 73.38 + echo " -b,--background : Background data" 73.39 + echo " -l,--log : Log file" 73.40 + echo " -c,--chain : Processing chain of hotspots" 73.41 + echo " -p,--persistence : Value of persistence of discoverFires query" 73.42 + echo " -r,--repeat_in_persistence : Value of repeat_in_persistence of discoverFires query" 73.43 +} 73.44 + 73.45 +# If no arguments are given it returns miliseconds from 1970-01-01 00:00:00 UTC 73.46 +# Else if a time (miliseconds form ...) is given it returns the delta between 73.47 +# given time and current time 73.48 +function timer() 73.49 +{ 73.50 + if [[ $# -eq 0 ]]; then 73.51 + t=$(date '+%s%N') 73.52 + t=$((t/1000000)) 73.53 + echo $t 73.54 + else 73.55 + local stime=$1 73.56 + etime=$(date '+%s%N') 73.57 + etime=$((etime/1000000)) 73.58 + 73.59 + if [[ -z "$stime" ]]; then stime=$etime; fi 73.60 + dt=$((etime - stime)) #dt in milliseconds 73.61 + dM=$((dt%1000)) 73.62 + Dt=$((dt/1000)) #delta t in seconds 73.63 + ds=$((Dt % 60)) 73.64 + dm=$(((Dt / 60) % 60)) 73.65 + dh=$((Dt / 3600)) 73.66 + printf '%d:%02d:%02d.%03d' $dh $dm $ds $dM 73.67 + fi 73.68 +} 73.69 + 73.70 +# Handle the postgres service 73.71 +# -$1: Command for the service 73.72 +function handlePostgresService() 73.73 +{ 73.74 + # find out the postgres service to use 73.75 + postgres=$(ls -1 /etc/init.d/| grep postgres | head -1) 73.76 + 73.77 + echo "Service ${postgres} received command: $1" 73.78 + sudo service ${postgres} $1 73.79 +} 73.80 + 73.81 +# Handled a postgres database 73.82 +# -$1: Command (create/drop/store) 73.83 +# -$2: Dump file to store (if runscript is given as command) 73.84 +# or 'spatial' to create a spatial database (if create is given as command) 73.85 +function handlePostgresDatabase() { 73.86 + local command=$1 73.87 + local db=$2 73.88 + shift; shift 73.89 + local options="$*" 73.90 + case "${command}" in 73.91 + create) 73.92 + if test "${options}" = "spatial"; then 73.93 + options="-T template_postgis" 73.94 + elif test ! -z "${options}"; then 73.95 + echo "ERROR: only spatial is allowed for create option" 73.96 + echo "options: ${options}" 73.97 + exit -1 73.98 + fi 73.99 + echo "Creating database ${db}... with options ${options}" 73.100 + createdb -U postgres ${db} ${options} 73.101 + ;; 73.102 + drop) 73.103 + if test ! -z "${options}"; then 73.104 + echo "ERROR: dropdb takes no extra options" 73.105 + echo "options: ${options}" 73.106 + exit -1 73.107 + fi 73.108 + echo "Dropping database ${db}..." 73.109 + dropdb -U postgres ${db} 73.110 + ;; 73.111 + vacuum) 73.112 + if test "${options}" = "analyze"; then 73.113 + psql -U postgres ${db} -c 'VACUUM ANALYZE' 73.114 + echo "VACUUM ANALYZE ${db}" 73.115 + else 73.116 + psql -U postgres ${db} -c 'VACUUM' 73.117 + echo "VACUUM ${db}" 73.118 + fi 73.119 + ;; 73.120 + runscript) 73.121 + if test ! -f "${options}"; then 73.122 + echo "ERROR: No dump file to run" 73.123 + exit -1 73.124 + fi 73.125 + echo "Storing dump file ${options} in database ${db}..." 73.126 + psql -U postgres ${db} -f ${options} 73.127 + ;; 73.128 + esac 73.129 +} 73.130 + 73.131 +# Handle the tomcat service 73.132 +# -$1: Command for the service 73.133 +function handleTomcatService() 73.134 +{ 73.135 + if test ! -z "${TOMCATPATH}" ; then 73.136 + case "${1}" in 73.137 + start) 73.138 + ${TOMCATPATH}/bin/startup.sh 73.139 + ;; 73.140 + stop) 73.141 + ${TOMCATPATH}/bin/shutdown.sh 73.142 + ;; 73.143 + restart) 73.144 + ${TOMCATPATH}/bin/startup.sh 73.145 + ${TOMCATPATH}/bin/shutdown.sh 73.146 + ;; 73.147 + esac 73.148 + return 73.149 + # find out the tomcat service to use 73.150 + elif test -s /etc/fedora-release ; then 73.151 + tomcat="tomcat" 73.152 + #elif test -s /etc/centos-release ; then 73.153 + #elif test -s /etc/yellowdog-release ; then 73.154 + #elif test -s /etc/redhat-release ; then 73.155 + #elif test -s /etc/SuSE-release ; then 73.156 + #elif test -s /etc/gentoo-release ; then 73.157 + elif test -s /etc/lsb-release ; then # Ubuntu 73.158 + tomcat=$(ls -1 /etc/init.d/| grep tomcat | head -1) 73.159 + elif test -s /etc/debian_version ; then 73.160 + tomcat="tomcat" 73.161 + fi 73.162 + 73.163 + # check for service availability 73.164 + if ! test -e "/etc/init.d/${tomcat}"; then 73.165 + echo "ERROR: No tomcat service found" 73.166 + exit -1 73.167 + fi 73.168 + 73.169 + echo "Service ${tomcat} received command: $1" 73.170 + sudo service ${tomcat} $1 73.171 +} 73.172 + 73.173 + 73.174 +# get the main version of postgres 73.175 +function getPostgresMainVersion() { 73.176 + echo $(sudo service ${postgres} status | grep -o '.\..' | cut -b 1) 73.177 +} 73.178 + 73.179 +# It stores the backgroud data 73.180 +# - $1: database 73.181 +# - $2: backgound data file 73.182 +function storeBackgroundData() { 73.183 + local db=$1 73.184 + local bgFile=$2 73.185 + 73.186 + if test -f ${bgFile}; then 73.187 + handlePostgresDatabase runscript ${db} ${bgFile} 73.188 + elif test "${bgFile:0:7}" = "http://"; then 73.189 + curl -s ${bgFile} | tar xzf - -O > /tmp/bgFiles$$.sql 73.190 +# wget ${bgFile} -O /tmp/bgFile$$.tar.gz 73.191 +# tar xzf /tmp/bgFile$$.tar.gz 73.192 + handlePostgresDatabase runscript ${db} /tmp/bgFiles$$.sql 73.193 +# rm /tmp/bgFile$$.tar.gz 73.194 + rm /tmp/bgFiles$$.sql 73.195 + else 73.196 + echo "Backgound file not foung" 73.197 + exit -1 73.198 + fi 73.199 + handlePostgresDatabase vacuum ${db} analyze 73.200 +} 73.201 + 73.202 +# Handle Stabon Endpoint 73.203 +# - $1: endpoint 73.204 +# - $2: command (store/query) 73.205 +# - $2: file/query 73.206 +function handleStrabonEndpoint(){ 73.207 + endpoint=$1 73.208 + command=$2 73.209 + options=$3 73.210 + 73.211 + endpointScript=${loc}/../../scripts/endpoint 73.212 + case ${command} in 73.213 + store) 73.214 + url=${options} 73.215 + 73.216 + tmr1=$(timer) 73.217 + #${endpointScript} store ${endpoint} N-Triples -u ${url} 73.218 + #read t 73.219 + ${endpointScript} store ${endpoint} N-Triples -u ${url} 73.220 + tmr2=$(timer) 73.221 + 73.222 + # execute an explicit VACUUM ANALYZE when a query takes longer than it should 73.223 + duration=$((tmr2-tmr1)) 73.224 + if test ${duration} -ge 30000; then 73.225 + handlePostgresDatabase vacuum ${db} analyze 73.226 +# psql -U postgres ${DB} -c 'VACUUM ANALYZE' 73.227 +# echo "Explicit VACUUM ANALYZE" 73.228 + tmr2=$(timer) 73.229 + fi 73.230 + printf '%s ' $((tmr2-tmr1)) >> ${logFile} 73.231 + ;; 73.232 + query) 73.233 + query=${options} 73.234 + tmr1=$(timer) 73.235 + #${endpointScript} query ${endpoint} "${query}" 73.236 + #read t 73.237 + ${endpointScript} query ${endpoint} "${query}" 73.238 + tmr2=$(timer) 73.239 + printf '%s ' $((tmr2-tmr1)) >> ${logFile} 73.240 + ;; 73.241 + update) 73.242 + update=${options} 73.243 + tmr1=$(timer) 73.244 + #${endpointScript} update ${endpoint} "${update}" 73.245 + #read t 73.246 + ${endpointScript} update ${endpoint} "${update}" 73.247 + tmr2=$(timer) 73.248 + printf '%s ' $((tmr2-tmr1)) >> ${logFile} 73.249 + ;; 73.250 + *) 73.251 + echo "ERROR: Unknown endpoint command" 73.252 + exit -1 73.253 + ;; 73.254 + esac 73.255 +} 73.256 + 73.257 +# default values 73.258 +endpoint="http://teleios3.di.uoa.gr:8080/endpoint" 73.259 +db="NOA2012" 73.260 +hotspotsURL="http://jose.di.uoa.gr/rdf/hotspots/MSG1" 73.261 +# ./examples/teleios/data/data-dump-9.sql 73.262 +bgFile="http://dev.strabon.di.uoa.gr/rdf/data-dump-9.sql" 73.263 +logFile="/home/ggarbis/runChain.log" 73.264 + 73.265 +chain="DynamicThresholds" 73.266 +persistence=10 73.267 +repeatInPers=3 73.268 + 73.269 +# read script options 73.270 +while test $# -gt 0 -a "X${1:0:1}" == "X-"; do 73.271 + case "${1}" in 73.272 + --help) 73.273 + help 73.274 + exit 0 73.275 + ;; 73.276 + -e|--endpoint) 73.277 + shift 73.278 + endpoint=${1} 73.279 + shift 73.280 + ;; 73.281 + -d|--db) 73.282 + shift 73.283 + db=${1} 73.284 + shift 73.285 + ;; 73.286 + -h|--hotspots) 73.287 + shift 73.288 + hotspots_url=${1} 73.289 + shift 73.290 + ;; 73.291 + -b|--background) 73.292 + shift 73.293 + bgFile=${1} 73.294 + shift 73.295 + ;; 73.296 + -l|--log) 73.297 + shift 73.298 + logFile=${1} 73.299 + shift 73.300 + ;; 73.301 + -c|--chain) 73.302 + shift 73.303 + chain=${1} 73.304 + shift 73.305 + ;; 73.306 + -p|--persistence) 73.307 + shift 73.308 + persistence=${1} 73.309 + shift 73.310 + ;; 73.311 + -r|--repeat_in_persistence) 73.312 + shift 73.313 + repeat_in_persistence=${1} 73.314 + shift 73.315 + ;; 73.316 + *) 73.317 + echo "unknown argument ${1}" 73.318 + help 73.319 + exit -1 73.320 + ;; 73.321 + esac 73.322 +done 73.323 + 73.324 +echo "endpoint: ${endpoint}" 73.325 +echo "db: ${db}" 73.326 +echo "hotspots: ${hotspotsURL}" 73.327 +echo "background: ${bgFile}" 73.328 +echo "logFile: ${logFile}" 73.329 + 73.330 +echo > ${logFile} 73.331 +echo 2222 73.332 +instantiate=${loc}/instantiate.sh 73.333 + 73.334 +#Initialize (stop tomcat, restart postgres, drop/create database, start tomcat) 73.335 +echo 111 73.336 +handleTomcatService stop 73.337 +handlePostgresService restart 73.338 + 73.339 +handlePostgresDatabase drop ${db} 73.340 +handlePostgresDatabase create ${db} 73.341 + 73.342 +storeBackgroundData ${db} ${bgFile} # ~/Temp/Kallikratis-Coastline-Corine-postgres-9.sql 73.343 + 73.344 +handleTomcatService start 73.345 +# Wait until tomcat server is up 73.346 +until [ "`curl --silent --show-error --connect-timeout 1 -I ${endpoint} | grep 'Coyote'`" != "" ]; do sleep 1; done; 73.347 + 73.348 + 73.349 +#${loc}/../../scripts/endpoint query ${endpoint} size 73.350 +#exit -1 73.351 +echo "Timestamp Store Municipalities DeleteInSea InvalidForFires RefineInCoast TimePersistence DiscoverHotspots" > ${logFile} 73.352 +echo > /home/ggarbis/discoverFires.log 73.353 +echo > /home/ggarbis/discover.log 73.354 + 73.355 +years="2012" #"2007 2008 2010 2011" 73.356 +for y in ${years}; do 73.357 +# hotspots="`ls /var/www/hotspots/${y} | sort | grep -o 'HMSG.*\.nt'`" 73.358 + # get hotpost URLS 73.359 + for hot in $(curl -s ${hotspotsURL}/${y}/ | grep -o '>HMSG.*\.nt' | colrm 1 1); do 73.360 +# for hot in ${hotspots}; do 73.361 + file="${hotspotsURL}/${y}/${hot}" 73.362 + 73.363 + time_status=$(echo ${hot} | egrep -o '[[:digit:]]{6}_[[:digit:]]{4}') 73.364 + 73.365 + # get sensor 73.366 + sensor=$(echo ${hot} | grep -o 'MSG.') 73.367 + 73.368 + # get satellite and set number of acquisitions per hour 73.369 + if test "${sensor}" = "MSG1"; then 73.370 + sensor="MSG1_RSS" 73.371 + fi 73.372 + 73.373 + # get time information for acquisition and construct timestamp 73.374 + year="20$(expr substr ${time_status} 1 2)" 73.375 + month=$(expr substr ${time_status} 3 2) 73.376 + day=$(expr substr ${time_status} 5 2) 73.377 + time2=$(expr substr ${time_status} 8 2) 73.378 + time2="${time2}:$(expr substr ${time_status} 10 2)" 73.379 + 73.380 + # construct timestamp 73.381 + timestamp="${year}-${month}-${day}T${time2}:00" 73.382 + # print timestamp 73.383 + echo -n "${timestamp} " >> ${logFile} 73.384 + 73.385 + handleStrabonEndpoint ${endpoint} store ${file} 73.386 + echo "Processing File ${file}" ; # read t 73.387 + 73.388 + # Insert Municipalities 73.389 + update="`${instantiate} -t ${timestamp} -c ${chain} -s ${sensor} ${loc}/insertMunicipalities.rq`" 73.390 +# echo "Insert Municipalities: ${update}" ; read t 73.391 + handleStrabonEndpoint ${endpoint} update "${update}" 73.392 + 73.393 + 73.394 + # Delete Sea Hotspots 73.395 + update="`${instantiate} -t ${timestamp} -c ${chain} -s ${sensor} ${loc}/deleteSeaHotspots.rq`" 73.396 +# echo "Delete Sea Hotspots: ${update}" ; read t 73.397 + handleStrabonEndpoint ${endpoint} update "${update}" 73.398 + 73.399 + # Invalid For Fires 73.400 + update="`${instantiate} -t ${timestamp} -c ${chain} -s ${sensor} ${loc}/landUseInvalidForFires.rq`" 73.401 +# echo "Invalid For Fires: ${update}" ; read t 73.402 + handleStrabonEndpoint ${endpoint} update "${update}" 73.403 + 73.404 +# # Delete Reflections 73.405 +# minTime=`date --date="${year}-${month}-${day} ${time2}:00 EEST -60 minutes" +%Y-%m-%dT%H:%M:00` 73.406 +# update="`${instantiate} -t ${timestamp} -c ${chain} -s ${sensor} -m ${minTime} ${loc}/deleteReflections.rq`" 73.407 +## echo "Delete Reflections: ${update}" ; 73.408 +# handleStrabonEndpoint ${endpoint} update "${update}" 73.409 + 73.410 + # Refine Partial Sea Hotspots 73.411 + update="`${instantiate} -t ${timestamp} -c ${chain} -s ${sensor} ${loc}/refinePartialSeaHotspots.rq`" 73.412 +# echo "Refine Partial Sea Hotspots: ${update}" ; read t 73.413 + handleStrabonEndpoint ${endpoint} update "${update}" 73.414 + 73.415 + # Refine Time Persistence 73.416 + minTime=`date --date="${year}-${month}-${day} ${time2}:00 EEST -30 minutes" +%Y-%m-%dT%H:%M:00` 73.417 + update="`${instantiate} -t ${timestamp} -c ${chain} -s ${sensor} -m ${minTime} ${loc}/refineTimePersistence.rq`" 73.418 +# echo "Refine Time Persistence: ${update}" ; read t 73.419 + handleStrabonEndpoint ${endpoint} update "${update}" #2>&1 | tee /home/ggarbis/timePersistence.log 73.420 + 73.421 + #psql -U postgres -d ${DB} -c 'VACUUM ANALYZE;'; 73.422 + 73.423 + # Discover 73.424 + minTime=`date --date="${year}-${month}-${day} 00:00 EEST" +%Y-%m-%dT%H:%M:00` 73.425 + maxTime=`date --date="${year}-${month}-${day} 23:59 EEST" +%Y-%m-%dT%H:%M:00` 73.426 + query="`${instantiate} -c ${chain} -s ${sensor} -m ${minTime} -M ${maxTime} ${loc}/discover.rq`" 73.427 +# echo "Discover: ${query}" ; #read t 73.428 + handleStrabonEndpoint ${endpoint} query "${query}" &>> /home/ggarbis/discover.log 73.429 +# 73.430 +# # Discover Fires 73.431 +# minTime=`date --date="${year}-${month}-${day} 00:00 EEST" +%Y-%m-%dT%H:%M:00` 73.432 +# maxTime=`date --date="${year}-${month}-${day} 23:59 EEST" +%Y-%m-%dT%H:%M:00` 73.433 +# query="`${instantiate} -c ${chain} -s ${sensor} -m ${minTime} -M ${maxTime} -p 10 -r 3 ${loc}/discoverFires.rq`" 73.434 +## echo "Discover Fires: ${query}" ; #read t 73.435 +# handleStrabonEndpoint ${endpoint} query "${query}" &>> /home/ggarbis/discoverFires.log 73.436 + 73.437 + # Add a new line 73.438 + echo >> ${logFile} 73.439 + done 73.440 +done
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 74.2 +++ b/examples/teleios/runNoaRefinement.sh Fri Feb 08 16:42:42 2013 +0200 74.3 @@ -0,0 +1,116 @@ 74.4 +#! /bin/bash 74.5 + 74.6 +# 74.7 +# This Source Code Form is subject to the terms of the Mozilla Public 74.8 +# License, v. 2.0. If a copy of the MPL was not distributed with this 74.9 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 74.10 +# 74.11 +# Copyright (C) 2010, 2011, 2012, Pyravlos Team 74.12 +# 74.13 +# http://www.strabon.di.uoa.gr/ 74.14 +# 74.15 + 74.16 + 74.17 +dataDir="/var/www/shapefiles2012all" 74.18 +dataUrl="http://challenge.strabon.di.uoa.gr/shapefiles2012all/" 74.19 +name="HMSG2_IR_039_s7" 74.20 +suffix=".n3" 74.21 + 74.22 +logFile="chain.log" 74.23 +countTime="/usr/bin/time -ao ${logFile} -f %e" 74.24 +echo > ${logFile} 74.25 + 74.26 +insertMunicipalities="`cat insertMunicipalities.rq`" 74.27 +deleteSeaHotspots="`cat deleteSeaHotspots.rq`" 74.28 +landUseInvalidForFires="`cat landUseInvalidForFires.rq`" 74.29 +refinePartialSeaHotspots="`cat refinePartialSeaHotspots.rq`" 74.30 +refineTimePersistence="`cat refineTimePersistence.rq`" 74.31 + 74.32 +# Initialize 74.33 +#sudo service postgresql restart 74.34 +#dropdb endpoint 74.35 +#createdb endpoint -T template_postgis 74.36 +#sudo service tomcat6 restart 74.37 +#./endpoint store http://localhost:8080/endpoint N-Triples -u http://pathway.di.uoa.gr/hotspots/grid_4.nt 74.38 + 74.39 +#./scripts/endpoint query http://localhost:8080/endpoint "SELECT (COUNT(*) AS ?C) WHERE {?s ?p ?o}" 74.40 +#echo "Continue?" 74.41 +#read a 74.42 + 74.43 + 74.44 +for Month in `sec 7 8`; do 74.45 + for d in `sec 1 31`; do 74.46 + for h in `seq 0 12`; do 74.47 + for m in `seq 0 15 45`; do 74.48 + time=`printf "%02d%02d\n" $h $m` 74.49 + time2=`printf "%02d:%02d\n" $h $m` 74.50 + date=`printf "%02d-%02d\n" $Month $d` 74.51 +## file=${dataDir}${name}_${time}$suffix 74.52 +# file=${dataUrl}${name}_${time}$suffix 74.53 +# 74.54 +# # store file 74.55 +# echo -n "storing 2007-08-25T${time2}:00 " >> ${logFile} 74.56 +## ${countTime} ./strabon -db endpoint store $file 74.57 +# ${countTime} ./endpoint store http://localhost:8080/endpoint N-Triples -u ${file} 74.58 +# 74.59 +## echo "File ${file} stored!" >> ${logFile} 74.60 +## echo "Continue?" 74.61 +## read a 74.62 + 74.63 + # deleteSeaHotspots 74.64 + echo -n "deleteSeaHotspots 2007-${date}T${time2}:00 " >> ${logFile} 74.65 + query=`echo "${deleteSeaHotspots}" | sed "s/TIMESTAMP/2007-${date}T${time2}:00/g" | \ 74.66 + sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \ 74.67 + sed "s/SENSOR/MSG2/g"` 74.68 +# ${countTime} ./strabon -db endpoint update "${query}" 74.69 + ${countTime} ./endpoint update http://localhost:8080/endpoint "${query}" 74.70 + 74.71 +# echo "File ${file} deleteSeaHotspots done!" 74.72 +# echo "Continue?" 74.73 +# read a 74.74 + 74.75 + # refinePartialSeaHotspots 74.76 + echo -n "refinePartialSeaHotspots 2007-${date}T${time2}:00 " >> ${logFile} 74.77 + query=`echo "${refinePartialSeaHotspots}" | sed "s/TIMESTAMP/2007-${date}T${time2}:00/g" | \ 74.78 + sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \ 74.79 + sed "s/SENSOR/MSG2/g"` 74.80 +# ${countTime} ./strabon -db endpoint update "${query}" 74.81 + ${countTime} ./endpoint update http://localhost:8080/endpoint "${query}" 74.82 + 74.83 +# echo "File ${file} refinePartialSeaHotspots done!" 74.84 +# echo "Continue?" 74.85 +# read a 74.86 + 74.87 + # refineTimePersistence 74.88 + echo -n "refineTimePersistence 2007-${date}T${time2}:00 " >> ${logFile} 74.89 + min_acquisition_time=`date --date="2007-${date} ${time2}:00 EEST -30 minutes" +%Y-%m-%dT%H:%m:00` 74.90 + query=`echo "${refineTimePersistence}" | sed "s/TIMESTAMP/2007-${date}T${time2}:00/g" | \ 74.91 + sed "s/PROCESSING_CHAIN/DynamicThresholds/g" | \ 74.92 + sed "s/SENSOR/MSG2/g" | \ 74.93 + sed "s/ACQUISITIONS_IN_HALF_AN_HOUR/3.0/g" | \ 74.94 + sed "s/MIN_ACQUISITION_TIME/${min_acquisition_time}/g"` 74.95 + 74.96 +# echo "Query:" 74.97 +# echo "${query}" 74.98 +# echo "Continue?" 74.99 +# read a 74.100 +# ${countTime} ./strabon -db endpoint update "${query}" 74.101 +# ${countTime} ./endpoint update http://localhost:8080/endpoint "${query}" 74.102 + ${countTime} ./endpoint update http://localhost:8080/endpoint "${query}" 74.103 + 74.104 +# echo "File ${file} refinePartialSeaHotspots done!" 74.105 +# echo "Continue?" 74.106 +# read a 74.107 + done 74.108 +done 74.109 + 74.110 + 74.111 +#for f in `ls /home/ggarbis/TELEIOS/NOA_Processing_Chain/chain_msg2/data/out_triples/HMSG2_IR_039_s7_070825_*.hotspots.n3` 74.112 +#do 74.113 + 74.114 +# echo "Store $f" 74.115 +# ${countTime} ./scripts/strabon -db endpoint store $f 74.116 +# 74.117 +# 74.118 +#done 74.119 +
75.1 --- a/generaldb/pom.xml Thu Feb 07 17:59:46 2013 +0200 75.2 +++ b/generaldb/pom.xml Fri Feb 08 16:42:42 2013 +0200 75.3 @@ -6,7 +6,7 @@ 75.4 <parent> 75.5 <groupId>eu.earthobservatory</groupId> 75.6 <artifactId>strabon</artifactId> 75.7 - <version>3.2.5-SNAPSHOT</version> 75.8 + <version>3.2.8-SNAPSHOT</version> 75.9 </parent> 75.10 75.11 <groupId>org.openrdf.sesame</groupId> 75.12 @@ -22,10 +22,12 @@ 75.13 <groupId>org.openrdf.sesame</groupId> 75.14 <artifactId>sesame-queryalgebra-evaluation-spatial</artifactId> 75.15 </dependency> 75.16 + 75.17 <dependency> 75.18 <groupId>org.openrdf.sesame</groupId> 75.19 <artifactId>sesame-sail-rdbms</artifactId> 75.20 </dependency> 75.21 + 75.22 <dependency> 75.23 <groupId>org.openrdf.sesame</groupId> 75.24 <artifactId>sesame-sail-api</artifactId> 75.25 @@ -35,10 +37,12 @@ 75.26 <groupId>org.openrdf.sesame</groupId> 75.27 <artifactId>sesame-queryalgebra-evaluation</artifactId> 75.28 </dependency> 75.29 + 75.30 <dependency> 75.31 <groupId>org.openrdf.sesame</groupId> 75.32 <artifactId>sesame-queryalgebra-model</artifactId> 75.33 </dependency> 75.34 + 75.35 <dependency> 75.36 <groupId>org.openrdf.sesame</groupId> 75.37 <artifactId>sesame-query</artifactId> 75.38 @@ -53,10 +57,12 @@ 75.39 <groupId>info.aduna.commons</groupId> 75.40 <artifactId>aduna-commons-collections</artifactId> 75.41 </dependency> 75.42 + 75.43 <dependency> 75.44 <groupId>info.aduna.commons</groupId> 75.45 <artifactId>aduna-commons-iteration</artifactId> 75.46 </dependency> 75.47 + 75.48 <dependency> 75.49 <groupId>info.aduna.commons</groupId> 75.50 <artifactId>aduna-commons-concurrent</artifactId> 75.51 @@ -73,21 +79,24 @@ 75.52 <scope>provided</scope> 75.53 </dependency> 75.54 75.55 - <dependency> 75.56 - <groupId>junit</groupId> 75.57 - <artifactId>junit</artifactId> 75.58 - <scope>test</scope> 75.59 - </dependency> 75.60 - 75.61 + <dependency> 75.62 + <groupId>junit</groupId> 75.63 + <artifactId>junit</artifactId> 75.64 + <scope>test</scope> 75.65 + </dependency> 75.66 + 75.67 + <!-- 75.68 <dependency> 75.69 <groupId>net.sf</groupId> 75.70 <artifactId>log4jdbc4</artifactId> 75.71 </dependency> 75.72 - <dependency> 75.73 - <groupId>commons-codec</groupId> 75.74 - <artifactId>commons-codec</artifactId> 75.75 - <version>1.4</version> 75.76 -</dependency> 75.77 + --> 75.78 + 75.79 + <dependency> 75.80 + <groupId>commons-codec</groupId> 75.81 + <artifactId>commons-codec</artifactId> 75.82 + <version>1.4</version> 75.83 + </dependency> 75.84 75.85 </dependencies> 75.86 </project>
76.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBConnection.java Thu Feb 07 17:59:46 2013 +0200 76.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/GeneralDBConnection.java Fri Feb 08 16:42:42 2013 +0200 76.3 @@ -211,6 +211,7 @@ 76.4 EvaluationStrategy strategy; 76.5 strategy = factory.createRdbmsEvaluation(dataset); 76.6 tupleExpr = optimizer.optimize(expr, dataset, bindings, strategy); 76.7 + // Mexri edw to GeneralDBSqlDiffDateTime ftanei kanonika 76.8 return strategy.evaluate(tupleExpr, EmptyBindingSet.getInstance()); 76.9 } 76.10 catch (QueryEvaluationException e) {
77.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlAnyInteract.java Thu Feb 07 17:59:46 2013 +0200 77.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 77.3 @@ -1,19 +0,0 @@ 77.4 -/* 77.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 77.6 - * 77.7 - * Licensed under the Aduna BSD-style license. 77.8 - */ 77.9 -package org.openrdf.sail.generaldb.algebra; 77.10 - 77.11 - 77.12 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 77.13 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 77.14 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 77.15 - 77.16 -public class GeneralDBSqlAnyInteract extends GeneralDBSqlGeoSpatial{ 77.17 - 77.18 - public GeneralDBSqlAnyInteract(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 77.19 - super(left, right); 77.20 - } 77.21 - 77.22 -} 77.23 \ No newline at end of file
78.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlContainsMBB.java Thu Feb 07 17:59:46 2013 +0200 78.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 78.3 @@ -1,19 +0,0 @@ 78.4 -/* 78.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 78.6 - * 78.7 - * Licensed under the Aduna BSD-style license. 78.8 - */ 78.9 -package org.openrdf.sail.generaldb.algebra; 78.10 - 78.11 - 78.12 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 78.13 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 78.14 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 78.15 - 78.16 -public class GeneralDBSqlContainsMBB extends GeneralDBSqlGeoSpatial{ 78.17 - 78.18 - public GeneralDBSqlContainsMBB(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 78.19 - super(left, right); 78.20 - } 78.21 - 78.22 -} 78.23 \ No newline at end of file
79.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlCoveredBy.java Thu Feb 07 17:59:46 2013 +0200 79.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 79.3 @@ -1,20 +0,0 @@ 79.4 -/* 79.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 79.6 - * 79.7 - * Licensed under the Aduna BSD-style license. 79.8 - */ 79.9 -package org.openrdf.sail.generaldb.algebra; 79.10 - 79.11 - 79.12 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 79.13 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 79.14 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 79.15 - 79.16 -public class GeneralDBSqlCoveredBy extends GeneralDBSqlGeoSpatial{ 79.17 - 79.18 - public GeneralDBSqlCoveredBy(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 79.19 - super(left, right); 79.20 - } 79.21 - 79.22 - 79.23 -} 79.24 \ No newline at end of file
80.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlCovers.java Thu Feb 07 17:59:46 2013 +0200 80.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 80.3 @@ -1,20 +0,0 @@ 80.4 -/* 80.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 80.6 - * 80.7 - * Licensed under the Aduna BSD-style license. 80.8 - */ 80.9 -package org.openrdf.sail.generaldb.algebra; 80.10 - 80.11 - 80.12 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 80.13 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 80.14 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 80.15 - 80.16 -public class GeneralDBSqlCovers extends GeneralDBSqlGeoSpatial{ 80.17 - 80.18 - public GeneralDBSqlCovers(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 80.19 - super(left, right); 80.20 - } 80.21 - 80.22 - 80.23 -} 80.24 \ No newline at end of file
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 81.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlCrosses.java Fri Feb 08 16:42:42 2013 +0200 81.3 @@ -0,0 +1,20 @@ 81.4 +/* 81.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 81.6 + * 81.7 + * Licensed under the Aduna BSD-style license. 81.8 + */ 81.9 +package org.openrdf.sail.generaldb.algebra; 81.10 + 81.11 + 81.12 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 81.13 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 81.14 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 81.15 + 81.16 +public class GeneralDBSqlCrosses extends GeneralDBSqlGeoSpatial{ 81.17 + 81.18 + public GeneralDBSqlCrosses(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 81.19 + super(left, right); 81.20 + } 81.21 + 81.22 + 81.23 +} 81.24 \ No newline at end of file
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 82.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlDateTimeMetricBinary.java Fri Feb 08 16:42:42 2013 +0200 82.3 @@ -0,0 +1,35 @@ 82.4 +package org.openrdf.sail.generaldb.algebra; 82.5 + 82.6 +import java.util.ArrayList; 82.7 + 82.8 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 82.9 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 82.10 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 82.11 +import org.openrdf.sail.generaldb.algebra.base.UnaryGeneralDBOperator; 82.12 + 82.13 +/** Addition for datetime metric functions 82.14 + * 82.15 + * @author George Garbis <ggarbis@di.uoa.gr> 82.16 + * 82.17 + */ 82.18 + 82.19 +public class GeneralDBSqlDateTimeMetricBinary extends BinaryGeneralDBOperator 82.20 +{ 82.21 + 82.22 + 82.23 + /*CONSTRUCTOR*/ 82.24 + 82.25 + public GeneralDBSqlDateTimeMetricBinary(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 82.26 + super(left, right); 82.27 + } 82.28 + 82.29 + @Override 82.30 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) 82.31 + throws X 82.32 + { 82.33 + visitor.meet(this); 82.34 + } 82.35 + 82.36 +} 82.37 + 82.38 +
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 83.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlDiffDateTime.java Fri Feb 08 16:42:42 2013 +0200 83.3 @@ -0,0 +1,31 @@ 83.4 +/* 83.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 83.6 + * 83.7 + * Licensed under the Aduna BSD-style license. 83.8 + */ 83.9 +package org.openrdf.sail.generaldb.algebra; 83.10 + 83.11 + 83.12 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 83.13 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 83.14 + 83.15 +/** Addition for datetime metric functions 83.16 + * 83.17 + * @author George Garbis <ggarbis@di.uoa.gr> 83.18 + * 83.19 + */ 83.20 + 83.21 +public class GeneralDBSqlDiffDateTime extends GeneralDBSqlDateTimeMetricBinary { 83.22 + 83.23 + public GeneralDBSqlDiffDateTime(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 83.24 + super(left, right); 83.25 + } 83.26 + 83.27 + @Override 83.28 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) 83.29 + throws X 83.30 + { 83.31 + visitor.meet(this); 83.32 + } 83.33 + 83.34 +} 83.35 \ No newline at end of file
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 84.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlExtDiffDateTime.java Fri Feb 08 16:42:42 2013 +0200 84.3 @@ -0,0 +1,31 @@ 84.4 +/* 84.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 84.6 + * 84.7 + * Licensed under the Aduna BSD-style license. 84.8 + */ 84.9 +package org.openrdf.sail.generaldb.algebra; 84.10 + 84.11 + 84.12 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 84.13 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 84.14 + 84.15 +/** Addition for datetime metric functions 84.16 + * 84.17 + * @author George Garbis <ggarbis@di.uoa.gr> 84.18 + * 84.19 + */ 84.20 + 84.21 +public class GeneralDBSqlExtDiffDateTime extends GeneralDBSqlDateTimeMetricBinary { 84.22 + 84.23 + public GeneralDBSqlExtDiffDateTime(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 84.24 + super(left, right); 84.25 + } 84.26 + 84.27 + @Override 84.28 + public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) 84.29 + throws X 84.30 + { 84.31 + visitor.meet(this); 84.32 + } 84.33 + 84.34 +} 84.35 \ No newline at end of file
85.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoDistance.java Thu Feb 07 17:59:46 2013 +0200 85.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoDistance.java Fri Feb 08 16:42:42 2013 +0200 85.3 @@ -9,7 +9,7 @@ 85.4 import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 85.5 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 85.6 85.7 -public class GeneralDBSqlGeoDistance extends GeneralDBSqlSpatialMetricBinary{ 85.8 +public class GeneralDBSqlGeoDistance extends GeneralDBSqlSpatialMetricBinary { 85.9 85.10 public GeneralDBSqlGeoDistance(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 85.11 super(left, right);
86.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlInside.java Thu Feb 07 17:59:46 2013 +0200 86.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 86.3 @@ -1,21 +0,0 @@ 86.4 -/* 86.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 86.6 - * 86.7 - * Licensed under the Aduna BSD-style license. 86.8 - */ 86.9 -package org.openrdf.sail.generaldb.algebra; 86.10 - 86.11 - 86.12 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 86.13 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 86.14 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 86.15 - 86.16 -public class GeneralDBSqlInside extends GeneralDBSqlGeoSpatial{ 86.17 - 86.18 - public GeneralDBSqlInside(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 86.19 - super(left, right); 86.20 - } 86.21 - 86.22 - 86.23 - 86.24 -} 86.25 \ No newline at end of file
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 87.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlMbbContains.java Fri Feb 08 16:42:42 2013 +0200 87.3 @@ -0,0 +1,19 @@ 87.4 +/* 87.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 87.6 + * 87.7 + * Licensed under the Aduna BSD-style license. 87.8 + */ 87.9 +package org.openrdf.sail.generaldb.algebra; 87.10 + 87.11 + 87.12 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 87.13 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 87.14 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 87.15 + 87.16 +public class GeneralDBSqlMbbContains extends GeneralDBSqlGeoSpatial{ 87.17 + 87.18 + public GeneralDBSqlMbbContains(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 87.19 + super(left, right); 87.20 + } 87.21 + 87.22 +} 87.23 \ No newline at end of file
88.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlMbbInside.java Thu Feb 07 17:59:46 2013 +0200 88.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 88.3 @@ -1,19 +0,0 @@ 88.4 -/* 88.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 88.6 - * 88.7 - * Licensed under the Aduna BSD-style license. 88.8 - */ 88.9 -package org.openrdf.sail.generaldb.algebra; 88.10 - 88.11 - 88.12 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 88.13 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 88.14 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 88.15 - 88.16 -public class GeneralDBSqlMbbInside extends GeneralDBSqlGeoSpatial{ 88.17 - 88.18 - public GeneralDBSqlMbbInside(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 88.19 - super(left, right); 88.20 - } 88.21 - 88.22 -} 88.23 \ No newline at end of file
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 89.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlMbbWithin.java Fri Feb 08 16:42:42 2013 +0200 89.3 @@ -0,0 +1,19 @@ 89.4 +/* 89.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 89.6 + * 89.7 + * Licensed under the Aduna BSD-style license. 89.8 + */ 89.9 +package org.openrdf.sail.generaldb.algebra; 89.10 + 89.11 + 89.12 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 89.13 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 89.14 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 89.15 + 89.16 +public class GeneralDBSqlMbbWithin extends GeneralDBSqlGeoSpatial{ 89.17 + 89.18 + public GeneralDBSqlMbbWithin(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 89.19 + super(left, right); 89.20 + } 89.21 + 89.22 +} 89.23 \ No newline at end of file
90.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlOverlap.java Thu Feb 07 17:59:46 2013 +0200 90.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 90.3 @@ -1,20 +0,0 @@ 90.4 -/* 90.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 90.6 - * 90.7 - * Licensed under the Aduna BSD-style license. 90.8 - */ 90.9 -package org.openrdf.sail.generaldb.algebra; 90.10 - 90.11 - 90.12 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 90.13 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 90.14 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 90.15 - 90.16 -public class GeneralDBSqlOverlap extends GeneralDBSqlGeoSpatial{ 90.17 - 90.18 - public GeneralDBSqlOverlap(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 90.19 - super(left, right); 90.20 - } 90.21 - 90.22 - 90.23 -} 90.24 \ No newline at end of file
91.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 91.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlOverlaps.java Fri Feb 08 16:42:42 2013 +0200 91.3 @@ -0,0 +1,20 @@ 91.4 +/* 91.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 91.6 + * 91.7 + * Licensed under the Aduna BSD-style license. 91.8 + */ 91.9 +package org.openrdf.sail.generaldb.algebra; 91.10 + 91.11 + 91.12 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 91.13 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 91.14 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 91.15 + 91.16 +public class GeneralDBSqlOverlaps extends GeneralDBSqlGeoSpatial{ 91.17 + 91.18 + public GeneralDBSqlOverlaps(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 91.19 + super(left, right); 91.20 + } 91.21 + 91.22 + 91.23 +} 91.24 \ No newline at end of file
92.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlTouch.java Thu Feb 07 17:59:46 2013 +0200 92.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 92.3 @@ -1,20 +0,0 @@ 92.4 -/* 92.5 - * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 92.6 - * 92.7 - * Licensed under the Aduna BSD-style license. 92.8 - */ 92.9 -package org.openrdf.sail.generaldb.algebra; 92.10 - 92.11 - 92.12 -import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 92.13 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 92.14 -import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 92.15 - 92.16 -public class GeneralDBSqlTouch extends GeneralDBSqlGeoSpatial{ 92.17 - 92.18 - public GeneralDBSqlTouch(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 92.19 - super(left, right); 92.20 - } 92.21 - 92.22 - 92.23 -} 92.24 \ No newline at end of file
93.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 93.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlTouches.java Fri Feb 08 16:42:42 2013 +0200 93.3 @@ -0,0 +1,20 @@ 93.4 +/* 93.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 93.6 + * 93.7 + * Licensed under the Aduna BSD-style license. 93.8 + */ 93.9 +package org.openrdf.sail.generaldb.algebra; 93.10 + 93.11 + 93.12 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 93.13 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase; 93.14 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 93.15 + 93.16 +public class GeneralDBSqlTouches extends GeneralDBSqlGeoSpatial{ 93.17 + 93.18 + public GeneralDBSqlTouches(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 93.19 + super(left, right); 93.20 + } 93.21 + 93.22 + 93.23 +} 93.24 \ No newline at end of file
94.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/BinaryGeneralDBOperator.java Thu Feb 07 17:59:46 2013 +0200 94.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/BinaryGeneralDBOperator.java Fri Feb 08 16:42:42 2013 +0200 94.3 @@ -27,7 +27,7 @@ 94.4 } 94.5 94.6 public BinaryGeneralDBOperator(GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) { 94.7 - super(); 94.8 + super(); // Edw to this(distance) exei ginei GeneralDBSqlGeoDistance 94.9 setLeftArg(leftArg); 94.10 setRightArg(rightArg); 94.11 }
95.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java Thu Feb 07 17:59:46 2013 +0200 95.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java Fri Feb 08 16:42:42 2013 +0200 95.3 @@ -16,19 +16,19 @@ 95.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbove; 95.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbs; 95.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnd; 95.7 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnyInteract; 95.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlBelow; 95.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 95.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCast; 95.11 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCompare; 95.12 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlConcat; 95.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContains; 95.14 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContainsMBB; 95.15 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCoveredBy; 95.16 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCovers; 95.17 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbContains; 95.18 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCrosses; 95.19 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDiffDateTime; 95.20 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDisjoint; 95.21 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlEq; 95.22 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlEqualsSpatial; 95.23 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlExtDiffDateTime; 95.24 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoArea; 95.25 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoAsGML; 95.26 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoAsText; 95.27 @@ -47,7 +47,6 @@ 95.28 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSymDifference; 95.29 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 95.30 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoUnion; 95.31 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlInside; 95.32 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIntersects; 95.33 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 95.34 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLeft; 95.35 @@ -55,16 +54,17 @@ 95.36 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLowerCase; 95.37 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 95.38 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbEquals; 95.39 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbInside; 95.40 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbWithin; 95.41 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbIntersects; 95.42 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 95.43 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull; 95.44 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOr; 95.45 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlap; 95.46 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlaps; 95.47 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRegex; 95.48 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRelate; 95.49 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRight; 95.50 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouch; 95.51 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouches; 95.52 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlWithin; 95.53 import org.openrdf.sail.generaldb.algebra.GeneralDBStringValue; 95.54 import org.openrdf.sail.generaldb.algebra.egenhofer.GeneralDBSqlEgenhofer_Contains; 95.55 import org.openrdf.sail.generaldb.algebra.egenhofer.GeneralDBSqlEgenhofer_CoveredBy; 95.56 @@ -295,66 +295,62 @@ 95.57 * 95.58 */ 95.59 95.60 - //XXX Spatial Relationship Functions - all 10 of them - stSPARQL++ 95.61 - public static GeneralDBSqlExpr anyInteract(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.62 - return new GeneralDBSqlAnyInteract(left, right); 95.63 + //XXX Spatial Relationship Functions - all 9 of them - stSPARQL++ 95.64 + public static GeneralDBSqlExpr equalsGeo(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.65 + return new GeneralDBSqlEqualsSpatial(left, right); 95.66 } 95.67 - 95.68 + 95.69 public static GeneralDBSqlExpr disjoint(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.70 return new GeneralDBSqlDisjoint(left, right); 95.71 } 95.72 - 95.73 - public static GeneralDBSqlExpr touch(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.74 - return new GeneralDBSqlTouch(left, right); 95.75 - } 95.76 95.77 public static GeneralDBSqlExpr intersects(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.78 return new GeneralDBSqlIntersects(left, right); 95.79 } 95.80 95.81 - public static GeneralDBSqlExpr mbbIntersects(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.82 - return new GeneralDBSqlMbbIntersects(left, right); 95.83 - } 95.84 - public static GeneralDBSqlExpr mbbInside(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.85 - return new GeneralDBSqlMbbInside(left, right); 95.86 - } 95.87 - public static GeneralDBSqlExpr ContainsMBB(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.88 - return new GeneralDBSqlContainsMBB(left, right); 95.89 + public static GeneralDBSqlExpr touches(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.90 + return new GeneralDBSqlTouches(left, right); 95.91 } 95.92 95.93 + public static GeneralDBSqlExpr crosses(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.94 + return new GeneralDBSqlCrosses(left, right); 95.95 + } 95.96 95.97 - public static GeneralDBSqlExpr mbbEqualsGeo(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.98 - return new GeneralDBSqlMbbEquals(left, right); 95.99 + public static GeneralDBSqlExpr within(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.100 + return new GeneralDBSqlWithin(left, right); 95.101 } 95.102 - 95.103 - public static GeneralDBSqlExpr equalsGeo(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.104 - return new GeneralDBSqlEqualsSpatial(left, right); 95.105 - } 95.106 - 95.107 + 95.108 public static GeneralDBSqlExpr contains(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.109 return new GeneralDBSqlContains(left, right); 95.110 } 95.111 - 95.112 - public static GeneralDBSqlExpr covers(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.113 - return new GeneralDBSqlCovers(left, right); 95.114 - } 95.115 - 95.116 - public static GeneralDBSqlExpr inside(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.117 - return new GeneralDBSqlInside(left, right); 95.118 - } 95.119 - 95.120 - public static GeneralDBSqlExpr coveredBy(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.121 - return new GeneralDBSqlCoveredBy(left, right); 95.122 - } 95.123 - 95.124 - public static GeneralDBSqlExpr overlap(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.125 - return new GeneralDBSqlOverlap(left, right); 95.126 + 95.127 + public static GeneralDBSqlExpr overlaps(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.128 + return new GeneralDBSqlOverlaps(left, right); 95.129 } 95.130 95.131 public static GeneralDBSqlExpr relate(GeneralDBSqlExpr left, GeneralDBSqlExpr right, GeneralDBSqlExpr third) { 95.132 return new GeneralDBSqlRelate(left, right,third); 95.133 } 95.134 95.135 + // mbb functions 95.136 + 95.137 + public static GeneralDBSqlExpr mbbIntersects(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.138 + return new GeneralDBSqlMbbIntersects(left, right); 95.139 + } 95.140 + public static GeneralDBSqlExpr mbbWithin(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.141 + return new GeneralDBSqlMbbWithin(left, right); 95.142 + } 95.143 + 95.144 + public static GeneralDBSqlExpr mbbEqualsGeo(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.145 + return new GeneralDBSqlMbbEquals(left, right); 95.146 + } 95.147 + 95.148 + public static GeneralDBSqlExpr mbbContains(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.149 + return new GeneralDBSqlMbbContains(left, right); 95.150 + } 95.151 + 95.152 + // directional 95.153 + 95.154 public static GeneralDBSqlExpr left(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.155 return new GeneralDBSqlLeft(left, right); 95.156 } 95.157 @@ -480,6 +476,30 @@ 95.158 return new GeneralDBSqlGeoSymDifference(left, right); 95.159 } 95.160 95.161 + /** Addition for datetime metric functions 95.162 + * 95.163 + * @author George Garbis <ggarbis@di.uoa.gr> 95.164 + * 95.165 + */ 95.166 + public static GeneralDBSqlExpr extDiffDateTime(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.167 + 95.168 + return new GeneralDBSqlExtDiffDateTime(left, right); 95.169 + } 95.170 + /***/ 95.171 + 95.172 + /** Addition for datetime metric functions 95.173 + * 95.174 + * @author George Garbis <ggarbis@di.uoa.gr> 95.175 + * 95.176 + */ 95.177 + 95.178 + public static GeneralDBSqlExpr diffDateTime(GeneralDBSqlExpr left, GeneralDBSqlExpr right) { 95.179 + 95.180 + return new GeneralDBSqlDiffDateTime(left, right); 95.181 + } 95.182 + 95.183 + /***/ 95.184 + 95.185 //XXX Spatial Metric Functions 95.186 public static GeneralDBSqlExpr geoArea(GeneralDBSqlExpr expr) { 95.187
96.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBQueryModelVisitorBase.java Thu Feb 07 17:59:46 2013 +0200 96.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBQueryModelVisitorBase.java Fri Feb 08 16:42:42 2013 +0200 96.3 @@ -25,19 +25,13 @@ 96.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSelectQuery; 96.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbs; 96.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnd; 96.7 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnyInteract; 96.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 96.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCast; 96.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCompare; 96.11 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlConcat; 96.12 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContains; 96.13 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCoveredBy; 96.14 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCovers; 96.15 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDisjoint; 96.16 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDateTimeMetricBinary; 96.17 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlEq; 96.18 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlEqualsSpatial; 96.19 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSpatial; 96.20 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlInside; 96.21 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 96.22 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLike; 96.23 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLowerCase; 96.24 @@ -45,7 +39,6 @@ 96.25 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 96.26 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull; 96.27 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOr; 96.28 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlap; 96.29 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRegex; 96.30 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlShift; 96.31 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary; 96.32 @@ -53,7 +46,6 @@ 96.33 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricBinary; 96.34 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricUnary; 96.35 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialProperty; 96.36 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouch; 96.37 import org.openrdf.sail.generaldb.algebra.GeneralDBStringValue; 96.38 import org.openrdf.sail.generaldb.algebra.GeneralDBTrueValue; 96.39 import org.openrdf.sail.generaldb.algebra.GeneralDBURIColumn; 96.40 @@ -342,7 +334,7 @@ 96.41 { 96.42 meetUnarySqlOperator(node); 96.43 } 96.44 - 96.45 + 96.46 public void meet(GeneralDBSqlSpatialMetricBinary node) throws X 96.47 { 96.48 meetBinarySqlOperator(node); 96.49 @@ -400,6 +392,17 @@ 96.50 96.51 96.52 96.53 + /** Addition for datetime metric functions 96.54 + * 96.55 + * @author George Garbis <ggarbis@di.uoa.gr> 96.56 + * 96.57 + */ 96.58 + public void meet(GeneralDBSqlDateTimeMetricBinary node) 96.59 + throws X { 96.60 + meetBinarySqlOperator(node); 96.61 + } 96.62 + /***/ 96.63 + 96.64 // public void meet(GeneralDBSqlAnyInteract node) throws X 96.65 // { 96.66 // meetBinarySqlOperator(node);
97.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Thu Feb 07 17:59:46 2013 +0200 97.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java Fri Feb 08 16:42:42 2013 +0200 97.3 @@ -31,6 +31,8 @@ 97.4 import org.openrdf.query.algebra.Var; 97.5 import org.openrdf.query.algebra.evaluation.function.Function; 97.6 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 97.7 +import org.openrdf.query.algebra.evaluation.function.link.AddDateTimeFunc; 97.8 +import org.openrdf.query.algebra.evaluation.function.spatial.DateTimeMetricFunc; 97.9 import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 97.10 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 97.11 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 97.12 @@ -125,7 +127,7 @@ 97.13 @Override 97.14 public void meet(Compare compare) 97.15 throws UnsupportedRdbmsOperatorException 97.16 - { 97.17 + { 97.18 ValueExpr left = compare.getLeftArg(); 97.19 ValueExpr right = compare.getRightArg(); 97.20 CompareOp op = compare.getOperator(); 97.21 @@ -134,7 +136,9 @@ 97.22 * 97.23 */ 97.24 boolean leftIsSpatial = false; 97.25 + boolean leftIsDateTime = false; 97.26 boolean rightIsSpatial = false; 97.27 + boolean rightIsDateTime = false; 97.28 GeneralDBSqlExpr leftSql = null; 97.29 GeneralDBSqlExpr rightSql = null; 97.30 97.31 @@ -144,12 +148,25 @@ 97.32 if(function instanceof SpatialMetricFunc) 97.33 { 97.34 leftSql = spatialMetricFunction((FunctionCall) left, function); 97.35 + leftIsSpatial = true; 97.36 } 97.37 + /** 97.38 + * Addition for datetime metric functions 97.39 + * 97.40 + * @author George Garbis <ggarbis@di.uoa.gr> 97.41 + * 97.42 + */ 97.43 + else if (function instanceof DateTimeMetricFunc){ 97.44 + // Edw prepei na epistrafei ena GenearalDBSqlDiffDateTime me parent=null 97.45 + leftSql = dateTimeMetricFunction((FunctionCall)left, function); 97.46 + leftIsDateTime = true; 97.47 + } 97.48 + /***/ 97.49 else //spatial property 97.50 { 97.51 leftSql = spatialPropertyFunction((FunctionCall) left, function); 97.52 + leftIsSpatial = true; 97.53 } 97.54 - leftIsSpatial = true; 97.55 } 97.56 else if(left instanceof MathExpr) 97.57 { 97.58 @@ -167,17 +184,31 @@ 97.59 if(function instanceof SpatialMetricFunc) 97.60 { 97.61 rightSql = spatialMetricFunction((FunctionCall) right, function); 97.62 + rightIsSpatial = true; 97.63 } 97.64 + /** 97.65 + * Addition for datetime metric functions 97.66 + * 97.67 + * @author George Garbis <ggarbis@di.uoa.gr> 97.68 + * 97.69 + */ 97.70 + else if (function instanceof DateTimeMetricFunc){ 97.71 + // Edw prepei na epistrafei ena GenearalDBSqlDiffDateTime me parent=null 97.72 + rightSql = dateTimeMetricFunction((FunctionCall)right, function); 97.73 + rightIsDateTime = true; 97.74 + } 97.75 + /***/ 97.76 else //spatial property 97.77 { 97.78 + System.out.println("SPATIAL PROPERTY!!!"); 97.79 rightSql = spatialPropertyFunction((FunctionCall) right, function); 97.80 + rightIsSpatial = true; 97.81 } 97.82 - rightIsSpatial = true; 97.83 } 97.84 else if(right instanceof MathExpr) 97.85 { 97.86 //some recursive function plainly to find out whether there is some nested metric 97.87 - rightIsSpatial = containsMetric((MathExpr)left); 97.88 + rightIsSpatial = containsMetric((MathExpr)right); 97.89 if(rightIsSpatial) 97.90 { 97.91 rightSql = numeric(right); 97.92 @@ -190,7 +221,7 @@ 97.93 97.94 switch (op) { 97.95 case EQ: 97.96 - if(!rightIsSpatial&&!leftIsSpatial) 97.97 + if( (!rightIsSpatial && !rightIsDateTime) && (!leftIsSpatial && !leftIsDateTime) ) 97.98 { 97.99 //default cases 97.100 if (isTerm(left) && isTerm(right)) { 97.101 @@ -204,12 +235,12 @@ 97.102 else 97.103 { 97.104 //more complicated cases 97.105 - if(!rightIsSpatial) 97.106 + if(!rightIsSpatial && !rightIsDateTime) 97.107 { 97.108 rightSql = numeric(right); 97.109 } 97.110 97.111 - if(!leftIsSpatial) 97.112 + if(!leftIsSpatial && !leftIsDateTime) 97.113 { 97.114 leftSql = numeric(right); 97.115 } 97.116 @@ -217,7 +248,7 @@ 97.117 } 97.118 break; 97.119 case NE: 97.120 - if(!rightIsSpatial&&!leftIsSpatial) 97.121 + if( (!rightIsSpatial && !rightIsDateTime) && (!leftIsSpatial && !leftIsDateTime) ) 97.122 { 97.123 //default cases 97.124 if (isTerm(left) && isTerm(right)) { 97.125 @@ -231,12 +262,12 @@ 97.126 else 97.127 { 97.128 //more complicated cases 97.129 - if(!rightIsSpatial) 97.130 + if(!rightIsSpatial && !rightIsDateTime) 97.131 { 97.132 rightSql = numeric(right); 97.133 } 97.134 97.135 - if(!leftIsSpatial) 97.136 + if(!leftIsSpatial && !leftIsSpatial) 97.137 { 97.138 leftSql = numeric(right); 97.139 } 97.140 @@ -248,7 +279,7 @@ 97.141 case LE: 97.142 case LT: 97.143 97.144 - if(!rightIsSpatial&&!leftIsSpatial) 97.145 + if( (!rightIsSpatial && !rightIsDateTime) && (!leftIsSpatial && !leftIsDateTime) ) 97.146 { 97.147 //default cases 97.148 GeneralDBSqlExpr simple = and(simple(type(left)), simple(type(right))); 97.149 @@ -268,12 +299,12 @@ 97.150 else 97.151 { 97.152 //more complicated cases 97.153 - if(!rightIsSpatial) 97.154 + if(!rightIsSpatial && !rightIsDateTime) 97.155 { 97.156 rightSql = numeric(right); 97.157 } 97.158 97.159 - if(!leftIsSpatial) 97.160 + if(!leftIsSpatial && !leftIsDateTime) 97.161 { 97.162 leftSql = numeric(right); 97.163 } 97.164 @@ -282,7 +313,7 @@ 97.165 97.166 break; 97.167 } 97.168 - } 97.169 + } 97.170 97.171 @Override 97.172 public void meet(IsBNode node) 97.173 @@ -727,6 +758,24 @@ 97.174 97.175 } 97.176 97.177 + /** 97.178 + * Addition for datetime metric functions 97.179 + * 97.180 + * @author George Garbis <ggarbis@di.uoa.gr> 97.181 + * 97.182 + */ 97.183 + public GeneralDBSqlExpr dateTimeFunction(FunctionCall functionCall) throws UnsupportedRdbmsOperatorException 97.184 + { 97.185 + Function function = FunctionRegistry.getInstance().get(functionCall.getURI()); 97.186 + if(function instanceof DateTimeMetricFunc) //1 argument 97.187 + { 97.188 + return dateTimeMetricFunction(functionCall,function); 97.189 + } 97.190 + return null; 97.191 + } 97.192 + 97.193 + /***/ 97.194 + 97.195 public GeneralDBSqlExpr spatialFunction(FunctionCall functionCall) throws UnsupportedRdbmsOperatorException 97.196 { 97.197 Function function = FunctionRegistry.getInstance().get(functionCall.getURI()); 97.198 @@ -928,6 +977,45 @@ 97.199 97.200 } 97.201 97.202 + /** 97.203 + * Addition for datetime metric functions 97.204 + * 97.205 + * @author George Garbis <ggarbis@di.uoa.gr> 97.206 + * 97.207 + */ 97.208 + GeneralDBSqlExpr dateTimeMetricFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException 97.209 + { 97.210 + GeneralDBSqlExpr leftArg = null; 97.211 + GeneralDBSqlExpr rightArg = null; 97.212 + 97.213 + ValueExpr left = functionCall.getArgs().get(0); 97.214 + ValueExpr right = functionCall.getArgs().get(1); 97.215 + 97.216 + if(left instanceof FunctionCall) 97.217 + { 97.218 + leftArg = dateTimeFunction((FunctionCall) left); 97.219 + } 97.220 + else 97.221 + { 97.222 + leftArg = time(left); 97.223 + } 97.224 + 97.225 + if(right instanceof FunctionCall) 97.226 + { 97.227 + rightArg = spatialFunction((FunctionCall) right); 97.228 + rightArg = dateTimeFunction((FunctionCall) right); 97.229 + } 97.230 + else 97.231 + { 97.232 + rightArg = time(right); 97.233 + } 97.234 + 97.235 + return dateTimeMetricPicker(function, leftArg, rightArg); 97.236 + 97.237 + } 97.238 + 97.239 + /***/ 97.240 + 97.241 GeneralDBSqlExpr spatialMetricFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException 97.242 { 97.243 GeneralDBSqlExpr leftArg = null; 97.244 @@ -1074,51 +1162,44 @@ 97.245 GeneralDBSqlExpr spatialRelationshipPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, 97.246 GeneralDBSqlExpr thirdArg) 97.247 { 97.248 - //XXX stSPARQL 97.249 - if(function.getURI().equals(GeoConstants.anyInteract)) 97.250 + //XXX stSPARQL 97.251 + if(function.getURI().equals(GeoConstants.equals)) 97.252 { 97.253 - return anyInteract(leftArg,rightArg); 97.254 - } 97.255 - if(function.getURI().equals(GeoConstants.intersects)) 97.256 - { 97.257 - return intersects(leftArg,rightArg); 97.258 - } 97.259 - else if(function.getURI().equals(GeoConstants.contains)) 97.260 - { 97.261 - return contains(leftArg,rightArg); 97.262 - } 97.263 - else if(function.getURI().equals(GeoConstants.coveredBy)) 97.264 - { 97.265 - return coveredBy(leftArg,rightArg); 97.266 - } 97.267 - else if(function.getURI().equals(GeoConstants.covers)) 97.268 - { 97.269 - return covers(leftArg,rightArg); 97.270 + return equalsGeo(leftArg,rightArg); 97.271 } 97.272 else if(function.getURI().equals(GeoConstants.disjoint)) 97.273 { 97.274 return disjoint(leftArg,rightArg); 97.275 } 97.276 - else if(function.getURI().equals(GeoConstants.equals)) 97.277 + else if(function.getURI().equals(GeoConstants.intersects)) 97.278 { 97.279 - return equalsGeo(leftArg,rightArg); 97.280 + return intersects(leftArg,rightArg); 97.281 } 97.282 - else if(function.getURI().equals(GeoConstants.inside)) 97.283 + else if(function.getURI().equals(GeoConstants.touches)) 97.284 { 97.285 - return inside(leftArg,rightArg); 97.286 + return touches(leftArg,rightArg); 97.287 } 97.288 - else if(function.getURI().equals(GeoConstants.overlap)) 97.289 + else if(function.getURI().equals(GeoConstants.crosses)) 97.290 { 97.291 - return overlap(leftArg,rightArg); 97.292 + return crosses(leftArg,rightArg); 97.293 } 97.294 - else if(function.getURI().equals(GeoConstants.touch)) 97.295 + else if(function.getURI().equals(GeoConstants.within)) 97.296 { 97.297 - return touch(leftArg,rightArg); 97.298 + return within(leftArg,rightArg); 97.299 } 97.300 + else if(function.getURI().equals(GeoConstants.contains)) 97.301 + { 97.302 + return contains(leftArg,rightArg); 97.303 + } 97.304 + else if(function.getURI().equals(GeoConstants.overlaps)) 97.305 + { 97.306 + return overlaps(leftArg,rightArg); 97.307 + } 97.308 else if(function.getURI().equals(GeoConstants.relate)) 97.309 { 97.310 return relate(leftArg,rightArg,thirdArg); 97.311 } 97.312 + // directional 97.313 else if(function.getURI().equals(GeoConstants.left)) 97.314 { 97.315 return left(leftArg,rightArg); 97.316 @@ -1135,21 +1216,18 @@ 97.317 { 97.318 return below(leftArg,rightArg); 97.319 } 97.320 - else if(function.getURI().equals(GeoConstants.touch)) 97.321 - { 97.322 - return touch(leftArg,rightArg); 97.323 - } 97.324 - else if(function.getURI().equals(GeoConstants.mbbOverlaps)) 97.325 + // mbb 97.326 + else if(function.getURI().equals(GeoConstants.mbbIntersects)) 97.327 { 97.328 return mbbIntersects(leftArg,rightArg); 97.329 } 97.330 - else if(function.getURI().equals(GeoConstants.mbbInside)) 97.331 + else if(function.getURI().equals(GeoConstants.mbbWithin)) 97.332 { 97.333 - return mbbInside(leftArg,rightArg); 97.334 + return mbbWithin(leftArg,rightArg); 97.335 } 97.336 else if(function.getURI().equals(GeoConstants.mbbContains)) 97.337 { 97.338 - return ContainsMBB(leftArg,rightArg); 97.339 + return mbbContains(leftArg,rightArg); 97.340 } 97.341 else if(function.getURI().equals(GeoConstants.mbbEquals)) 97.342 { 97.343 @@ -1370,6 +1448,25 @@ 97.344 return null; 97.345 } 97.346 97.347 + /** Addition for datetime metric functions 97.348 + * 97.349 + * @author George Garbis <ggarbis@di.uoa.gr> 97.350 + * 97.351 + */ 97.352 + 97.353 + GeneralDBSqlExpr dateTimeMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) 97.354 + { 97.355 + if(function.getURI().equals(GeoConstants.diffDateTime)) 97.356 + { 97.357 + return diffDateTime(leftArg, rightArg); 97.358 + } 97.359 + 97.360 + //Should never reach this place 97.361 + return null; 97.362 + } 97.363 + 97.364 + /***/ 97.365 + 97.366 //TODO more to be added here probably 97.367 GeneralDBSqlExpr spatialMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) 97.368 {
98.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java Thu Feb 07 17:59:46 2013 +0200 98.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java Fri Feb 08 16:42:42 2013 +0200 98.3 @@ -12,6 +12,7 @@ 98.4 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoBuffer; 98.5 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoConvexHull; 98.6 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoDifference; 98.7 +import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.extDiffDateTime; 98.8 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoDistance; 98.9 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoEnvelope; 98.10 import static org.openrdf.sail.generaldb.algebra.base.GeneralDBExprSupport.geoIntersection; 98.11 @@ -41,6 +42,7 @@ 98.12 import org.openrdf.query.algebra.Var; 98.13 import org.openrdf.query.algebra.evaluation.function.Function; 98.14 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 98.15 +import org.openrdf.query.algebra.evaluation.function.spatial.DateTimeMetricFunc; 98.16 import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 98.17 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 98.18 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 98.19 @@ -249,7 +251,27 @@ 98.20 return spatialPropertyPicker(function, leftArg); 98.21 } 98.22 } 98.23 + 98.24 + /** Addition for datetime metric functions 98.25 + * 98.26 + * @author George Garbis <ggarbis@di.uoa.gr> 98.27 + * 98.28 + */ 98.29 98.30 + public GeneralDBSqlExpr dateTimeFunction(FunctionCall functionCall) throws UnsupportedRdbmsOperatorException 98.31 + { 98.32 + Function function = FunctionRegistry.getInstance().get(functionCall.getURI()); 98.33 + if(function instanceof DateTimeMetricFunc) 98.34 + { 98.35 + return dateTimeMetricFunction(functionCall,function); 98.36 + } 98.37 + 98.38 + return null; 98.39 + } 98.40 + 98.41 + 98.42 + /***/ 98.43 + 98.44 public GeneralDBSqlExpr spatialFunction(FunctionCall functionCall) throws UnsupportedRdbmsOperatorException 98.45 { 98.46 Function function = FunctionRegistry.getInstance().get(functionCall.getURI()); 98.47 @@ -329,6 +351,31 @@ 98.48 98.49 } 98.50 98.51 + /** 98.52 + * Addition for datetime metric functions 98.53 + * 98.54 + * @author George Garbis <ggarbis@di.uoa.gr> 98.55 + * 98.56 + */ 98.57 + 98.58 + GeneralDBSqlExpr dateTimeMetricFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException 98.59 + { 98.60 + GeneralDBSqlExpr leftArg = null; 98.61 + GeneralDBSqlExpr rightArg = null; 98.62 + 98.63 + ValueExpr left = functionCall.getArgs().get(0); 98.64 + ValueExpr right = functionCall.getArgs().get(1); 98.65 + 98.66 + // TODO ti bazw edw?? 98.67 + leftArg = null; 98.68 + 98.69 + rightArg = null; 98.70 + return dateTimeMetricPicker(function, leftArg, rightArg); 98.71 + 98.72 + } 98.73 + 98.74 + /***/ 98.75 + 98.76 GeneralDBSqlExpr spatialMetricFunction(FunctionCall functionCall, Function function) throws UnsupportedRdbmsOperatorException 98.77 { 98.78 GeneralDBSqlExpr leftArg = null; 98.79 @@ -458,6 +505,24 @@ 98.80 return null; 98.81 } 98.82 98.83 + /** 98.84 + * Addition for datetime metric functions 98.85 + * 98.86 + * @author George Garbis <ggarbis@di.uoa.gr> 98.87 + * 98.88 + */ 98.89 + GeneralDBSqlExpr dateTimeMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) 98.90 + { 98.91 + if(function.getURI().equals(GeoConstants.diffDateTime)) 98.92 + { 98.93 + return extDiffDateTime(leftArg, rightArg); 98.94 + } 98.95 + 98.96 + //Should never reach this place 98.97 + return null; 98.98 + } 98.99 + /***/ 98.100 + 98.101 //TODO more to be added here probably 98.102 GeneralDBSqlExpr spatialMetricPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg) 98.103 {
99.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Thu Feb 07 17:59:46 2013 +0200 99.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Fri Feb 08 16:42:42 2013 +0200 99.3 @@ -47,22 +47,20 @@ 99.4 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 99.5 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonTemporalElement; 99.6 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.AboveFunc; 99.7 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.AnyInteractFunc; 99.8 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.BelowFunc; 99.9 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.ContainsFunc; 99.10 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.CoveredByFunc; 99.11 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.CoversFunc; 99.12 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.CrossesFunc; 99.13 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.DisjointFunc; 99.14 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.EqualsFunc; 99.15 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.InsideFunc; 99.16 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.WithinFunc; 99.17 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.IntersectsFunc; 99.18 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.LeftFunc; 99.19 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.OverlapFunc; 99.20 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.OverlapsFunc; 99.21 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.RightFunc; 99.22 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.TouchFunc; 99.23 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.TouchesFunc; 99.24 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbContainsFunc; 99.25 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbEqualsFunc; 99.26 -import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbInsideFunc; 99.27 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbWithinFunc; 99.28 import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.relation.mbb.MbbIntersectsFunc; 99.29 import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.construct.TemporalConstructFunc; 99.30 import org.openrdf.query.algebra.evaluation.function.temporal.stsparql.relation.TemporalConstants; 99.31 @@ -83,6 +81,7 @@ 99.32 import org.openrdf.sail.generaldb.algebra.GeneralDBSelectQuery; 99.33 import org.openrdf.sail.generaldb.algebra.GeneralDBSelectQuery.OrderElem; 99.34 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 99.35 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDateTimeMetricBinary; 99.36 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoAsGML; 99.37 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoAsText; 99.38 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoDimension; 99.39 @@ -372,13 +371,6 @@ 99.40 Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 99.41 funcResult = leftGeom.getEnvelopeInternal().getMinY() > rightConverted.getEnvelopeInternal().getMaxY(); 99.42 } 99.43 - else if(function instanceof AnyInteractFunc) 99.44 - { 99.45 - int targetSRID = leftGeom.getSRID(); 99.46 - int sourceSRID = rightGeom.getSRID(); 99.47 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 99.48 - funcResult = leftGeom.intersects(rightConverted); 99.49 - } 99.50 else if(function instanceof IntersectsFunc) 99.51 { 99.52 int targetSRID = leftGeom.getSRID(); 99.53 @@ -400,19 +392,12 @@ 99.54 Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 99.55 funcResult = leftGeom.contains(rightConverted); 99.56 } 99.57 - else if(function instanceof CoveredByFunc) 99.58 + else if(function instanceof CrossesFunc) 99.59 { 99.60 int targetSRID = leftGeom.getSRID(); 99.61 int sourceSRID = rightGeom.getSRID(); 99.62 Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 99.63 - funcResult = leftGeom.coveredBy(rightConverted); 99.64 - } 99.65 - else if(function instanceof CoversFunc) 99.66 - { 99.67 - int targetSRID = leftGeom.getSRID(); 99.68 - int sourceSRID = rightGeom.getSRID(); 99.69 - Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 99.70 - funcResult = leftGeom.covers(rightConverted); 99.71 + funcResult = leftGeom.crosses(rightConverted); 99.72 } 99.73 else if(function instanceof DisjointFunc) 99.74 { 99.75 @@ -428,7 +413,7 @@ 99.76 Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 99.77 funcResult = leftGeom.equals(rightConverted); 99.78 } 99.79 - else if(function instanceof InsideFunc) 99.80 + else if(function instanceof WithinFunc) 99.81 { 99.82 int targetSRID = leftGeom.getSRID(); 99.83 int sourceSRID = rightGeom.getSRID(); 99.84 @@ -442,7 +427,7 @@ 99.85 Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 99.86 funcResult = leftGeom.getEnvelopeInternal().getMaxX() < rightConverted.getEnvelopeInternal().getMinX(); 99.87 } 99.88 - else if(function instanceof OverlapFunc) 99.89 + else if(function instanceof OverlapsFunc) 99.90 { 99.91 int targetSRID = leftGeom.getSRID(); 99.92 int sourceSRID = rightGeom.getSRID(); 99.93 @@ -456,7 +441,7 @@ 99.94 Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 99.95 funcResult = leftGeom.getEnvelopeInternal().getMinX() > rightConverted.getEnvelopeInternal().getMaxX(); 99.96 } 99.97 - else if(function instanceof TouchFunc) 99.98 + else if(function instanceof TouchesFunc) 99.99 { 99.100 int targetSRID = leftGeom.getSRID(); 99.101 int sourceSRID = rightGeom.getSRID(); 99.102 @@ -470,7 +455,7 @@ 99.103 Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 99.104 funcResult = leftGeom.getEnvelope().intersects(rightConverted.getEnvelope()); 99.105 } 99.106 - else if(function instanceof MbbInsideFunc)//within function will do the job!!! 99.107 + else if(function instanceof MbbWithinFunc) 99.108 { 99.109 int targetSRID = leftGeom.getSRID(); 99.110 int sourceSRID = rightGeom.getSRID(); 99.111 @@ -992,6 +977,17 @@ 99.112 { 99.113 locateColumnVars(((GeneralDBSqlSpatialConstructUnary)expr).getArg(),allKnown); 99.114 } 99.115 + /** Addition for datetime metric functions 99.116 + * 99.117 + * @author George Garbis <ggarbis@di.uoa.gr> 99.118 + * 99.119 + */ 99.120 + else if(expr instanceof GeneralDBSqlDateTimeMetricBinary) 99.121 + { 99.122 + locateColumnVars(((GeneralDBSqlDateTimeMetricBinary)expr).getLeftArg(),allKnown); 99.123 + locateColumnVars(((GeneralDBSqlDateTimeMetricBinary)expr).getRightArg(),allKnown); 99.124 + } 99.125 + /***/ 99.126 else if(expr instanceof GeneralDBSqlSpatialMetricBinary) 99.127 { 99.128 locateColumnVars(((GeneralDBSqlSpatialMetricBinary)expr).getLeftArg(),allKnown); 99.129 @@ -1161,7 +1157,14 @@ 99.130 } 99.131 else if(expr instanceof GeneralDBSqlSpatialMetricBinary || 99.132 expr instanceof GeneralDBSqlSpatialMetricUnary || 99.133 - expr instanceof GeneralDBSqlMathExpr) 99.134 + expr instanceof GeneralDBSqlMathExpr || 99.135 + /** Addition for datetime metric functions 99.136 + * 99.137 + * @author George Garbis <ggarbis@di.uoa.gr> 99.138 + * 99.139 + */ 99.140 + expr instanceof GeneralDBSqlDateTimeMetricBinary 99.141 + /***/) 99.142 { 99.143 return ResultType.DOUBLE; 99.144 }
100.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java Thu Feb 07 17:59:46 2013 +0200 100.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java Fri Feb 08 16:42:42 2013 +0200 100.3 @@ -29,16 +29,15 @@ 100.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbove; 100.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbs; 100.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnd; 100.7 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnyInteract; 100.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlBelow; 100.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 100.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCast; 100.11 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCompare; 100.12 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlConcat; 100.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContains; 100.14 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContainsMBB; 100.15 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCoveredBy; 100.16 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCovers; 100.17 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbContains; 100.18 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCrosses; 100.19 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDiffDateTime; 100.20 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDisjoint; 100.21 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlEq; 100.22 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlEqualsSpatial; 100.23 @@ -60,7 +59,6 @@ 100.24 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSymDifference; 100.25 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 100.26 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoUnion; 100.27 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlInside; 100.28 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIntersects; 100.29 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 100.30 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLeft; 100.31 @@ -68,17 +66,18 @@ 100.32 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLowerCase; 100.33 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 100.34 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbEquals; 100.35 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbInside; 100.36 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbWithin; 100.37 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbIntersects; 100.38 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 100.39 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull; 100.40 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOr; 100.41 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlap; 100.42 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlaps; 100.43 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRegex; 100.44 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRelate; 100.45 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRight; 100.46 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlShift; 100.47 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouch; 100.48 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouches; 100.49 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlWithin; 100.50 import org.openrdf.sail.generaldb.algebra.GeneralDBStringValue; 100.51 import org.openrdf.sail.generaldb.algebra.GeneralDBTrueValue; 100.52 import org.openrdf.sail.generaldb.algebra.GeneralDBURIColumn; 100.53 @@ -553,8 +552,8 @@ 100.54 * FIXME 100.55 */ 100.56 //Relationships - boolean - stSPARQL 100.57 - else if (expr instanceof GeneralDBSqlAnyInteract) { 100.58 - append((GeneralDBSqlAnyInteract)expr, filter); 100.59 + else if (expr instanceof GeneralDBSqlCrosses) { 100.60 + append((GeneralDBSqlCrosses)expr, filter); 100.61 } 100.62 else if (expr instanceof GeneralDBSqlIntersects) { 100.63 append((GeneralDBSqlIntersects)expr, filter); 100.64 @@ -562,26 +561,20 @@ 100.65 else if (expr instanceof GeneralDBSqlContains) { 100.66 append((GeneralDBSqlContains)expr, filter); 100.67 } 100.68 - else if (expr instanceof GeneralDBSqlCovers) { 100.69 - append((GeneralDBSqlCovers)expr, filter); 100.70 - } 100.71 - else if (expr instanceof GeneralDBSqlCoveredBy) { 100.72 - append((GeneralDBSqlCoveredBy)expr, filter); 100.73 - } 100.74 else if (expr instanceof GeneralDBSqlEqualsSpatial) { 100.75 append((GeneralDBSqlEqualsSpatial)expr, filter); 100.76 } 100.77 - else if (expr instanceof GeneralDBSqlInside) { 100.78 - append((GeneralDBSqlInside)expr, filter); 100.79 + else if (expr instanceof GeneralDBSqlWithin) { 100.80 + append((GeneralDBSqlWithin)expr, filter); 100.81 } 100.82 - else if (expr instanceof GeneralDBSqlTouch) { 100.83 - append((GeneralDBSqlTouch)expr, filter); 100.84 + else if (expr instanceof GeneralDBSqlTouches) { 100.85 + append((GeneralDBSqlTouches)expr, filter); 100.86 } 100.87 else if (expr instanceof GeneralDBSqlDisjoint) { 100.88 append((GeneralDBSqlDisjoint)expr, filter); 100.89 } 100.90 - else if (expr instanceof GeneralDBSqlOverlap) { 100.91 - append((GeneralDBSqlOverlap)expr, filter); 100.92 + else if (expr instanceof GeneralDBSqlOverlaps) { 100.93 + append((GeneralDBSqlOverlaps)expr, filter); 100.94 } 100.95 else if (expr instanceof GeneralDBSqlLeft) { 100.96 append((GeneralDBSqlLeft)expr, filter); 100.97 @@ -598,11 +591,11 @@ 100.98 else if (expr instanceof GeneralDBSqlMbbIntersects) { 100.99 append((GeneralDBSqlMbbIntersects)expr, filter); 100.100 } 100.101 - else if (expr instanceof GeneralDBSqlMbbInside) { 100.102 - append((GeneralDBSqlMbbInside)expr, filter); 100.103 + else if (expr instanceof GeneralDBSqlMbbWithin) { 100.104 + append((GeneralDBSqlMbbWithin)expr, filter); 100.105 } 100.106 - else if (expr instanceof GeneralDBSqlContainsMBB) { 100.107 - append((GeneralDBSqlContainsMBB)expr, filter); 100.108 + else if (expr instanceof GeneralDBSqlMbbContains) { 100.109 + append((GeneralDBSqlMbbContains)expr, filter); 100.110 } 100.111 else if (expr instanceof GeneralDBSqlMbbEquals) { 100.112 append((GeneralDBSqlMbbEquals)expr, filter); 100.113 @@ -760,7 +753,9 @@ 100.114 else if (expr instanceof GeneralDBSqlGeoDistance) { 100.115 append((GeneralDBSqlGeoDistance)expr, filter); 100.116 } 100.117 - 100.118 + else if (expr instanceof GeneralDBSqlDiffDateTime) { 100.119 + append((GeneralDBSqlDiffDateTime)expr, filter); 100.120 + } 100.121 /** 100.122 * end of my addition 100.123 */ 100.124 @@ -1037,10 +1032,10 @@ 100.125 throws UnsupportedRdbmsOperatorException; 100.126 100.127 //Spatial Relationship Functions 100.128 - protected abstract void append(GeneralDBSqlAnyInteract expr, GeneralDBSqlExprBuilder filter) 100.129 + protected abstract void append(GeneralDBSqlIntersects expr, GeneralDBSqlExprBuilder filter) 100.130 throws UnsupportedRdbmsOperatorException; 100.131 100.132 - protected abstract void append(GeneralDBSqlIntersects expr, GeneralDBSqlExprBuilder filter) 100.133 + protected abstract void append(GeneralDBSqlCrosses expr, GeneralDBSqlExprBuilder filter) 100.134 throws UnsupportedRdbmsOperatorException; 100.135 100.136 protected abstract void append(GeneralDBSqlContains expr, GeneralDBSqlExprBuilder filter) 100.137 @@ -1049,19 +1044,13 @@ 100.138 protected abstract void append(GeneralDBSqlEqualsSpatial expr, GeneralDBSqlExprBuilder filter) 100.139 throws UnsupportedRdbmsOperatorException; 100.140 100.141 - protected abstract void append(GeneralDBSqlInside expr, GeneralDBSqlExprBuilder filter) 100.142 + protected abstract void append(GeneralDBSqlWithin expr, GeneralDBSqlExprBuilder filter) 100.143 throws UnsupportedRdbmsOperatorException; 100.144 100.145 - protected abstract void append(GeneralDBSqlCovers expr, GeneralDBSqlExprBuilder filter) 100.146 + protected abstract void append(GeneralDBSqlTouches expr, GeneralDBSqlExprBuilder filter) 100.147 throws UnsupportedRdbmsOperatorException; 100.148 100.149 - protected abstract void append(GeneralDBSqlCoveredBy expr, GeneralDBSqlExprBuilder filter) 100.150 - throws UnsupportedRdbmsOperatorException; 100.151 - 100.152 - protected abstract void append(GeneralDBSqlTouch expr, GeneralDBSqlExprBuilder filter) 100.153 - throws UnsupportedRdbmsOperatorException; 100.154 - 100.155 - protected abstract void append(GeneralDBSqlOverlap expr, GeneralDBSqlExprBuilder filter) 100.156 + protected abstract void append(GeneralDBSqlOverlaps expr, GeneralDBSqlExprBuilder filter) 100.157 throws UnsupportedRdbmsOperatorException; 100.158 100.159 protected abstract void append(GeneralDBSqlDisjoint expr, GeneralDBSqlExprBuilder filter) 100.160 @@ -1083,9 +1072,9 @@ 100.161 throws UnsupportedRdbmsOperatorException; 100.162 protected abstract void append(GeneralDBSqlMbbIntersects expr, GeneralDBSqlExprBuilder filter) 100.163 throws UnsupportedRdbmsOperatorException; 100.164 - protected abstract void append(GeneralDBSqlMbbInside expr, GeneralDBSqlExprBuilder filter) 100.165 + protected abstract void append(GeneralDBSqlMbbWithin expr, GeneralDBSqlExprBuilder filter) 100.166 throws UnsupportedRdbmsOperatorException; 100.167 - protected abstract void append(GeneralDBSqlContainsMBB expr, GeneralDBSqlExprBuilder filter) 100.168 + protected abstract void append(GeneralDBSqlMbbContains expr, GeneralDBSqlExprBuilder filter) 100.169 throws UnsupportedRdbmsOperatorException; 100.170 protected abstract void append(GeneralDBSqlMbbEquals expr, GeneralDBSqlExprBuilder filter) 100.171 throws UnsupportedRdbmsOperatorException; 100.172 @@ -1194,6 +1183,15 @@ 100.173 protected abstract void append(GeneralDBSqlGeoSymDifference expr, GeneralDBSqlExprBuilder filter) 100.174 throws UnsupportedRdbmsOperatorException; 100.175 100.176 + /** Addition for datetime metric functions 100.177 + * 100.178 + * @author George Garbis <ggarbis@di.uoa.gr> 100.179 + * 100.180 + */ 100.181 + protected abstract void append(GeneralDBSqlDiffDateTime expr, GeneralDBSqlExprBuilder filter) 100.182 + throws UnsupportedRdbmsOperatorException; 100.183 + /***/ 100.184 + 100.185 //Spatial Metric Functions 100.186 protected abstract void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter) 100.187 throws UnsupportedRdbmsOperatorException; 100.188 @@ -1341,6 +1339,18 @@ 100.189 100.190 } 100.191 100.192 + /** Addition for datetime metric functions 100.193 + * 100.194 + * @author George Garbis <ggarbis@di.uoa.gr> 100.195 + * 100.196 + */ 100.197 + protected void appendCastToEpoch(GeneralDBSqlExprBuilder filter) 100.198 + { 100.199 +// filter.epochCastBefore(); 100.200 +// filter.epochCastAfter(); 100.201 + } 100.202 + /***/ 100.203 + 100.204 protected void appendCastToDouble(GeneralDBSqlExprBuilder filter) 100.205 { 100.206 filter.doubleCast(); 100.207 @@ -1433,5 +1443,4 @@ 100.208 */ 100.209 100.210 100.211 - 100.212 }
101.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBSqlExprBuilder.java Thu Feb 07 17:59:46 2013 +0200 101.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBSqlExprBuilder.java Fri Feb 08 16:42:42 2013 +0200 101.3 @@ -270,7 +270,7 @@ 101.4 public void intersectsMBB() { 101.5 101.6 //XXX 101.7 - //edw prepei na ginei allou eidous douleia!! oxi na mpei to anyinteract, 101.8 + //edw prepei na ginei allou eidous douleia!! oxi na mpei to mbbIntersects, 101.9 //alla na prostethei kati pou tha mou pei o kwstis 101.10 where.append(" && "); 101.11 }
102.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Thu Feb 07 17:59:46 2013 +0200 102.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/optimizers/GeneralDBSelectQueryOptimizer.java Fri Feb 08 16:42:42 2013 +0200 102.3 @@ -64,6 +64,7 @@ 102.4 import org.openrdf.query.algebra.evaluation.QueryOptimizer; 102.5 import org.openrdf.query.algebra.evaluation.function.Function; 102.6 import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; 102.7 +import org.openrdf.query.algebra.evaluation.function.spatial.DateTimeMetricFunc; 102.8 import org.openrdf.query.algebra.evaluation.function.spatial.GeoConstants; 102.9 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc; 102.10 import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc; 102.11 @@ -831,7 +832,7 @@ 102.12 // } 102.13 // else //DEFAULT CASE 102.14 // { 102.15 - query.addFilter(sql.createBooleanExpr(expr)); 102.16 + query.addFilter(sql.createBooleanExpr(expr)); 102.17 // } 102.18 102.19 } 102.20 @@ -911,6 +912,7 @@ 102.21 throws RuntimeException 102.22 { 102.23 super.meet(node); 102.24 + // Edw ftanei to Filter GeneralDBSqlDiffDateTime! 102.25 if (node.getArg() instanceof GeneralDBSelectQuery) { 102.26 GeneralDBSelectQuery query = (GeneralDBSelectQuery)node.getArg(); 102.27 102.28 @@ -938,13 +940,13 @@ 102.29 @Override 102.30 public void meet(FunctionCall node) 102.31 throws RuntimeException 102.32 - { 102.33 + { 102.34 Function function = FunctionRegistry.getInstance().get(node.getURI()); 102.35 102.36 super.meet(node); 102.37 102.38 if(function instanceof SpatialRelationshipFunc || function instanceof SpatialConstructFunc 102.39 - || function instanceof SpatialMetricFunc || function instanceof SpatialPropertyFunc) 102.40 + || function instanceof SpatialMetricFunc || function instanceof SpatialPropertyFunc ) 102.41 { 102.42 List<ValueExpr> allArgs = node.getArgs(); 102.43 102.44 @@ -1028,7 +1030,30 @@ 102.45 102.46 102.47 102.48 - } 102.49 + /** 102.50 + * Addition for datetime metric functions 102.51 + * @author George Garbis <ggarbis@di.uoa.gr> 102.52 + * 102.53 + */ 102.54 + else if (function instanceof DateTimeMetricFunc) 102.55 + { 102.56 + List<ValueExpr> allArgs = node.getArgs(); 102.57 + 102.58 + int argNo = 0; 102.59 + //Used so that the second argument of buffer func is not 102.60 + //mistakenly confused with a spatial variable 102.61 + for(ValueExpr arg : allArgs) 102.62 + { 102.63 + argNo++; 102.64 + if(arg instanceof Var && argNo!=2) 102.65 + { 102.66 + String originalName = ((Var)arg).getName(); 102.67 + ((Var)arg).setName(originalName); 102.68 + } 102.69 + } 102.70 + } 102.71 + 102.72 + } 102.73 102.74 // 102.75 @Override
103.1 --- a/monetdb/pom.xml Thu Feb 07 17:59:46 2013 +0200 103.2 +++ b/monetdb/pom.xml Fri Feb 08 16:42:42 2013 +0200 103.3 @@ -6,7 +6,7 @@ 103.4 <parent> 103.5 <groupId>eu.earthobservatory</groupId> 103.6 <artifactId>strabon</artifactId> 103.7 - <version>3.2.5-SNAPSHOT</version> 103.8 + <version>3.2.8-SNAPSHOT</version> 103.9 </parent> 103.10 103.11 <groupId>org.openrdf.sesame</groupId>
104.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java Thu Feb 07 17:59:46 2013 +0200 104.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java Fri Feb 08 16:42:42 2013 +0200 104.3 @@ -16,13 +16,12 @@ 104.4 import org.openrdf.sail.generaldb.algebra.GeneralDBNumericColumn; 104.5 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbove; 104.6 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnd; 104.7 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnyInteract; 104.8 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlBelow; 104.9 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 104.10 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContains; 104.11 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContainsMBB; 104.12 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCoveredBy; 104.13 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCovers; 104.14 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbContains; 104.15 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCrosses; 104.16 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDiffDateTime; 104.17 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDisjoint; 104.18 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlEqualsSpatial; 104.19 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoArea; 104.20 @@ -43,18 +42,17 @@ 104.21 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSymDifference; 104.22 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 104.23 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoUnion; 104.24 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlInside; 104.25 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIntersects; 104.26 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 104.27 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLeft; 104.28 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 104.29 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbEquals; 104.30 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbInside; 104.31 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbWithin; 104.32 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbIntersects; 104.33 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 104.34 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull; 104.35 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOr; 104.36 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlap; 104.37 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlaps; 104.38 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRelate; 104.39 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRight; 104.40 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary; 104.41 @@ -62,7 +60,8 @@ 104.42 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricBinary; 104.43 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricUnary; 104.44 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialProperty; 104.45 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouch; 104.46 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouches; 104.47 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlWithin; 104.48 import org.openrdf.sail.generaldb.algebra.GeneralDBStringValue; 104.49 import org.openrdf.sail.generaldb.algebra.GeneralDBURIColumn; 104.50 import org.openrdf.sail.generaldb.algebra.GeneralDBUnionItem; 104.51 @@ -141,13 +140,13 @@ 104.52 { //Spatial Relationships 104.53 ST_Disjoint, 104.54 ST_Touches, 104.55 - ST_Covers, 104.56 - ST_CoveredBy, 104.57 + ST_Crosses, 104.58 + ST_Within, 104.59 ST_Overlaps, 104.60 ST_Relate, 104.61 104.62 // These Spatial Relations are implemented in MonetDB as operands and they apply in MBB of a geometry 104.63 - anyInteract, 104.64 + mbbIntersects, 104.65 equals, 104.66 contains, 104.67 inside, 104.68 @@ -212,6 +211,15 @@ 104.69 ; 104.70 } 104.71 104.72 + /** Addition for datetime metric functions 104.73 + * 104.74 + * @author George Garbis <ggarbis@di.uoa.gr> 104.75 + * 104.76 + */ 104.77 + public enum DateTimeFunctionMonetDB { Difference; } 104.78 + /***/ 104.79 + 104.80 + 104.81 public MonetDBQueryBuilder() { 104.82 super(); 104.83 } 104.84 @@ -399,20 +407,11 @@ 104.85 return this; 104.86 } 104.87 104.88 - //Spatial Relationship Functions 104.89 - @Override 104.90 - protected void append(GeneralDBSqlAnyInteract expr, GeneralDBSqlExprBuilder filter) 104.91 - throws UnsupportedRdbmsOperatorException 104.92 - { 104.93 - appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.anyInteract); 104.94 - // appendMonetDBSpatialOperand(expr, filter, SpatialOperandsMonetDB.anyInteract); 104.95 - } 104.96 - 104.97 - 104.98 + 104.99 @Override 104.100 protected void append(GeneralDBSqlIntersects expr, GeneralDBSqlExprBuilder filter) 104.101 throws UnsupportedRdbmsOperatorException { 104.102 - appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.anyInteract); 104.103 + appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.mbbIntersects); 104.104 104.105 } 104.106 104.107 @@ -433,36 +432,28 @@ 104.108 } 104.109 104.110 @Override 104.111 - protected void append(GeneralDBSqlInside expr, GeneralDBSqlExprBuilder filter) 104.112 + protected void append(GeneralDBSqlWithin expr, GeneralDBSqlExprBuilder filter) 104.113 throws UnsupportedRdbmsOperatorException { 104.114 104.115 - appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.inside); 104.116 - // appendMonetDBSpatialOperand(expr, filter, SpatialOperandsMonetDB.inside); 104.117 + appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Within); 104.118 } 104.119 104.120 @Override 104.121 - protected void append(GeneralDBSqlCovers expr, GeneralDBSqlExprBuilder filter) 104.122 + protected void append(GeneralDBSqlCrosses expr, GeneralDBSqlExprBuilder filter) 104.123 throws UnsupportedRdbmsOperatorException { 104.124 104.125 - appendgeoSPARQLSpatialRelation(expr, filter, SpatialFunctionsMonetDB.ST_Covers); 104.126 + appendgeoSPARQLSpatialRelation(expr, filter, SpatialFunctionsMonetDB.ST_Crosses); 104.127 } 104.128 104.129 @Override 104.130 - protected void append(GeneralDBSqlCoveredBy expr, GeneralDBSqlExprBuilder filter) 104.131 - throws UnsupportedRdbmsOperatorException { 104.132 - 104.133 - appendgeoSPARQLSpatialRelation(expr, filter, SpatialFunctionsMonetDB.ST_CoveredBy); 104.134 - } 104.135 - 104.136 - @Override 104.137 - protected void append(GeneralDBSqlTouch expr, GeneralDBSqlExprBuilder filter) 104.138 + protected void append(GeneralDBSqlTouches expr, GeneralDBSqlExprBuilder filter) 104.139 throws UnsupportedRdbmsOperatorException { 104.140 104.141 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Touches); 104.142 } 104.143 104.144 @Override 104.145 - protected void append(GeneralDBSqlOverlap expr, GeneralDBSqlExprBuilder filter) 104.146 + protected void append(GeneralDBSqlOverlaps expr, GeneralDBSqlExprBuilder filter) 104.147 throws UnsupportedRdbmsOperatorException { 104.148 104.149 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Overlaps); 104.150 @@ -516,7 +507,7 @@ 104.151 protected void append(GeneralDBSqlMbbIntersects expr, 104.152 GeneralDBSqlExprBuilder filter) 104.153 throws UnsupportedRdbmsOperatorException { 104.154 - appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.anyInteract); 104.155 + appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.mbbIntersects); 104.156 104.157 } 104.158 104.159 @@ -776,6 +767,19 @@ 104.160 appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_SymDifference); 104.161 } 104.162 104.163 + /** Addition for datetime metric functions 104.164 + * 104.165 + * @author George Garbis <ggarbis@di.uoa.gr> 104.166 + * 104.167 + */ 104.168 + @Override 104.169 + protected void append(GeneralDBSqlDiffDateTime expr, GeneralDBSqlExprBuilder filter) 104.170 + throws UnsupportedRdbmsOperatorException 104.171 + { 104.172 + appendGeneralDBDateTimeFunctionBinary(expr, filter, DateTimeFunctionMonetDB.Difference); 104.173 + } 104.174 + /***/ 104.175 + 104.176 @Override 104.177 //Spatial Metric Functions 104.178 protected void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter) 104.179 @@ -1120,6 +1124,147 @@ 104.180 104.181 } 104.182 104.183 + /** Addition for datetime metric functions 104.184 + * 104.185 + * @author George Garbis <ggarbis@di.uoa.gr> 104.186 + * 104.187 + */ 104.188 + protected void appendGeneralDBDateTimeFunctionBinary(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, DateTimeFunctionMonetDB func) 104.189 + throws UnsupportedRdbmsOperatorException 104.190 + { 104.191 + filter.openBracket(); 104.192 + 104.193 + boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 104.194 + boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 104.195 + 104.196 + if(check1) 104.197 + { 104.198 + this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 104.199 + 104.200 + } 104.201 + else if(check2) 104.202 + { 104.203 + this.append((GeneralDBSqlNull)expr.getRightArg(), filter); 104.204 + } 104.205 + else 104.206 + { 104.207 + 104.208 + GeneralDBSqlExpr tmp = expr; 104.209 + if(tmp instanceof GeneralDBSqlSpatialConstructBinary && tmp.getParentNode() == null) 104.210 + { 104.211 + while(true) 104.212 + { 104.213 + GeneralDBSqlExpr child; 104.214 + 104.215 + if(tmp instanceof BinaryGeneralDBOperator) 104.216 + { 104.217 + child = ((BinaryGeneralDBOperator) tmp).getLeftArg(); 104.218 + } 104.219 + else //(tmp instanceof UnaryGeneralDBOperator) 104.220 + { 104.221 + child = ((UnaryGeneralDBOperator) tmp).getArg(); 104.222 + } 104.223 + 104.224 + tmp = child; 104.225 + if(tmp instanceof GeneralDBLabelColumn) 104.226 + { 104.227 + //Reached the innermost left var -> need to capture its SRID 104.228 + String alias; 104.229 + if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 104.230 + //Predicates used in triple patterns non-existent in db 104.231 + alias="NULL"; 104.232 + } 104.233 + else 104.234 + { 104.235 + //Reached the innermost left var -> need to capture its SRID 104.236 + alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar()); 104.237 + } 104.238 + break; 104.239 + } 104.240 + } 104.241 + } 104.242 + 104.243 + filter.openBracket(); 104.244 + 104.245 + if(expr.getLeftArg() instanceof GeneralDBStringValue) 104.246 + { 104.247 + GeneralDBStringValue arg = (GeneralDBStringValue) expr.getLeftArg(); 104.248 + String raw = arg.getValue(); 104.249 + filter.append(" "+raw+" "); 104.250 + } 104.251 + else if(expr.getLeftArg() instanceof GeneralDBDoubleValue) //case met in buffer! 104.252 + { 104.253 + append(((GeneralDBDoubleValue)expr.getLeftArg()), filter); 104.254 + } 104.255 + else if(expr.getLeftArg() instanceof GeneralDBNumericColumn) //case met in buffer! 104.256 + { 104.257 + append(((GeneralDBNumericColumn)expr.getLeftArg()), filter); 104.258 + } 104.259 + else if(expr.getLeftArg() instanceof GeneralDBURIColumn) //case met in transform! 104.260 + { 104.261 + filter.keepSRID_part1(); 104.262 + append(((GeneralDBURIColumn)expr.getLeftArg()), filter); 104.263 + filter.keepSRID_part2(); 104.264 + append(((GeneralDBURIColumn)expr.getLeftArg()), filter); 104.265 + filter.keepSRID_part3(); 104.266 + } 104.267 + //case met in buffer when in select -> buffer(?spatial,?thematic) 104.268 + else if(expr.getLeftArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getLeftArg()).isSpatial()) 104.269 + { 104.270 + append(((GeneralDBLabelColumn)expr.getLeftArg()),filter); 104.271 + appendCastToDouble(filter); 104.272 + } 104.273 + else 104.274 + { 104.275 + // Den prepei na ftasei edw 104.276 + } 104.277 + 104.278 + switch(func) 104.279 + { 104.280 + case Difference: filter.append(" - "); break; 104.281 + } 104.282 + 104.283 + if(expr.getRightArg() instanceof GeneralDBStringValue) 104.284 + { 104.285 + GeneralDBStringValue arg = (GeneralDBStringValue) expr.getRightArg(); 104.286 + String raw = arg.getValue(); 104.287 + filter.append(" "+raw+" "); 104.288 + } 104.289 + else if(expr.getRightArg() instanceof GeneralDBDoubleValue) //case met in buffer! 104.290 + { 104.291 + append(((GeneralDBDoubleValue)expr.getRightArg()), filter); 104.292 + } 104.293 + else if(expr.getRightArg() instanceof GeneralDBNumericColumn) //case met in buffer! 104.294 + { 104.295 + append(((GeneralDBNumericColumn)expr.getRightArg()), filter); 104.296 + } 104.297 + else if(expr.getRightArg() instanceof GeneralDBURIColumn) //case met in transform! 104.298 + { 104.299 + filter.keepSRID_part1(); 104.300 + append(((GeneralDBURIColumn)expr.getRightArg()), filter); 104.301 + filter.keepSRID_part2(); 104.302 + append(((GeneralDBURIColumn)expr.getRightArg()), filter); 104.303 + filter.keepSRID_part3(); 104.304 + } 104.305 + //case met in buffer when in select -> buffer(?spatial,?thematic) 104.306 + else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial()) 104.307 + { 104.308 + append(((GeneralDBLabelColumn)expr.getRightArg()),filter); 104.309 + appendCastToDouble(filter); 104.310 + } 104.311 + else 104.312 + { 104.313 + // Den prepei na ftasei edw 104.314 + } 104.315 + 104.316 + 104.317 + filter.closeBracket(); 104.318 + } 104.319 + filter.closeBracket(); 104.320 + } 104.321 + 104.322 + /***/ 104.323 + 104.324 104.325 //Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 104.326 //EXCEPT ST_Transform!!! 104.327 @@ -1203,10 +1348,10 @@ 104.328 case ST_Distance: filter.appendFunction("Distance"); break; 104.329 case ST_Touches: filter.appendFunction("Touches"); break; 104.330 case ST_Disjoint: filter.appendFunction("Disjoint"); break; 104.331 - case ST_Covers: filter.appendFunction(""); break; // FIXME (with relate ?) 104.332 - case ST_CoveredBy: filter.appendFunction(""); break; // FIXME (with relate ?) 104.333 + case ST_Crosses: filter.appendFunction("Crosses"); break; 104.334 case ST_Overlaps: filter.appendFunction("Overlaps"); break; 104.335 - case anyInteract: filter.appendFunction("NOT Disjoint"); break; 104.336 + case ST_Within: filter.appendFunction("Within"); break; 104.337 + case mbbIntersects: filter.appendFunction("NOT Disjoint"); break; 104.338 case equals: filter.appendFunction("Equals"); break; 104.339 case contains: filter.appendFunction("Contains"); break; 104.340 case inside: filter.appendFunction("Within"); break; 104.341 @@ -1706,89 +1851,37 @@ 104.342 char[][] intersectionPattern = null; 104.343 switch(func) 104.344 { 104.345 - case ST_Covers: 104.346 - intersectionPattern = new char[4][9]; 104.347 + case ST_Crosses: 104.348 + intersectionPattern = new char[3][9]; 104.349 intersectionPattern[0][0] = 'T'; 104.350 intersectionPattern[0][1] = '*'; 104.351 - intersectionPattern[0][2] = '*'; 104.352 + intersectionPattern[0][2] = 'T'; 104.353 intersectionPattern[0][3] = '*'; 104.354 intersectionPattern[0][4] = '*'; 104.355 intersectionPattern[0][5] = '*'; 104.356 - intersectionPattern[0][6] = 'F'; 104.357 - intersectionPattern[0][7] = 'F'; 104.358 + intersectionPattern[0][6] = '*'; 104.359 + intersectionPattern[0][7] = '*'; 104.360 intersectionPattern[0][8] = '*'; 104.361 // 104.362 - intersectionPattern[1][0] = '*'; 104.363 - intersectionPattern[1][1] = 'T'; 104.364 + intersectionPattern[1][0] = 'T'; 104.365 + intersectionPattern[1][1] = '*'; 104.366 intersectionPattern[1][2] = '*'; 104.367 intersectionPattern[1][3] = '*'; 104.368 intersectionPattern[1][4] = '*'; 104.369 intersectionPattern[1][5] = '*'; 104.370 - intersectionPattern[1][6] = 'F'; 104.371 - intersectionPattern[1][7] = 'F'; 104.372 - intersectionPattern[1][8] = '*'; 104.373 - // 104.374 - intersectionPattern[2][0] = '*'; 104.375 - intersectionPattern[2][1] = '*'; 104.376 - intersectionPattern[2][2] = '*'; 104.377 - intersectionPattern[2][3] = 'T'; 104.378 - intersectionPattern[2][4] = '*'; 104.379 - intersectionPattern[2][5] = '*'; 104.380 - intersectionPattern[2][6] = 'F'; 104.381 - intersectionPattern[2][7] = 'F'; 104.382 - intersectionPattern[2][8] = '*'; 104.383 - // 104.384 - intersectionPattern[3][0] = '*'; 104.385 - intersectionPattern[3][1] = '*'; 104.386 - intersectionPattern[3][2] = '*'; 104.387 - intersectionPattern[3][3] = '*'; 104.388 - intersectionPattern[3][4] = 'T'; 104.389 - intersectionPattern[3][5] = '*'; 104.390 - intersectionPattern[3][6] = 'F'; 104.391 - intersectionPattern[3][7] = 'F'; 104.392 - intersectionPattern[3][8] = '*'; 104.393 - break; 104.394 - case ST_CoveredBy: 104.395 - intersectionPattern = new char[4][9]; 104.396 - intersectionPattern[0][0] = 'T'; 104.397 - intersectionPattern[0][1] = '*'; 104.398 - intersectionPattern[0][2] = 'F'; 104.399 - intersectionPattern[0][3] = '*'; 104.400 - intersectionPattern[0][4] = '*'; 104.401 - intersectionPattern[0][5] = 'F'; 104.402 - intersectionPattern[0][6] = '*'; 104.403 - intersectionPattern[0][7] = '*'; 104.404 - intersectionPattern[0][8] = '*'; 104.405 - // 104.406 - intersectionPattern[1][0] = '*'; 104.407 - intersectionPattern[1][1] = 'T'; 104.408 - intersectionPattern[1][2] = 'F'; 104.409 - intersectionPattern[1][3] = '*'; 104.410 - intersectionPattern[1][4] = '*'; 104.411 - intersectionPattern[1][5] = 'F'; 104.412 - intersectionPattern[1][6] = '*'; 104.413 + intersectionPattern[1][6] = 'T'; 104.414 intersectionPattern[1][7] = '*'; 104.415 intersectionPattern[1][8] = '*'; 104.416 // 104.417 - intersectionPattern[2][0] = '*'; 104.418 + intersectionPattern[2][0] = '0'; 104.419 intersectionPattern[2][1] = '*'; 104.420 - intersectionPattern[2][2] = 'F'; 104.421 - intersectionPattern[2][3] = 'T'; 104.422 + intersectionPattern[2][2] = '*'; 104.423 + intersectionPattern[2][3] = '*'; 104.424 intersectionPattern[2][4] = '*'; 104.425 - intersectionPattern[2][5] = 'F'; 104.426 + intersectionPattern[2][5] = '*'; 104.427 intersectionPattern[2][6] = '*'; 104.428 intersectionPattern[2][7] = '*'; 104.429 intersectionPattern[2][8] = '*'; 104.430 - // 104.431 - intersectionPattern[3][0] = '*'; 104.432 - intersectionPattern[3][1] = '*'; 104.433 - intersectionPattern[3][2] = 'F'; 104.434 - intersectionPattern[3][3] = '*'; 104.435 - intersectionPattern[3][4] = 'T'; 104.436 - intersectionPattern[3][5] = 'F'; 104.437 - intersectionPattern[3][6] = '*'; 104.438 - intersectionPattern[3][7] = '*'; 104.439 - intersectionPattern[3][8] = '*'; 104.440 break; 104.441 case SF_Contains: 104.442 intersectionPattern = new char[1][9]; 104.443 @@ -2095,7 +2188,7 @@ 104.444 } 104.445 104.446 @Override 104.447 - protected void append(GeneralDBSqlContainsMBB expr, 104.448 + protected void append(GeneralDBSqlMbbContains expr, 104.449 GeneralDBSqlExprBuilder filter) 104.450 throws UnsupportedRdbmsOperatorException { 104.451 // TODO Auto-generated method stub 104.452 @@ -2103,7 +2196,7 @@ 104.453 } 104.454 104.455 @Override 104.456 - protected void append(GeneralDBSqlMbbInside expr, 104.457 + protected void append(GeneralDBSqlMbbWithin expr, 104.458 GeneralDBSqlExprBuilder filter) 104.459 throws UnsupportedRdbmsOperatorException { 104.460 // TODO Auto-generated method stub 104.461 @@ -2259,4 +2352,4 @@ 104.462 104.463 } 104.464 104.465 -} 104.466 \ No newline at end of file 104.467 +}
105.1 --- a/pom.xml Thu Feb 07 17:59:46 2013 +0200 105.2 +++ b/pom.xml Fri Feb 08 16:42:42 2013 +0200 105.3 @@ -4,7 +4,7 @@ 105.4 105.5 <groupId>eu.earthobservatory</groupId> 105.6 <artifactId>strabon</artifactId> 105.7 - <version>3.2.5-SNAPSHOT</version> 105.8 + <version>3.2.8-SNAPSHOT</version> 105.9 <packaging>pom</packaging> 105.10 105.11 <parent> 105.12 @@ -24,12 +24,14 @@ 105.13 <module>postgis</module> 105.14 <module>monetdb</module> 105.15 <module>generaldb</module> 105.16 - <module>resultio</module> 105.17 + <module>resultio-spatial</module> 105.18 <module>endpoint</module> 105.19 + <module>endpoint-client</module> 105.20 + <module>endpoint-exec</module> 105.21 </modules> 105.22 105.23 <properties> 105.24 - <eu.earthobservatory.version>3.2.5-SNAPSHOT</eu.earthobservatory.version> 105.25 + <eu.earthobservatory.version>3.2.8-SNAPSHOT</eu.earthobservatory.version> 105.26 <sesame.version>2.6.3</sesame.version> 105.27 <aduna.appbase.version>3.5.0</aduna.appbase.version> 105.28 <!--slf4j.version>1.5.8</slf4j.version--> 105.29 @@ -53,11 +55,57 @@ 105.30 <version>${eu.earthobservatory.version}</version> 105.31 </dependency> 105.32 105.33 + 105.34 + <!-- queryresultio-spatial dependencies--> 105.35 <dependency> 105.36 <groupId>org.openrdf.sesame</groupId> 105.37 - <artifactId>sesame-queryresultio-spatial</artifactId> 105.38 + <artifactId>sesame-queryresultio-spatial-api</artifactId> 105.39 <version>${eu.earthobservatory.version}</version> 105.40 </dependency> 105.41 + <dependency> 105.42 + <groupId>org.openrdf.sesame</groupId> 105.43 + <artifactId>sesame-queryresultio-spatial-sparqlgeojson</artifactId> 105.44 + <version>${eu.earthobservatory.version}</version> 105.45 + </dependency> 105.46 + <dependency> 105.47 + <groupId>org.openrdf.sesame</groupId> 105.48 + <artifactId>sesame-queryresultio-spatial-sparqlhtml</artifactId> 105.49 + <version>${eu.earthobservatory.version}</version> 105.50 + </dependency> 105.51 + <dependency> 105.52 + <groupId>org.openrdf.sesame</groupId> 105.53 + <artifactId>sesame-queryresultio-spatial-sparqlkml</artifactId> 105.54 + <version>${eu.earthobservatory.version}</version> 105.55 + </dependency> 105.56 + <dependency> 105.57 + <groupId>org.openrdf.sesame</groupId> 105.58 + <artifactId>sesame-queryresultio-spatial-sparqlxml</artifactId> 105.59 + <version>${eu.earthobservatory.version}</version> 105.60 + </dependency> 105.61 + <dependency> 105.62 + <groupId>org.openrdf.sesame</groupId> 105.63 + <artifactId>sesame-queryresultio-spatial-text</artifactId> 105.64 + <version>${eu.earthobservatory.version}</version> 105.65 + </dependency> 105.66 + <!-- queryresultio-spatial dependencies--> 105.67 + 105.68 + <!-- sesame queryresultio dependencies --> 105.69 + <dependency> 105.70 + <groupId>org.openrdf.sesame</groupId> 105.71 + <artifactId>sesame-queryresultio-api</artifactId> 105.72 + <version>${sesame.version}</version> 105.73 + </dependency> 105.74 + <dependency> 105.75 + <groupId>org.openrdf.sesame</groupId> 105.76 + <artifactId>sesame-queryresultio-sparqlxml</artifactId> 105.77 + <version>${sesame.version}</version> 105.78 + </dependency> 105.79 + <dependency> 105.80 + <groupId>org.openrdf.sesame</groupId> 105.81 + <artifactId>sesame-queryresultio-text</artifactId> 105.82 + <version>${sesame.version}</version> 105.83 + </dependency> 105.84 + <!-- sesame queryresultio dependencies --> 105.85 105.86 <dependency> 105.87 <groupId>org.openrdf.sesame</groupId> 105.88 @@ -209,6 +257,11 @@ 105.89 <!-- RIO --> 105.90 <dependency> 105.91 <groupId>org.openrdf.sesame</groupId> 105.92 + <artifactId>sesame-rio-api</artifactId> 105.93 + <version>${sesame.version}</version> 105.94 + </dependency> 105.95 + <dependency> 105.96 + <groupId>org.openrdf.sesame</groupId> 105.97 <artifactId>sesame-rio-rdfxml</artifactId> 105.98 <version>2.6.9</version> 105.99 </dependency> 105.100 @@ -366,11 +419,13 @@ 105.101 <version>5.1.15</version> 105.102 </dependency> 105.103 105.104 + <!-- 105.105 <dependency> 105.106 <groupId>net.sf</groupId> 105.107 <artifactId>log4jdbc4</artifactId> 105.108 <version>1.2</version> 105.109 </dependency> 105.110 + --> 105.111 105.112 <!-- LOG4J --> 105.113 <dependency> 105.114 @@ -507,16 +562,16 @@ 105.115 <version>2.2</version> 105.116 </dependency> 105.117 105.118 -<dependency> 105.119 - <groupId>org.jvnet.ogc</groupId> 105.120 - <artifactId>ogc-tools-gml-jts</artifactId> 105.121 - <version>1.0.2</version> 105.122 -</dependency> 105.123 -<dependency> 105.124 - <groupId>com.sun.xml.bind</groupId> 105.125 - <artifactId>jaxb-impl</artifactId> 105.126 - <version>2.1.1</version> 105.127 -</dependency> 105.128 + <dependency> 105.129 + <groupId>org.jvnet.ogc</groupId> 105.130 + <artifactId>ogc-tools-gml-jts</artifactId> 105.131 + <version>1.0.2</version> 105.132 + </dependency> 105.133 + <dependency> 105.134 + <groupId>com.sun.xml.bind</groupId> 105.135 + <artifactId>jaxb-impl</artifactId> 105.136 + <version>2.1.1</version> 105.137 + </dependency> 105.138 105.139 <dependency> 105.140 <groupId>javax</groupId> 105.141 @@ -540,7 +595,7 @@ 105.142 <plugin> 105.143 <groupId>org.apache.tomcat.maven</groupId> 105.144 <artifactId>tomcat7-maven-plugin</artifactId> 105.145 - <version>2.0-SNAPSHOT</version> 105.146 + <version>2.0</version> 105.147 </plugin> 105.148 </plugins> 105.149 </pluginManagement> 105.150 @@ -620,7 +675,7 @@ 105.151 </scm> 105.152 105.153 <repositories> 105.154 - 105.155 + <!-- 105.156 <repository> 105.157 <releases> 105.158 <enabled>true</enabled> 105.159 @@ -632,7 +687,7 @@ 105.160 <name>Strabon - maven repository</name> 105.161 <url>http://maven.strabon.di.uoa.gr/content/repositories/testing</url> 105.162 </repository> 105.163 - 105.164 + --> 105.165 <repository> 105.166 <releases> 105.167 <enabled>true</enabled> 105.168 @@ -655,8 +710,6 @@ 105.169 <name>Strabon - maven repository - snapshots</name> 105.170 <url>http://maven.strabon.di.uoa.gr/content/repositories/snapshots</url> 105.171 </repository> 105.172 - 105.173 - 105.174 <repository> 105.175 <releases> 105.176 <enabled>true</enabled>
106.1 --- a/postgis/pom.xml Thu Feb 07 17:59:46 2013 +0200 106.2 +++ b/postgis/pom.xml Fri Feb 08 16:42:42 2013 +0200 106.3 @@ -6,7 +6,7 @@ 106.4 <parent> 106.5 <groupId>eu.earthobservatory</groupId> 106.6 <artifactId>strabon</artifactId> 106.7 - <version>3.2.5-SNAPSHOT</version> 106.8 + <version>3.2.8-SNAPSHOT</version> 106.9 </parent> 106.10 106.11 <groupId>org.openrdf.sesame</groupId>
107.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Thu Feb 07 17:59:46 2013 +0200 107.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java Fri Feb 08 16:42:42 2013 +0200 107.3 @@ -17,18 +17,19 @@ 107.4 import org.openrdf.query.algebra.evaluation.function.datetime.Timezone; 107.5 import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 107.6 import org.openrdf.sail.generaldb.algebra.GeneralDBColumnVar; 107.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBDateTimeColumn; 107.8 import org.openrdf.sail.generaldb.algebra.GeneralDBDoubleValue; 107.9 import org.openrdf.sail.generaldb.algebra.GeneralDBLabelColumn; 107.10 +import org.openrdf.sail.generaldb.algebra.GeneralDBNumberValue; 107.11 import org.openrdf.sail.generaldb.algebra.GeneralDBNumericColumn; 107.12 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbove; 107.13 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnd; 107.14 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnyInteract; 107.15 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlBelow; 107.16 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 107.17 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContains; 107.18 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContainsMBB; 107.19 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCoveredBy; 107.20 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCovers; 107.21 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbContains; 107.22 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCrosses; 107.23 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDiffDateTime; 107.24 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDisjoint; 107.25 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlEqualsSpatial; 107.26 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoArea; 107.27 @@ -49,17 +50,16 @@ 107.28 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSymDifference; 107.29 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 107.30 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoUnion; 107.31 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlInside; 107.32 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIntersects; 107.33 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 107.34 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLeft; 107.35 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 107.36 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbEquals; 107.37 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbInside; 107.38 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbWithin; 107.39 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbIntersects; 107.40 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 107.41 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull; 107.42 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlap; 107.43 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlaps; 107.44 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRelate; 107.45 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRight; 107.46 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary; 107.47 @@ -67,7 +67,8 @@ 107.48 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricBinary; 107.49 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricUnary; 107.50 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialProperty; 107.51 -import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouch; 107.52 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouches; 107.53 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlWithin; 107.54 import org.openrdf.sail.generaldb.algebra.GeneralDBStringValue; 107.55 import org.openrdf.sail.generaldb.algebra.GeneralDBURIColumn; 107.56 import org.openrdf.sail.generaldb.algebra.GeneralDBUnionItem; 107.57 @@ -132,21 +133,19 @@ 107.58 */ 107.59 boolean nullLabel = false; 107.60 107.61 - public enum SpatialOperandsPostGIS { anyInteract, equals, contains, left, right, above, inside, below; } 107.62 + public enum SpatialOperandsPostGIS { intersects, equals, contains, inside, left, right, above, below; } 107.63 public enum SpatialFunctionsPostGIS 107.64 { //stSPARQL++ 107.65 //Spatial Relationships 107.66 - ST_Disjoint, 107.67 + ST_Equals, 107.68 + ST_Disjoint, 107.69 + ST_Intersects, 107.70 ST_Touches, 107.71 - ST_Covers, 107.72 - ST_CoveredBy, 107.73 - ST_Overlaps, 107.74 - ST_Intersects, 107.75 - ST_Equals, 107.76 - ST_Relate, 107.77 + ST_Crosses, 107.78 ST_Within, 107.79 ST_Contains, 107.80 - 107.81 + ST_Overlaps, 107.82 + ST_Relate, 107.83 107.84 //Spatial Constructs - Binary 107.85 ST_Union, 107.86 @@ -210,6 +209,14 @@ 107.87 ; 107.88 } 107.89 107.90 + /** Addition for datetime metric functions 107.91 + * 107.92 + * @author George Garbis <ggarbis@di.uoa.gr> 107.93 + * 107.94 + */ 107.95 + public enum DateTimeFunctionPostGIS { Difference; } 107.96 + /***/ 107.97 + 107.98 public PostGISQueryBuilder() { 107.99 super(); 107.100 } 107.101 @@ -249,6 +256,12 @@ 107.102 } 107.103 107.104 @Override 107.105 + protected void append(GeneralDBDateTimeColumn var, GeneralDBSqlExprBuilder filter) { 107.106 + String alias = getDateTimeAlias(var.getRdbmsVar()); 107.107 + filter.column(alias, "value"); 107.108 + } 107.109 + 107.110 + @Override 107.111 protected void append(GeneralDBLabelColumn var, GeneralDBSqlExprBuilder filter) { 107.112 if (var.getRdbmsVar().isResource()) { 107.113 filter.appendNull(); 107.114 @@ -388,89 +401,88 @@ 107.115 return this; 107.116 } 107.117 107.118 - //Spatial Relationship Functions 107.119 + //Spatial Relationship Functions 107.120 @Override 107.121 - protected void append(GeneralDBSqlAnyInteract expr, GeneralDBSqlExprBuilder filter) 107.122 - throws UnsupportedRdbmsOperatorException 107.123 - { 107.124 - appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Intersects); 107.125 - } 107.126 + protected void append(GeneralDBSqlEqualsSpatial expr, GeneralDBSqlExprBuilder filter) 107.127 + throws UnsupportedRdbmsOperatorException { 107.128 107.129 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Equals); 107.130 + } 107.131 + 107.132 + @Override 107.133 + protected void append(GeneralDBSqlDisjoint expr, GeneralDBSqlExprBuilder filter) 107.134 + throws UnsupportedRdbmsOperatorException { 107.135 107.136 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Disjoint); 107.137 + } 107.138 + 107.139 @Override 107.140 protected void append(GeneralDBSqlIntersects expr, GeneralDBSqlExprBuilder filter) 107.141 throws UnsupportedRdbmsOperatorException { 107.142 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Intersects); 107.143 } 107.144 + 107.145 + @Override 107.146 + protected void append(GeneralDBSqlTouches expr, GeneralDBSqlExprBuilder filter) 107.147 + throws UnsupportedRdbmsOperatorException { 107.148 107.149 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Touches); 107.150 + } 107.151 + 107.152 + @Override 107.153 + protected void append(GeneralDBSqlCrosses expr, GeneralDBSqlExprBuilder filter) 107.154 + throws UnsupportedRdbmsOperatorException { 107.155 + 107.156 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Crosses); 107.157 + } 107.158 + 107.159 + @Override 107.160 + protected void append(GeneralDBSqlWithin expr, GeneralDBSqlExprBuilder filter) 107.161 + throws UnsupportedRdbmsOperatorException { 107.162 + 107.163 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Within); 107.164 + 107.165 + } 107.166 + 107.167 @Override 107.168 protected void append(GeneralDBSqlContains expr, GeneralDBSqlExprBuilder filter) 107.169 throws UnsupportedRdbmsOperatorException { 107.170 107.171 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Contains); 107.172 } 107.173 - 107.174 - 107.175 - 107.176 107.177 @Override 107.178 - protected void append(GeneralDBSqlEqualsSpatial expr, GeneralDBSqlExprBuilder filter) 107.179 - throws UnsupportedRdbmsOperatorException { 107.180 - 107.181 - appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Equals); 107.182 - } 107.183 - 107.184 - @Override 107.185 - protected void append(GeneralDBSqlInside expr, GeneralDBSqlExprBuilder filter) 107.186 - throws UnsupportedRdbmsOperatorException { 107.187 - 107.188 - //appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.inside); 107.189 - appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Within); 107.190 - 107.191 - } 107.192 - 107.193 - @Override 107.194 - protected void append(GeneralDBSqlCovers expr, GeneralDBSqlExprBuilder filter) 107.195 - throws UnsupportedRdbmsOperatorException { 107.196 - 107.197 - appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Covers); 107.198 - } 107.199 - 107.200 - @Override 107.201 - protected void append(GeneralDBSqlCoveredBy expr, GeneralDBSqlExprBuilder filter) 107.202 - throws UnsupportedRdbmsOperatorException { 107.203 - 107.204 - appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_CoveredBy); 107.205 - } 107.206 - 107.207 - @Override 107.208 - protected void append(GeneralDBSqlTouch expr, GeneralDBSqlExprBuilder filter) 107.209 - throws UnsupportedRdbmsOperatorException { 107.210 - 107.211 - appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Touches); 107.212 - } 107.213 - 107.214 - @Override 107.215 - protected void append(GeneralDBSqlOverlap expr, GeneralDBSqlExprBuilder filter) 107.216 + protected void append(GeneralDBSqlOverlaps expr, GeneralDBSqlExprBuilder filter) 107.217 throws UnsupportedRdbmsOperatorException { 107.218 107.219 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Overlaps); 107.220 } 107.221 - 107.222 + 107.223 @Override 107.224 - protected void append(GeneralDBSqlDisjoint expr, GeneralDBSqlExprBuilder filter) 107.225 + protected void append(GeneralDBSqlRelate expr, GeneralDBSqlExprBuilder filter) 107.226 throws UnsupportedRdbmsOperatorException { 107.227 - 107.228 - appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Disjoint); 107.229 + appendGeneralDBSpatialFunctionTriple(expr, filter, SpatialFunctionsPostGIS.ST_Relate); 107.230 } 107.231 107.232 - @Override 107.233 - protected void append(GeneralDBSqlRelate expr, GeneralDBSqlExprBuilder filter) 107.234 - throws UnsupportedRdbmsOperatorException 107.235 - { 107.236 - appendGeneralDBSpatialFunctionTriple(expr, filter, SpatialFunctionsPostGIS.ST_Relate); 107.237 - } 107.238 +// @Override 107.239 +// protected void append(GeneralDBSqlCovers expr, GeneralDBSqlExprBuilder filter) 107.240 +// throws UnsupportedRdbmsOperatorException { 107.241 +// 107.242 +// appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Covers); 107.243 +// } 107.244 +// 107.245 +// @Override 107.246 +// protected void append(GeneralDBSqlCoveredBy expr, GeneralDBSqlExprBuilder filter) 107.247 +// throws UnsupportedRdbmsOperatorException { 107.248 +// 107.249 +// appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_CoveredBy); 107.250 +// } 107.251 107.252 + 107.253 + 107.254 + 107.255 + 107.256 + 107.257 @Override 107.258 protected void append(GeneralDBSqlLeft expr, GeneralDBSqlExprBuilder filter) 107.259 throws UnsupportedRdbmsOperatorException 107.260 @@ -502,18 +514,18 @@ 107.261 @Override 107.262 protected void append(GeneralDBSqlMbbIntersects expr, GeneralDBSqlExprBuilder filter) 107.263 throws UnsupportedRdbmsOperatorException { 107.264 - appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.anyInteract); 107.265 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.intersects); 107.266 } 107.267 107.268 @Override 107.269 - protected void append(GeneralDBSqlMbbInside expr, GeneralDBSqlExprBuilder filter) 107.270 + protected void append(GeneralDBSqlMbbWithin expr, GeneralDBSqlExprBuilder filter) 107.271 throws UnsupportedRdbmsOperatorException { 107.272 appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.inside); 107.273 } 107.274 107.275 107.276 @Override 107.277 - protected void append(GeneralDBSqlContainsMBB expr, GeneralDBSqlExprBuilder filter) 107.278 + protected void append(GeneralDBSqlMbbContains expr, GeneralDBSqlExprBuilder filter) 107.279 throws UnsupportedRdbmsOperatorException { 107.280 appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.contains); 107.281 } 107.282 @@ -762,6 +774,19 @@ 107.283 appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_SymDifference); 107.284 } 107.285 107.286 + /** Addition for datetime metric functions 107.287 + * 107.288 + * @author George Garbis <ggarbis@di.uoa.gr> 107.289 + * 107.290 + */ 107.291 + @Override 107.292 + protected void append(GeneralDBSqlDiffDateTime expr, GeneralDBSqlExprBuilder filter) 107.293 + throws UnsupportedRdbmsOperatorException 107.294 + { 107.295 + appendGeneralDBDateTimeFunctionBinary(expr, filter, DateTimeFunctionPostGIS.Difference); 107.296 + } 107.297 + /***/ 107.298 + 107.299 //Spatial Metric Functions 107.300 @Override 107.301 protected void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter) 107.302 @@ -1205,7 +1230,7 @@ 107.303 // 107.304 // switch(operand) 107.305 // { 107.306 - // case anyInteract: filter.anyInteract(); break; 107.307 + // case mbbIntersects: filter.mbbIntersects(); break; 107.308 // case equals: filter.equals(); break; 107.309 // case contains: filter.contains(); break; 107.310 // case inside: filter.inside(); break; 107.311 @@ -1292,7 +1317,7 @@ 107.312 107.313 switch(operand) 107.314 { 107.315 - case anyInteract: filter.intersectsMBB(); break; 107.316 + case intersects: filter.intersectsMBB(); break; 107.317 case equals: filter.equalsMBB(); break; 107.318 case contains: filter.containsMBB(); break; 107.319 case inside: filter.insideMBB(); break; 107.320 @@ -1481,7 +1506,117 @@ 107.321 107.322 } 107.323 107.324 + /** Addition for datetime metric functions 107.325 + * 107.326 + * @author George Garbis <ggarbis@di.uoa.gr> 107.327 + * 107.328 + */ 107.329 + protected void appendGeneralDBDateTimeFunctionBinary(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, DateTimeFunctionPostGIS func) 107.330 + throws UnsupportedRdbmsOperatorException 107.331 + { 107.332 + filter.openBracket(); 107.333 107.334 + boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 107.335 + boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 107.336 + 107.337 + if(check1) 107.338 + { 107.339 + this.append((GeneralDBSqlNull)expr.getLeftArg(), filter); 107.340 + 107.341 + } 107.342 + else if(check2) 107.343 + { 107.344 + this.append((GeneralDBSqlNull)expr.getRightArg(), filter); 107.345 + } 107.346 + else 107.347 + { 107.348 + 107.349 + GeneralDBSqlExpr tmp = expr; 107.350 + if(tmp instanceof GeneralDBSqlSpatialConstructBinary && tmp.getParentNode() == null) 107.351 + { 107.352 + while(true) 107.353 + { 107.354 + GeneralDBSqlExpr child; 107.355 + 107.356 + if(tmp instanceof BinaryGeneralDBOperator) 107.357 + { 107.358 + child = ((BinaryGeneralDBOperator) tmp).getLeftArg(); 107.359 + } 107.360 + else //(tmp instanceof UnaryGeneralDBOperator) 107.361 + { 107.362 + child = ((UnaryGeneralDBOperator) tmp).getArg(); 107.363 + } 107.364 + 107.365 + tmp = child; 107.366 + if(tmp instanceof GeneralDBLabelColumn) 107.367 + { 107.368 + //Reached the innermost left var -> need to capture its SRID 107.369 + String alias; 107.370 + if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) { 107.371 + //Predicates used in triple patterns non-existent in db 107.372 + alias="NULL"; 107.373 + } 107.374 + else 107.375 + { 107.376 + //Reached the innermost left var -> need to capture its SRID 107.377 + alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar()); 107.378 + } 107.379 + break; 107.380 + } 107.381 + } 107.382 + } 107.383 + 107.384 + filter.openBracket(); 107.385 + 107.386 + if(expr.getLeftArg() instanceof GeneralDBStringValue) 107.387 + { 107.388 + GeneralDBStringValue arg = (GeneralDBStringValue) expr.getLeftArg(); 107.389 + String raw = arg.getValue(); 107.390 + filter.append(" "+raw+" "); 107.391 + } 107.392 + else if(expr.getLeftArg() instanceof GeneralDBNumberValue) 107.393 + { 107.394 + append(((GeneralDBNumberValue)expr.getLeftArg()), filter); 107.395 + } 107.396 + else if(expr.getLeftArg() instanceof GeneralDBDateTimeColumn) 107.397 + { 107.398 + append(((GeneralDBDateTimeColumn)expr.getLeftArg()),filter); 107.399 + } 107.400 + else 107.401 + { 107.402 + // Den prepei na ftasei edw 107.403 + } 107.404 + 107.405 + switch(func) 107.406 + { 107.407 + case Difference: filter.append(" - "); break; 107.408 + } 107.409 + 107.410 + if(expr.getRightArg() instanceof GeneralDBStringValue) 107.411 + { 107.412 + GeneralDBStringValue arg = (GeneralDBStringValue) expr.getRightArg(); 107.413 + String raw = arg.getValue(); 107.414 + filter.append(" "+raw+" "); 107.415 + } 107.416 + else if(expr.getRightArg() instanceof GeneralDBNumberValue) 107.417 + { 107.418 + append(((GeneralDBNumberValue)expr.getRightArg()), filter); 107.419 + } 107.420 + else if(expr.getRightArg() instanceof GeneralDBDateTimeColumn) 107.421 + { 107.422 + append(((GeneralDBDateTimeColumn)expr.getRightArg()),filter); 107.423 + } 107.424 + else 107.425 + { 107.426 + // Den prepei na ftasei edw 107.427 + } 107.428 + 107.429 + 107.430 + filter.closeBracket(); 107.431 + } 107.432 + filter.closeBracket(); 107.433 + } 107.434 + /***/ 107.435 107.436 //Used in all the generaldb stsparql boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 107.437 //EXCEPT ST_Transform!!! 107.438 @@ -1754,15 +1889,15 @@ 107.439 case ST_SymDifference: filter.appendFunction("ST_SymDifference"); break; 107.440 case ST_Buffer: filter.appendFunction("ST_Buffer"); break; 107.441 case ST_Distance: filter.appendFunction("ST_Distance"); break; 107.442 + 107.443 + case ST_Equals: filter.appendFunction("ST_Equals"); break; 107.444 + case ST_Disjoint: filter.appendFunction("ST_Disjoint"); break; 107.445 + case ST_Intersects: filter.appendFunction("ST_Intersects"); break; 107.446 case ST_Touches: filter.appendFunction("ST_Touches"); break; 107.447 - case ST_Disjoint: filter.appendFunction("ST_Disjoint"); break; 107.448 - case ST_Covers: filter.appendFunction("ST_Covers"); break; 107.449 + case ST_Crosses: filter.appendFunction("ST_Crosses"); break; 107.450 + case ST_Within: filter.appendFunction("ST_Within"); break; 107.451 case ST_Contains: filter.appendFunction("ST_Contains"); break; 107.452 - case ST_CoveredBy: filter.appendFunction("ST_CoveredBy"); break; 107.453 case ST_Overlaps: filter.appendFunction("ST_Overlaps"); break; 107.454 - case ST_Intersects: filter.appendFunction("ST_Intersects"); break; 107.455 - case ST_Equals: filter.appendFunction("ST_Equals"); break; 107.456 - case ST_Within: filter.appendFunction("ST_Within"); break; 107.457 107.458 } 107.459 107.460 @@ -2277,30 +2412,6 @@ 107.461 char[][] intersectionPattern = null; 107.462 switch(func) 107.463 { 107.464 - case ST_Covers: 107.465 - intersectionPattern = new char[1][9]; 107.466 - intersectionPattern[0][0] = 'T'; 107.467 - intersectionPattern[0][1] = '*'; 107.468 - intersectionPattern[0][2] = 'T'; 107.469 - intersectionPattern[0][3] = 'F'; 107.470 - intersectionPattern[0][4] = 'T'; 107.471 - intersectionPattern[0][5] = '*'; 107.472 - intersectionPattern[0][6] = 'F'; 107.473 - intersectionPattern[0][7] = 'F'; 107.474 - intersectionPattern[0][8] = '*'; 107.475 - break; 107.476 - case ST_CoveredBy: 107.477 - intersectionPattern = new char[1][9]; 107.478 - intersectionPattern[0][0] = 'T'; 107.479 - intersectionPattern[0][1] = 'F'; 107.480 - intersectionPattern[0][2] = 'F'; 107.481 - intersectionPattern[0][3] = '*'; 107.482 - intersectionPattern[0][4] = 'T'; 107.483 - intersectionPattern[0][5] = 'F'; 107.484 - intersectionPattern[0][6] = 'T'; 107.485 - intersectionPattern[0][7] = '*'; 107.486 - intersectionPattern[0][8] = '*'; 107.487 - break; 107.488 case SF_Contains: 107.489 intersectionPattern = new char[1][9]; 107.490 intersectionPattern[0][0] = 'T'; 107.491 @@ -2313,8 +2424,14 @@ 107.492 intersectionPattern[0][7] = 'F'; 107.493 intersectionPattern[0][8] = '*'; 107.494 break; 107.495 - case SF_Crosses: 107.496 - intersectionPattern = new char[1][9]; 107.497 + case SF_Crosses: 107.498 + // FIXME BUG 107.499 + // TODO a crosses b, they have some but not all interior points in common 107.500 + // (and the dimension of the intersection is less than that of at least one 107.501 + // of them). Mask selection rules are checked only when dim(a)≠dim(b), 107.502 + // except by point/point inputs, otherwise is false. 107.503 + // (II=0) for points, (II ∧ IE) when dim(a)<dim(b), (II ∧ EI) when dim(a)>dim(b) 107.504 + intersectionPattern = new char[3][9]; 107.505 intersectionPattern[0][0] = 'T'; 107.506 intersectionPattern[0][1] = '*'; 107.507 intersectionPattern[0][2] = 'T'; 107.508 @@ -2324,6 +2441,26 @@ 107.509 intersectionPattern[0][6] = '*'; 107.510 intersectionPattern[0][7] = '*'; 107.511 intersectionPattern[0][8] = '*'; 107.512 + // 107.513 + intersectionPattern[1][0] = 'T'; 107.514 + intersectionPattern[1][1] = '*'; 107.515 + intersectionPattern[1][2] = '*'; 107.516 + intersectionPattern[1][3] = '*'; 107.517 + intersectionPattern[1][4] = '*'; 107.518 + intersectionPattern[1][5] = '*'; 107.519 + intersectionPattern[1][6] = 'T'; 107.520 + intersectionPattern[1][7] = '*'; 107.521 + intersectionPattern[1][8] = '*'; 107.522 + // 107.523 + intersectionPattern[2][0] = '0'; 107.524 + intersectionPattern[2][1] = '*'; 107.525 + intersectionPattern[2][2] = '*'; 107.526 + intersectionPattern[2][3] = '*'; 107.527 + intersectionPattern[2][4] = '*'; 107.528 + intersectionPattern[2][5] = '*'; 107.529 + intersectionPattern[2][6] = '*'; 107.530 + intersectionPattern[2][7] = '*'; 107.531 + intersectionPattern[2][8] = '*'; 107.532 break; 107.533 case SF_Disjoint: 107.534 case EH_Disjoint: 107.535 @@ -2354,7 +2491,14 @@ 107.536 break; 107.537 case SF_Overlaps: 107.538 case EH_Overlap: 107.539 - intersectionPattern = new char[1][9]; 107.540 + // FIXME BUG 107.541 + // TODO a overlaps b, they have some but not all points in common, 107.542 + // they have the same dimension, and the intersection of the 107.543 + // interiors of the two geometries has the same dimension as the 107.544 + // geometries themselves. Mask selection rules are checked 107.545 + // only when dim(a)=dim(b), otherwise is false: 107.546 + // (II ∧ IE ∧ EI) for points or surfaces, (II=1 ∧ IE ∧ EI) for lines 107.547 + intersectionPattern = new char[2][9]; 107.548 intersectionPattern[0][0] = 'T'; 107.549 intersectionPattern[0][1] = '*'; 107.550 intersectionPattern[0][2] = 'T'; 107.551 @@ -2364,6 +2508,15 @@ 107.552 intersectionPattern[0][6] = 'T'; 107.553 intersectionPattern[0][7] = '*'; 107.554 intersectionPattern[0][8] = '*'; 107.555 + intersectionPattern[1][0] = '1'; 107.556 + intersectionPattern[1][1] = '*'; 107.557 + intersectionPattern[1][2] = 'T'; 107.558 + intersectionPattern[1][3] = '*'; 107.559 + intersectionPattern[1][4] = '*'; 107.560 + intersectionPattern[1][5] = '*'; 107.561 + intersectionPattern[1][6] = 'T'; 107.562 + intersectionPattern[1][7] = '*'; 107.563 + intersectionPattern[1][8] = '*'; 107.564 break; 107.565 case SF_Within: 107.566 intersectionPattern = new char[1][9];
108.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 108.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java.orig Fri Feb 08 16:42:42 2013 +0200 108.3 @@ -0,0 +1,2150 @@ 108.4 +/* 108.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008. 108.6 + * 108.7 + * Licensed under the Aduna BSD-style license. 108.8 + */ 108.9 +package org.openrdf.sail.postgis.evaluation; 108.10 + 108.11 +import java.util.ArrayList; 108.12 +import java.util.List; 108.13 + 108.14 +import org.openrdf.query.algebra.evaluation.function.spatial.StrabonPolyhedron; 108.15 +import org.openrdf.sail.generaldb.algebra.GeneralDBColumnVar; 108.16 +import org.openrdf.sail.generaldb.algebra.GeneralDBDoubleValue; 108.17 +import org.openrdf.sail.generaldb.algebra.GeneralDBLabelColumn; 108.18 +import org.openrdf.sail.generaldb.algebra.GeneralDBNumericColumn; 108.19 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAbove; 108.20 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnd; 108.21 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlAnyInteract; 108.22 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlBelow; 108.23 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCase; 108.24 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContains; 108.25 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlContainsMBB; 108.26 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCoveredBy; 108.27 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlCovers; 108.28 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlDisjoint; 108.29 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlEqualsSpatial; 108.30 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoArea; 108.31 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoAsGML; 108.32 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoAsText; 108.33 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoBoundary; 108.34 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoBuffer; 108.35 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoConvexHull; 108.36 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoDifference; 108.37 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoDimension; 108.38 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoDistance; 108.39 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoEnvelope; 108.40 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoGeometryType; 108.41 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIntersection; 108.42 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsEmpty; 108.43 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoIsSimple; 108.44 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSrid; 108.45 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoSymDifference; 108.46 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoTransform; 108.47 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlGeoUnion; 108.48 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlInside; 108.49 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIntersects; 108.50 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlIsNull; 108.51 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlLeft; 108.52 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr; 108.53 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbEquals; 108.54 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbInside; 108.55 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMbbIntersects; 108.56 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot; 108.57 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull; 108.58 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlOverlap; 108.59 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRelate; 108.60 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRight; 108.61 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary; 108.62 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructUnary; 108.63 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricBinary; 108.64 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricUnary; 108.65 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialProperty; 108.66 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouch; 108.67 +import org.openrdf.sail.generaldb.algebra.GeneralDBStringValue; 108.68 +import org.openrdf.sail.generaldb.algebra.GeneralDBURIColumn; 108.69 +import org.openrdf.sail.generaldb.algebra.GeneralDBUnionItem; 108.70 +import org.openrdf.sail.generaldb.algebra.base.BinaryGeneralDBOperator; 108.71 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBFromItem; 108.72 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 108.73 +import org.openrdf.sail.generaldb.algebra.base.TripleGeneralDBOperator; 108.74 +import org.openrdf.sail.generaldb.algebra.base.UnaryGeneralDBOperator; 108.75 +import org.openrdf.sail.generaldb.algebra.egenhofer.GeneralDBSqlEgenhofer_Contains; 108.76 +import org.openrdf.sail.generaldb.algebra.egenhofer.GeneralDBSqlEgenhofer_CoveredBy; 108.77 +import org.openrdf.sail.generaldb.algebra.egenhofer.GeneralDBSqlEgenhofer_Covers; 108.78 +import org.openrdf.sail.generaldb.algebra.egenhofer.GeneralDBSqlEgenhofer_Disjoint; 108.79 +import org.openrdf.sail.generaldb.algebra.egenhofer.GeneralDBSqlEgenhofer_Equals; 108.80 +import org.openrdf.sail.generaldb.algebra.egenhofer.GeneralDBSqlEgenhofer_Inside; 108.81 +import org.openrdf.sail.generaldb.algebra.egenhofer.GeneralDBSqlEgenhofer_Meet; 108.82 +import org.openrdf.sail.generaldb.algebra.egenhofer.GeneralDBSqlEgenhofer_Overlap; 108.83 +import org.openrdf.sail.generaldb.algebra.rcc8.GeneralDBSqlRCC8_Dc; 108.84 +import org.openrdf.sail.generaldb.algebra.rcc8.GeneralDBSqlRCC8_Ec; 108.85 +import org.openrdf.sail.generaldb.algebra.rcc8.GeneralDBSqlRCC8_Eq; 108.86 +import org.openrdf.sail.generaldb.algebra.rcc8.GeneralDBSqlRCC8_Ntpp; 108.87 +import org.openrdf.sail.generaldb.algebra.rcc8.GeneralDBSqlRCC8_Ntppi; 108.88 +import org.openrdf.sail.generaldb.algebra.rcc8.GeneralDBSqlRCC8_Po; 108.89 +import org.openrdf.sail.generaldb.algebra.rcc8.GeneralDBSqlRCC8_Tpp; 108.90 +import org.openrdf.sail.generaldb.algebra.rcc8.GeneralDBSqlRCC8_Tppi; 108.91 +import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Contains; 108.92 +import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Crosses; 108.93 +import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Disjoint; 108.94 +import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Equals; 108.95 +import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Intersects; 108.96 +import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Overlaps; 108.97 +import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Touches; 108.98 +import org.openrdf.sail.generaldb.algebra.sf.GeneralDBSqlSF_Within; 108.99 +import org.openrdf.sail.generaldb.evaluation.GeneralDBQueryBuilder; 108.100 +import org.openrdf.sail.generaldb.evaluation.GeneralDBSqlBracketBuilder; 108.101 +import org.openrdf.sail.generaldb.evaluation.GeneralDBSqlExprBuilder; 108.102 +import org.openrdf.sail.generaldb.evaluation.GeneralDBSqlJoinBuilder; 108.103 +import org.openrdf.sail.generaldb.evaluation.GeneralDBSqlQueryBuilder; 108.104 +import org.openrdf.sail.rdbms.exceptions.RdbmsException; 108.105 +import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException; 108.106 + 108.107 +/** 108.108 + * Constructs an SQL query from {@link GeneralDBSqlExpr}s and {@link GeneralDBFromItem}s. 108.109 + * 108.110 + * @author Manos Karpathiotakis <mk@di.uoa.gr> 108.111 + * 108.112 + */ 108.113 +public class PostGISQueryBuilder extends GeneralDBQueryBuilder { 108.114 + 108.115 + public static final String STRDFGEO_FIELD = "strdfgeo"; 108.116 + public static final String SRID_FIELD = "srid"; 108.117 + public static final String ST_TRANSFORM = "ST_Transform"; 108.118 + public static final String ST_ASBINARY = "ST_AsBinary"; 108.119 + /** 108.120 + * If (spatial) label column met is null, I must not try to retrieve its srid. 108.121 + * Opting to ask for 'null' instead 108.122 + */ 108.123 + boolean nullLabel = false; 108.124 + 108.125 + public enum SpatialOperandsPostGIS { anyInteract, equals, contains, left, right, above, inside, below; } 108.126 + public enum SpatialFunctionsPostGIS 108.127 + { //stSPARQL++ 108.128 + //Spatial Relationships 108.129 + ST_Disjoint, 108.130 + ST_Touches, 108.131 + ST_Covers, 108.132 + ST_CoveredBy, 108.133 + ST_Overlaps, 108.134 + ST_Intersects, 108.135 + ST_Equals, 108.136 + ST_Relate, 108.137 + ST_Within, 108.138 + ST_Contains, 108.139 + 108.140 + 108.141 + //Spatial Constructs - Binary 108.142 + ST_Union, 108.143 + ST_Intersection, 108.144 + ST_Difference, 108.145 + ST_Buffer, 108.146 + ST_Transform, 108.147 + ST_SymDifference, 108.148 + 108.149 + 108.150 + //Spatial Constructs - Unary 108.151 + ST_Envelope, 108.152 + ST_ConvexHull, 108.153 + ST_Boundary, 108.154 + 108.155 + //Spatial Metrics - Binary 108.156 + ST_Distance, 108.157 + 108.158 + //Spatial Metrics - Unary 108.159 + ST_Area, 108.160 + 108.161 + //Spatial Properties - All Unary 108.162 + ST_Dimension, 108.163 + ST_GeometryType, 108.164 + ST_AsGML, 108.165 + ST_AsText, 108.166 + ST_SRID, 108.167 + ST_IsEmpty, 108.168 + ST_IsSimple, 108.169 + 108.170 + //GeoSPARQL 108.171 + //Simple Features 108.172 + SF_Equals, 108.173 + SF_Disjoint, 108.174 + SF_Intersects, 108.175 + SF_Touches, 108.176 + SF_Within, 108.177 + SF_Contains, 108.178 + SF_Overlaps, 108.179 + SF_Crosses, 108.180 + 108.181 + //RCC8 108.182 + RCC8_Eq, 108.183 + RCC8_Dc, 108.184 + RCC8_Ec, 108.185 + RCC8_Po, 108.186 + RCC8_Tppi, 108.187 + RCC8_Tpp, 108.188 + RCC8_Ntppi, 108.189 + RCC8_Ntpp, 108.190 + 108.191 + //Egenhofer 108.192 + EH_Equals, 108.193 + EH_Disjoint, 108.194 + EH_Meet, 108.195 + EH_Overlap, 108.196 + EH_Covers, 108.197 + EH_CoveredBy, 108.198 + EH_Inside, 108.199 + EH_Contains, 108.200 + ; 108.201 + } 108.202 + 108.203 + public enum DateTimeFunctionsPostGIS { 108.204 + Difference; 108.205 + } 108.206 + 108.207 + public PostGISQueryBuilder() { 108.208 + super(); 108.209 + } 108.210 + 108.211 + public PostGISQueryBuilder(GeneralDBSqlQueryBuilder builder) { 108.212 + super(builder); 108.213 + this.query = builder; 108.214 + } 108.215 + 108.216 + @Override 108.217 + protected void append(GeneralDBSqlNull expr, GeneralDBSqlExprBuilder filter) { 108.218 + filter.appendNull(); 108.219 + } 108.220 + 108.221 + @Override 108.222 + protected void append(GeneralDBSqlIsNull expr, GeneralDBSqlExprBuilder filter) 108.223 + throws UnsupportedRdbmsOperatorException 108.224 + { 108.225 + dispatch(expr.getArg(), filter); 108.226 + filter.isNull(); 108.227 + } 108.228 + 108.229 + @Override 108.230 + protected void append(GeneralDBSqlNot expr, GeneralDBSqlExprBuilder filter) 108.231 + throws UnsupportedRdbmsOperatorException 108.232 + { 108.233 + if (expr.getArg() instanceof GeneralDBSqlIsNull) { 108.234 + GeneralDBSqlIsNull arg = (GeneralDBSqlIsNull)expr.getArg(); 108.235 + dispatch(arg.getArg(), filter); 108.236 + filter.isNotNull(); 108.237 + } 108.238 + else { 108.239 + GeneralDBSqlBracketBuilder open = filter.not(); 108.240 + dispatch(expr.getArg(), (GeneralDBSqlExprBuilder) open); 108.241 + open.close(); 108.242 + } 108.243 + } 108.244 + 108.245 + @Override 108.246 + protected void append(GeneralDBLabelColumn var, GeneralDBSqlExprBuilder filter) { 108.247 + if (var.getRdbmsVar().isResource()) { 108.248 + filter.appendNull(); 108.249 + nullLabel = true; 108.250 + } 108.251 + else { 108.252 + if(var.isSpatial()) 108.253 + { 108.254 + filter.appendFunction(ST_ASBINARY); 108.255 + filter.openBracket(); 108.256 + //XXX SRID 108.257 + filter.appendFunction(ST_TRANSFORM); 108.258 + filter.openBracket(); 108.259 + // 108.260 + String alias = getLabelAlias(var.getRdbmsVar()); 108.261 + 108.262 + filter.column(alias, STRDFGEO_FIELD); 108.263 + //XXX SRID 108.264 + filter.appendComma(); 108.265 + filter.column(alias, SRID_FIELD); 108.266 + filter.closeBracket(); 108.267 + // 108.268 + filter.closeBracket(); 108.269 + 108.270 + //Adding srid field explicitly for my StrabonPolyhedron constructor later on! 108.271 + filter.appendComma(); 108.272 + filter.column(alias, SRID_FIELD); 108.273 + } 108.274 + else 108.275 + { 108.276 + //XXX original/default case 108.277 + String alias = getLabelAlias(var.getRdbmsVar()); 108.278 + filter.column(alias, "value"); 108.279 + } 108.280 + } 108.281 + } 108.282 + 108.283 + @Override 108.284 + protected void append(GeneralDBSqlAnd expr, GeneralDBSqlExprBuilder filter) 108.285 + throws UnsupportedRdbmsOperatorException 108.286 + { 108.287 + dispatch(expr.getLeftArg(), filter); 108.288 + filter.and(); 108.289 + dispatch(expr.getRightArg(), filter); 108.290 + } 108.291 + 108.292 + protected GeneralDBSqlJoinBuilder subJoinAndFilter(GeneralDBSqlJoinBuilder query, GeneralDBFromItem from) 108.293 + throws RdbmsException, UnsupportedRdbmsOperatorException 108.294 + { 108.295 + if (from instanceof GeneralDBUnionItem) { 108.296 + GeneralDBUnionItem union = (GeneralDBUnionItem)from; 108.297 + List<String> names = union.getSelectVarNames(); 108.298 + List<GeneralDBColumnVar> vars = union.appendVars(new ArrayList<GeneralDBColumnVar>()); 108.299 + GeneralDBSqlQueryBuilder subquery = query.subquery(); 108.300 + for (GeneralDBFromItem item : union.getUnion()) { 108.301 + for (int i = 0, n = names.size(); i < n; i++) { 108.302 + GeneralDBColumnVar var = item.getVar(names.get(i)); 108.303 + GeneralDBSqlExprBuilder select = subquery.select(); 108.304 + if (var == null) { 108.305 + select.appendNull(); 108.306 + } 108.307 + else if (var.isImplied()) { 108.308 + select.appendNumeric(vf.getInternalId(var.getValue())); 108.309 + } 108.310 + else { 108.311 + select.column(var.getAlias(), var.getColumn()); 108.312 + } 108.313 + select.as(vars.get(i).getColumn()); 108.314 + } 108.315 + from(subquery, item); 108.316 + subquery = subquery.union(); 108.317 + } 108.318 + } 108.319 + for (GeneralDBFromItem join : from.getJoins()) { 108.320 + join(query, join); 108.321 + } 108.322 + for (GeneralDBSqlExpr expr : from.getFilters()) { 108.323 + dispatch(expr, query.on().and()); 108.324 + } 108.325 + return query; 108.326 + } 108.327 + 108.328 + //FIXME my addition from here on 108.329 + 108.330 + //Issue with this function: crashes when MathExpr is present in Select but does not 108.331 + //involve spatial variables! must escape this somehow 108.332 + @Override 108.333 + public GeneralDBQueryBuilder construct(GeneralDBSqlExpr expr) throws UnsupportedRdbmsOperatorException 108.334 + { 108.335 + if(!(expr instanceof GeneralDBSqlSpatialMetricBinary) 108.336 + &&!(expr instanceof GeneralDBSqlSpatialMetricUnary) 108.337 + &&!(expr instanceof GeneralDBSqlMathExpr) 108.338 + &&!(expr instanceof GeneralDBSqlSpatialProperty)) 108.339 + { 108.340 + query.select().appendFunction(ST_ASBINARY); 108.341 + } 108.342 + else 108.343 + { 108.344 + query.select(); 108.345 + } 108.346 + if(expr instanceof BinaryGeneralDBOperator) 108.347 + { 108.348 + dispatchBinarySqlOperator((BinaryGeneralDBOperator) expr, query.select); 108.349 + } 108.350 + else if(expr instanceof UnaryGeneralDBOperator) 108.351 + { 108.352 + dispatchUnarySqlOperator((UnaryGeneralDBOperator) expr, query.select); 108.353 + } 108.354 + //SRID support must be explicitly added! 108.355 + 108.356 + return this; 108.357 + } 108.358 + 108.359 + //Spatial Relationship Functions 108.360 + @Override 108.361 + protected void append(GeneralDBSqlAnyInteract expr, GeneralDBSqlExprBuilder filter) 108.362 + throws UnsupportedRdbmsOperatorException 108.363 + { 108.364 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Intersects); 108.365 + } 108.366 + 108.367 + 108.368 + @Override 108.369 + protected void append(GeneralDBSqlIntersects expr, GeneralDBSqlExprBuilder filter) 108.370 + throws UnsupportedRdbmsOperatorException { 108.371 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Intersects); 108.372 + } 108.373 + 108.374 + @Override 108.375 + protected void append(GeneralDBSqlContains expr, GeneralDBSqlExprBuilder filter) 108.376 + throws UnsupportedRdbmsOperatorException { 108.377 + 108.378 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Contains); 108.379 + } 108.380 + 108.381 + 108.382 + 108.383 + 108.384 + @Override 108.385 + protected void append(GeneralDBSqlEqualsSpatial expr, GeneralDBSqlExprBuilder filter) 108.386 + throws UnsupportedRdbmsOperatorException { 108.387 + 108.388 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Equals); 108.389 + } 108.390 + 108.391 + @Override 108.392 + protected void append(GeneralDBSqlInside expr, GeneralDBSqlExprBuilder filter) 108.393 + throws UnsupportedRdbmsOperatorException { 108.394 + 108.395 + //appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.inside); 108.396 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Within); 108.397 + 108.398 + } 108.399 + 108.400 + @Override 108.401 + protected void append(GeneralDBSqlCovers expr, GeneralDBSqlExprBuilder filter) 108.402 + throws UnsupportedRdbmsOperatorException { 108.403 + 108.404 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Covers); 108.405 + } 108.406 + 108.407 + @Override 108.408 + protected void append(GeneralDBSqlCoveredBy expr, GeneralDBSqlExprBuilder filter) 108.409 + throws UnsupportedRdbmsOperatorException { 108.410 + 108.411 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_CoveredBy); 108.412 + } 108.413 + 108.414 + @Override 108.415 + protected void append(GeneralDBSqlTouch expr, GeneralDBSqlExprBuilder filter) 108.416 + throws UnsupportedRdbmsOperatorException { 108.417 + 108.418 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Touches); 108.419 + } 108.420 + 108.421 + @Override 108.422 + protected void append(GeneralDBSqlOverlap expr, GeneralDBSqlExprBuilder filter) 108.423 + throws UnsupportedRdbmsOperatorException { 108.424 + 108.425 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Overlaps); 108.426 + } 108.427 + 108.428 + protected void append(GeneralDBSqlDisjoint expr, GeneralDBSqlExprBuilder filter) 108.429 + throws UnsupportedRdbmsOperatorException { 108.430 + 108.431 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Disjoint); 108.432 + } 108.433 + 108.434 + @Override 108.435 + protected void append(GeneralDBSqlRelate expr, GeneralDBSqlExprBuilder filter) 108.436 + throws UnsupportedRdbmsOperatorException 108.437 + { 108.438 + appendGeneralDBSpatialFunctionTriple(expr, filter, SpatialFunctionsPostGIS.ST_Relate); 108.439 + } 108.440 + 108.441 + @Override 108.442 + protected void append(GeneralDBSqlLeft expr, GeneralDBSqlExprBuilder filter) 108.443 + throws UnsupportedRdbmsOperatorException 108.444 + { 108.445 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.left); 108.446 + } 108.447 + 108.448 + @Override 108.449 + protected void append(GeneralDBSqlRight expr, GeneralDBSqlExprBuilder filter) 108.450 + throws UnsupportedRdbmsOperatorException 108.451 + { 108.452 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.right); 108.453 + } 108.454 + 108.455 + @Override 108.456 + protected void append(GeneralDBSqlAbove expr, GeneralDBSqlExprBuilder filter) 108.457 + throws UnsupportedRdbmsOperatorException 108.458 + { 108.459 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.above); 108.460 + } 108.461 + 108.462 + @Override 108.463 + protected void append(GeneralDBSqlBelow expr, GeneralDBSqlExprBuilder filter) 108.464 + throws UnsupportedRdbmsOperatorException 108.465 + { 108.466 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.below); 108.467 + } 108.468 + 108.469 + @Override 108.470 + protected void append(GeneralDBSqlMbbIntersects expr, GeneralDBSqlExprBuilder filter) 108.471 + throws UnsupportedRdbmsOperatorException { 108.472 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.anyInteract); 108.473 + } 108.474 + 108.475 + @Override 108.476 + protected void append(GeneralDBSqlMbbInside expr, GeneralDBSqlExprBuilder filter) 108.477 + throws UnsupportedRdbmsOperatorException { 108.478 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.inside); 108.479 + } 108.480 + 108.481 + 108.482 + @Override 108.483 + protected void append(GeneralDBSqlContainsMBB expr, GeneralDBSqlExprBuilder filter) 108.484 + throws UnsupportedRdbmsOperatorException { 108.485 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.contains); 108.486 + } 108.487 + 108.488 + 108.489 + @Override 108.490 + protected void append(GeneralDBSqlMbbEquals expr, GeneralDBSqlExprBuilder filter) 108.491 + throws UnsupportedRdbmsOperatorException { 108.492 + appendStSPARQLSpatialOperand(expr, filter, SpatialOperandsPostGIS.equals); 108.493 + } 108.494 + 108.495 + //GeoSPARQL - Spatial Relationship Functions 108.496 + //Simple Features 108.497 + @Override 108.498 + protected void append(GeneralDBSqlSF_Contains expr, GeneralDBSqlExprBuilder filter) 108.499 + throws UnsupportedRdbmsOperatorException 108.500 + { 108.501 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Contains); 108.502 + } 108.503 + 108.504 + @Override 108.505 + protected void append(GeneralDBSqlSF_Crosses expr, GeneralDBSqlExprBuilder filter) 108.506 + throws UnsupportedRdbmsOperatorException 108.507 + { 108.508 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Crosses); 108.509 + } 108.510 + 108.511 + @Override 108.512 + protected void append(GeneralDBSqlSF_Disjoint expr, GeneralDBSqlExprBuilder filter) 108.513 + throws UnsupportedRdbmsOperatorException 108.514 + { 108.515 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Disjoint); 108.516 + } 108.517 + 108.518 + @Override 108.519 + protected void append(GeneralDBSqlSF_Equals expr, GeneralDBSqlExprBuilder filter) 108.520 + throws UnsupportedRdbmsOperatorException 108.521 + { 108.522 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Equals); 108.523 + } 108.524 + 108.525 + @Override 108.526 + protected void append(GeneralDBSqlSF_Intersects expr, GeneralDBSqlExprBuilder filter) 108.527 + throws UnsupportedRdbmsOperatorException 108.528 + { 108.529 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Intersects); 108.530 + } 108.531 + 108.532 + @Override 108.533 + protected void append(GeneralDBSqlSF_Overlaps expr, GeneralDBSqlExprBuilder filter) 108.534 + throws UnsupportedRdbmsOperatorException 108.535 + { 108.536 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Overlaps); 108.537 + } 108.538 + 108.539 + @Override 108.540 + protected void append(GeneralDBSqlSF_Touches expr, GeneralDBSqlExprBuilder filter) 108.541 + throws UnsupportedRdbmsOperatorException 108.542 + { 108.543 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Touches); 108.544 + } 108.545 + 108.546 + @Override 108.547 + protected void append(GeneralDBSqlSF_Within expr, GeneralDBSqlExprBuilder filter) 108.548 + throws UnsupportedRdbmsOperatorException 108.549 + { 108.550 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Within); 108.551 + } 108.552 + 108.553 + //Egenhofer 108.554 + @Override 108.555 + protected void append(GeneralDBSqlEgenhofer_CoveredBy expr, GeneralDBSqlExprBuilder filter) 108.556 + throws UnsupportedRdbmsOperatorException 108.557 + { 108.558 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_CoveredBy); 108.559 + } 108.560 + 108.561 + @Override 108.562 + protected void append(GeneralDBSqlEgenhofer_Covers expr, GeneralDBSqlExprBuilder filter) 108.563 + throws UnsupportedRdbmsOperatorException 108.564 + { 108.565 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Covers); 108.566 + } 108.567 + 108.568 + @Override 108.569 + protected void append(GeneralDBSqlEgenhofer_Contains expr, GeneralDBSqlExprBuilder filter) 108.570 + throws UnsupportedRdbmsOperatorException 108.571 + { 108.572 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Contains); 108.573 + } 108.574 + 108.575 + @Override 108.576 + protected void append(GeneralDBSqlEgenhofer_Disjoint expr, GeneralDBSqlExprBuilder filter) 108.577 + throws UnsupportedRdbmsOperatorException 108.578 + { 108.579 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Disjoint); 108.580 + } 108.581 + 108.582 + @Override 108.583 + protected void append(GeneralDBSqlEgenhofer_Equals expr, GeneralDBSqlExprBuilder filter) 108.584 + throws UnsupportedRdbmsOperatorException 108.585 + { 108.586 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Equals); 108.587 + } 108.588 + 108.589 + @Override 108.590 + protected void append(GeneralDBSqlEgenhofer_Inside expr, GeneralDBSqlExprBuilder filter) 108.591 + throws UnsupportedRdbmsOperatorException 108.592 + { 108.593 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Inside); 108.594 + } 108.595 + 108.596 + @Override 108.597 + protected void append(GeneralDBSqlEgenhofer_Meet expr, GeneralDBSqlExprBuilder filter) 108.598 + throws UnsupportedRdbmsOperatorException 108.599 + { 108.600 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Meet); 108.601 + } 108.602 + 108.603 + @Override 108.604 + protected void append(GeneralDBSqlEgenhofer_Overlap expr, GeneralDBSqlExprBuilder filter) 108.605 + throws UnsupportedRdbmsOperatorException 108.606 + { 108.607 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.EH_Overlap); 108.608 + } 108.609 + 108.610 + //RCC8 108.611 + @Override 108.612 + protected void append(GeneralDBSqlRCC8_Dc expr, GeneralDBSqlExprBuilder filter) 108.613 + throws UnsupportedRdbmsOperatorException 108.614 + { 108.615 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Dc); 108.616 + } 108.617 + 108.618 + @Override 108.619 + protected void append(GeneralDBSqlRCC8_Eq expr, GeneralDBSqlExprBuilder filter) 108.620 + throws UnsupportedRdbmsOperatorException 108.621 + { 108.622 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Eq); 108.623 + } 108.624 + 108.625 + @Override 108.626 + protected void append(GeneralDBSqlRCC8_Ec expr, GeneralDBSqlExprBuilder filter) 108.627 + throws UnsupportedRdbmsOperatorException 108.628 + { 108.629 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Ec); 108.630 + } 108.631 + 108.632 + @Override 108.633 + protected void append(GeneralDBSqlRCC8_Po expr, GeneralDBSqlExprBuilder filter) 108.634 + throws UnsupportedRdbmsOperatorException 108.635 + { 108.636 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Po); 108.637 + } 108.638 + 108.639 + @Override 108.640 + protected void append(GeneralDBSqlRCC8_Tppi expr, GeneralDBSqlExprBuilder filter) 108.641 + throws UnsupportedRdbmsOperatorException 108.642 + { 108.643 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Tppi); 108.644 + } 108.645 + 108.646 + @Override 108.647 + protected void append(GeneralDBSqlRCC8_Tpp expr, GeneralDBSqlExprBuilder filter) 108.648 + throws UnsupportedRdbmsOperatorException 108.649 + { 108.650 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Tpp); 108.651 + } 108.652 + 108.653 + @Override 108.654 + protected void append(GeneralDBSqlRCC8_Ntpp expr, GeneralDBSqlExprBuilder filter) 108.655 + throws UnsupportedRdbmsOperatorException 108.656 + { 108.657 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Ntpp); 108.658 + } 108.659 + 108.660 + @Override 108.661 + protected void append(GeneralDBSqlRCC8_Ntppi expr, GeneralDBSqlExprBuilder filter) 108.662 + throws UnsupportedRdbmsOperatorException 108.663 + { 108.664 + appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.RCC8_Ntppi); 108.665 + } 108.666 + 108.667 + //Spatial Construct Functions 108.668 + @Override 108.669 + protected void append(GeneralDBSqlGeoUnion expr, GeneralDBSqlExprBuilder filter) 108.670 + throws UnsupportedRdbmsOperatorException 108.671 + { 108.672 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Union); 108.673 + } 108.674 + 108.675 + @Override 108.676 + protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter) 108.677 + throws UnsupportedRdbmsOperatorException 108.678 + { 108.679 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Buffer); 108.680 + } 108.681 + 108.682 + //XXX Different Behavior 108.683 + @Override 108.684 + protected void append(GeneralDBSqlGeoTransform expr, GeneralDBSqlExprBuilder filter) 108.685 + throws UnsupportedRdbmsOperatorException 108.686 + { 108.687 + appendTransformFunc(expr, filter); 108.688 + } 108.689 + 108.690 + @Override 108.691 + protected void append(GeneralDBSqlGeoEnvelope expr, GeneralDBSqlExprBuilder filter) 108.692 + throws UnsupportedRdbmsOperatorException 108.693 + { 108.694 + appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Envelope); 108.695 + } 108.696 + 108.697 + @Override 108.698 + protected void append(GeneralDBSqlGeoConvexHull expr, GeneralDBSqlExprBuilder filter) 108.699 + throws UnsupportedRdbmsOperatorException 108.700 + { 108.701 + appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_ConvexHull); 108.702 + } 108.703 + 108.704 + @Override 108.705 + protected void append(GeneralDBSqlGeoBoundary expr, GeneralDBSqlExprBuilder filter) 108.706 + throws UnsupportedRdbmsOperatorException 108.707 + { 108.708 + appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Boundary); 108.709 + } 108.710 + 108.711 + @Override 108.712 + protected void append(GeneralDBSqlGeoIntersection expr, GeneralDBSqlExprBuilder filter) 108.713 + throws UnsupportedRdbmsOperatorException 108.714 + { 108.715 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Intersection); 108.716 + } 108.717 + 108.718 + @Override 108.719 + protected void append(GeneralDBSqlGeoDifference expr, GeneralDBSqlExprBuilder filter) 108.720 + throws UnsupportedRdbmsOperatorException 108.721 + { 108.722 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Difference); 108.723 + } 108.724 + 108.725 + @Override 108.726 + protected void append(GeneralDBSqlGeoSymDifference expr, GeneralDBSqlExprBuilder filter) 108.727 + throws UnsupportedRdbmsOperatorException 108.728 + { 108.729 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_SymDifference); 108.730 + } 108.731 + 108.732 + //Spatial Metric Functions 108.733 + @Override 108.734 + protected void append(GeneralDBSqlGeoDistance expr, GeneralDBSqlExprBuilder filter) 108.735 + throws UnsupportedRdbmsOperatorException 108.736 + { 108.737 + appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Distance); 108.738 + } 108.739 + 108.740 + @Override 108.741 + protected void append(GeneralDBSqlGeoArea expr, GeneralDBSqlExprBuilder filter) 108.742 + throws UnsupportedRdbmsOperatorException 108.743 + { 108.744 + appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Area); 108.745 + } 108.746 + 108.747 + //Spatial Property Functions 108.748 + @Override 108.749 + protected void append(GeneralDBSqlGeoDimension expr, GeneralDBSqlExprBuilder filter) 108.750 + throws UnsupportedRdbmsOperatorException 108.751 + { 108.752 + appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_Dimension); 108.753 + } 108.754 + 108.755 + @Override 108.756 + protected void append(GeneralDBSqlGeoGeometryType expr, GeneralDBSqlExprBuilder filter) 108.757 + throws UnsupportedRdbmsOperatorException 108.758 + { 108.759 + appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_GeometryType); 108.760 + } 108.761 + 108.762 + @Override 108.763 + protected void append(GeneralDBSqlGeoAsText expr, GeneralDBSqlExprBuilder filter) 108.764 + throws UnsupportedRdbmsOperatorException 108.765 + { 108.766 + appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_AsText); 108.767 + } 108.768 + 108.769 + @Override 108.770 + protected void append(GeneralDBSqlGeoAsGML expr, GeneralDBSqlExprBuilder filter) 108.771 + throws UnsupportedRdbmsOperatorException 108.772 + { 108.773 + appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_AsGML); 108.774 + } 108.775 + 108.776 + // @Override 108.777 + // protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 108.778 + // throws UnsupportedRdbmsOperatorException 108.779 + // { 108.780 + // appendGeneralDBSpatialFunctionUnary(expr, filter, SpatialFunctionsPostGIS.ST_SRID); 108.781 + // } 108.782 + 108.783 + /** 108.784 + * Special Case because I need to retrieve a single different column from geo_values when this function occurs 108.785 + * in the select clause 108.786 + */ 108.787 + @Override 108.788 + protected void append(GeneralDBSqlGeoSrid expr, GeneralDBSqlExprBuilder filter) 108.789 + throws UnsupportedRdbmsOperatorException 108.790 + { 108.791 + boolean sridNeeded = true; 108.792 + filter.openBracket(); 108.793 + 108.794 + boolean check1 = expr.getArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull"); 108.795 + boolean check2 = false; 108.796 + if(expr.getArg() instanceof GeneralDBLabelColumn) 108.797 + { 108.798 + if(((GeneralDBLabelColumn) expr.getArg()).getRdbmsVar().isResource()) 108.799 + { 108.800 + check2 = true; 108.801 + } 108.802 + } 108.803 + if(check1) 108.804 + { 108.805 + this.append((GeneralDBSqlNull)expr.getArg(), filter); 108.806 + 108.807 + } 108.808 + else if (check2) 108.809 + { 108.810 + appendMBB((GeneralDBLabelColumn)(expr.getArg()),filter); 108.811 + } 108.812 + else 108.813 + { 108.814 + //XXX Incorporating SRID 108.815 + GeneralDBSqlExpr tmp = expr; 108.816 + if(tmp.getParentNode() == null) 108.817 + { 108.818 + String sridExpr; 108.819 + while(true) 108.820 + { 108.821 + GeneralDBSqlExpr child = null; 108.822 + 108.823 + if(tmp instanceof BinaryGeneralDBOperator)