Strabon

changeset 1084:c8f7bc3e7c1c

merge with default
author Babis Nikolaou <charnik@di.uoa.gr>
date Fri Apr 26 19:49:12 2013 +0300 (2013-04-26)
parents 0944a501d988 fb73954c4f91
children d22ee30280ff
files generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java runtime/src/main/java/eu/earthobservatory/runtime/postgis/testCRS.java testsuite/src/test/java/eu/earthobservatory/runtime/postgis/StoreTest.java testsuite/src/test/java/eu/earthobservatory/runtime/postgis/TemplateTest.java testsuite/src/test/java/eu/earthobservatory/runtime/postgis/Utils.java testsuite/src/test/resources/StoreTest/StoreTest.nt testsuite/src/test/resources/StoreTest/StoreTest.rq testsuite/src/test/resources/StoreTest/StoreTest.srx
line diff
     1.1 --- a/README	Fri Apr 26 19:48:06 2013 +0300
     1.2 +++ b/README	Fri Apr 26 19:49:12 2013 +0300
     1.3 @@ -318,19 +318,20 @@
     1.4  	1. Import Strabon into Eclipse as explained in the Developer Guide.
     1.5  	2. Go to strabon-testsuite project.
     1.6  	3. Create a new folder (Recommended folder name: <test's name>) and place inside the following files:
     1.7 -		3.1. An ntriples or nquads file with the test dataset (Recommended file name: <test's name>[.nt, .nq]).
     1.8 -		3.2. A file with the sparql test query (Recommended file name: <test's name>.rq).
     1.9 -		3.3. A file with the expected test results in xml format (Recommended file name: <test's name>.srx).
    1.10 +		3.1. An ntriples or nquads file with the test dataset (with .nt or .nq extension).
    1.11 +		3.2. Pairs of files with sparql test queries and expected test results in xml format.
    1.12 +			 Notice that each pair must have the same name and .rq extension for the queryFile and .srx extension for the resultsFile.
    1.13  	4. Create a test class that extends TemplateTest class.
    1.14 -	5. If you have followed the recommendations the test is ready. If you have different names for your
    1.15 -	files, insert them explicitly in the constructor of TemplateTest class.
    1.16 +	5. If you have followed the recommendations the test is ready. If you have different names or location for your
    1.17 +	files, insert them explicitly in the constructor of the class. WARNING: All prefixes must be placed in file "prefixes" so that
    1.18 +	every time a namespace changes, we have to change it just once.
    1.19  	
    1.20  	If you want to run a test:
    1.21  	
    1.22  	1. Right-click on the test class.
    1.23  	2. Select "Run as JUnit Test".
    1.24  	3. Database properties are retrieved from database.properties file. If you want, you can change a property
    1.25 -	on the fly with an environment variable.
    1.26 +	"on the fly" with an environment variable.
    1.27  
    1.28  	
    1.29  * Command Line
     2.1 --- a/endpoint-client/pom.xml	Fri Apr 26 19:48:06 2013 +0300
     2.2 +++ b/endpoint-client/pom.xml	Fri Apr 26 19:49:12 2013 +0300
     2.3 @@ -59,7 +59,7 @@
     2.4  									<pluginExecutionFilter>
     2.5  										<groupId>org.apache.maven.plugins</groupId>
     2.6  										<artifactId>maven-dependency-plugin</artifactId>
     2.7 -										<versionRange>[2.3,)</versionRange>
     2.8 +										<versionRange>[2.4,)</versionRange>
     2.9  										<goals>
    2.10  											<goal>copy-dependencies</goal>
    2.11  										</goals>
    2.12 @@ -154,6 +154,16 @@
    2.13                                                                          <mainClass>eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint</mainClass>
    2.14                                                                  </transformer>
    2.15                                                          </transformers>
    2.16 +                                                        <filters>
    2.17 +															<filter>
    2.18 +																<artifact>*:*</artifact>
    2.19 +																<excludes>
    2.20 +																	<exclude>META-INF/*.SF</exclude>
    2.21 +																	<exclude>META-INF/*.DSA</exclude>
    2.22 +																	<exclude>META-INF/*.RSA</exclude>
    2.23 +																</excludes>
    2.24 +															</filter>
    2.25 +														</filters>
    2.26                                                  </configuration>
    2.27                                          </execution>
    2.28                                  </executions>
     3.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithVirtuoso.java	Fri Apr 26 19:48:06 2013 +0300
     3.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithVirtuoso.java	Fri Apr 26 19:49:12 2013 +0300
     3.3 @@ -59,9 +59,9 @@
     3.4  	@Test
     3.5  	public void testQuery() {
     3.6  			try {
     3.7 -				EndpointResult response = endpoint.query(query, stSPARQLQueryResultFormat.XML);
     3.8 +				EndpointResult response = endpoint.query(query, stSPARQLQueryResultFormat.TSV);
     3.9  				
    3.10 -				//System.out.println(response.getResponse());
    3.11 +			//	System.out.println(response.getResponse());
    3.12  				
    3.13  				if (response.getStatusCode() != 200) {
    3.14  					System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText());
     4.1 --- a/endpoint/WebContent/store.jsp	Fri Apr 26 19:48:06 2013 +0300
     4.2 +++ b/endpoint/WebContent/store.jsp	Fri Apr 26 19:49:12 2013 +0300
     4.3 @@ -44,7 +44,7 @@
     4.4  
     4.5  <% if (request.getAttribute("error") != null) {%>
     4.6  		<!-- Error Message -->
     4.7 -	  		<TR><TD colspan=3>
     4.8 +	  		<TR><TD colspan=2>
     4.9  	  		<CENTER><P style="color: red;"><%=request.getAttribute("error") %></P></CENTER>
    4.10  	  		</TD></TR>
    4.11  		<!-- Error Message -->
    4.12 @@ -52,29 +52,47 @@
    4.13  
    4.14  <%if (request.getAttribute("info") != null) { %>
    4.15  	<!-- Info Message -->
    4.16 -  		<TR><TD colspan=3>
    4.17 +  		<TR><TD colspan=2>
    4.18    		<CENTER><P><%=request.getAttribute("info") %></P></CENTER>
    4.19    		</TD></TR>
    4.20  	<!-- Info Message -->
    4.21  <%}%>
    4.22  	<tr>
    4.23 -	<!--  direct input form -->
    4.24 -		<td id="output">Direct Input:</td>
    4.25 -		<td id="output">
    4.26 +		<td colspan=2 id="output">
    4.27  			<div style="font-size:13px"> 
    4.28  				You must be logged in to store.
    4.29 -			</div>	
    4.30 -			<textarea name="data" rows="15" cols="100"></textarea></td>
    4.31 -		<td rowspan=4 id="output">
    4.32 -			<CENTER>RDF Format:<br/>
    4.33 +			</div>
    4.34 +		</td>	
    4.35 +	</tr>
    4.36 +	<tr>
    4.37 +		<!--  direct input form -->
    4.38 +		<td id="output">Graph:</td>
    4.39 +		<td id="output">
    4.40 +			<textarea name="graph" title="URI of the named graph to store the input" rows="1" cols="100"></textarea>
    4.41 +		</td>
    4.42 +	</tr>
    4.43 +	<tr>
    4.44 +		<td id="output">RDF Format:</td>
    4.45 +		<td id="output">
    4.46  				<SELECT name="format" title="select one of the following RDF graph format types">
    4.47  				<% for (String format : Common.registeredFormats) {%>
    4.48  					<OPTION value="<%=format%>"><%=format%></OPTION>
    4.49  				<%}%>
    4.50  				</SELECT>
    4.51 -			</CENTER>
    4.52  		</td>
    4.53  	</tr>
    4.54 +		<tr>
    4.55 +		<td id="output">Inference:</td>
    4.56 +		<td id="output">
    4.57 +				<input type="checkbox" title="Enable Inference" name="inference" value="true"> <br>
    4.58 +		</td>
    4.59 +	</tr>
    4.60 +	<tr>
    4.61 +		<!--  direct input form -->
    4.62 +		<td id="output">Direct Input:</td>
    4.63 +		<td id="output">
    4.64 +			<textarea name="data" rows="15" cols="100"></textarea></td>
    4.65 +	</tr>
    4.66  	<tr>
    4.67  		<td colspan=2 id="output"><br/>
    4.68  		<CENTER>
     5.1 --- a/endpoint/pom.xml	Fri Apr 26 19:48:06 2013 +0300
     5.2 +++ b/endpoint/pom.xml	Fri Apr 26 19:49:12 2013 +0300
     5.3 @@ -208,13 +208,32 @@
     5.4  						</archive> -->
     5.5  				</configuration>
     5.6  			</plugin>
     5.7 -			<!-- <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> 
     5.8 -				<version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> 
     5.9 -				<pluginExecution> <pluginExecutionFilter> <groupId>org.apache.maven.plugins</groupId> 
    5.10 -				<artifactId>maven-dependency-plugin</artifactId> <versionRange>[2.1,)</versionRange> 
    5.11 -				<goals> <goal>copy-dependencies</goal> </goals> </pluginExecutionFilter> 
    5.12 -				<action> <ignore /> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> 
    5.13 -				</configuration> </plugin> -->
    5.14 +			<!--
    5.15 +			<plugin>
    5.16 +				<groupId>org.eclipse.m2e</groupId>
    5.17 +				<artifactId>lifecycle-mapping</artifactId>
    5.18 +				<version>1.0.0</version>
    5.19 +				<configuration>
    5.20 +					<lifecycleMappingMetadata>
    5.21 +						<pluginExecutions>
    5.22 +							<pluginExecution>
    5.23 +								<pluginExecutionFilter>
    5.24 +									<groupId>org.apache.maven.plugins</groupId>
    5.25 +									<artifactId>maven-dependency-plugin</artifactId>
    5.26 +									<versionRange>[2.1,)</versionRange>
    5.27 +									<goals>
    5.28 +										<goal>copy-dependencies</goal>
    5.29 +									</goals>
    5.30 +								</pluginExecutionFilter>
    5.31 +								<action>
    5.32 +									<ignore />
    5.33 +								</action>
    5.34 +							</pluginExecution>
    5.35 +						</pluginExecutions>
    5.36 +						</lifecycleMappingMetadata>
    5.37 +				</configuration>
    5.38 +			</plugin>
    5.39 +			-->
    5.40  			<plugin>
    5.41  				<groupId>org.apache.maven.plugins</groupId>
    5.42  				<artifactId>maven-dependency-plugin</artifactId>
    5.43 @@ -271,7 +290,7 @@
    5.44  									<pluginExecutionFilter>
    5.45  										<groupId>org.apache.maven.plugins</groupId>
    5.46  										<artifactId>maven-dependency-plugin</artifactId>
    5.47 -										<versionRange>[2.1,)</versionRange>
    5.48 +										<versionRange>[2.4,)</versionRange>
    5.49  										<goals>
    5.50  											<goal>copy-dependencies</goal>
    5.51  										</goals>
     6.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java	Fri Apr 26 19:48:06 2013 +0300
     6.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/Common.java	Fri Apr 26 19:49:12 2013 +0300
     6.3 @@ -3,7 +3,7 @@
     6.4   * License, v. 2.0. If a copy of the MPL was not distributed with this
     6.5   * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6.6   * 
     6.7 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team
     6.8 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team
     6.9   * 
    6.10   * http://www.strabon.di.uoa.gr/
    6.11   */
    6.12 @@ -20,6 +20,7 @@
    6.13   * Keeps common variables shared by beans and .jsp pages.
    6.14   *
    6.15   * @author Charalampos Nikolaou <charnik@di.uoa.gr>
    6.16 + * @author Panayiotis Smeros <psmeros@di.uoa.gr>
    6.17   */
    6.18  public class Common {
    6.19  	  
    6.20 @@ -36,6 +37,10 @@
    6.21  	public static final String PARAM_DATA 		= "data";
    6.22  	public static final String PARAM_FORMAT 	= "format";
    6.23  	public static final String PARAM_DATA_URL	= "url";
    6.24 +	public static final String PARAM_INFERENCE	= "inference";
    6.25 +	public static final String PARAM_GRAPH	    = "graph";
    6.26 +
    6.27 +
    6.28  	
    6.29  	/**
    6.30  	 * Submit buttons in store.jsp
     7.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StoreBean.java	Fri Apr 26 19:48:06 2013 +0300
     7.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StoreBean.java	Fri Apr 26 19:49:12 2013 +0300
     7.3 @@ -3,7 +3,7 @@
     7.4   * License, v. 2.0. If a copy of the MPL was not distributed with this
     7.5   * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     7.6   * 
     7.7 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team
     7.8 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team
     7.9   * 
    7.10   * http://www.strabon.di.uoa.gr/
    7.11   */
    7.12 @@ -13,6 +13,7 @@
    7.13  import java.io.UnsupportedEncodingException;
    7.14  import java.net.MalformedURLException;
    7.15  import java.net.URLDecoder;
    7.16 +import java.util.Map;
    7.17  
    7.18  import javax.servlet.RequestDispatcher;
    7.19  import javax.servlet.ServletConfig;
    7.20 @@ -33,6 +34,7 @@
    7.21  /**
    7.22   * 
    7.23   * @author Charalampos Nikolaou <charnik@di.uoa.gr>
    7.24 + * @author Panayiotis Smeros <psmeros@di.uoa.gr>
    7.25   *
    7.26   */
    7.27  public class StoreBean extends HttpServlet {
    7.28 @@ -138,6 +140,12 @@
    7.29      			
    7.30      	// the format of the data
    7.31      	RDFFormat format = (request.getParameter(Common.PARAM_FORMAT) != null) ? RDFFormat.valueOf(request.getParameter(Common.PARAM_FORMAT)):null;
    7.32 +
    7.33 +      	// graph
    7.34 +    	String graph = (request.getParameter(Common.PARAM_GRAPH) != null) ? request.getParameter(Common.PARAM_GRAPH):null;
    7.35 +    	    	
    7.36 +      	// inference
    7.37 +    	Boolean inference = (request.getParameter(Common.PARAM_INFERENCE) != null) ? Boolean.valueOf(request.getParameter(Common.PARAM_INFERENCE)):false;
    7.38      	
    7.39      	if (data == null || format == null) {
    7.40      		request.setAttribute(ERROR, PARAM_ERROR);
    7.41 @@ -146,7 +154,7 @@
    7.42      		
    7.43      		// store data
    7.44      		try {
    7.45 -    			strabon.store(data, format, !input);
    7.46 +    			strabon.store(data, graph, format.getName(), inference, !input);
    7.47      			
    7.48      			// store was successful, return the respective message
    7.49      			request.setAttribute(INFO, STORE_OK);
    7.50 @@ -170,7 +178,13 @@
    7.51      private void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
    7.52  		// check whether we read from INPUT or URL
    7.53  		boolean input = (request.getParameter(Common.SUBMIT_URL) != null) ? false:true;
    7.54 -		
    7.55 +
    7.56 +      	// graph
    7.57 +    	String graph = (request.getParameter(Common.PARAM_GRAPH) != null) ? request.getParameter(Common.PARAM_GRAPH):null;
    7.58 +    	    	
    7.59 +      	// inference
    7.60 +    	Boolean inference = (request.getParameter(Common.PARAM_INFERENCE) != null) ? Boolean.valueOf(request.getParameter(Common.PARAM_INFERENCE)):false;
    7.61 +
    7.62      	// RDF data to store
    7.63      	String data = getData(request);
    7.64      	
    7.65 @@ -189,8 +203,9 @@
    7.66  		
    7.67  		// store data
    7.68  		try {
    7.69 -			strabon.store(data, format, !input);
    7.70  			
    7.71 +			strabon.store(data, graph, format.getName(), inference, !input);
    7.72 +
    7.73  			// store was successful, return the respective message
    7.74  			response.sendError(HttpServletResponse.SC_OK);
    7.75  		} catch (Exception e) {
     8.1 --- a/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java	Fri Apr 26 19:48:06 2013 +0300
     8.2 +++ b/endpoint/src/main/java/eu/earthobservatory/org/StrabonEndpoint/StrabonBeanWrapper.java	Fri Apr 26 19:49:12 2013 +0300
     8.3 @@ -3,17 +3,14 @@
     8.4   * License, v. 2.0. If a copy of the MPL was not distributed with this
     8.5   * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     8.6   * 
     8.7 - * Copyright (C) 2010, 2011, 2012, Pyravlos Team
     8.8 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team
     8.9   * 
    8.10   * http://www.strabon.di.uoa.gr/
    8.11   */
    8.12  package eu.earthobservatory.org.StrabonEndpoint;
    8.13  
    8.14 -import eu.earthobservatory.utils.Format;
    8.15 -
    8.16  import java.io.IOException;
    8.17  import java.io.OutputStream;
    8.18 -import java.io.StringReader;
    8.19  import java.net.URL;
    8.20  import java.util.ArrayList;
    8.21  import java.util.Iterator;
    8.22 @@ -21,18 +18,18 @@
    8.23  import java.util.regex.Matcher;
    8.24  import java.util.regex.Pattern;
    8.25  
    8.26 -import org.openrdf.model.Resource;
    8.27  import org.openrdf.query.MalformedQueryException;
    8.28  import org.openrdf.query.QueryEvaluationException;
    8.29  import org.openrdf.query.TupleQueryResultHandlerException;
    8.30  import org.openrdf.repository.RepositoryException;
    8.31 -import org.openrdf.repository.sail.SailRepositoryConnection;
    8.32 -import org.openrdf.rio.RDFFormat;
    8.33 +import org.openrdf.rio.RDFHandlerException;
    8.34 +import org.openrdf.rio.RDFParseException;
    8.35  import org.slf4j.Logger;
    8.36  import org.slf4j.LoggerFactory;
    8.37  
    8.38 -import eu.earthobservatory.org.StrabonEndpoint.StrabonBeanWrapperConfiguration;
    8.39 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
    8.40  import eu.earthobservatory.runtime.generaldb.Strabon;
    8.41 +import eu.earthobservatory.utils.Format;
    8.42  
    8.43  
    8.44  public class StrabonBeanWrapper implements org.springframework.beans.factory.DisposableBean {
    8.45 @@ -242,41 +239,33 @@
    8.46  	 * @return
    8.47  	 * @throws MalformedQueryException
    8.48  	 * @throws RepositoryException
    8.49 +	 * @throws InvalidDatasetFormatFault 
    8.50 +	 * @throws RDFHandlerException 
    8.51 +	 * @throws RDFParseException 
    8.52  	 * @throws QueryEvaluationException
    8.53  	 * @throws TupleQueryResultHandlerException
    8.54  	 * @throws IOException
    8.55  	 * @throws ClassNotFoundException
    8.56  	 */
    8.57 -	public boolean store(String source_data, RDFFormat format, boolean url) throws Exception {
    8.58 +	public boolean store(String src, String context, String format, Boolean inference, Boolean url) throws RepositoryException, RDFParseException, RDFHandlerException, IOException, InvalidDatasetFormatFault {
    8.59  		logger.info("[StrabonEndpoint] Received STORE request.");
    8.60  		
    8.61  		if ((this.strabon == null) && (!init())) {
    8.62  			throw new RepositoryException("Could not connect to Strabon.");
    8.63  		}
    8.64  
    8.65 -		// get sail connection
    8.66 -		SailRepositoryConnection conn = strabon.getSailRepoConnection();
    8.67 -
    8.68 -		try {
    8.69 -			// store data
    8.70 -			if (url) {
    8.71 -				URL source = new URL(source_data);
    8.72 -				if (source.getProtocol().equalsIgnoreCase(FILE_PROTOCOL)) {
    8.73 -					// it would be a security issue if we read from the server's filesystem
    8.74 -					throw new IllegalArgumentException("The protocol of the URL should be one of http or ftp.");
    8.75 -				} 
    8.76 -				conn.add(source, "", format, new Resource[1]);
    8.77 -
    8.78 -			} else {
    8.79 -				conn.add(new StringReader(source_data), "", format, new Resource[1]);
    8.80 +		if (url) {
    8.81 +			URL source = new URL(src);
    8.82 +			if (source.getProtocol().equalsIgnoreCase(FILE_PROTOCOL)) {
    8.83 +				// it would be a security issue if we read from the server's filesystem
    8.84 +				throw new IllegalArgumentException("The protocol of the URL should be one of http or ftp.");
    8.85  			}
    8.86 -			
    8.87 -			logger.info("[StrabonEndpoint] STORE was successful.");
    8.88 -
    8.89 -		} catch (Exception e) {
    8.90 -			throw e;
    8.91  		}
    8.92  
    8.93 +		strabon.storeInRepo(src, null, context, format, inference);
    8.94 +		
    8.95 +		logger.info("[StrabonEndpoint] STORE was successful.");
    8.96 +		
    8.97  		return true;
    8.98  	}
    8.99  
     9.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/GeoSparqlNonTopologicalMetric.java	Fri Apr 26 19:48:06 2013 +0300
     9.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/geosparql/GeoSparqlNonTopologicalMetric.java	Fri Apr 26 19:49:12 2013 +0300
     9.3 @@ -12,7 +12,7 @@
     9.4  import org.openrdf.model.Value;
     9.5  import org.openrdf.model.ValueFactory;
     9.6  import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException;
     9.7 -import org.openrdf.query.algebra.evaluation.function.spatial.SpatialConstructFunc;
     9.8 +import org.openrdf.query.algebra.evaluation.function.spatial.SpatialMetricFunc;
     9.9  
    9.10  /**
    9.11   * This class represents a spatial function like the one defined in its superclass 
    9.12 @@ -23,7 +23,7 @@
    9.13   * @author Manos Karpathiotakis <mk@di.uoa.gr>
    9.14   * @author Charalampos Nikolaou <charnik@di.uoa.gr>
    9.15   */
    9.16 -public abstract class GeoSparqlNonTopologicalMetric extends SpatialConstructFunc {
    9.17 +public abstract class GeoSparqlNonTopologicalMetric extends SpatialMetricFunc {
    9.18  
    9.19  	//No need for any implementation, I will have replaced this class's presence before reaching this place
    9.20  	public Value evaluate(ValueFactory valueFactory, Value... args)
    10.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoBuffer.java	Fri Apr 26 19:48:06 2013 +0300
    10.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoBuffer.java	Fri Apr 26 19:49:12 2013 +0300
    10.3 @@ -9,17 +9,16 @@
    10.4  import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase;
    10.5  import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr;
    10.6  
    10.7 -public class GeneralDBSqlGeoBuffer extends GeneralDBSqlSpatialConstructBinary{
    10.8 +public class GeneralDBSqlGeoBuffer extends GeneralDBSqlSpatialConstructTriple {
    10.9  
   10.10 -	public GeneralDBSqlGeoBuffer(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
   10.11 -		super(left, right);
   10.12 +	public GeneralDBSqlGeoBuffer(GeneralDBSqlExpr left, GeneralDBSqlExpr right, GeneralDBSqlExpr third)
   10.13 +	{
   10.14 +		super(left, right, third);
   10.15  	}
   10.16  
   10.17  	@Override
   10.18 -	public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor)
   10.19 -		throws X
   10.20 +	public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) throws X
   10.21  	{
   10.22  		visitor.meet(this);
   10.23  	}
   10.24 -
   10.25  }
   10.26 \ No newline at end of file
    11.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoDistance.java	Fri Apr 26 19:48:06 2013 +0300
    11.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlGeoDistance.java	Fri Apr 26 19:49:12 2013 +0300
    11.3 @@ -8,7 +8,6 @@
    11.4    
    11.5  import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase;
    11.6  import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr;
    11.7 -import org.openrdf.sail.generaldb.algebra.base.TripleGeneralDBOperator;
    11.8  
    11.9  public class GeneralDBSqlGeoDistance extends GeneralDBSqlSpatialMetricTriple
   11.10  {
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlSpatialConstructTriple.java	Fri Apr 26 19:49:12 2013 +0300
    12.3 @@ -0,0 +1,23 @@
    12.4 +/*
    12.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008.
    12.6 + *
    12.7 + * Licensed under the Aduna BSD-style license.
    12.8 + */
    12.9 +package org.openrdf.sail.generaldb.algebra;
   12.10 +
   12.11 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase;
   12.12 +import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr;
   12.13 +import org.openrdf.sail.generaldb.algebra.base.TripleGeneralDBOperator;
   12.14 +
   12.15 +public class GeneralDBSqlSpatialConstructTriple extends TripleGeneralDBOperator {
   12.16 +	public GeneralDBSqlSpatialConstructTriple(GeneralDBSqlExpr left, GeneralDBSqlExpr right, GeneralDBSqlExpr third) 
   12.17 +	{
   12.18 +		super(left, right, third);
   12.19 +	}
   12.20 +
   12.21 +	@Override
   12.22 +	public <X extends Exception> void visit(GeneralDBQueryModelVisitorBase<X> visitor) throws X
   12.23 +	{
   12.24 +		visitor.meet(this);
   12.25 +	}
   12.26 +}
    13.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlSpatialMetricTriple.java	Fri Apr 26 19:48:06 2013 +0300
    13.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/GeneralDBSqlSpatialMetricTriple.java	Fri Apr 26 19:49:12 2013 +0300
    13.3 @@ -1,3 +1,8 @@
    13.4 +/*
    13.5 + * Copyright Aduna (http://www.aduna-software.com/) (c) 2008.
    13.6 + *
    13.7 + * Licensed under the Aduna BSD-style license.
    13.8 + */
    13.9  package org.openrdf.sail.generaldb.algebra;
   13.10  
   13.11  import org.openrdf.sail.generaldb.algebra.base.GeneralDBQueryModelVisitorBase;
    14.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java	Fri Apr 26 19:48:06 2013 +0300
    14.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/base/GeneralDBExprSupport.java	Fri Apr 26 19:49:12 2013 +0300
    14.3 @@ -349,9 +349,9 @@
    14.4  		return new GeneralDBSqlGeoUnion(left, right);
    14.5  	}
    14.6  
    14.7 -	public static GeneralDBSqlExpr geoBuffer(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    14.8 +	public static GeneralDBSqlExpr geoBuffer(GeneralDBSqlExpr left, GeneralDBSqlExpr right, GeneralDBSqlExpr third) {
    14.9  
   14.10 -		return new GeneralDBSqlGeoBuffer(left, right);
   14.11 +		return new GeneralDBSqlGeoBuffer(left, right, third);
   14.12  	}
   14.13  	
   14.14  	public static GeneralDBSqlExpr geoTransform(GeneralDBSqlExpr left, GeneralDBSqlExpr right) {
    15.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Fri Apr 26 19:48:06 2013 +0300
    15.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBBooleanExprFactory.java	Fri Apr 26 19:49:12 2013 +0300
    15.3 @@ -119,9 +119,11 @@
    15.4  import org.openrdf.query.algebra.evaluation.function.spatial.SpatialRelationshipFunc;
    15.5  import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.GeoSparqlRelateFunc;
    15.6  import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlBoundaryFunc;
    15.7 +import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlBufferFunc;
    15.8  import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlConvexHullFunc;
    15.9  import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlEnvelopeFunc;
   15.10  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BoundaryFunc;
   15.11 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BufferFunc;
   15.12  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.ConvexHullFunc;
   15.13  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.EnvelopeFunc;
   15.14  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.UnionFunc;
   15.15 @@ -615,6 +617,7 @@
   15.16  		{
   15.17  			GeneralDBSqlExpr leftArg = null;
   15.18  			GeneralDBSqlExpr rightArg = null;
   15.19 +			GeneralDBSqlExpr thirdArg = null;
   15.20  
   15.21  			ValueExpr left = functionCall.getArgs().get(0);
   15.22  
   15.23 @@ -660,9 +663,11 @@
   15.24  						rightArg = label(right);
   15.25  					}
   15.26  				}
   15.27 +				if(function instanceof BufferFunc)
   15.28 +					thirdArg = uri(functionCall.getArgs().get(2));
   15.29  			}
   15.30  
   15.31 -			result = spatialConstructPicker(function, leftArg, rightArg);
   15.32 +			result = spatialConstructPicker(function, leftArg, rightArg, thirdArg);
   15.33  
   15.34  		}
   15.35  		else if(function instanceof SpatialRelationshipFunc)
   15.36 @@ -845,10 +850,10 @@
   15.37  	{
   15.38  		GeneralDBSqlExpr leftArg = null;
   15.39  		GeneralDBSqlExpr rightArg = null;
   15.40 +		GeneralDBSqlExpr thirdArg = null;
   15.41  
   15.42  		ValueExpr left = functionCall.getArgs().get(0);
   15.43  
   15.44 -
   15.45  		if(left instanceof FunctionCall)
   15.46  		{
   15.47  			leftArg = spatialFunction((FunctionCall) left);
   15.48 @@ -858,9 +863,6 @@
   15.49  			leftArg = label(left);
   15.50  		}
   15.51  
   15.52 -
   15.53 -
   15.54 -
   15.55  		if(!(function instanceof EnvelopeFunc) 
   15.56  				&& !(function instanceof ConvexHullFunc) 
   15.57  				&& !(function instanceof BoundaryFunc)
   15.58 @@ -876,7 +878,7 @@
   15.59  			}
   15.60  			else
   15.61  			{
   15.62 -				if(function.getURI().equals(GeoConstants.stSPARQLbuffer))
   15.63 +				if(function.getURI().equals(GeoConstants.stSPARQLbuffer) || function.getURI().equals(GeoConstants.geoSparqlBuffer))
   15.64  				{
   15.65  					//Be it a Var or a Value Constant, 'numeric' is the way to go
   15.66  					rightArg = numeric(right);
   15.67 @@ -893,9 +895,11 @@
   15.68  					rightArg = label(right);
   15.69  				}
   15.70  			}
   15.71 +			if(function instanceof BufferFunc || function instanceof GeoSparqlBufferFunc)
   15.72 +				thirdArg = uri(functionCall.getArgs().get(2));
   15.73  		}
   15.74  
   15.75 -		return spatialConstructPicker(function, leftArg, rightArg);
   15.76 +		return spatialConstructPicker(function, leftArg, rightArg, thirdArg);
   15.77  
   15.78  	}
   15.79  
   15.80 @@ -992,8 +996,7 @@
   15.81  
   15.82  	}
   15.83  
   15.84 -	GeneralDBSqlExpr spatialRelationshipPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, 
   15.85 -			GeneralDBSqlExpr thirdArg)
   15.86 +	GeneralDBSqlExpr spatialRelationshipPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg)
   15.87  	{
   15.88  		//XXX stSPARQL		
   15.89  		if(function.getURI().equals(GeoConstants.stSPARQLequals))
   15.90 @@ -1100,6 +1103,7 @@
   15.91  		{
   15.92  			return sfWithin(leftArg,rightArg);
   15.93  		}
   15.94 +		
   15.95  		//RCC8
   15.96  		else if(function.getURI().equals(GeoConstants.rccDisconnected))
   15.97  		{
   15.98 @@ -1176,7 +1180,7 @@
   15.99  	}
  15.100  
  15.101  
  15.102 -	GeneralDBSqlExpr spatialConstructPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg)
  15.103 +	GeneralDBSqlExpr spatialConstructPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg)
  15.104  	{
  15.105  		if(function.getURI().equals(GeoConstants.stSPARQLunion))
  15.106  		{
  15.107 @@ -1184,7 +1188,7 @@
  15.108  		}
  15.109  		else if(function.getURI().equals(GeoConstants.stSPARQLbuffer))
  15.110  		{
  15.111 -			return geoBuffer(leftArg,rightArg);
  15.112 +			return geoBuffer(leftArg, rightArg, thirdArg);
  15.113  		}
  15.114  		else if(function.getURI().equals(GeoConstants.stSPARQLtransform))
  15.115  		{
  15.116 @@ -1214,8 +1218,7 @@
  15.117  		{
  15.118  			return geoSymDifference(leftArg, rightArg);
  15.119  		}
  15.120 -		//XXX GeoSPARQL - Non topological - except distance
  15.121 -		//TODO Must add buffer after deciding how to implement it
  15.122 +		//XXX GeoSPARQL - Non topological - except distance		
  15.123  		else if(function.getURI().equals(GeoConstants.geoSparqlConvexHull))
  15.124  		{
  15.125  			return geoConvexHull(leftArg);
  15.126 @@ -1244,6 +1247,10 @@
  15.127  		{
  15.128  			return geoBoundary(leftArg);
  15.129  		}
  15.130 +		else if(function.getURI().equals(GeoConstants.geoSparqlBuffer))
  15.131 +		{
  15.132 +			return geoBuffer(leftArg, rightArg, thirdArg);
  15.133 +		}
  15.134  
  15.135  		logger.error("[Strabon.spatialConstructPicker] No appropriate SQL expression was generated for extension function {}. This is probably a bug.", function.getURI());
  15.136  		return null;
  15.137 @@ -1272,11 +1279,14 @@
  15.138  		{
  15.139  			return geoDistance(leftArg, rightArg, thirdArg);
  15.140  		}
  15.141 +		else if(function.getURI().equals(GeoConstants.geoSparqlDistance))
  15.142 +		{
  15.143 +			return geoDistance(leftArg, rightArg, thirdArg);
  15.144 +		}	
  15.145  		else if(function.getURI().equals(GeoConstants.stSPARQLarea))
  15.146  		{
  15.147  			return geoArea(leftArg);
  15.148 -		}
  15.149 -		//GeoSPARQL's distance must be added at this place
  15.150 +		}		
  15.151  
  15.152  		logger.error("[Strabon.spatialMetricPicker] No appropriate SQL expression was generated for extension function {}. This is probably a bug.", function.getURI());
  15.153  		return null;
    16.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java	Fri Apr 26 19:48:06 2013 +0300
    16.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/algebra/factories/GeneralDBNumericExprFactory.java	Fri Apr 26 19:49:12 2013 +0300
    16.3 @@ -50,6 +50,7 @@
    16.4  import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlConvexHullFunc;
    16.5  import org.openrdf.query.algebra.evaluation.function.spatial.geosparql.nontopological.GeoSparqlEnvelopeFunc;
    16.6  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BoundaryFunc;
    16.7 +import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.BufferFunc;
    16.8  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.ConvexHullFunc;
    16.9  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.construct.EnvelopeFunc;
   16.10  import org.openrdf.query.algebra.evaluation.function.spatial.stsparql.metric.AreaFunc;
   16.11 @@ -297,6 +298,7 @@
   16.12  	{
   16.13  		GeneralDBSqlExpr leftArg = null;
   16.14  		GeneralDBSqlExpr rightArg = null;
   16.15 +		GeneralDBSqlExpr thirdArg = null;
   16.16  
   16.17  		ValueExpr left = functionCall.getArgs().get(0);
   16.18  
   16.19 @@ -310,8 +312,6 @@
   16.20  			leftArg = label(left);
   16.21  		}
   16.22  
   16.23 -
   16.24 -
   16.25  		if(!(function instanceof EnvelopeFunc) 
   16.26  				&& !(function instanceof ConvexHullFunc) 
   16.27  				&& !(function instanceof BoundaryFunc)
   16.28 @@ -342,14 +342,12 @@
   16.29  					//thus the special treatment
   16.30  					rightArg = label(right);
   16.31  				}
   16.32 -
   16.33 -
   16.34 -
   16.35 -
   16.36  			}
   16.37 +			if(function instanceof BufferFunc)
   16.38 +				thirdArg = uri(functionCall.getArgs().get(2));
   16.39  		}
   16.40  
   16.41 -		return spatialConstructPicker(function, leftArg, rightArg);
   16.42 +		return spatialConstructPicker(function, leftArg, rightArg, thirdArg);
   16.43  
   16.44  	}
   16.45  
   16.46 @@ -435,7 +433,7 @@
   16.47  	}
   16.48  
   16.49  
   16.50 -	GeneralDBSqlExpr spatialConstructPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg)
   16.51 +	GeneralDBSqlExpr spatialConstructPicker(Function function,GeneralDBSqlExpr leftArg, GeneralDBSqlExpr rightArg, GeneralDBSqlExpr thirdArg)
   16.52  	{
   16.53  		if(function.getURI().equals(GeoConstants.stSPARQLunion))
   16.54  		{
   16.55 @@ -443,7 +441,7 @@
   16.56  		}
   16.57  		else if(function.getURI().equals(GeoConstants.stSPARQLbuffer))
   16.58  		{
   16.59 -			return geoBuffer(leftArg,rightArg);
   16.60 +			return geoBuffer(leftArg,rightArg, thirdArg);
   16.61  		}
   16.62  		else if(function.getURI().equals(GeoConstants.stSPARQLtransform))
   16.63  		{
   16.64 @@ -473,8 +471,7 @@
   16.65  		{
   16.66  			return geoSymDifference(leftArg, rightArg);
   16.67  		}
   16.68 -		//XXX GeoSPARQL - Non topological - except distance
   16.69 -		//TODO Must add buffer after deciding how to implement it
   16.70 +		//XXX GeoSPARQL - Non topological - except distance		
   16.71  		else if(function.getURI().equals(GeoConstants.geoSparqlConvexHull))
   16.72  		{
   16.73  			return geoConvexHull(leftArg);
   16.74 @@ -503,6 +500,10 @@
   16.75  		{
   16.76  			return geoBoundary(leftArg);
   16.77  		}
   16.78 +		else if(function.getURI().equals(GeoConstants.geoSparqlBuffer))
   16.79 +		{
   16.80 +			return geoBuffer(leftArg,rightArg, thirdArg);
   16.81 +		}
   16.82  		//Should never reach this place
   16.83  		return null;
   16.84  	}
   16.85 @@ -532,11 +533,14 @@
   16.86  		{
   16.87  			return geoDistance(leftArg, rightArg, thirdArg);
   16.88  		}
   16.89 +		else if(function.getURI().equals(GeoConstants.geoSparqlDistance))
   16.90 +		{
   16.91 +			return geoDistance(leftArg, rightArg, thirdArg);
   16.92 +		}
   16.93  		else if(function.getURI().equals(GeoConstants.stSPARQLarea))
   16.94  		{
   16.95  			return geoArea(leftArg);
   16.96 -		}
   16.97 -		//GeoSPARQL's distance must be added at this place
   16.98 +		}		
   16.99  
  16.100  		//Should never reach this place
  16.101  		return null;
    17.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Fri Apr 26 19:48:06 2013 +0300
    17.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Fri Apr 26 19:49:12 2013 +0300
    17.3 @@ -85,6 +85,7 @@
    17.4  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlMathExpr;
    17.5  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlNot;
    17.6  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary;
    17.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructTriple;
    17.8  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructUnary;
    17.9  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricBinary;
   17.10  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricTriple;
   17.11 @@ -816,6 +817,12 @@
   17.12  		{
   17.13  			locateColumnVars(((GeneralDBSqlSpatialConstructUnary)expr).getArg(),allKnown);
   17.14  		}
   17.15 +		else if(expr instanceof GeneralDBSqlSpatialConstructTriple)
   17.16 +		{
   17.17 +			locateColumnVars(((GeneralDBSqlSpatialConstructTriple)expr).getLeftArg(),allKnown);
   17.18 +			locateColumnVars(((GeneralDBSqlSpatialConstructTriple)expr).getRightArg(),allKnown);
   17.19 +			locateColumnVars(((GeneralDBSqlSpatialConstructTriple)expr).getThirdArg(),allKnown);
   17.20 +		}
   17.21  		/** Addition for datetime metric functions
   17.22  		 * 
   17.23  		 * @author George Garbis <ggarbis@di.uoa.gr>
   17.24 @@ -985,8 +992,7 @@
   17.25  			}
   17.26  
   17.27  		}
   17.28 -		else if(expr instanceof GeneralDBSqlSpatialConstructBinary ||
   17.29 -				expr instanceof GeneralDBSqlSpatialConstructUnary)
   17.30 +		else if(expr instanceof GeneralDBSqlSpatialConstructBinary || expr instanceof GeneralDBSqlSpatialConstructUnary || expr instanceof GeneralDBSqlSpatialConstructTriple)
   17.31  		{
   17.32  			return ResultType.WKB;
   17.33  		}
    18.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Fri Apr 26 19:48:06 2013 +0300
    18.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Fri Apr 26 19:49:12 2013 +0300
    18.3 @@ -661,9 +661,6 @@
    18.4  		else if (expr instanceof GeneralDBSqlGeoUnion) {
    18.5  			append((GeneralDBSqlGeoUnion)expr, filter);
    18.6  		}
    18.7 -		else if (expr instanceof GeneralDBSqlGeoBuffer) {
    18.8 -			append((GeneralDBSqlGeoBuffer)expr, filter);
    18.9 -		}
   18.10  		else if (expr instanceof GeneralDBSqlGeoTransform) {
   18.11  			append((GeneralDBSqlGeoTransform)expr, filter);
   18.12  		}
   18.13 @@ -696,6 +693,10 @@
   18.14  		else if (expr instanceof GeneralDBSqlGeoDistance) {
   18.15  			append((GeneralDBSqlGeoDistance)expr, filter);
   18.16  		}
   18.17 +		//Construct
   18.18 +		else if (expr instanceof GeneralDBSqlGeoBuffer) {
   18.19 +			append((GeneralDBSqlGeoBuffer)expr, filter);
   18.20 +		}
   18.21  		else
   18.22  		{
   18.23  			throw unsupported(expr);
   18.24 @@ -1153,9 +1154,8 @@
   18.25  
   18.26  	protected abstract String appendWKT(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter);
   18.27  
   18.28 -	protected void appendConstructFunction(GeneralDBSqlExpr constr, GeneralDBSqlExprBuilder filter) 
   18.29 -			throws UnsupportedRdbmsOperatorException
   18.30 -			{
   18.31 +	protected void appendConstructFunction(GeneralDBSqlExpr constr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException
   18.32 +	{
   18.33  		if(constr instanceof GeneralDBSqlGeoUnion)
   18.34  		{
   18.35  			append((GeneralDBSqlGeoUnion)constr, filter);
   18.36 @@ -1192,8 +1192,7 @@
   18.37  		{
   18.38  			append((GeneralDBSqlGeoSymDifference)constr, filter);
   18.39  		}
   18.40 -
   18.41 -			}
   18.42 +	}
   18.43  
   18.44  	protected void appendMetricFunction(GeneralDBSqlExpr constr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException
   18.45  	{
    19.1 --- a/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java	Fri Apr 26 19:48:06 2013 +0300
    19.2 +++ b/monetdb/src/main/java/org/openrdf/sail/monetdb/evaluation/MonetDBQueryBuilder.java	Fri Apr 26 19:49:12 2013 +0300
    19.3 @@ -56,8 +56,10 @@
    19.4  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRelate;
    19.5  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRight;
    19.6  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary;
    19.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructTriple;
    19.8  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructUnary;
    19.9  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricBinary;
   19.10 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricTriple;
   19.11  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricUnary;
   19.12  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialProperty;
   19.13  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlTouches;
   19.14 @@ -103,6 +105,7 @@
   19.15  import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException;
   19.16  
   19.17  import eu.earthobservatory.constants.GeoConstants;
   19.18 +import eu.earthobservatory.constants.OGCConstants;
   19.19  
   19.20  /**
   19.21   * Constructs an SQL query from {@link GeneralDBSqlExpr}s and {@link GeneralDBFromItem}s.
   19.22 @@ -111,7 +114,11 @@
   19.23   * 
   19.24   */
   19.25  public class MonetDBQueryBuilder extends GeneralDBQueryBuilder {
   19.26 -
   19.27 +	
   19.28 +	public static final String ST_TRANSFORM = "ST_Transform";	
   19.29 +	public static final String GEOGRAPHY = "Geography";
   19.30 +	public static final String GEOMETRY = "Geometry";
   19.31 +	
   19.32  	/**
   19.33  	 * If (spatial) label column met is null, I must not try to retrieve its srid. 
   19.34  	 * Opting to ask for 'null' instead
   19.35 @@ -693,11 +700,10 @@
   19.36  			}
   19.37  
   19.38  	@Override
   19.39 -	protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter)
   19.40 -			throws UnsupportedRdbmsOperatorException
   19.41 -			{
   19.42 -		appendMonetDBSpatialFunctionBinary(expr, filter, SpatialFunctionsMonetDB.ST_Buffer);
   19.43 -			}
   19.44 +	protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException
   19.45 +	{
   19.46 +		appendMonetDBBuffer(expr, filter, SpatialFunctionsMonetDB.ST_Buffer);
   19.47 +	}
   19.48  
   19.49  	//XXX Different Behavior
   19.50  	@Override
   19.51 @@ -1325,8 +1331,7 @@
   19.52  			case ST_Difference: filter.appendFunction("Difference"); break;
   19.53  			case ST_Intersection: filter.appendFunction("Intersection"); break;
   19.54  			case ST_Union: filter.appendFunction("\"Union\""); break;
   19.55 -			case ST_SymDifference: filter.appendFunction("SymDifference"); break;
   19.56 -			case ST_Buffer: filter.appendFunction("Buffer"); break;			
   19.57 +			case ST_SymDifference: filter.appendFunction("SymDifference"); break;			
   19.58  			case ST_Touches: filter.appendFunction("Touches"); break;
   19.59  			case ST_Disjoint: filter.appendFunction("Disjoint"); break;
   19.60  			case ST_Crosses: filter.appendFunction("Crosses"); break;
   19.61 @@ -1440,51 +1445,286 @@
   19.62  			filter.appendComma();
   19.63  			filter.append(sridExpr);
   19.64  		}
   19.65 -			}
   19.66 +	}
   19.67  	
   19.68 -		protected void appendMonetDBDistance(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func) throws UnsupportedRdbmsOperatorException
   19.69 +	protected void appendMonetDBDistance(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func) throws UnsupportedRdbmsOperatorException
   19.70 +	{
   19.71 +		String units = null;
   19.72 +
   19.73 +		filter.openBracket();
   19.74 +		
   19.75 +		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull");
   19.76 +		boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull");
   19.77 +		boolean check3 = expr.getThirdArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull");
   19.78 +		
   19.79 +		if(check1)
   19.80  		{
   19.81 -			String units = null;
   19.82 -
   19.83 +			this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
   19.84 +		}
   19.85 +		else if(check2)
   19.86 +		{
   19.87 +			this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
   19.88 +		}
   19.89 +		else if(check3)
   19.90 +		{
   19.91 +			this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
   19.92 +		}
   19.93 +		
   19.94 +		else
   19.95 +		{								
   19.96 +			filter.appendFunction("Distance");
   19.97 +			
   19.98  			filter.openBracket();
   19.99  			
  19.100 -			boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull");
  19.101 -			boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull");
  19.102 -			boolean check3 = expr.getThirdArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull");
  19.103 -			if(check1)
  19.104 +			if (expr.getThirdArg() instanceof GeneralDBStringValue)
  19.105 +			{			
  19.106 +				units = ((GeneralDBStringValue)expr.getThirdArg()).getValue();
  19.107 +				if(!OGCConstants.supportedUnitsOfMeasure.contains(units))
  19.108 +				{
  19.109 +					throw new UnsupportedRdbmsOperatorException("No such unit of measure exists");
  19.110 +				}	
  19.111 +
  19.112 +				if(units.equals(OGCConstants.OGCmetre))
  19.113 +				{
  19.114 +					filter.appendFunction(GEOGRAPHY);
  19.115 +					filter.openBracket();
  19.116 +					filter.appendFunction(ST_TRANSFORM);
  19.117 +					filter.openBracket();
  19.118 +				}
  19.119 +				else if(units.equals(OGCConstants.OGCdegree))
  19.120 +				{
  19.121 +					filter.appendFunction(ST_TRANSFORM);
  19.122 +					filter.openBracket();
  19.123 +				}	
  19.124 +			}	
  19.125 +			
  19.126 +			if(expr.getLeftArg() instanceof GeneralDBStringValue)
  19.127  			{
  19.128 -				this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
  19.129 +				appendWKT(expr.getLeftArg(),filter);
  19.130  			}
  19.131 -			else if(check2)
  19.132 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructBinary)
  19.133  			{
  19.134 -				this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
  19.135 +				appendConstructFunction(expr.getLeftArg(), filter);
  19.136  			}
  19.137 -			else if(check3)
  19.138 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructUnary)
  19.139  			{
  19.140 -				this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
  19.141 +				appendConstructFunction(expr.getLeftArg(), filter);
  19.142 +			}
  19.143 +			else if(expr.getLeftArg() instanceof GeneralDBSqlCase)
  19.144 +			{
  19.145 +				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
  19.146 +				appendMBB(onlyLabel,filter); 
  19.147 +			}
  19.148 +			else
  19.149 +			{
  19.150 +				appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter);
  19.151  			}
  19.152  			
  19.153 +			if(units.equals(OGCConstants.OGCmetre))
  19.154 +			{				
  19.155 +				filter.appendComma();
  19.156 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
  19.157 +				filter.closeBracket(); //close st_transform
  19.158 +				filter.closeBracket(); //close geography
  19.159 +				
  19.160 +				filter.appendComma();
  19.161 +
  19.162 +				filter.appendFunction(GEOGRAPHY);
  19.163 +				filter.openBracket();
  19.164 +				filter.appendFunction(ST_TRANSFORM);
  19.165 +				filter.openBracket();
  19.166 +			}
  19.167 +			else if(units.equals(OGCConstants.OGCdegree))
  19.168 +			{
  19.169 +				filter.appendComma();
  19.170 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
  19.171 +				filter.closeBracket(); //close st_transform
  19.172 +				
  19.173 +				filter.appendComma();
  19.174 +				
  19.175 +				filter.appendFunction(ST_TRANSFORM);
  19.176 +				filter.openBracket();
  19.177 +			}	
  19.178  			else
  19.179 -			{								
  19.180 -				filter.appendFunction("Distance");
  19.181 -				
  19.182 -				filter.openBracket();
  19.183 -				
  19.184 +			{
  19.185 +				filter.appendComma();
  19.186 +			}															
  19.187 +			
  19.188 +			if(expr.getRightArg() instanceof GeneralDBStringValue)
  19.189 +			{
  19.190 +				appendWKT(expr.getRightArg(),filter);
  19.191 +			}
  19.192 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructUnary)
  19.193 +			{
  19.194 +				appendConstructFunction(expr.getRightArg(), filter);
  19.195 +			}
  19.196 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructBinary)
  19.197 +			{
  19.198 +				appendConstructFunction(expr.getRightArg(), filter);
  19.199 +			}
  19.200 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructTriple)
  19.201 +			{
  19.202 +				appendConstructFunction(expr.getRightArg(), filter);
  19.203 +			}
  19.204 +			else if(expr.getRightArg() instanceof GeneralDBSqlCase)
  19.205 +			{
  19.206 +				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult();
  19.207 +				appendMBB(onlyLabel,filter);					 
  19.208 +			}
  19.209 +			else if(expr.getRightArg() instanceof GeneralDBDoubleValue) //case met in buffer!
  19.210 +			{
  19.211 +				append(((GeneralDBDoubleValue)expr.getRightArg()), filter);
  19.212 +			}
  19.213 +			else if(expr.getRightArg() instanceof GeneralDBNumericColumn) //case met in buffer!
  19.214 +			{
  19.215 +				append(((GeneralDBNumericColumn)expr.getRightArg()), filter);
  19.216 +			}
  19.217 +			else if(expr.getRightArg() instanceof GeneralDBURIColumn) //case met in transform!
  19.218 +			{
  19.219 +				filter.keepSRID_part1();
  19.220 +				append(((GeneralDBURIColumn)expr.getRightArg()), filter);
  19.221 +				filter.keepSRID_part2();
  19.222 +				append(((GeneralDBURIColumn)expr.getRightArg()), filter);
  19.223 +				filter.keepSRID_part3();
  19.224 +			}
  19.225 +			//case met in buffer when in select -> buffer(?spatial,?thematic)
  19.226 +			else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial())
  19.227 +			{
  19.228 +				appendWithCastDouble(((GeneralDBLabelColumn)expr.getRightArg()),filter);
  19.229 +				//					append(((GeneralDBLabelColumn)expr.getRightArg()),filter);
  19.230 +				//					appendCastToDouble(filter);
  19.231 +			}
  19.232 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricBinary)
  19.233 +			{
  19.234 +				appendMetricFunction(expr.getRightArg(), filter);
  19.235 +			}
  19.236 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricUnary)
  19.237 +			{
  19.238 +				appendMetricFunction(expr.getRightArg(), filter);
  19.239 +			}
  19.240 +			else
  19.241 +			{
  19.242 +				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
  19.243 +			}
  19.244 +
  19.245 +			if(units.equals(OGCConstants.OGCmetre))
  19.246 +			{
  19.247 +				filter.appendComma();
  19.248 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
  19.249 +				filter.closeBracket();
  19.250 +				filter.closeBracket();
  19.251 +			}
  19.252 +			else if(units.equals(OGCConstants.OGCdegree))
  19.253 +			{
  19.254 +				filter.appendComma();
  19.255 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
  19.256 +				filter.closeBracket();
  19.257 +			}
  19.258 +
  19.259 +			filter.closeBracket();
  19.260 +		}
  19.261 +
  19.262 +		filter.closeBracket();
  19.263 +	}
  19.264 +	
  19.265 +	protected void appendMonetDBBuffer(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func) throws UnsupportedRdbmsOperatorException
  19.266 +	{
  19.267 +		boolean sridNeeded = true;
  19.268 +		//XXX Incorporating SRID
  19.269 +		String sridExpr = null;
  19.270 +		String units = null;
  19.271 +
  19.272 +		filter.openBracket();
  19.273 +		
  19.274 +		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull");
  19.275 +		boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull");
  19.276 +		boolean check3 = expr.getThirdArg().getClass().getCanonicalName().equals("org.openrdf.sail.monetdb.algebra.MonetDBSqlNull");
  19.277 +		
  19.278 +		if(check1)
  19.279 +		{
  19.280 +			this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
  19.281 +		}
  19.282 +		else if(check2)
  19.283 +		{
  19.284 +			this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
  19.285 +		}
  19.286 +		else if(check3)
  19.287 +		{
  19.288 +			this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
  19.289 +		}
  19.290 +		
  19.291 +		else
  19.292 +		{	
  19.293 +			GeneralDBSqlExpr tmp = expr;
  19.294 +			if(tmp instanceof GeneralDBSqlSpatialConstructBinary && tmp.getParentNode() == null)
  19.295 +			{
  19.296 +				while(true)
  19.297 +				{
  19.298 +					GeneralDBSqlExpr child;
  19.299 +
  19.300 +					if(tmp instanceof BinaryGeneralDBOperator)
  19.301 +					{
  19.302 +						child = ((BinaryGeneralDBOperator) tmp).getLeftArg();
  19.303 +					}
  19.304 +					else //(tmp instanceof UnaryGeneralDBOperator)
  19.305 +					{
  19.306 +						child = ((UnaryGeneralDBOperator) tmp).getArg();
  19.307 +					}
  19.308 +
  19.309 +					tmp = child;
  19.310 +					if(tmp instanceof GeneralDBLabelColumn)
  19.311 +					{
  19.312 +						//Reached the innermost left var -> need to capture its SRID
  19.313 +						String alias;
  19.314 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
  19.315 +							//Predicates used in triple patterns non-existent in db
  19.316 +							alias="NULL";
  19.317 +						}
  19.318 +						else
  19.319 +						{
  19.320 +							//Reached the innermost left var -> need to capture its SRID
  19.321 +							alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
  19.322 +							alias=alias+".srid";
  19.323 +						}
  19.324 +						sridExpr = alias;
  19.325 +						break;
  19.326 +					}
  19.327 +					else if (tmp instanceof GeneralDBStringValue) //Constant!!
  19.328 +					{
  19.329 +						sridNeeded  = false;
  19.330 +						break;
  19.331 +					}
  19.332 +				}
  19.333 +				if(sridNeeded)
  19.334 +				{
  19.335 +					filter.appendFunction("Transform");
  19.336 +					filter.openBracket();
  19.337 +				}								
  19.338 +									
  19.339  				if (expr.getThirdArg() instanceof GeneralDBStringValue)
  19.340  				{			
  19.341 -					String unparsedUnits = ((GeneralDBStringValue)expr.getThirdArg()).getValue();
  19.342 -
  19.343 -					units = unparsedUnits.substring(unparsedUnits.lastIndexOf('/')+1);
  19.344 -					if(units.equals("metre") || units.equals("meter"))
  19.345 -					{					
  19.346 -						filter.appendFunction("GEOGRAPHY");
  19.347 +					units = ((GeneralDBStringValue)expr.getThirdArg()).getValue();
  19.348 +					if(!OGCConstants.supportedUnitsOfMeasure.contains(units))
  19.349 +					{
  19.350 +						throw new UnsupportedRdbmsOperatorException("No such unit of measure exists");
  19.351 +					}	
  19.352 +	
  19.353 +					if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))
  19.354 +					{
  19.355 +						filter.appendFunction("ST_Buffer");
  19.356  						filter.openBracket();
  19.357 -						filter.appendFunction("ST_TRANSFORM");
  19.358 +						filter.appendFunction(ST_TRANSFORM);
  19.359 +						filter.openBracket();		
  19.360 +					}
  19.361 +					else
  19.362 +					{	
  19.363 +						filter.appendFunction(GEOMETRY);
  19.364  						filter.openBracket();
  19.365 -					}	
  19.366 -					else if(units.equals("degree"))
  19.367 -					{
  19.368 -						filter.appendFunction("ST_TRANSFORM");
  19.369 +						filter.appendFunction("ST_Buffer");
  19.370 +						filter.openBracket();
  19.371 +						filter.appendFunction(GEOGRAPHY);
  19.372 +						filter.openBracket();
  19.373 +						filter.appendFunction(ST_TRANSFORM);
  19.374  						filter.openBracket();
  19.375  					}	
  19.376  				}	
  19.377 @@ -1501,46 +1741,46 @@
  19.378  				{
  19.379  					appendConstructFunction(expr.getLeftArg(), filter);
  19.380  				}
  19.381 +				else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  19.382 +				{
  19.383 +					appendConstructFunction(expr.getLeftArg(), filter);
  19.384 +				}
  19.385  				else if(expr.getLeftArg() instanceof GeneralDBSqlCase)
  19.386  				{
  19.387  					GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
  19.388 -					appendMBB(onlyLabel,filter); 
  19.389 +					appendMBB(onlyLabel,filter);
  19.390  				}
  19.391  				else
  19.392  				{
  19.393  					appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter);
  19.394  				}
  19.395 -				
  19.396 -				if(units.equals("metre") || units.equals("meter"))
  19.397 -				{					
  19.398 -					filter.appendComma();
  19.399 -					filter.append(String.valueOf(GeoConstants.defaultSRID));
  19.400 -					filter.closeBracket(); //close st_transform
  19.401 -					filter.closeBracket(); //close geography
  19.402 -					
  19.403 -					filter.appendComma();
  19.404  
  19.405 -					filter.appendFunction("GEOGRAPHY");
  19.406 -					filter.openBracket();
  19.407 -					filter.appendFunction("ST_TRANSFORM");
  19.408 -					filter.openBracket();				
  19.409 +				if(units.equals(OGCConstants.OGCmetre))
  19.410 +				{
  19.411 +					if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))
  19.412 +					{
  19.413 +						filter.appendComma();
  19.414 +						filter.append(String.valueOf(GeoConstants.defaultSRID));
  19.415 +						filter.closeBracket(); //close st_transform
  19.416 +						filter.appendComma();
  19.417 +					}	
  19.418 +					else
  19.419 +					{	
  19.420 +						filter.appendComma();
  19.421 +						filter.append(String.valueOf(GeoConstants.defaultSRID));
  19.422 +						filter.closeBracket(); //close st_transform
  19.423 +						filter.closeBracket(); //close geography
  19.424 +						filter.appendComma();
  19.425 +					}
  19.426  				}
  19.427 -				else if(units.equals("degree"))
  19.428 +				else if(units.equals(OGCConstants.OGCdegree))
  19.429  				{
  19.430  					filter.appendComma();
  19.431  					filter.append(String.valueOf(GeoConstants.defaultSRID));
  19.432  					filter.closeBracket(); //close st_transform
  19.433 -					
  19.434  					filter.appendComma();
  19.435 -					
  19.436 -					filter.appendFunction("ST_TRANSFORM");
  19.437 -					filter.openBracket();
  19.438 -				}	
  19.439 -				else
  19.440 -				{
  19.441 -					filter.appendComma();
  19.442 -				}																
  19.443 -				
  19.444 +				}
  19.445 +
  19.446  				if(expr.getRightArg() instanceof GeneralDBStringValue)
  19.447  				{
  19.448  					appendWKT(expr.getRightArg(),filter);
  19.449 @@ -1553,33 +1793,28 @@
  19.450  				{
  19.451  					appendConstructFunction(expr.getRightArg(), filter);
  19.452  				}
  19.453 +				else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
  19.454 +				{
  19.455 +					appendMetricFunction(expr.getRightArg(), filter);
  19.456 +				}
  19.457  				else if(expr.getRightArg() instanceof GeneralDBSqlCase)
  19.458  				{
  19.459  					GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult();
  19.460 -					appendMBB(onlyLabel,filter);					 
  19.461 +					appendMBB(onlyLabel,filter);
  19.462  				}
  19.463 -				else if(expr.getRightArg() instanceof GeneralDBDoubleValue) //case met in buffer!
  19.464 +				else if(expr.getRightArg() instanceof GeneralDBDoubleValue)
  19.465  				{
  19.466  					append(((GeneralDBDoubleValue)expr.getRightArg()), filter);
  19.467  				}
  19.468 -				else if(expr.getRightArg() instanceof GeneralDBNumericColumn) //case met in buffer!
  19.469 +				else if(expr.getRightArg() instanceof GeneralDBNumericColumn)
  19.470  				{
  19.471  					append(((GeneralDBNumericColumn)expr.getRightArg()), filter);
  19.472  				}
  19.473 -				else if(expr.getRightArg() instanceof GeneralDBURIColumn) //case met in transform!
  19.474 -				{
  19.475 -					filter.keepSRID_part1();
  19.476 -					append(((GeneralDBURIColumn)expr.getRightArg()), filter);
  19.477 -					filter.keepSRID_part2();
  19.478 -					append(((GeneralDBURIColumn)expr.getRightArg()), filter);
  19.479 -					filter.keepSRID_part3();
  19.480 -				}
  19.481  				//case met in buffer when in select -> buffer(?spatial,?thematic)
  19.482  				else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial())
  19.483  				{
  19.484 -					appendWithCastDouble(((GeneralDBLabelColumn)expr.getRightArg()),filter);
  19.485 -					//					append(((GeneralDBLabelColumn)expr.getRightArg()),filter);
  19.486 -					//					appendCastToDouble(filter);
  19.487 +					append(((GeneralDBLabelColumn)expr.getRightArg()),filter);
  19.488 +					appendCastToDouble(filter);
  19.489  				}
  19.490  				else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricBinary)
  19.491  				{
  19.492 @@ -1589,30 +1824,36 @@
  19.493  				{
  19.494  					appendMetricFunction(expr.getRightArg(), filter);
  19.495  				}
  19.496 +				else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
  19.497 +				{
  19.498 +					appendMetricFunction(expr.getRightArg(), filter);
  19.499 +				}
  19.500  				else
  19.501  				{
  19.502  					appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
  19.503  				}
  19.504  
  19.505 -				if(units.equals("metre") || units.equals("meter"))
  19.506 +				filter.closeBracket();
  19.507 +				//SRID Support
  19.508 +				if(expr instanceof GeneralDBSqlSpatialConstructTriple && expr.getParentNode() == null)
  19.509  				{
  19.510  					filter.appendComma();
  19.511 -					filter.append(String.valueOf(GeoConstants.defaultSRID));
  19.512 -					filter.closeBracket();
  19.513 +					filter.append(sridExpr);
  19.514  					filter.closeBracket();
  19.515  				}
  19.516 -				else if(units.equals("degree"))
  19.517 -				{
  19.518 -					filter.appendComma();
  19.519 -					filter.append(String.valueOf(GeoConstants.defaultSRID));
  19.520 -					filter.closeBracket();
  19.521 -				}
  19.522 -
  19.523 -				filter.closeBracket();
  19.524 +				///
  19.525  			}
  19.526 -
  19.527 +			if(units.equals(OGCConstants.OGCmetre) && !((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0))))
  19.528 +				filter.closeBracket(); //close Geometry
  19.529  			filter.closeBracket();
  19.530 -		}
  19.531 +			//Used to explicitly include SRID
  19.532 +			if(expr instanceof GeneralDBSqlSpatialConstructTriple && expr.getParentNode() == null)
  19.533 +			{
  19.534 +				filter.appendComma();
  19.535 +				filter.append(sridExpr);
  19.536 +			}
  19.537 +		}	
  19.538 +	}	
  19.539  
  19.540  	//Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1) 
  19.541  	protected void appendMonetDBSpatialFunctionUnary(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsMonetDB func)
    20.1 --- a/pom.xml	Fri Apr 26 19:48:06 2013 +0300
    20.2 +++ b/pom.xml	Fri Apr 26 19:49:12 2013 +0300
    20.3 @@ -740,9 +740,9 @@
    20.4  			<plugin>
    20.5  		        <groupId>org.apache.maven.plugins</groupId>
    20.6  		        <artifactId>maven-surefire-plugin</artifactId>
    20.7 -		        <version>2.12</version>
    20.8 +		        <version>2.14</version>
    20.9  		        <configuration>
   20.10 -		          <skipTests>${skipTests}</skipTests>
   20.11 +		        <skipTests>${skipTests}</skipTests>
   20.12  			    </configuration>
   20.13  		    </plugin>
   20.14  		</plugins>
   20.15 @@ -875,6 +875,18 @@
   20.16  			<name>Strabon - maven repository - snapshots</name>
   20.17  			<url>http://maven.strabon.di.uoa.gr/content/repositories/snapshots</url>
   20.18  		</repository>
   20.19 +        <repository>
   20.20 +            <releases>
   20.21 +                <enabled>true</enabled>
   20.22 +            </releases>
   20.23 +            <snapshots>
   20.24 +                <enabled>false</enabled>
   20.25 +            </snapshots>
   20.26 +            <id>strabon.sesame</id>
   20.27 +            <name>Strabon - maven repository - sesame artifacts (temporary)</name>
   20.28 +            <url>http://maven.strabon.di.uoa.gr/content/repositories/strabon.sesame/</url>
   20.29 +        </repository>
   20.30 +		<!--
   20.31  		<repository>
   20.32  			<releases>
   20.33  				<enabled>true</enabled>
   20.34 @@ -897,6 +909,7 @@
   20.35  			<name>Aduna Open Source - Maven snapshots</name>
   20.36  			<url>http://repo.aduna-software.org/maven2/snapshots</url>
   20.37  		</repository>
   20.38 +		-->
   20.39  		<repository>
   20.40  			<snapshots>
   20.41  				<enabled>true</enabled>
    21.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Fri Apr 26 19:48:06 2013 +0300
    21.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Fri Apr 26 19:49:12 2013 +0300
    21.3 @@ -57,6 +57,7 @@
    21.4  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRelate;
    21.5  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlRight;
    21.6  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructBinary;
    21.7 +import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructTriple;
    21.8  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialConstructUnary;
    21.9  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricBinary;
   21.10  import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialMetricTriple;
   21.11 @@ -120,6 +121,7 @@
   21.12  	public static final String ST_TRANSFORM = "ST_Transform";
   21.13  	public static final String ST_ASBINARY = "ST_AsBinary";
   21.14  	public static final String GEOGRAPHY = "Geography";
   21.15 +	public static final String GEOMETRY = "Geometry";
   21.16  	/**
   21.17  	 * If (spatial) label column met is null, I must not try to retrieve its srid. 
   21.18  	 * Opting to ask for 'null' instead
   21.19 @@ -368,6 +370,10 @@
   21.20  		{
   21.21  			dispatchTripleSqlOperator((GeneralDBSqlSpatialMetricTriple) expr, query.select);
   21.22  		}
   21.23 +		else if(expr instanceof GeneralDBSqlSpatialConstructTriple)
   21.24 +		{
   21.25 +			dispatchTripleSqlOperator((GeneralDBSqlSpatialConstructTriple) expr, query.select);
   21.26 +		}
   21.27  		//SRID support must be explicitly added!
   21.28  
   21.29  		return this;
   21.30 @@ -515,7 +521,7 @@
   21.31  	protected void append(GeneralDBSqlSF_Contains expr, GeneralDBSqlExprBuilder filter)
   21.32  			throws UnsupportedRdbmsOperatorException
   21.33  			{
   21.34 -		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Contains);
   21.35 +		appendGeneralDBSpatialFunctionBinary(expr, filter,SpatialFunctionsPostGIS.ST_Contains);
   21.36  			}
   21.37  
   21.38  	@Override
   21.39 @@ -531,21 +537,21 @@
   21.40  	protected void append(GeneralDBSqlSF_Disjoint expr, GeneralDBSqlExprBuilder filter)
   21.41  			throws UnsupportedRdbmsOperatorException
   21.42  			{
   21.43 -		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Disjoint);
   21.44 +		appendGeneralDBSpatialFunctionBinary(expr, filter,SpatialFunctionsPostGIS.ST_Disjoint);
   21.45  			}
   21.46  
   21.47  	@Override
   21.48  	protected void append(GeneralDBSqlSF_Equals expr, GeneralDBSqlExprBuilder filter)
   21.49  			throws UnsupportedRdbmsOperatorException
   21.50  			{
   21.51 -		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Equals);
   21.52 +		appendGeneralDBSpatialFunctionBinary(expr, filter,SpatialFunctionsPostGIS.ST_Equals);
   21.53  			}
   21.54  
   21.55  	@Override
   21.56  	protected void append(GeneralDBSqlSF_Intersects expr, GeneralDBSqlExprBuilder filter)
   21.57  			throws UnsupportedRdbmsOperatorException
   21.58  			{
   21.59 -		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Intersects);
   21.60 +		appendGeneralDBSpatialFunctionBinary(expr, filter,SpatialFunctionsPostGIS.ST_Intersects);
   21.61  			}
   21.62  
   21.63  	@Override
   21.64 @@ -561,14 +567,14 @@
   21.65  	protected void append(GeneralDBSqlSF_Touches expr, GeneralDBSqlExprBuilder filter)
   21.66  			throws UnsupportedRdbmsOperatorException
   21.67  			{
   21.68 -		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Touches);
   21.69 +		appendGeneralDBSpatialFunctionBinary(expr, filter,SpatialFunctionsPostGIS.ST_Touches);
   21.70  			}
   21.71  
   21.72  	@Override
   21.73  	protected void append(GeneralDBSqlSF_Within expr, GeneralDBSqlExprBuilder filter)
   21.74  			throws UnsupportedRdbmsOperatorException
   21.75  			{
   21.76 -		appendgeoSPARQLSpatialRelation(expr, filter,SpatialFunctionsPostGIS.SF_Within);
   21.77 +		appendGeneralDBSpatialFunctionBinary(expr, filter,SpatialFunctionsPostGIS.ST_Within);
   21.78  			}
   21.79  
   21.80  	//Egenhofer
   21.81 @@ -696,11 +702,10 @@
   21.82  			}
   21.83  
   21.84  	@Override
   21.85 -	protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter)
   21.86 -			throws UnsupportedRdbmsOperatorException
   21.87 -			{
   21.88 -		appendGeneralDBSpatialFunctionBinary(expr, filter, SpatialFunctionsPostGIS.ST_Buffer);
   21.89 -			}
   21.90 +	protected void append(GeneralDBSqlGeoBuffer expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException
   21.91 +	{
   21.92 +		appendBuffer(expr, filter, SpatialFunctionsPostGIS.ST_Buffer);
   21.93 +	}
   21.94  
   21.95  	//XXX Different Behavior
   21.96  	@Override
   21.97 @@ -917,6 +922,10 @@
   21.98  				{
   21.99  					appendConstructFunction(expr.getArg(), filter);
  21.100  				}
  21.101 +				else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.102 +				{
  21.103 +					appendConstructFunction(expr.getArg(), filter);
  21.104 +				}
  21.105  				else if(expr.getArg() instanceof GeneralDBSqlCase)
  21.106  				{
  21.107  					GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getArg()).getEntries().get(0).getResult();
  21.108 @@ -1098,6 +1107,10 @@
  21.109  			{
  21.110  				appendConstructFunction(expr.getLeftArg(), filter);
  21.111  			}
  21.112 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.113 +			{
  21.114 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.115 +			}
  21.116  			else
  21.117  			{
  21.118  				appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter);
  21.119 @@ -1140,6 +1153,10 @@
  21.120  			{
  21.121  				appendConstructFunction(expr.getRightArg(), filter);
  21.122  			}
  21.123 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.124 +			{
  21.125 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.126 +			}
  21.127  			else
  21.128  			{
  21.129  				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
  21.130 @@ -1151,9 +1168,8 @@
  21.131  	}
  21.132  
  21.133  	//Used in all the generaldb stsparql boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 
  21.134 -	protected void appendTransformFunc(GeneralDBSqlGeoTransform expr, GeneralDBSqlExprBuilder filter)
  21.135 -			throws UnsupportedRdbmsOperatorException
  21.136 -			{
  21.137 +	protected void appendTransformFunc(GeneralDBSqlGeoTransform expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException
  21.138 +	{
  21.139  		//In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))")
  21.140  		boolean sridNeeded = true;
  21.141  		//XXX Incorporating SRID
  21.142 @@ -1236,6 +1252,10 @@
  21.143  			{
  21.144  				appendConstructFunction(expr.getLeftArg(), filter);
  21.145  			}
  21.146 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.147 +			{
  21.148 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.149 +			}
  21.150  			else if(expr.getLeftArg() instanceof GeneralDBSqlCase)
  21.151  			{
  21.152  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
  21.153 @@ -1405,9 +1425,8 @@
  21.154  
  21.155  	//Used in all the generaldb stsparql (and geosparql) boolean spatial functions of the form ST_Function(?GEO1,?GEO2) 
  21.156  	//EXCEPT ST_Transform!!!
  21.157 -	protected void appendGeneralDBSpatialFunctionBinary(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func)
  21.158 -			throws UnsupportedRdbmsOperatorException
  21.159 -			{
  21.160 +	protected void appendGeneralDBSpatialFunctionBinary(BinaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) throws UnsupportedRdbmsOperatorException
  21.161 +	{
  21.162  		//In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))")
  21.163  		boolean sridNeeded = true;
  21.164  		//XXX Incorporating SRID
  21.165 @@ -1441,6 +1460,11 @@
  21.166  					{
  21.167  						child = ((BinaryGeneralDBOperator) tmp).getLeftArg();
  21.168  					}
  21.169 +					else if(tmp instanceof TripleGeneralDBOperator)
  21.170 +					{
  21.171 +						child = ((TripleGeneralDBOperator) tmp).getLeftArg();
  21.172 +					}
  21.173 +
  21.174  					else //(tmp instanceof UnaryGeneralDBOperator)
  21.175  					{
  21.176  						child = ((UnaryGeneralDBOperator) tmp).getArg();
  21.177 @@ -1513,6 +1537,10 @@
  21.178  			{
  21.179  				appendConstructFunction(expr.getLeftArg(), filter);
  21.180  			}
  21.181 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.182 +			{
  21.183 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.184 +			}
  21.185  			else if(expr.getLeftArg() instanceof GeneralDBSqlCase)
  21.186  			{
  21.187  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
  21.188 @@ -1536,6 +1564,10 @@
  21.189  			{
  21.190  				appendConstructFunction(expr.getRightArg(), filter);
  21.191  			}
  21.192 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.193 +			{
  21.194 +				appendConstructFunction(expr.getRightArg(), filter);
  21.195 +			}
  21.196  			else if(expr.getRightArg() instanceof GeneralDBSqlCase)
  21.197  			{
  21.198  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult();
  21.199 @@ -1571,6 +1603,10 @@
  21.200  			{
  21.201  				appendMetricFunction(expr.getRightArg(), filter);
  21.202  			}
  21.203 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
  21.204 +			{
  21.205 +				appendMetricFunction(expr.getRightArg(), filter);
  21.206 +			}
  21.207  			else
  21.208  			{
  21.209  				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
  21.210 @@ -1619,27 +1655,22 @@
  21.211  		else if(check3)
  21.212  		{
  21.213  			this.append((GeneralDBSqlNull)expr.getThirdArg(), filter);
  21.214 -
  21.215  		}
  21.216  		else
  21.217 -		{						
  21.218 +		{
  21.219  			filter.appendFunction("ST_Distance");
  21.220 -
  21.221  			filter.openBracket();
  21.222  	
  21.223  			if (expr.getThirdArg() instanceof GeneralDBStringValue)
  21.224 -			{	
  21.225 -				
  21.226 +			{
  21.227  				units = ((GeneralDBStringValue)expr.getThirdArg()).getValue();
  21.228 -				
  21.229  				if(!OGCConstants.supportedUnitsOfMeasure.contains(units))
  21.230  				{
  21.231  					throw new UnsupportedRdbmsOperatorException("No such unit of measure exists");
  21.232  				}	
  21.233 -				
  21.234 +
  21.235  				if(units.equals(OGCConstants.OGCmetre))
  21.236 -				{							
  21.237 -					//if(!unparsedUnits.equals(OGCConstants.OGCmetre));
  21.238 +				{
  21.239  					filter.appendFunction(GEOGRAPHY);
  21.240  					filter.openBracket();
  21.241  					filter.appendFunction(ST_TRANSFORM);
  21.242 @@ -1664,6 +1695,10 @@
  21.243  			{
  21.244  				appendConstructFunction(expr.getLeftArg(), filter);
  21.245  			}
  21.246 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.247 +			{
  21.248 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.249 +			}			
  21.250  			else if(expr.getLeftArg() instanceof GeneralDBSqlCase)
  21.251  			{
  21.252  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
  21.253 @@ -1686,7 +1721,7 @@
  21.254  				filter.appendFunction(GEOGRAPHY);
  21.255  				filter.openBracket();
  21.256  				filter.appendFunction(ST_TRANSFORM);
  21.257 -				filter.openBracket();				
  21.258 +				filter.openBracket();
  21.259  			}
  21.260  			else if(units.equals(OGCConstants.OGCdegree))
  21.261  			{
  21.262 @@ -1716,6 +1751,10 @@
  21.263  			{
  21.264  				appendConstructFunction(expr.getRightArg(), filter);
  21.265  			}
  21.266 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.267 +			{
  21.268 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.269 +			}
  21.270  			else if(expr.getRightArg() instanceof GeneralDBSqlCase)
  21.271  			{
  21.272  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult();
  21.273 @@ -1743,6 +1782,10 @@
  21.274  			{
  21.275  				appendMetricFunction(expr.getRightArg(), filter);
  21.276  			}
  21.277 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
  21.278 +			{
  21.279 +				appendMetricFunction(expr.getRightArg(), filter);
  21.280 +			}
  21.281  			else
  21.282  			{
  21.283  				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
  21.284 @@ -1767,10 +1810,253 @@
  21.285  		filter.closeBracket();
  21.286  	}
  21.287  
  21.288 +	//Buffer function
  21.289 +	protected void appendBuffer(TripleGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) throws UnsupportedRdbmsOperatorException
  21.290 +	{
  21.291 +		boolean sridNeeded = true;
  21.292 +		//XXX Incorporating SRID
  21.293 +		String sridExpr = null;
  21.294 +		String units = null;
  21.295 +
  21.296 +		filter.openBracket();
  21.297 +
  21.298 +		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
  21.299 +		boolean check2 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
  21.300 +		boolean check3 = expr.getRightArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
  21.301 +
  21.302 +		if(check1)
  21.303 +		{
  21.304 +			this.append((GeneralDBSqlNull)expr.getLeftArg(), filter);
  21.305 +
  21.306 +		}
  21.307 +		else if(check2)
  21.308 +		{
  21.309 +			this.append((GeneralDBSqlNull)expr.getRightArg(), filter);
  21.310 +		}
  21.311 +		else if(check3)
  21.312 +		{
  21.313 +			this.append((GeneralDBSqlNull)expr.getRightArg(), filter);
  21.314 +		}
  21.315 +		else
  21.316 +		{
  21.317 +			GeneralDBSqlExpr tmp = expr;
  21.318 +			if(tmp instanceof GeneralDBSqlSpatialConstructTriple && tmp.getParentNode() == null)
  21.319 +			{
  21.320 +				while(true)
  21.321 +				{
  21.322 +					GeneralDBSqlExpr child;
  21.323 +
  21.324 +					if(tmp instanceof TripleGeneralDBOperator)
  21.325 +					{
  21.326 +						child = ((TripleGeneralDBOperator) tmp).getLeftArg();
  21.327 +					}
  21.328 +					else if(tmp instanceof BinaryGeneralDBOperator)
  21.329 +					{
  21.330 +						child = ((BinaryGeneralDBOperator) tmp).getLeftArg();
  21.331 +					}
  21.332 +					else //(tmp instanceof UnaryGeneralDBOperator)
  21.333 +					{
  21.334 +						child = ((UnaryGeneralDBOperator) tmp).getArg();
  21.335 +					}
  21.336 +
  21.337 +					tmp = child;
  21.338 +					if(tmp instanceof GeneralDBLabelColumn)
  21.339 +					{
  21.340 +						//Reached the innermost left var -> need to capture its SRID
  21.341 +						String alias;
  21.342 +						if (((GeneralDBLabelColumn) tmp).getRdbmsVar().isResource()) {
  21.343 +							//Predicates used in triple patterns non-existent in db
  21.344 +							alias="NULL";
  21.345 +						}
  21.346 +						else
  21.347 +						{
  21.348 +							//Reached the innermost left var -> need to capture its SRID
  21.349 +							alias = getLabelAlias(((GeneralDBLabelColumn) tmp).getRdbmsVar());
  21.350 +							alias=alias+".srid";
  21.351 +						}
  21.352 +						sridExpr = alias;
  21.353 +						break;
  21.354 +					}
  21.355 +					else if (tmp instanceof GeneralDBStringValue) //Constant!!
  21.356 +					{
  21.357 +						sridNeeded  = false;
  21.358 +						break;
  21.359 +					}
  21.360 +				}
  21.361 +				if(sridNeeded)
  21.362 +				{
  21.363 +					filter.appendFunction(ST_TRANSFORM);
  21.364 +					filter.openBracket();
  21.365 +				}
  21.366 +			}			
  21.367 +
  21.368 +			if (expr.getThirdArg() instanceof GeneralDBStringValue)
  21.369 +			{
  21.370 +				units = ((GeneralDBStringValue)expr.getThirdArg()).getValue();
  21.371 +
  21.372 +				if(!OGCConstants.supportedUnitsOfMeasure.contains(units))
  21.373 +				{
  21.374 +					throw new UnsupportedRdbmsOperatorException("No such unit of measure exists");
  21.375 +				}													
  21.376 +					
  21.377 +				if(units.equals(OGCConstants.OGCmetre))
  21.378 +				{
  21.379 +					if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))
  21.380 +					{
  21.381 +						filter.appendFunction("ST_Buffer");
  21.382 +						filter.openBracket();
  21.383 +						filter.appendFunction(ST_TRANSFORM);
  21.384 +						filter.openBracket();		
  21.385 +					}
  21.386 +					else
  21.387 +					{	
  21.388 +						filter.appendFunction(GEOMETRY);
  21.389 +						filter.openBracket();
  21.390 +						filter.appendFunction("ST_Buffer");
  21.391 +						filter.openBracket();
  21.392 +						filter.appendFunction(GEOGRAPHY);
  21.393 +						filter.openBracket();
  21.394 +						filter.appendFunction(ST_TRANSFORM);
  21.395 +						filter.openBracket();
  21.396 +					}
  21.397 +				}
  21.398 +				else if(units.equals(OGCConstants.OGCdegree))
  21.399 +				{
  21.400 +					filter.appendFunction("ST_Buffer");
  21.401 +					filter.openBracket();
  21.402 +					filter.appendFunction(ST_TRANSFORM);
  21.403 +					filter.openBracket();
  21.404 +				}
  21.405 +			}
  21.406 +
  21.407 +			if(expr.getLeftArg() instanceof GeneralDBStringValue)
  21.408 +			{
  21.409 +				appendWKT(expr.getLeftArg(),filter);
  21.410 +			}
  21.411 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructBinary)
  21.412 +			{
  21.413 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.414 +			}
  21.415 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructUnary)
  21.416 +			{
  21.417 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.418 +			}
  21.419 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.420 +			{
  21.421 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.422 +			}
  21.423 +			else if(expr.getLeftArg() instanceof GeneralDBSqlCase)
  21.424 +			{
  21.425 +				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
  21.426 +				appendMBB(onlyLabel,filter);
  21.427 +			}
  21.428 +			else
  21.429 +			{
  21.430 +				appendMBB((GeneralDBLabelColumn)(expr.getLeftArg()),filter);
  21.431 +			}
  21.432 +
  21.433 +			if(units.equals(OGCConstants.OGCmetre))
  21.434 +			{
  21.435 +				if((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0)))
  21.436 +				{
  21.437 +					filter.appendComma();
  21.438 +					filter.append(String.valueOf(GeoConstants.defaultSRID));
  21.439 +					filter.closeBracket(); //close st_transform
  21.440 +					filter.appendComma();
  21.441 +				}	
  21.442 +				else
  21.443 +				{	
  21.444 +					filter.appendComma();
  21.445 +					filter.append(String.valueOf(GeoConstants.defaultSRID));
  21.446 +					filter.closeBracket(); //close st_transform
  21.447 +					filter.closeBracket(); //close geography
  21.448 +					filter.appendComma();
  21.449 +				}
  21.450 +			}
  21.451 +			else if(units.equals(OGCConstants.OGCdegree))
  21.452 +			{
  21.453 +				filter.appendComma();
  21.454 +				filter.append(String.valueOf(GeoConstants.defaultSRID));
  21.455 +				filter.closeBracket(); //close st_transform
  21.456 +				filter.appendComma();
  21.457 +			}
  21.458 +
  21.459 +			if(expr.getRightArg() instanceof GeneralDBStringValue)
  21.460 +			{
  21.461 +				appendWKT(expr.getRightArg(),filter);
  21.462 +			}
  21.463 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructUnary)
  21.464 +			{
  21.465 +				appendConstructFunction(expr.getRightArg(), filter);
  21.466 +			}
  21.467 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructBinary)
  21.468 +			{
  21.469 +				appendConstructFunction(expr.getRightArg(), filter);
  21.470 +			}
  21.471 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.472 +			{
  21.473 +				appendConstructFunction(expr.getRightArg(), filter);
  21.474 +			}
  21.475 +			else if(expr.getRightArg() instanceof GeneralDBSqlCase)
  21.476 +			{
  21.477 +				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult();
  21.478 +				appendMBB(onlyLabel,filter);
  21.479 +			}
  21.480 +			else if(expr.getRightArg() instanceof GeneralDBDoubleValue)
  21.481 +			{
  21.482 +				append(((GeneralDBDoubleValue)expr.getRightArg()), filter);
  21.483 +			}
  21.484 +			else if(expr.getRightArg() instanceof GeneralDBNumericColumn)
  21.485 +			{
  21.486 +				append(((GeneralDBNumericColumn)expr.getRightArg()), filter);
  21.487 +			}
  21.488 +			//case met in buffer when in select -> buffer(?spatial,?thematic)
  21.489 +			else if(expr.getRightArg() instanceof GeneralDBLabelColumn && !((GeneralDBLabelColumn)expr.getRightArg()).isSpatial())
  21.490 +			{
  21.491 +				append(((GeneralDBLabelColumn)expr.getRightArg()),filter);
  21.492 +				appendCastToDouble(filter);
  21.493 +			}
  21.494 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricBinary)
  21.495 +			{
  21.496 +				appendMetricFunction(expr.getRightArg(), filter);
  21.497 +			}
  21.498 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricUnary)
  21.499 +			{
  21.500 +				appendMetricFunction(expr.getRightArg(), filter);
  21.501 +			}
  21.502 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
  21.503 +			{
  21.504 +				appendMetricFunction(expr.getRightArg(), filter);
  21.505 +			}
  21.506 +			else
  21.507 +			{
  21.508 +				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
  21.509 +			}
  21.510 +			
  21.511 +			if(units.equals(OGCConstants.OGCmetre) && !((expr.getRightArg() instanceof GeneralDBDoubleValue) && (((GeneralDBDoubleValue)expr.getRightArg()).getValue().equals(0.0))))
  21.512 +				filter.closeBracket(); //close Geometry
  21.513 +			filter.closeBracket();
  21.514 +			//SRID Support
  21.515 +			if(expr instanceof GeneralDBSqlSpatialConstructTriple && expr.getParentNode() == null)
  21.516 +			{
  21.517 +				filter.appendComma();
  21.518 +				filter.append(sridExpr);
  21.519 +				filter.closeBracket();
  21.520 +			}
  21.521 +			///
  21.522 +		}
  21.523 +		filter.closeBracket();
  21.524 +		//Used to explicitly include SRID
  21.525 +		if(expr instanceof GeneralDBSqlSpatialConstructTriple && expr.getParentNode() == null)
  21.526 +		{
  21.527 +			filter.appendComma();
  21.528 +			filter.append(sridExpr);
  21.529 +		}
  21.530 +	}
  21.531 +
  21.532  	//Used in all the generaldb boolean spatial functions of the form ST_Function(?GEO1) 
  21.533 -	protected void appendGeneralDBSpatialFunctionUnary(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func)
  21.534 -			throws UnsupportedRdbmsOperatorException
  21.535 -			{
  21.536 +	protected void appendGeneralDBSpatialFunctionUnary(UnaryGeneralDBOperator expr, GeneralDBSqlExprBuilder filter, SpatialFunctionsPostGIS func) throws UnsupportedRdbmsOperatorException
  21.537 +	{
  21.538  		//In the case where no variable is present in the expression! e.g ConvexHull("POLYGON((.....))")
  21.539  		boolean sridNeeded = true;
  21.540  		String sridExpr = null;
  21.541 @@ -1881,6 +2167,10 @@
  21.542  			{
  21.543  				appendConstructFunction(expr.getArg(), filter);
  21.544  			}
  21.545 +			else if(expr.getArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.546 +			{
  21.547 +				appendConstructFunction(expr.getArg(), filter);
  21.548 +			}
  21.549  			else if(expr.getArg() instanceof GeneralDBSqlCase)
  21.550  			{
  21.551  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getArg()).getEntries().get(0).getResult();
  21.552 @@ -1957,6 +2247,10 @@
  21.553  			{
  21.554  				appendConstructFunction(expr.getLeftArg(), filter);
  21.555  			}
  21.556 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.557 +			{
  21.558 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.559 +			}
  21.560  			else if(expr.getLeftArg() instanceof GeneralDBSqlCase)
  21.561  			{
  21.562  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
  21.563 @@ -1986,6 +2280,10 @@
  21.564  			{
  21.565  				appendConstructFunction(expr.getRightArg(), filter);
  21.566  			}
  21.567 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.568 +			{
  21.569 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.570 +			}
  21.571  			else if(expr.getRightArg() instanceof GeneralDBSqlCase)
  21.572  			{
  21.573  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult();
  21.574 @@ -2013,6 +2311,10 @@
  21.575  			{
  21.576  				appendMetricFunction(expr.getRightArg(), filter);
  21.577  			}
  21.578 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
  21.579 +			{
  21.580 +				appendMetricFunction(expr.getRightArg(), filter);
  21.581 +			}
  21.582  			else
  21.583  			{
  21.584  				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
  21.585 @@ -2055,9 +2357,8 @@
  21.586  
  21.587  	//GeoSPARQL
  21.588  	//XXX
  21.589 -	protected void appendRelate(BinaryGeneralDBOperator expr, PostGISSqlExprBuilder filter, char[] intersectionPattern)
  21.590 -			throws UnsupportedRdbmsOperatorException
  21.591 -			{
  21.592 +	protected void appendRelate(BinaryGeneralDBOperator expr, PostGISSqlExprBuilder filter, char[] intersectionPattern) throws UnsupportedRdbmsOperatorException
  21.593 +	{
  21.594  		filter.openBracket();
  21.595  
  21.596  		boolean check1 = expr.getLeftArg().getClass().getCanonicalName().equals("org.openrdf.sail.generaldb.algebra.GeneralDBSqlNull");
  21.597 @@ -2090,6 +2391,10 @@
  21.598  			{
  21.599  				appendConstructFunction(expr.getLeftArg(), filter);
  21.600  			}
  21.601 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.602 +			{
  21.603 +				appendConstructFunction(expr.getLeftArg(), filter);				
  21.604 +			}	
  21.605  			else if(expr.getLeftArg() instanceof GeneralDBSqlCase)
  21.606  			{
  21.607  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
  21.608 @@ -2113,6 +2418,10 @@
  21.609  			{
  21.610  				appendConstructFunction(expr.getRightArg(), filter);
  21.611  			}
  21.612 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.613 +			{
  21.614 +				appendConstructFunction(expr.getRightArg(), filter);				
  21.615 +			}
  21.616  			else if(expr.getRightArg() instanceof GeneralDBSqlCase)
  21.617  			{
  21.618  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult();
  21.619 @@ -2140,6 +2449,10 @@
  21.620  			{
  21.621  				appendMetricFunction(expr.getRightArg(), filter);
  21.622  			}
  21.623 +			else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
  21.624 +			{
  21.625 +				appendMetricFunction(expr.getRightArg(), filter);
  21.626 +			}
  21.627  			else
  21.628  			{
  21.629  				appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
  21.630 @@ -2546,8 +2859,6 @@
  21.631  		else
  21.632  		{	
  21.633  			filter.appendFunction("ST_Relate");
  21.634 -
  21.635 -
  21.636  			filter.openBracket();
  21.637  			if(expr.getLeftArg() instanceof GeneralDBStringValue)
  21.638  			{
  21.639 @@ -2561,6 +2872,10 @@
  21.640  			{
  21.641  				appendConstructFunction(expr.getLeftArg(), filter);
  21.642  			}
  21.643 +			else if(expr.getLeftArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.644 +			{
  21.645 +				appendConstructFunction(expr.getLeftArg(), filter);
  21.646 +			}
  21.647  			else if(expr.getLeftArg() instanceof GeneralDBSqlCase)
  21.648  			{
  21.649  				GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getLeftArg()).getEntries().get(0).getResult();
  21.650 @@ -2590,6 +2905,11 @@
  21.651  				{
  21.652  					appendConstructFunction(expr.getRightArg(), filter);
  21.653  				}
  21.654 +				
  21.655 +				else if(expr.getRightArg() instanceof GeneralDBSqlSpatialConstructTriple)
  21.656 +				{
  21.657 +					appendConstructFunction(expr.getRightArg(), filter);
  21.658 +				}
  21.659  				else if(expr.getRightArg() instanceof GeneralDBSqlCase)
  21.660  				{
  21.661  					GeneralDBLabelColumn onlyLabel = (GeneralDBLabelColumn)((GeneralDBSqlCase)expr.getRightArg()).getEntries().get(0).getResult();
  21.662 @@ -2617,6 +2937,10 @@
  21.663  				{
  21.664  					appendMetricFunction(expr.getRightArg(), filter);
  21.665  				}
  21.666 +				else if(expr.getRightArg() instanceof GeneralDBSqlSpatialMetricTriple)
  21.667 +				{
  21.668 +					appendMetricFunction(expr.getRightArg(), filter);
  21.669 +				}
  21.670  				else
  21.671  				{
  21.672  					appendMBB((GeneralDBLabelColumn)(expr.getRightArg()),filter);
    22.1 --- a/runtime/pom.xml	Fri Apr 26 19:48:06 2013 +0300
    22.2 +++ b/runtime/pom.xml	Fri Apr 26 19:49:12 2013 +0300
    22.3 @@ -357,7 +357,7 @@
    22.4  									<pluginExecutionFilter>
    22.5  										<groupId>org.apache.maven.plugins</groupId>
    22.6  										<artifactId>maven-dependency-plugin</artifactId>
    22.7 -										<versionRange>[2.3,)</versionRange>
    22.8 +										<versionRange>[2.4,)</versionRange>
    22.9  										<goals>
   22.10  											<goal>copy-dependencies</goal>
   22.11  										</goals>
   22.12 @@ -424,3 +424,15 @@
   22.13  	</build>
   22.14  </project>
   22.15  
   22.16 +
   22.17 +
   22.18 +
   22.19 +
   22.20 +
   22.21 +
   22.22 +
   22.23 +
   22.24 +
   22.25 +
   22.26 +
   22.27 +
    23.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeosparqlRDFHandlerBase.java	Fri Apr 26 19:48:06 2013 +0300
    23.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/GeosparqlRDFHandlerBase.java	Fri Apr 26 19:49:12 2013 +0300
    23.3 @@ -39,12 +39,13 @@
    23.4   * 
    23.5   * @author Charalampos Nikolaou <charnik@di.uoa.gr>
    23.6   * @author Konstantina Bereta <konstantina.bereta@di.uoa.gr>
    23.7 + * @author Panayiotis Smeros <psmeros@di.uoa.gr>
    23.8   */
    23.9  public class GeosparqlRDFHandlerBase extends RDFInserter {
   23.10  	
   23.11  	private static final Logger logger = LoggerFactory.getLogger(eu.earthobservatory.runtime.generaldb.GeosparqlRDFHandlerBase.class);
   23.12  	
   23.13 -	private static final boolean ENABLE_INFERENCE = false;
   23.14 +	public static boolean ENABLE_INFERENCE;
   23.15  	
   23.16  	/**
   23.17  	 * Keeps a String to URI mapping for the URIs of Simple Features and GML
    24.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Fri Apr 26 19:48:06 2013 +0300
    24.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/generaldb/Strabon.java	Fri Apr 26 19:49:12 2013 +0300
    24.3 @@ -307,15 +307,17 @@
    24.4  		}
    24.5  	}
    24.6  
    24.7 -	public void storeInRepo(String src, String format) throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    24.8 +	public void storeInRepo(String src, String format, Boolean inference) throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    24.9  	{
   24.10 -		storeInRepo(src, null, null, format);
   24.11 +		storeInRepo(src, null, null, format, inference);
   24.12  	}
   24.13  
   24.14 -	public void storeInRepo(String src, String baseURI, String context, String format) throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
   24.15 +	public void storeInRepo(String src, String baseURI, String context, String format, Boolean inference) throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
   24.16  	{
   24.17  		RDFFormat realFormat = null;
   24.18  
   24.19 +		GeosparqlRDFHandlerBase.ENABLE_INFERENCE=inference;
   24.20 +		
   24.21  		if ((baseURI != null) && (baseURI.equals(""))) {
   24.22  			baseURI = null;
   24.23  		}
   24.24 @@ -330,16 +332,16 @@
   24.25  			uriContext = f.createURI(context);
   24.26  		}
   24.27  
   24.28 -		if(format.equalsIgnoreCase("N3")) {
   24.29 +		if(format.equalsIgnoreCase("N3") || format.equals(RDFFormat.N3.getName())) {
   24.30  			realFormat =  RDFFormat.N3;
   24.31  			
   24.32 -		} else if(format.equalsIgnoreCase("NTRIPLES")) {
   24.33 +		} else if(format.equalsIgnoreCase("NTRIPLES") || format.equals(RDFFormat.NTRIPLES.getName())) {
   24.34  			realFormat =  RDFFormat.NTRIPLES;
   24.35  			
   24.36 -		} else if(format.equalsIgnoreCase("RDFXML")) {
   24.37 +		} else if(format.equalsIgnoreCase("RDFXML") || format.equals(RDFFormat.RDFXML.getName())) {
   24.38  			realFormat =  RDFFormat.RDFXML;
   24.39  			
   24.40 -		} else if(format.equalsIgnoreCase("TURTLE")) {
   24.41 +		} else if(format.equalsIgnoreCase("TURTLE") || format.equals(RDFFormat.TURTLE.getName())) {
   24.42  			realFormat =  RDFFormat.TURTLE;
   24.43  			
   24.44  		} else {
    25.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/monetdb/StoreOp.java	Fri Apr 26 19:48:06 2013 +0300
    25.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/monetdb/StoreOp.java	Fri Apr 26 19:49:12 2013 +0300
    25.3 @@ -35,6 +35,7 @@
    25.4  		String src = args[5];
    25.5  		String format = "NTRIPLES";
    25.6  		String graph = null;
    25.7 +		Boolean inference = false;
    25.8  		
    25.9  		for (int i = 6; i < args.length; i += 2) {
   25.10  			if (args[i].equals("-f")) {
   25.11 @@ -54,12 +55,21 @@
   25.12  					
   25.13  				} else {
   25.14  					graph = args[i+1];
   25.15 +				}			
   25.16 +			} else if (args[i].equals("-i")) {
   25.17 +				if (i + 1 >= args.length) {
   25.18 +					System.err.println("Option \"-i\" requires an argument.");
   25.19 +					help();
   25.20 +					System.exit(1);
   25.21 +					
   25.22 +				} else {
   25.23 +					inference = Boolean.valueOf(args[i+1]);
   25.24  				}
   25.25  				
   25.26  			} else {
   25.27 -				System.err.println("Unknown argument \"" + args[i] + "\".");
   25.28 -				help();
   25.29 -				System.exit(1);
   25.30 +					System.err.println("Unknown argument \"" + args[i] + "\".");
   25.31 +					help();
   25.32 +					System.exit(1);
   25.33  			}
   25.34  		}
   25.35  
   25.36 @@ -67,10 +77,10 @@
   25.37  		try {
   25.38  			strabon = new Strabon(db, user, passwd, port, host, false);
   25.39  			if (graph == null) {
   25.40 -				strabon.storeInRepo(src, format);
   25.41 +				strabon.storeInRepo(src, format, inference);
   25.42  				
   25.43  			} else {
   25.44 -				strabon.storeInRepo(src, null, graph, format);
   25.45 +				strabon.storeInRepo(src, null, graph, format, inference);
   25.46  			}
   25.47  		
   25.48  		} catch (Exception e) {
   25.49 @@ -84,15 +94,16 @@
   25.50  	}
   25.51  	
   25.52  	private static void help() {
   25.53 -		System.err.println("Usage: eu.earthobservatory.runtime.monetdb.StoreOp <HOST> <PORT> <DATABASE> <USERNAME> <PASSWORD> <FILE> [-f <FORMAT>] [-g <NAMED_GRAPH>]");
   25.54 +		System.err.println("Usage: eu.earthobservatory.runtime.monetdb.StoreOp <HOST> <PORT> <DATABASE> <USERNAME> <PASSWORD> <FILE> [-f <FORMAT>] [-g <NAMED_GRAPH>] [-i <INFERENCE>]");
   25.55  		System.err.println("       where <HOST>       		 is the postgis database host to connect to");
   25.56  		System.err.println("             <PORT>       		 is the port to connect to on the database host");		
   25.57 -		System.err.println("             <DATABASE>   		 is the spatially enabled postgis database that Strabon will use as a backend, ");
   25.58 -		System.err.println("             <USERNAME>   		 is the username to use when connecting to the database ");
   25.59 +		System.err.println("             <DATABASE>   		 is the spatially enabled postgis database that Strabon will use as a backend");
   25.60 +		System.err.println("             <USERNAME>   		 is the username to use when connecting to the database");
   25.61  		System.err.println("             <PASSWORD>   		 is the password to use when connecting to the database");
   25.62  		System.err.println("             <FILE>       		 is the file to be stored");
   25.63  		System.err.println("             [-f <FORMAT>] 		 is the format of the file (default: NTRIPLES)");
   25.64  		System.err.println("             [-g <NAMED_GRAPH>]  is the URI of the named graph to store the input file (default: default graph)");
   25.65 +		System.err.println("             [-i <INFERENCE>] 	 is true when inference is enabled (default: false)");
   25.66  	}
   25.67  
   25.68  }
    26.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/StoreOp.java	Fri Apr 26 19:48:06 2013 +0300
    26.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/postgis/StoreOp.java	Fri Apr 26 19:49:12 2013 +0300
    26.3 @@ -35,6 +35,7 @@
    26.4  		String src = args[5];
    26.5  		String format = "NTRIPLES";
    26.6  		String graph = null;
    26.7 +		Boolean inference = false;
    26.8  		
    26.9  		for (int i = 6; i < args.length; i += 2) {
   26.10  			if (args[i].equals("-f")) {
   26.11 @@ -54,8 +55,17 @@
   26.12  					
   26.13  				} else {
   26.14  					graph = args[i+1];
   26.15 -				}
   26.16 -				
   26.17 +				}	
   26.18 +			} else if (args[i].equals("-i")) {
   26.19 +					if (i + 1 >= args.length) {
   26.20 +						System.err.println("Option \"-i\" requires an argument.");
   26.21 +						help();
   26.22 +						System.exit(1);
   26.23 +						
   26.24 +					} else {
   26.25 +						inference = Boolean.valueOf(args[i+1]);
   26.26 +					}
   26.27 +					
   26.28  			} else {
   26.29  				System.err.println("Unknown argument \"" + args[i] + "\".");
   26.30  				help();
   26.31 @@ -67,10 +77,10 @@
   26.32  		try {
   26.33  			strabon = new Strabon(db, user, passwd, port, host, false);
   26.34  			if (graph == null) {
   26.35 -				strabon.storeInRepo(src, format);
   26.36 +				strabon.storeInRepo(src, format, inference);
   26.37  				
   26.38  			} else {
   26.39 -				strabon.storeInRepo(src, null, graph, format);
   26.40 +				strabon.storeInRepo(src, null, graph, format, inference);
   26.41  			}
   26.42  			
   26.43  		} catch (Exception e) {
   26.44 @@ -84,14 +94,16 @@
   26.45  	}
   26.46  
   26.47  	private static void help() {
   26.48 -		System.err.println("Usage: eu.earthobservatory.runtime.postgis.StoreOp <HOST> <PORT> <DATABASE> <USERNAME> <PASSWORD> <FILE> [-f <FORMAT>] [-g <NAMED_GRAPH>]");
   26.49 +		System.err.println("Usage: eu.earthobservatory.runtime.postgis.StoreOp <HOST> <PORT> <DATABASE> <USERNAME> <PASSWORD> <FILE> [-f <FORMAT>] [-g <NAMED_GRAPH>] [-i <INFERENCE>]");
   26.50  		System.err.println("       where <HOST>       		 is the postgis database host to connect to");
   26.51  		System.err.println("             <PORT>       		 is the port to connect to on the database host");		
   26.52 -		System.err.println("             <DATABASE>   		 is the spatially enabled postgis database that Strabon will use as a backend, ");
   26.53 -		System.err.println("             <USERNAME>   		 is the username to use when connecting to the database ");
   26.54 +		System.err.println("             <DATABASE>   		 is the spatially enabled postgis database that Strabon will use as a backend");
   26.55 +		System.err.println("             <USERNAME>   		 is the username to use when connecting to the database");
   26.56  		System.err.println("             <PASSWORD>   		 is the password to use when connecting to the database");
   26.57  		System.err.println("             <FILE>       		 is the file to be stored");
   26.58  		System.err.println("             [-f <FORMAT>] 		 is the format of the file (default: NTRIPLES)");
   26.59  		System.err.println("             [-g <NAMED_GRAPH>]  is the URI of the named graph to store the input file (default: default graph)");
   26.60 +		System.err.println("             [-i <INFERENCE>] 	 is true when inference is enabled (default: false)");
   26.61 +
   26.62  	}
   26.63  }
    27.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/testCRS.java	Fri Apr 26 19:48:06 2013 +0300
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,83 +0,0 @@
    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) 2010, 2011, 2012, Pyravlos Team
   27.10 - * 
   27.11 - * http://www.strabon.di.uoa.gr/
   27.12 - */
   27.13 -package eu.earthobservatory.runtime.postgis;
   27.14 -
   27.15 -import java.io.IOException;
   27.16 -import java.net.URL;
   27.17 -import java.sql.SQLException;
   27.18 -
   27.19 -import org.openrdf.repository.RepositoryException;
   27.20 -import org.openrdf.rio.RDFHandlerException;
   27.21 -import org.openrdf.rio.RDFParseException;
   27.22 -
   27.23 -import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
   27.24 -
   27.25 -public class testCRS {
   27.26 -	
   27.27 -	public static Strabon strabon;
   27.28 -	
   27.29 -	public static void main(String[] args) throws RDFParseException, RepositoryException, IOException, InvalidDatasetFormatFault, RDFHandlerException {
   27.30 -		try {
   27.31 -			strabon = new Strabon("tut","postgres","p1r3as", 5432, "localhost", true);
   27.32 -		} catch (SQLException e) {
   27.33 -			// TODO Auto-generated catch block
   27.34 -		
   27.35 -			e.printStackTrace();
   27.36 -		} catch (ClassNotFoundException e) {
   27.37 -			// TODO Auto-generated catch block
   27.38 -			e.printStackTrace();
   27.39 -		} catch (Exception e) {
   27.40 -			e.printStackTrace();
   27.41 -		}
   27.42 -		
   27.43 -		String text = 
   27.44 -				"<http://example.org/rcc8Obj1> <http://www.opengis.net/def/function/geosparql/rcc8eq> <http://example.org/rcc8Obj2> . \n" +
   27.45 -				"<http://example.org/simpleGeometry1> <http://www.opengis.net/def/function/geosparql/isEmpty> <http://example.org/nai> . \n"+
   27.46 -		"<http://example.org/ForestArea1> <http://www.opengis.net/def/function/geosparql/defaultGeometry> <http://example.org/defaultgeom> . \n"+
   27.47 -		"<http://example.org/SpatialObject1> <http://www.opengis.net/def/function/geosparql/ehIntersects> <http://example.org/SpatialObject2> . \n";
   27.48 -
   27.49 -		String statement1= "<http://example.org/CoastLine4> <http://www.earthobservatory.eu/ontologies/noaOntology.owl#hasGeometry> " +
   27.50 -				"\"POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/4326" +
   27.51 -				"\"^^<http://strdf.di.uoa.gr/ontology#WKT> .";
   27.52 -	String statement2= "<http://example.org/CoastLine5> <http://www.earthobservatory.eu/ontologies/noaOntology.owl#hasGeometry> " +
   27.53 -				"\"POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/32630" +
   27.54 -				"\"^^<http://strdf.di.uoa.gr/ontology#WKT> .";
   27.55 -		String gml =  "<http://example.org/rcc8Obj1> <http://example.org/hasGeometry> \"<gml:Point> <gml:coordinates>45.67, 88.56</gml:coordinates> </gml:Point>\"^^<http://strdf.di.uoa.gr/ontology#GML> .";
   27.56 -				
   27.57 -		String file = "/home/konstantina/gmlread.nt";
   27.58 -		URL url = new URL("http://www.di.uoa.gr/~pms509/rdf-data/streason.nt");
   27.59 -		String fileBaseURI = "http://example#";
   27.60 -		String fileRDFFormat = "NTRIPLES";
   27.61 -		String stringBaseURI = "http://example#";
   27.62 -		String stringRDFFormat = "NTRIPLES";
   27.63 -		try {
   27.64 -			//strabon.storeInRepo(statement1, stringBaseURI, null, stringRDFFormat);
   27.65 -			//strabon.storeInRepo(statement2, stringBaseURI, null, stringRDFFormat);
   27.66 -			//strabon.storeInRepo(text, null, null, "NTRIPLES");
   27.67 -			strabon.storeInRepo(file, fileRDFFormat);
   27.68 -			//strabon.storeInRepo(gml, null, null, stringRDFFormat);
   27.69 -			
   27.70 -		} catch (RDFParseException e) {
   27.71 -			e.printStackTrace();
   27.72 -		} catch (RepositoryException e) {
   27.73 -			e.printStackTrace();
   27.74 -		} catch (IOException e) {
   27.75 -			e.printStackTrace();
   27.76 -		} catch (InvalidDatasetFormatFault e) {
   27.77 -			e.printStackTrace();
   27.78 -		}
   27.79 -		finally{
   27.80 -			strabon.close();
   27.81 -			System.out.println("connection closed.");
   27.82 -		}
   27.83 -		
   27.84 -	}
   27.85 -
   27.86 -}
    28.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/TemplateTests.java	Fri Apr 26 19:48:06 2013 +0300
    28.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/TemplateTests.java	Fri Apr 26 19:49:12 2013 +0300
    28.3 @@ -84,7 +84,7 @@
    28.4  	protected static void loadTestData(String inputfile, Strabon strabon)
    28.5  			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    28.6  		{
    28.7 -			strabon.storeInRepo(inputfile, "NTRIPLES");
    28.8 +			strabon.storeInRepo(inputfile, "NTRIPLES", false);
    28.9  		}
   28.10  	
   28.11  //	/**
    29.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/TemplateTests.java	Fri Apr 26 19:48:06 2013 +0300
    29.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/TemplateTests.java	Fri Apr 26 19:49:12 2013 +0300
    29.3 @@ -127,7 +127,7 @@
    29.4  	protected static void loadTestData(String inputfile, Strabon strabon)
    29.5  		throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    29.6  	{
    29.7 -		strabon.storeInRepo(inputfile, "NTRIPLES");
    29.8 +		strabon.storeInRepo(inputfile, "NTRIPLES", false);
    29.9  	}
   29.10  
   29.11  	
    30.1 --- a/scripts/endpoint	Fri Apr 26 19:48:06 2013 +0300
    30.2 +++ b/scripts/endpoint	Fri Apr 26 19:49:12 2013 +0300
    30.3 @@ -15,6 +15,7 @@
    30.4  # as well as storing RDF triples on a Strabon Endpoint.
    30.5  #
    30.6  # Author: Charalampos (Babis) Nikolaou <charnik@di.uoa.gr>
    30.7 +# Author: Panayiotis Smeros <psmeros@di.uoa.gr>
    30.8  #
    30.9  
   30.10  # absolute directory name of this command
   30.11 @@ -70,12 +71,15 @@
   30.12  }
   30.13  
   30.14  function help_store() {
   30.15 -	echo "Usage: ${CMD} store ENDPOINT FORMAT -t TRIPLES|-u TRIPLES_URL"
   30.16 +	echo "Usage: ${CMD} store ENDPOINT FORMAT [-g NAMED_GRAPH] [--inference] -t TRIPLES|-u TRIPLES_URL"
   30.17  	echo
   30.18  	echo "	ENDPOINT    : the URL of Strabon Endpoint (e.g., http://localhost:8080/StrabonEndpoint/)"
   30.19  	echo "	FORMAT	    : the RDF format of the input (one of RDF/XML, N-Triples, Turtle, N3, TriX, TriG, or BinaryRDF)"
   30.20  	echo "	TRIPLES	    : the RDF triples to store"
   30.21  	echo "	TRIPLES_URL : the URL containing the RDF triples to store"
   30.22 +	echo "  NAMED_GRAPH : the URI of the named graph into which the RDF files shall be stored"
   30.23 +	echo "	              (defaults to the default graph)."
   30.24 +	echo "	--inference : enables inference."
   30.25  }
   30.26  
   30.27  function help_describe() {
   30.28 @@ -264,12 +268,14 @@
   30.29  		;;
   30.30  	store)
   30.31  		shift
   30.32 -		if ! test $# -eq 4; then
   30.33 +		if ! test $# -ge 4; then
   30.34  			help_store
   30.35  			exit 1
   30.36  		fi
   30.37  		URL="${1}/Store"
   30.38 -		FORMAT="${2}"
   30.39 +		shift
   30.40 +		FORMAT="${1}"
   30.41 +		shift
   30.42  		MIME_TYPE=
   30.43  		case "${FORMAT}" in
   30.44  			N-Triples)
   30.45 @@ -299,16 +305,52 @@
   30.46  				exit 2
   30.47  				;;
   30.48  		esac
   30.49 +				
   30.50 +		GRAPH=
   30.51 +		case "${1}" in
   30.52 +			 -g)
   30.53 +				shift
   30.54 +				if [ "${1}" == "--inference" ]; then
   30.55 +					help_store
   30.56 +					exit 1
   30.57 +				fi
   30.58 +				if ! test $# -ge 3; then
   30.59 +					help_store
   30.60 +					exit 1
   30.61 +				fi
   30.62 +				GRAPH="-d graph=${1}"
   30.63 +				shift
   30.64 +		esac
   30.65  
   30.66 -		case "${3}" in
   30.67 +		INFERENCE=
   30.68 +		case "${1}" in
   30.69 +			 --inference)
   30.70 +				shift
   30.71 +				if ! test $# -ge 2; then
   30.72 +					help_store
   30.73 +					exit 1
   30.74 +				fi
   30.75 +				INFERENCE="-d inference=true"
   30.76 +		esac
   30.77 +		
   30.78 +		case "${1}" in
   30.79  			-t)
   30.80 -				TRIPLES="${4}"
   30.81 -				EXEC="curl -u endpoint:3ndpo1nt -w '\nHTTP_CODE=%{http_code}\n' -H 'Content-Type:application/x-www-form-urlencoded' -H 'Accept:${MIME_TYPE}' --data-urlencode data='${TRIPLES}' ${URL}"
   30.82 +				shift
   30.83 +				if ! test $# -eq 1; then
   30.84 +					help_store
   30.85 +					exit 1
   30.86 +				fi
   30.87 +				TRIPLES="${1}"
   30.88 +				EXEC="curl -u endpoint:3ndpo1nt -w '\nHTTP_CODE=%{http_code}\n' -H 'Content-Type:application/x-www-form-urlencoded' -H 'Accept:${MIME_TYPE}' --data-urlencode data='${TRIPLES}' ${GRAPH} ${INFERENCE} ${URL}"
   30.89  				;;
   30.90  			-u)
   30.91 -
   30.92 -				URL_TRIPLES="${4}"
   30.93 -				EXEC="curl -u endpoint:3ndpo1nt -w '\nHTTP_CODE=%{http_code}\n' -H 'Content-Type:application/x-www-form-urlencoded' -H 'Accept:${MIME_TYPE}' --data-urlencode url='${URL_TRIPLES}' -d fromurl='' ${URL}"
   30.94 +				shift
   30.95 +				if ! test $# -eq 1; then
   30.96 +					help_store
   30.97 +					exit 1
   30.98 +				fi
   30.99 +				URL_TRIPLES="${1}"
  30.100 +				EXEC="curl -u endpoint:3ndpo1nt -w '\nHTTP_CODE=%{http_code}\n' -H 'Content-Type:application/x-www-form-urlencoded' -H 'Accept:${MIME_TYPE}' --data-urlencode url='${URL_TRIPLES}' -d fromurl='' ${GRAPH} ${INFERENCE} ${URL}"
  30.101  				;;
  30.102  			 *)
  30.103  				help_store
    31.1 --- a/scripts/strabon	Fri Apr 26 19:48:06 2013 +0300
    31.2 +++ b/scripts/strabon	Fri Apr 26 19:49:12 2013 +0300
    31.3 @@ -61,6 +61,9 @@
    31.4  # the URI of the named graph into which the RDF files shall be stored
    31.5  NAMED_GRAPH=
    31.6  
    31.7 +# true when inference is enabled
    31.8 +INFERENCE=
    31.9 +
   31.10  # predefined queries
   31.11  QUERY_SIZE="SELECT (COUNT(*) as ?C) WHERE {?s ?p ?o}"
   31.12  QUERY_GETALL="SELECT * WHERE {?s ?p ?o}"
   31.13 @@ -179,6 +182,7 @@
   31.14  	echo "		    \`ntriples' (default), \`n3', \`rdfxml', or \`turtle'."
   31.15  	echo "	-g NAMED_GRAPH : the URI of the named graph into which the RDF files shall be stored"
   31.16  	echo "	                 (defaults to the default graph)."
   31.17 +	echo "	--inference : enables inference."
   31.18  }
   31.19  
   31.20  function help_describe() {
   31.21 @@ -534,6 +538,12 @@
   31.22  				fi
   31.23  			fi
   31.24  
   31.25 +			# check whether inference is enabled
   31.26 +			if test "${1}" = "--inference"; then
   31.27 +				shift
   31.28 +				INFERENCE="-i true"
   31.29 +			fi
   31.30 +
   31.31  		done
   31.32  
   31.33  		# if no files are given
   31.34 @@ -599,7 +609,7 @@
   31.35  			file="$(pwd)/${file}"
   31.36  		fi
   31.37  
   31.38 -		STRABON_EXEC="${STRABON_EXEC}(cd ${RUNTIME} && java ${JAVA_OPTS} -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${file}\" -f ${FORMAT} ${NAMED_GRAPH});
   31.39 +		STRABON_EXEC="${STRABON_EXEC}(cd ${RUNTIME} && java ${JAVA_OPTS} -cp ./target/\*:. ${PKG}.${DATABASE}.${CLASS} ${HOST} ${PORT} ${DB} ${DBUSER} ${DBPASS} \"${file}\" -f ${FORMAT} ${NAMED_GRAPH} ${INFERENCE});
   31.40  "
   31.41  	done
   31.42  elif test "${CLASS}" = "QueryOp"; then
    32.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.2 +++ b/scripts/workaround/deploy-local-repo.sh	Fri Apr 26 19:49:12 2013 +0300
    32.3 @@ -0,0 +1,141 @@
    32.4 +#!/bin/bash
    32.5 +
    32.6 +#
    32.7 +# This Source Code Form is subject to the terms of the Mozilla Public
    32.8 +# License, v. 2.0. If a copy of the MPL was not distributed with this
    32.9 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
   32.10 +#
   32.11 +# Copyright (C) 2010, 2011, 2012, Pyravlos Team
   32.12 +#
   32.13 +# http://www.strabon.di.uoa.gr/
   32.14 +#
   32.15 +
   32.16 +#
   32.17 +# Script for deploying a local maven repository to a remote one
   32.18 +#
   32.19 +# Author: Kostis Kyzirakos <kk@di.uoa.gr>
   32.20 +#
   32.21 +
   32.22 +
   32.23 +# server id that maps on the <id> under <server> section of ~/.m2/settings.xml.
   32.24 +# In most cases, this parameter will be required for authentication.
   32.25 +DEPLOY_REPO_ID="strabon"
   32.26 +
   32.27 +# the url of the remote repository
   32.28 +DEPLOY_REPO_URL="http://maven.strabon.di.uoa.gr/content/repositories/strabon.sesame/"
   32.29 +
   32.30 +# temporary folder
   32.31 +TEMP_DIR="/tmp/deploy-local-repo-$$"
   32.32 +
   32.33 +# command name
   32.34 +CMD="$(basename ${0})"
   32.35 +
   32.36 +function help() {
   32.37 +        echo "Usage: ${CMD} [OPTIONS] [DIR]"
   32.38 +        echo
   32.39 +        echo "Deploy a local maven repository to a remote one"
   32.40 +        echo
   32.41 +        echo "  DIR     : resume the deployment of the local repository, starting from this directory"
   32.42 +        echo
   32.43 +        echo "OPTIONS can be any of the following (variable names and values are case sensitive)"
   32.44 +        echo "  --help           : Print this menu"
   32.45 +		echo ""
   32.46 +}
   32.47 +
   32.48 +if [[ ${#} -gt "0" ]] ; then
   32.49 +	ARRAY=(${@})
   32.50 +	ELEMENTS=${#ARRAY[@]}
   32.51 +	for (( i = 0; i < ${ELEMENTS}; i++ )); do
   32.52 +		if [[ "${ARRAY[${i}]}" = "--help" ]] || [[ "${ARRAY[${i}]}" = "-help" ]] || [[ "${ARRAY[${i}]}" = "help" ]]; then
   32.53 +			help
   32.54 +			exit 0
   32.55 +		fi
   32.56 +	done
   32.57 +fi
   32.58 +
   32.59 +mkdir ${TEMP_DIR}
   32.60 +if [[ ! -d "${TEMP_DIR}" ]] ; then
   32.61 +	echo "Could not create temporary directory."
   32.62 +	echo "Aborting..."
   32.63 +	exit
   32.64 +fi
   32.65 +
   32.66 +found=false;
   32.67 +for d in `find ${HOME}/.m2/repository -type d|sort` ;
   32.68 +do
   32.69 +	if [[ ! -z "$1" ]] && [[ "${found}" = "false" ]] && [[ "$d" != "$1" ]] ; then
   32.70 +		echo "Skipping ${d}"
   32.71 +		continue;
   32.72 +	fi
   32.73 +	# resuming
   32.74 +	found=true;
   32.75 +
   32.76 +	#for each directory
   32.77 +	cd ${d}
   32.78 +	children=`find . -type d|grep -v '^.$'|wc -l`
   32.79 +	if [[ "${children}" -ne "0" ]] ; then
   32.80 +		# if the directory has more subdirectories, move one
   32.81 +		continue;
   32.82 +	fi
   32.83 +
   32.84 +	countPoms=`ls -1 *.pom 2>/dev/null|wc -l`
   32.85 +	countJars=`ls -1 *.jar 2>/dev/null|wc -l`
   32.86 +
   32.87 +	if [[ "${countPoms}" -gt "1" ]] && [[ "${countJars}" -gt "1" ]] ; then
   32.88 +		echo "Found ${countPoms} poms and ${countJars} jars in directory '${d}'."
   32.89 +		echo "Aborting..."
   32.90 +		exit;
   32.91 +	elif [[ "${countPoms}" -eq "0" ]] ; then
   32.92 +		echo "No .pom file found in directory '${d}' (${children} children)."
   32.93 +		echo "Aborting..."
   32.94 +		exit;
   32.95 +	fi
   32.96 +
   32.97 +	if [[ "${countPoms}" -eq "1" ]] && [[ "${countJars}" -eq "1" ]] ; then
   32.98 +		pomFile=`ls -1 *.pom 2>/dev/null`
   32.99 +		jarFile=`ls -1 *.jar 2>/dev/null`
  32.100 +		cp ${pomFile} ${TEMP_DIR}/${pomFile} 2>/dev/null
  32.101 +		cp ${jarFile} ${TEMP_DIR}/${jarFile} 2>/dev/null
  32.102 +		# deploy the local jar file to the remote repo
  32.103 +		mvn deploy:deploy-file \
  32.104 +			-DrepositoryId=${DEPLOY_REPO_ID} \
  32.105 +			-Durl=${DEPLOY_REPO_URL} \
  32.106 +			-DpomFile=${TEMP_DIR}/${pomFile} \
  32.107 +			-Dfile=${TEMP_DIR}/${jarFile};
  32.108 +		if [[ "$?" -ne "0" ]] ; then echo "Error occured while processing directory '${d}' (temp dir is '${TEMP_DIR}')"; exit; fi
  32.109 +	elif [[ "${countPoms}" -eq "1" ]] && [[ "${countJars}" -eq "0" ]] ; then
  32.110 +		pomFile=`ls -1 *.pom 2>/dev/null`
  32.111 +		cp ${pomFile} ${TEMP_DIR}/${pomFile} 2>/dev/null
  32.112 +		# deploy the local pom file to the remote repo
  32.113 +		mvn deploy:deploy-file \
  32.114 +			-DrepositoryId=${DEPLOY_REPO_ID} \
  32.115 +			-Durl=${DEPLOY_REPO_URL} \
  32.116 +			-DpomFile=${TEMP_DIR}/${pomFile} \
  32.117 +			-Dfile=${TEMP_DIR}/${pomFile};
  32.118 +		if [[ "$?" -ne "0" ]] ; then echo "Error occured while processing directory '${d}' (temp dir is '${TEMP_DIR}'"; exit; fi
  32.119 +	elif [[ "${countPoms}" -gt "1" ]] && [[ "${countJars}" -eq "0" ]] ; then
  32.120 +		# deploy the local pom files to the remote repo
  32.121 +		for pom in `ls -1 *.pom` ; do
  32.122 +			pomFile=${pom};
  32.123 +			cp ${pomFile} ${TEMP_DIR}/${pomFile} 2>/dev/null;
  32.124 +			mvn deploy:deploy-file \
  32.125 +				-DrepositoryId=${DEPLOY_REPO_ID} \
  32.126 +				-Durl=${DEPLOY_REPO_URL} \
  32.127 +				-DpomFile=${TEMP_DIR}/${pomFile} \
  32.128 +				-Dfile=${TEMP_DIR}/${pomFile};
  32.129 +			if [[ "$?" -ne "0" ]] ; then echo "Error occured while processing directory '${d}' (temp dir is '${TEMP_DIR}'"; exit; fi
  32.130 +		done
  32.131 +	else
  32.132 +		echo "Found ${countPoms} poms and ${countJars} jars in directory '${d}' (temp dir is '${TEMP_DIR}')."
  32.133 +		echo "What should I do?"
  32.134 +		echo "Aborting..."
  32.135 +		exit;
  32.136 +	fi
  32.137 +
  32.138 +	# grooming
  32.139 +	rm ${TEMP_DIR}/*
  32.140 +done
  32.141 +
  32.142 +
  32.143 +# grooming
  32.144 +rm -rf ${TEMP_DIR}
    33.1 --- a/testsuite/src/test/java/eu/earthobservatory/runtime/postgis/StoreTest.java	Fri Apr 26 19:48:06 2013 +0300
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,18 +0,0 @@
    33.4 -/**
    33.5 - * This Source Code Form is subject to the terms of the Mozilla Public
    33.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this
    33.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    33.8 - * 
    33.9 - * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team
   33.10 - * 
   33.11 - * http://www.strabon.di.uoa.gr/
   33.12 - */
   33.13 -package eu.earthobservatory.runtime.postgis;
   33.14 -
   33.15 -
   33.16 -/**
   33.17 - * A simple store test. It tests if the input dataset is stored and retrieved correctly.
   33.18 - * 
   33.19 - * @author Panayiotis Smeros <psmeros@di.uoa.gr
   33.20 - */
   33.21 -public class StoreTest extends TemplateTest{}
    34.1 --- a/testsuite/src/test/java/eu/earthobservatory/runtime/postgis/TemplateTest.java	Fri Apr 26 19:48:06 2013 +0300
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,66 +0,0 @@
    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) 2010, 2011, 2012, 2013 Pyravlos Team
   34.10 - * 
   34.11 - * http://www.strabon.di.uoa.gr/
   34.12 - */
   34.13 -package eu.earthobservatory.runtime.postgis;
   34.14 -
   34.15 -import org.junit.After;
   34.16 -import org.junit.Before;
   34.17 -import org.junit.Test;
   34.18 -
   34.19 -/**
   34.20 - * A template test. It: 
   34.21 - * 1) creates a database
   34.22 - * 2) stores a dataset
   34.23 - * 3) poses a query
   34.24 - * 4) checks if the results of the query are the expected 
   34.25 - * 5) drops the database
   34.26 - * 
   34.27 - * @author Panayiotis Smeros <psmeros@di.uoa.gr
   34.28 - */
   34.29 -public abstract class TemplateTest
   34.30 -{	
   34.31 -	private String datasetFile;
   34.32 -	private String queryFile;
   34.33 -	private String resultsFile;
   34.34 -
   34.35 -	public TemplateTest(String datasetFile, String queryFile, String resultsFile)
   34.36 -	{
   34.37 -		this.datasetFile = datasetFile;
   34.38 -		this.queryFile = queryFile;
   34.39 -		this.resultsFile = resultsFile;
   34.40 -	}
   34.41 -
   34.42 -	public TemplateTest()
   34.43 -	{
   34.44 -		String testname=this.getClass().getSimpleName();
   34.45 -		
   34.46 -		this.datasetFile="/"+testname+"/"+testname+".nt";
   34.47 -		this.queryFile="/"+testname+"/"+testname+".rq";
   34.48 -		this.resultsFile="/"+testname+"/"+testname+".srx";
   34.49 -	}
   34.50 -
   34.51 -	@Before
   34.52 -	public void before() throws Exception
   34.53 -	{
   34.54 -		Utils.createdb();
   34.55 -		Utils.storeDataset(datasetFile);
   34.56 -	}
   34.57 -	
   34.58 -	@Test
   34.59 -	public void test() throws Exception
   34.60 -	{
   34.61 -		Utils.testQuery(queryFile, resultsFile);
   34.62 -	}
   34.63 -	
   34.64 -	@After
   34.65 -	public void after() throws Exception
   34.66 -	{
   34.67 -		Utils.dropdb();
   34.68 -	}
   34.69 -}
    35.1 --- a/testsuite/src/test/java/eu/earthobservatory/runtime/postgis/Utils.java	Fri Apr 26 19:48:06 2013 +0300
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,218 +0,0 @@
    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) 2010, 2011, 2012, 2013 Pyravlos Team
   35.10 - * 
   35.11 - * http://www.strabon.di.uoa.gr/
   35.12 - */
   35.13 -package eu.earthobservatory.runtime.postgis;
   35.14 -
   35.15 -import static org.junit.Assert.assertEquals;
   35.16 -import static org.junit.Assert.assertFalse;
   35.17 -import static org.junit.Assert.assertTrue;
   35.18 -import java.io.ByteArrayInputStream;
   35.19 -import java.io.ByteArrayOutputStream;
   35.20 -import java.io.File;
   35.21 -import java.io.IOException;
   35.22 -import java.io.InputStream;
   35.23 -import java.net.URISyntaxException;
   35.24 -import java.sql.Connection;
   35.25 -import java.sql.DriverManager;
   35.26 -import java.sql.PreparedStatement;
   35.27 -import java.sql.ResultSet;
   35.28 -import java.sql.SQLException;
   35.29 -import java.util.ArrayList;
   35.30 -import java.util.Collections;
   35.31 -import java.util.Iterator;
   35.32 -import java.util.List;
   35.33 -import java.util.Properties;
   35.34 -import org.apache.commons.io.FileUtils;
   35.35 -import org.openrdf.query.BindingSet;
   35.36 -import org.openrdf.query.MalformedQueryException;
   35.37 -import org.openrdf.query.QueryEvaluationException;
   35.38 -import org.openrdf.query.TupleQueryResult;
   35.39 -import org.openrdf.query.TupleQueryResultHandlerException;
   35.40 -import org.openrdf.query.resultio.QueryResultIO;
   35.41 -import org.openrdf.query.resultio.QueryResultParseException;
   35.42 -import org.openrdf.query.resultio.TupleQueryResultFormat;
   35.43 -import org.openrdf.query.resultio.UnsupportedQueryResultFormatException;
   35.44 -import org.openrdf.repository.RepositoryException;
   35.45 -import org.openrdf.rio.RDFHandlerException;
   35.46 -import org.openrdf.rio.RDFParseException;
   35.47 -import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
   35.48 -import eu.earthobservatory.utils.Format;
   35.49 -
   35.50 -/**
   35.51 - * A class with useful methods for the tests.
   35.52 - * 
   35.53 - * @author Panayiotis Smeros <psmeros@di.uoa.gr>
   35.54 - */
   35.55 -public class Utils
   35.56 -{
   35.57 -	private static final String dbPropertiesFile="/databases.properties";
   35.58 -	
   35.59 -	private static String databaseTemplateName = null;
   35.60 -	private static String defaultUser = null;
   35.61 -	private static String serverName = null;
   35.62 -	private static String username = null;
   35.63 -	private static String password = null;
   35.64 -	private static String port = null;
   35.65 -	
   35.66 -	private static Connection conn = null;
   35.67 -	private static String databaseName = null;
   35.68 -	
   35.69 -	private static Strabon strabon = null;
   35.70 -	
   35.71 -	public static void createdb() throws Exception
   35.72 -	{
   35.73 -		String url="";
   35.74 -		ArrayList<String> databases=new ArrayList<String>();
   35.75 -        PreparedStatement pst = null;
   35.76 -		
   35.77 -		//Read properties
   35.78 -		Properties properties = new Properties();
   35.79 -		InputStream propertiesStream =  Utils.class.getResourceAsStream(dbPropertiesFile);
   35.80 -		properties.load(propertiesStream);
   35.81 -
   35.82 -		if((databaseTemplateName = System.getProperty("postgis.databaseTemplateName"))==null)
   35.83 -		{
   35.84 -			databaseTemplateName = properties.getProperty("postgis.databaseTemplateName");
   35.85 -		}
   35.86 -
   35.87 -		if((defaultUser = System.getProperty("postgis.defaultUser"))==null)
   35.88 -		{
   35.89 -			defaultUser = properties.getProperty("postgis.defaultUser");
   35.90 -		}
   35.91 -		
   35.92 -		if((serverName = System.getProperty("postgis.serverName"))==null)
   35.93 -		{
   35.94 -			serverName = properties.getProperty("postgis.serverName");
   35.95 -		}
   35.96 -		
   35.97 -		if((username = System.getProperty("postgis.username"))==null)
   35.98 -		{
   35.99 -			username = properties.getProperty("postgis.username");
  35.100 -		}
  35.101 -		
  35.102 -		if((password = System.getProperty("postgis.password"))==null)
  35.103 -		{
  35.104 -			password = properties.getProperty("postgis.password");
  35.105 -		}
  35.106 -
  35.107 -		if((port = System.getProperty("postgis.port"))==null)
  35.108 -		{
  35.109 -			port = properties.getProperty("postgis.port");
  35.110 -		}
  35.111 -		
  35.112 -		//Connect to server and create the temp database
  35.113 -		url = "jdbc:postgresql://"+serverName+":"+port+"/"+defaultUser;
  35.114 -		conn = DriverManager.getConnection(url, username, password);
  35.115 -		
  35.116 -        pst = conn.prepareStatement("SELECT * FROM pg_catalog.pg_database");
  35.117 -        ResultSet rs = pst.executeQuery();
  35.118 -
  35.119 -        while (rs.next())
  35.120 -        {
  35.121 -        	databases.add(rs.getString(1));
  35.122 -        }
  35.123 -        rs.close();
  35.124 -        pst.close();
  35.125 -   
  35.126 -        databaseName="teststrabon"+(int)(Math.random()*10000);
  35.127 -        while(databases.contains(databaseName))
  35.128 -        {
  35.129 -        	databaseName+="0";
  35.130 -        }
  35.131 -    
  35.132 -		pst = conn.prepareStatement("CREATE DATABASE "+databaseName+" TEMPLATE " + databaseTemplateName);
  35.133 -		pst.executeUpdate();
  35.134 -		pst.close();
  35.135 -		conn.close();
  35.136 -
  35.137 -		url = "jdbc:postgresql://"+serverName+":"+port+"/"+databaseName;
  35.138 -		conn = DriverManager.getConnection(url, username, password);
  35.139 -		
  35.140 -	    strabon = new Strabon(databaseName, username, password, Integer.parseInt(port), serverName, true);
  35.141 -	}
  35.142 -	
  35.143 -	public static void storeDataset(String datasetFile) throws RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
  35.144 -	{
  35.145 -	    if(datasetFile.endsWith(".nt"))
  35.146 -	    	strabon.storeInRepo(datasetFile, "NTRIPLES");
  35.147 -	    else if(datasetFile.endsWith(".nq"))
  35.148 -	    	strabon.storeInRepo(datasetFile, "NQUADS");
  35.149 -	}
  35.150 -	
  35.151 -	public static void testQuery(String queryFile, String resultsFile) throws IOException, MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, URISyntaxException, QueryResultParseException, UnsupportedQueryResultFormatException
  35.152 -	{
  35.153 -		ByteArrayOutputStream resultsStream = new ByteArrayOutputStream();
  35.154 -		String query = FileUtils.readFileToString(new File(Utils.class.getResource(queryFile).toURI()));
  35.155 -		
  35.156 -		//Pose the query
  35.157 -		strabon.query(query, Format.XML, strabon.getSailRepoConnection(), resultsStream);
  35.158 -
  35.159 -		//Check if the results of the query are the expected
  35.160 -		TupleQueryResult expectedResults = QueryResultIO.parse(Utils.class.getResourceAsStream(resultsFile), TupleQueryResultFormat.SPARQL);
  35.161 -		TupleQueryResult actualResults = QueryResultIO.parse((new ByteArrayInputStream(resultsStream.toByteArray())), TupleQueryResultFormat.SPARQL);
  35.162 -
  35.163 -		List<String> eBindingNames = expectedResults.getBindingNames();
  35.164 -		List<String> aBindingNames = actualResults.getBindingNames();
  35.165 -		assertTrue("Results are not the expected.", aBindingNames.containsAll(aBindingNames) && eBindingNames.containsAll(aBindingNames));		
  35.166 -		
  35.167 -		//Sort each binding's values
  35.168 -		List<String> eBindingList = new ArrayList<String>();
  35.169 -		List<String> aBindingList = new ArrayList<String>();
  35.170 -
  35.171 -		while(expectedResults.hasNext() && actualResults.hasNext())
  35.172 -		{
  35.173 -			BindingSet eBinding = expectedResults.next();
  35.174 -			BindingSet aBinding = actualResults.next();
  35.175 -			
  35.176 -			String eBindingValues="";
  35.177 -			String aBindingValues="";
  35.178 -			for(String bindingName : eBindingNames)
  35.179 -			{
  35.180 -				eBindingValues+=eBinding.getValue(bindingName).stringValue();
  35.181 -				aBindingValues+=aBinding.getValue(bindingName).stringValue();
  35.182 -			}
  35.183 -			
  35.184 -			eBindingList.add(eBindingValues);
  35.185 -			aBindingList.add(aBindingValues);
  35.186 -		}
  35.187 -		
  35.188 -		assertFalse("Results are not the expected.", expectedResults.hasNext() || actualResults.hasNext());
  35.189 -		
  35.190 -		//Sort bindings alphabetically
  35.191 -		Collections.sort(eBindingList);
  35.192 -		Collections.sort(aBindingList);
  35.193 -		
  35.194 -		//Check bindings one by one
  35.195 -		Iterator<String> eBindingListIterator = eBindingList.iterator();
  35.196 -		Iterator<String> aBindingListIterator = aBindingList.iterator();
  35.197 -
  35.198 -		while(eBindingListIterator.hasNext() && aBindingListIterator.hasNext())
  35.199 -		{
  35.200 -			assertEquals("Results are not the expected.", eBindingListIterator.next(), aBindingListIterator.next());
  35.201 -		}
  35.202 -		
  35.203 -		actualResults.close();
  35.204 -		expectedResults.close();
  35.205 -	}
  35.206 -	
  35.207 -	public static void dropdb() throws SQLException
  35.208 -	{
  35.209 -		strabon.close();
  35.210 -		
  35.211 -		//Drop the temp database
  35.212 -		conn.close();
  35.213 -		String url = "jdbc:postgresql://"+serverName+":"+port+"/"+defaultUser;
  35.214 -		conn = DriverManager.getConnection(url, username, password);
  35.215 -		
  35.216 -		PreparedStatement pst = conn.prepareStatement("DROP DATABASE "+databaseName);
  35.217 -		pst.executeUpdate();
  35.218 -		pst.close();
  35.219 -		conn.close();
  35.220 -	}
  35.221 -}
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/bugs/StoreTest.java	Fri Apr 26 19:49:12 2013 +0300
    36.3 @@ -0,0 +1,20 @@
    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) 2010, 2011, 2012, 2013 Pyravlos Team
   36.10 + * 
   36.11 + * http://www.strabon.di.uoa.gr/
   36.12 + */
   36.13 +package eu.earthobservatory.testsuite.bugs;
   36.14 +
   36.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
   36.16 +
   36.17 +
   36.18 +/**
   36.19 + * A simple store test. It tests if the input dataset is stored and retrieved correctly.
   36.20 + * 
   36.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr
   36.22 + */
   36.23 +public class StoreTest extends TemplateTest{}
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/geoSPARQL/FeatureClassTest.java	Fri Apr 26 19:49:12 2013 +0300
    37.3 @@ -0,0 +1,27 @@
    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) 2010, 2011, 2012, 2013 Pyravlos Team
   37.10 + * 
   37.11 + * http://www.strabon.di.uoa.gr/
   37.12 + */
   37.13 +package eu.earthobservatory.testsuite.geoSPARQL;
   37.14 +
   37.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
   37.16 +
   37.17 +
   37.18 +/**
   37.19 + * GeoSPARQL Feature Class test. Something that has a geometry is a Feature. 
   37.20 + * 
   37.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr
   37.22 + */
   37.23 +public class FeatureClassTest extends TemplateTest
   37.24 +{
   37.25 +	public FeatureClassTest() 
   37.26 +	{
   37.27 +		super();
   37.28 +		this.inference=true;
   37.29 +	}
   37.30 +}
   37.31 \ No newline at end of file
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/geoSPARQL/SfSpatialRelationsTest.java	Fri Apr 26 19:49:12 2013 +0300
    38.3 @@ -0,0 +1,27 @@
    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) 2010, 2011, 2012, 2013 Pyravlos Team
   38.10 + * 
   38.11 + * http://www.strabon.di.uoa.gr/
   38.12 + */
   38.13 +package eu.earthobservatory.testsuite.geoSPARQL;
   38.14 +
   38.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
   38.16 +
   38.17 +
   38.18 +/**
   38.19 + * GeoSPARQL Feature Class test. Something that has a geometry is a Feature. 
   38.20 + * 
   38.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr
   38.22 + */
   38.23 +public class SfSpatialRelationsTest extends TemplateTest
   38.24 +{
   38.25 +	public SfSpatialRelationsTest() 
   38.26 +	{
   38.27 +		super();
   38.28 +		this.inference=true;
   38.29 +	}
   38.30 +}
   38.31 \ No newline at end of file
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/geoSPARQL/SpatialObjectClassTest.java	Fri Apr 26 19:49:12 2013 +0300
    39.3 @@ -0,0 +1,27 @@
    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) 2010, 2011, 2012, 2013 Pyravlos Team
   39.10 + * 
   39.11 + * http://www.strabon.di.uoa.gr/
   39.12 + */
   39.13 +package eu.earthobservatory.testsuite.geoSPARQL;
   39.14 +
   39.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
   39.16 +
   39.17 +
   39.18 +/**
   39.19 + * GeoSPARQL Spatial Object Class test. A Geometry is also a Spatial Object.
   39.20 + * 
   39.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr
   39.22 + */
   39.23 +public class SpatialObjectClassTest extends TemplateTest
   39.24 +{
   39.25 +	public SpatialObjectClassTest() 
   39.26 +	{
   39.27 +		super();
   39.28 +		this.inference=true;
   39.29 +	}
   39.30 +}
   39.31 \ No newline at end of file
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/BufferTest.java	Fri Apr 26 19:49:12 2013 +0300
    40.3 @@ -0,0 +1,20 @@
    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) 2010, 2011, 2012, 2013 Pyravlos Team
   40.10 + * 
   40.11 + * http://www.strabon.di.uoa.gr/
   40.12 + */
   40.13 +package eu.earthobservatory.testsuite.stSPARQL;
   40.14 +
   40.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
   40.16 +
   40.17 +/**
   40.18 + * A test for the strdf:buffer function.
   40.19 + * 
   40.20 + * @author Stella Giannakopoulou <sgian@di.uoa.gr
   40.21 + */
   40.22 +
   40.23 +public class BufferTest extends TemplateTest {}
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/DistanceTest.java	Fri Apr 26 19:49:12 2013 +0300
    41.3 @@ -0,0 +1,20 @@
    41.4 +/**
    41.5 + * This Source Code Form is subject to the terms of the Mozilla Public
    41.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
    41.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    41.8 + * 
    41.9 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team
   41.10 + * 
   41.11 + * http://www.strabon.di.uoa.gr/
   41.12 + */
   41.13 +package eu.earthobservatory.testsuite.stSPARQL;
   41.14 +
   41.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
   41.16 +
   41.17 +/**
   41.18 + * A test for the strdf:buffer function.
   41.19 + * 
   41.20 + * @author Stella Giannakopoulou <sgian@di.uoa.gr
   41.21 + */
   41.22 +
   41.23 +public class DistanceTest extends TemplateTest {}
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/StoreGMLTest.java	Fri Apr 26 19:49:12 2013 +0300
    42.3 @@ -0,0 +1,20 @@
    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) 2010, 2011, 2012, 2013 Pyravlos Team
   42.10 + * 
   42.11 + * http://www.strabon.di.uoa.gr/
   42.12 + */
   42.13 +package eu.earthobservatory.testsuite.stSPARQL;
   42.14 +
   42.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
   42.16 +
   42.17 +
   42.18 +/**
   42.19 + * A simple store test. It tests if triples with GML serialization are stored and retrieved correctly.
   42.20 + * 
   42.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr
   42.22 + */
   42.23 +public class StoreGMLTest extends TemplateTest{}
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/StoreWKTTest.java	Fri Apr 26 19:49:12 2013 +0300
    43.3 @@ -0,0 +1,20 @@
    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) 2010, 2011, 2012, 2013 Pyravlos Team
   43.10 + * 
   43.11 + * http://www.strabon.di.uoa.gr/
   43.12 + */
   43.13 +package eu.earthobservatory.testsuite.stSPARQL;
   43.14 +
   43.15 +import eu.earthobservatory.testsuite.utils.TemplateTest;
   43.16 +
   43.17 +
   43.18 +/**
   43.19 + * A simple store test. It tests if triples with WKT serialization are stored and retrieved correctly.
   43.20 + * 
   43.21 + * @author Panayiotis Smeros <psmeros@di.uoa.gr
   43.22 + */
   43.23 +public class StoreWKTTest extends TemplateTest{}
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/TemplateTest.java	Fri Apr 26 19:49:12 2013 +0300
    44.3 @@ -0,0 +1,102 @@
    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, 2013 Pyravlos Team
   44.10 + * 
   44.11 + * http://www.strabon.di.uoa.gr/
   44.12 + */
   44.13 +package eu.earthobservatory.testsuite.utils;
   44.14 +
   44.15 +import java.io.File;
   44.16 +import java.net.URISyntaxException;
   44.17 +import java.util.ArrayList;
   44.18 +import java.util.Iterator;
   44.19 +
   44.20 +import org.junit.After;
   44.21 +import org.junit.Before;
   44.22 +import org.junit.Test;
   44.23 +
   44.24 +
   44.25 +/**
   44.26 + * A template test. It: 
   44.27 + * 1) creates a database
   44.28 + * 2) stores a dataset
   44.29 + * 3) poses a query
   44.30 + * 4) checks if the results of the query are the expected 
   44.31 + * 5) drops the database
   44.32 + * 
   44.33 + * @author Panayiotis Smeros <psmeros@di.uoa.gr
   44.34 + */
   44.35 +public abstract class TemplateTest
   44.36 +{	
   44.37 +	protected String datasetFile;
   44.38 +	protected ArrayList<String> queryFile;
   44.39 +	protected ArrayList<String> resultsFile;
   44.40 +	protected Boolean inference;
   44.41 +
   44.42 +	
   44.43 +	public TemplateTest()
   44.44 +	{
   44.45 +		queryFile=new ArrayList<String>();
   44.46 +		resultsFile=new ArrayList<String>();
   44.47 +		
   44.48 +		String testname=this.getClass().getSimpleName();
   44.49 +		
   44.50 +		String testpackage=this.getClass().getPackage().getName().substring(this.getClass().getPackage().getName().lastIndexOf('.')+1);
   44.51 +		File testfolder = null;
   44.52 +		
   44.53 +		try 
   44.54 +		{
   44.55 +			testfolder = new File(this.getClass().getResource(File.separator+testpackage+File.separator+testname+File.separator).toURI());
   44.56 +		} 
   44.57 +		catch (URISyntaxException e) 
   44.58 +		{
   44.59 +			e.printStackTrace();
   44.60 +			System.exit(1);
   44.61 +		}
   44.62 +		
   44.63 +		String[] files = testfolder.list();
   44.64 +		
   44.65 +		for(String file : files)
   44.66 +		{
   44.67 +			if(file.endsWith(".nt") || file.endsWith(".nq"))
   44.68 +			{
   44.69 +				datasetFile=File.separator+testpackage+File.separator+testname+File.separator+file;
   44.70 +			}
   44.71 +			else if(file.endsWith(".rq"))
   44.72 +			{
   44.73 +				queryFile.add(File.separator+testpackage+File.separator+testname+File.separator+file);
   44.74 +				resultsFile.add(File.separator+testpackage+File.separator+testname+File.separator+file.substring(0, file.length()-3)+".srx");
   44.75 +			}
   44.76 +		}
   44.77 +		
   44.78 +		inference=false;
   44.79 +	}
   44.80 +
   44.81 +	@Before
   44.82 +	public void before() throws Exception
   44.83 +	{
   44.84 +		Utils.createdb();
   44.85 +		Utils.storeDataset(datasetFile, inference);
   44.86 +	}
   44.87 +	
   44.88 +	@Test
   44.89 +	public void test() throws Exception
   44.90 +	{
   44.91 +		Iterator<String> queryFileIterator = queryFile.iterator();
   44.92 +		Iterator<String> resultsFileIterator = resultsFile.iterator();
   44.93 +		
   44.94 +		while(queryFileIterator.hasNext() && resultsFileIterator.hasNext())
   44.95 +		{
   44.96 +			Utils.testQuery(queryFileIterator.next(), resultsFileIterator.next());
   44.97 +		}
   44.98 +	}
   44.99 +	
  44.100 +	@After
  44.101 +	public void after() throws Exception
  44.102 +	{
  44.103 +		Utils.dropdb();
  44.104 +	}
  44.105 +}
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/Utils.java	Fri Apr 26 19:49:12 2013 +0300
    45.3 @@ -0,0 +1,214 @@
    45.4 +/**
    45.5 + * This Source Code Form is subject to the terms of the Mozilla Public
    45.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
    45.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    45.8 + * 
    45.9 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team
   45.10 + * 
   45.11 + * http://www.strabon.di.uoa.gr/
   45.12 + */
   45.13 +package eu.earthobservatory.testsuite.utils;
   45.14 +
   45.15 +import static org.junit.Assert.assertEquals;
   45.16 +import static org.junit.Assert.assertFalse;
   45.17 +import static org.junit.Assert.assertTrue;
   45.18 +import java.io.ByteArrayInputStream;
   45.19 +import java.io.ByteArrayOutputStream;
   45.20 +import java.io.File;
   45.21 +import java.io.IOException;
   45.22 +import java.io.InputStream;
   45.23 +import java.net.URISyntaxException;
   45.24 +import java.sql.Connection;
   45.25 +import java.sql.DriverManager;
   45.26 +import java.sql.PreparedStatement;
   45.27 +import java.sql.ResultSet;
   45.28 +import java.sql.SQLException;
   45.29 +import java.util.ArrayList;
   45.30 +import java.util.Collections;
   45.31 +import java.util.Iterator;
   45.32 +import java.util.List;
   45.33 +import java.util.Properties;
   45.34 +import org.apache.commons.io.FileUtils;
   45.35 +import org.openrdf.query.BindingSet;
   45.36 +import org.openrdf.query.MalformedQueryException;
   45.37 +import org.openrdf.query.QueryEvaluationException;
   45.38 +import org.openrdf.query.TupleQueryResult;
   45.39 +import org.openrdf.query.TupleQueryResultHandlerException;
   45.40 +import org.openrdf.query.resultio.QueryResultIO;
   45.41 +import org.openrdf.query.resultio.QueryResultParseException;
   45.42 +import org.openrdf.query.resultio.TupleQueryResultFormat;
   45.43 +import org.openrdf.query.resultio.UnsupportedQueryResultFormatException;
   45.44 +import org.openrdf.repository.RepositoryException;
   45.45 +import org.openrdf.rio.RDFHandlerException;
   45.46 +import org.openrdf.rio.RDFParseException;
   45.47 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
   45.48 +import eu.earthobservatory.runtime.postgis.Strabon;
   45.49 +import eu.earthobservatory.utils.Format;
   45.50 +
   45.51 +/**
   45.52 + * A class with useful methods for the tests.
   45.53 + * 
   45.54 + * @author Panayiotis Smeros <psmeros@di.uoa.gr>
   45.55 + */
   45.56 +public class Utils
   45.57 +{
   45.58 +	private static final String dbPropertiesFile=File.separator+"databases.properties";
   45.59 +	private static final String prefixesFile=File.separator+"prefixes";
   45.60 +	
   45.61 +	private static String databaseTemplateName = null;
   45.62 +	private static String serverName = null;
   45.63 +	private static String username = null;
   45.64 +	private static String password = null;
   45.65 +	private static String port = null;
   45.66 +	
   45.67 +	private static Connection conn = null;
   45.68 +	private static String databaseName = null;
   45.69 +	
   45.70 +	private static Strabon strabon = null;
   45.71 +	
   45.72 +	public static void createdb() throws Exception
   45.73 +	{
   45.74 +		String url="";
   45.75 +		ArrayList<String> databases=new ArrayList<String>();
   45.76 +        PreparedStatement pst = null;
   45.77 +		
   45.78 +		//Read properties
   45.79 +		Properties properties = new Properties();
   45.80 +		InputStream propertiesStream =  Utils.class.getResourceAsStream(dbPropertiesFile);
   45.81 +		properties.load(propertiesStream);
   45.82 +
   45.83 +		if((databaseTemplateName = System.getProperty("postgis.databaseTemplateName"))==null)
   45.84 +		{
   45.85 +			databaseTemplateName = properties.getProperty("postgis.databaseTemplateName");
   45.86 +		}
   45.87 +		
   45.88 +		if((serverName = System.getProperty("postgis.serverName"))==null)
   45.89 +		{
   45.90 +			serverName = properties.getProperty("postgis.serverName");
   45.91 +		}
   45.92 +		
   45.93 +		if((username = System.getProperty("postgis.username"))==null)
   45.94 +		{
   45.95 +			username = properties.getProperty("postgis.username");
   45.96 +		}
   45.97 +		
   45.98 +		if((password = System.getProperty("postgis.password"))==null)
   45.99 +		{
  45.100 +			password = properties.getProperty("postgis.password");
  45.101 +		}
  45.102 +
  45.103 +		if((port = System.getProperty("postgis.port"))==null)
  45.104 +		{
  45.105 +			port = properties.getProperty("postgis.port");
  45.106 +		}
  45.107 +		
  45.108 +		//Connect to server and create the temp database
  45.109 +		url = "jdbc:postgresql://"+serverName+":"+port;
  45.110 +		conn = DriverManager.getConnection(url, username, password);
  45.111 +		
  45.112 +        pst = conn.prepareStatement("SELECT * FROM pg_catalog.pg_database");
  45.113 +        ResultSet rs = pst.executeQuery();
  45.114 +
  45.115 +        while (rs.next())
  45.116 +        {
  45.117 +        	databases.add(rs.getString(1));
  45.118 +        }
  45.119 +        rs.close();
  45.120 +        pst.close();
  45.121 +   
  45.122 +        databaseName="teststrabon"+(int)(Math.random()*10000);
  45.123 +        while(databases.contains(databaseName))
  45.124 +        {
  45.125 +        	databaseName+="0";
  45.126 +        }
  45.127 +    
  45.128 +		pst = conn.prepareStatement("CREATE DATABASE "+databaseName+" TEMPLATE " + databaseTemplateName);
  45.129 +		pst.executeUpdate();
  45.130 +		pst.close();
  45.131 +		conn.close();
  45.132 +
  45.133 +		url = "jdbc:postgresql://"+serverName+":"+port+"/"+databaseName;
  45.134 +		conn = DriverManager.getConnection(url, username, password);
  45.135 +		
  45.136 +	    strabon = new Strabon(databaseName, username, password, Integer.parseInt(port), serverName, true);
  45.137 +	}
  45.138 +	
  45.139 +	public static void storeDataset(String datasetFile, Boolean inference) throws RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
  45.140 +	{
  45.141 +	    if(datasetFile.endsWith(".nt"))
  45.142 +	    	strabon.storeInRepo(datasetFile, "NTRIPLES", inference);
  45.143 +	    else if(datasetFile.endsWith(".nq"))
  45.144 +	    	strabon.storeInRepo(datasetFile, "NQUADS", inference);
  45.145 +	}
  45.146 +	
  45.147 +	public static void testQuery(String queryFile, String resultsFile) throws IOException, MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, URISyntaxException, QueryResultParseException, UnsupportedQueryResultFormatException
  45.148 +	{
  45.149 +		ByteArrayOutputStream resultsStream = new ByteArrayOutputStream();
  45.150 +		String query = FileUtils.readFileToString(new File(Utils.class.getResource(prefixesFile).toURI()))+"\n"+FileUtils.readFileToString(new File(Utils.class.getResource(queryFile).toURI()));
  45.151 +		
  45.152 +		//Pose the query
  45.153 +		strabon.query(query, Format.XML, strabon.getSailRepoConnection(), resultsStream);
  45.154 +
  45.155 +		//Check if the results of the query are the expected
  45.156 +		TupleQueryResult expectedResults = QueryResultIO.parse(Utils.class.getResourceAsStream(resultsFile), TupleQueryResultFormat.SPARQL);
  45.157 +		TupleQueryResult actualResults = QueryResultIO.parse((new ByteArrayInputStream(resultsStream.toByteArray())), TupleQueryResultFormat.SPARQL);
  45.158 +
  45.159 +		List<String> eBindingNames = expectedResults.getBindingNames();
  45.160 +		List<String> aBindingNames = actualResults.getBindingNames();
  45.161 +		assertTrue("Results are not the expected.", aBindingNames.containsAll(aBindingNames) && eBindingNames.containsAll(aBindingNames));		
  45.162 +		
  45.163 +		//Sort each binding's values
  45.164 +		List<String> eBindingList = new ArrayList<String>();
  45.165 +		List<String> aBindingList = new ArrayList<String>();
  45.166 +
  45.167 +		while(expectedResults.hasNext() && actualResults.hasNext())
  45.168 +		{
  45.169 +			BindingSet eBinding = expectedResults.next();
  45.170 +			BindingSet aBinding = actualResults.next();
  45.171 +			
  45.172 +			String eBindingValues="";
  45.173 +			String aBindingValues="";
  45.174 +			for(String bindingName : eBindingNames)
  45.175 +			{
  45.176 +				eBindingValues+=eBinding.getValue(bindingName).stringValue();
  45.177 +				aBindingValues+=aBinding.getValue(bindingName).stringValue();
  45.178 +			}
  45.179 +			
  45.180 +			eBindingList.add(eBindingValues);
  45.181 +			aBindingList.add(aBindingValues);
  45.182 +		}
  45.183 +		
  45.184 +		assertFalse("Results are not the expected.", expectedResults.hasNext() || actualResults.hasNext());
  45.185 +		
  45.186 +		//Sort bindings alphabetically
  45.187 +		Collections.sort(eBindingList);
  45.188 +		Collections.sort(aBindingList);
  45.189 +		
  45.190 +		//Check bindings one by one
  45.191 +		Iterator<String> eBindingListIterator = eBindingList.iterator();
  45.192 +		Iterator<String> aBindingListIterator = aBindingList.iterator();
  45.193 +
  45.194 +		while(eBindingListIterator.hasNext() && aBindingListIterator.hasNext())
  45.195 +		{
  45.196 +			assertEquals("Results are not the expected.", eBindingListIterator.next(), aBindingListIterator.next());
  45.197 +		}
  45.198 +		
  45.199 +		actualResults.close();
  45.200 +		expectedResults.close();
  45.201 +	}
  45.202 +	
  45.203 +	public static void dropdb() throws SQLException
  45.204 +	{
  45.205 +		strabon.close();
  45.206 +		
  45.207 +		//Drop the temp database
  45.208 +		conn.close();
  45.209 +		String url = "jdbc:postgresql://"+serverName+":"+port;
  45.210 +		conn = DriverManager.getConnection(url, username, password);
  45.211 +		
  45.212 +		PreparedStatement pst = conn.prepareStatement("DROP DATABASE "+databaseName);
  45.213 +		pst.executeUpdate();
  45.214 +		pst.close();
  45.215 +		conn.close();
  45.216 +	}
  45.217 +}
    46.1 --- a/testsuite/src/test/resources/StoreTest/StoreTest.nt	Fri Apr 26 19:48:06 2013 +0300
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,9 +0,0 @@
    46.4 -<http://example.org/item1> <http://example.org/id> "1"^^<http://www.w3.org/2001/XMLSchema#int>.
    46.5 -<http://example.org/item1> <http://example.org/value> "10"^^<http://www.w3.org/2001/XMLSchema#int>.
    46.6 -<http://example.org/item1> <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry> "POINT(1 0)"^^<http://strdf.di.uoa.gr/ontology#WKT>.
    46.7 -<http://example.org/item2> <http://example.org/id> "2"^^<http://www.w3.org/2001/XMLSchema#int>.
    46.8 -<http://example.org/item2> <http://example.org/value> "20"^^<http://www.w3.org/2001/XMLSchema#int>.
    46.9 -<http://example.org/item2> <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry> "POINT(2 0)"^^<http://strdf.di.uoa.gr/ontology#WKT>.
   46.10 -<http://example.org/item3> <http://example.org/id> "3"^^<http://www.w3.org/2001/XMLSchema#int>.
   46.11 -<http://example.org/item3> <http://example.org/value> "30"^^<http://www.w3.org/2001/XMLSchema#int>.
   46.12 -<http://example.org/item3> <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry> "POINT(3 0)"^^<http://strdf.di.uoa.gr/ontology#WKT>.
    47.1 --- a/testsuite/src/test/resources/StoreTest/StoreTest.rq	Fri Apr 26 19:48:06 2013 +0300
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,2 +0,0 @@
    47.4 -SELECT *
    47.5 -WHERE{?s ?p ?o}
    47.6 \ No newline at end of file
    48.1 --- a/testsuite/src/test/resources/StoreTest/StoreTest.srx	Fri Apr 26 19:48:06 2013 +0300
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,109 +0,0 @@
    48.4 -<?xml version='1.0' encoding='UTF-8'?>
    48.5 -<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    48.6 -	<head>
    48.7 -		<variable name='s'/>
    48.8 -		<variable name='p'/>
    48.9 -		<variable name='o'/>
   48.10 -	</head>
   48.11 -	<results>
   48.12 -		<result>
   48.13 -			<binding name='s'>
   48.14 -				<uri>http://example.org/item1</uri>
   48.15 -			</binding>
   48.16 -			<binding name='o'>
   48.17 -				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>1</literal>
   48.18 -			</binding>
   48.19 -			<binding name='p'>
   48.20 -				<uri>http://example.org/id</uri>
   48.21 -			</binding>
   48.22 -		</result>
   48.23 -		<result>
   48.24 -			<binding name='s'>
   48.25 -				<uri>http://example.org/item1</uri>
   48.26 -			</binding>
   48.27 -			<binding name='o'>
   48.28 -				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>10</literal>
   48.29 -			</binding>
   48.30 -			<binding name='p'>
   48.31 -				<uri>http://example.org/value</uri>
   48.32 -			</binding>
   48.33 -		</result>
   48.34 -		<result>
   48.35 -			<binding name='s'>
   48.36 -				<uri>http://example.org/item1</uri>
   48.37 -			</binding>
   48.38 -			<binding name='o'>
   48.39 -				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POINT(1 0)</literal>
   48.40 -			</binding>
   48.41 -			<binding name='p'>
   48.42 -				<uri>http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry</uri>
   48.43 -			</binding>
   48.44 -		</result>
   48.45 -		<result>
   48.46 -			<binding name='s'>
   48.47 -				<uri>http://example.org/item2</uri>
   48.48 -			</binding>
   48.49 -			<binding name='o'>
   48.50 -				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>2</literal>
   48.51 -			</binding>
   48.52 -			<binding name='p'>
   48.53 -				<uri>http://example.org/id</uri>
   48.54 -			</binding>
   48.55 -		</result>
   48.56 -		<result>
   48.57 -			<binding name='s'>
   48.58 -				<uri>http://example.org/item2</uri>
   48.59 -			</binding>
   48.60 -			<binding name='o'>
   48.61 -				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>20</literal>
   48.62 -			</binding>
   48.63 -			<binding name='p'>
   48.64 -				<uri>http://example.org/value</uri>
   48.65 -			</binding>
   48.66 -		</result>
   48.67 -		<result>
   48.68 -			<binding name='s'>
   48.69 -				<uri>http://example.org/item2</uri>
   48.70 -			</binding>
   48.71 -			<binding name='o'>
   48.72 -				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POINT(2 0)</literal>
   48.73 -			</binding>
   48.74 -			<binding name='p'>
   48.75 -				<uri>http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry</uri>
   48.76 -			</binding>
   48.77 -		</result>
   48.78 -		<result>
   48.79 -			<binding name='s'>
   48.80 -				<uri>http://example.org/item3</uri>
   48.81 -			</binding>
   48.82 -			<binding name='o'>
   48.83 -				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>3</literal>
   48.84 -			</binding>
   48.85 -			<binding name='p'>
   48.86 -				<uri>http://example.org/id</uri>
   48.87 -			</binding>
   48.88 -		</result>
   48.89 -		<result>
   48.90 -			<binding name='s'>
   48.91 -				<uri>http://example.org/item3</uri>
   48.92 -			</binding>
   48.93 -			<binding name='o'>
   48.94 -				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>30</literal>
   48.95 -			</binding>
   48.96 -			<binding name='p'>
   48.97 -				<uri>http://example.org/value</uri>
   48.98 -			</binding>
   48.99 -		</result>
  48.100 -		<result>
  48.101 -			<binding name='s'>
  48.102 -				<uri>http://example.org/item3</uri>
  48.103 -			</binding>
  48.104 -			<binding name='o'>
  48.105 -				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POINT(3 0)</literal>
  48.106 -			</binding>
  48.107 -			<binding name='p'>
  48.108 -				<uri>http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry</uri>
  48.109 -			</binding>
  48.110 -		</result>
  48.111 -	</results>
  48.112 -</sparql>
  48.113 \ No newline at end of file
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/testsuite/src/test/resources/bugs/StoreTest/StoreTest.nt	Fri Apr 26 19:49:12 2013 +0300
    49.3 @@ -0,0 +1,9 @@
    49.4 +<http://example.org/item1> <http://example.org/id> "1"^^<http://www.w3.org/2001/XMLSchema#int>.
    49.5 +<http://example.org/item1> <http://example.org/value> "10"^^<http://www.w3.org/2001/XMLSchema#int>.
    49.6 +<http://example.org/item1> <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry> "POINT(1 0)"^^<http://strdf.di.uoa.gr/ontology#WKT>.
    49.7 +<http://example.org/item2> <http://example.org/id> "2"^^<http://www.w3.org/2001/XMLSchema#int>.
    49.8 +<http://example.org/item2> <http://example.org/value> "20"^^<http://www.w3.org/2001/XMLSchema#int>.
    49.9 +<http://example.org/item2> <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry> "POINT(2 0)"^^<http://strdf.di.uoa.gr/ontology#WKT>.
   49.10 +<http://example.org/item3> <http://example.org/id> "3"^^<http://www.w3.org/2001/XMLSchema#int>.
   49.11 +<http://example.org/item3> <http://example.org/value> "30"^^<http://www.w3.org/2001/XMLSchema#int>.
   49.12 +<http://example.org/item3> <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry> "POINT(3 0)"^^<http://strdf.di.uoa.gr/ontology#WKT>.
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/testsuite/src/test/resources/bugs/StoreTest/StoreTest.rq	Fri Apr 26 19:49:12 2013 +0300
    50.3 @@ -0,0 +1,2 @@
    50.4 +SELECT *
    50.5 +WHERE{?s ?p ?o}
    50.6 \ No newline at end of file
    51.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.2 +++ b/testsuite/src/test/resources/bugs/StoreTest/StoreTest.srx	Fri Apr 26 19:49:12 2013 +0300
    51.3 @@ -0,0 +1,109 @@
    51.4 +<?xml version='1.0' encoding='UTF-8'?>
    51.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    51.6 +	<head>
    51.7 +		<variable name='s'/>
    51.8 +		<variable name='p'/>
    51.9 +		<variable name='o'/>
   51.10 +	</head>
   51.11 +	<results>
   51.12 +		<result>
   51.13 +			<binding name='s'>
   51.14 +				<uri>http://example.org/item1</uri>
   51.15 +			</binding>
   51.16 +			<binding name='o'>
   51.17 +				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>1</literal>
   51.18 +			</binding>
   51.19 +			<binding name='p'>
   51.20 +				<uri>http://example.org/id</uri>
   51.21 +			</binding>
   51.22 +		</result>
   51.23 +		<result>
   51.24 +			<binding name='s'>
   51.25 +				<uri>http://example.org/item1</uri>
   51.26 +			</binding>
   51.27 +			<binding name='o'>
   51.28 +				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>10</literal>
   51.29 +			</binding>
   51.30 +			<binding name='p'>
   51.31 +				<uri>http://example.org/value</uri>
   51.32 +			</binding>
   51.33 +		</result>
   51.34 +		<result>
   51.35 +			<binding name='s'>
   51.36 +				<uri>http://example.org/item1</uri>
   51.37 +			</binding>
   51.38 +			<binding name='o'>
   51.39 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POINT(1 0)</literal>
   51.40 +			</binding>
   51.41 +			<binding name='p'>
   51.42 +				<uri>http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry</uri>
   51.43 +			</binding>
   51.44 +		</result>
   51.45 +		<result>
   51.46 +			<binding name='s'>
   51.47 +				<uri>http://example.org/item2</uri>
   51.48 +			</binding>
   51.49 +			<binding name='o'>
   51.50 +				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>2</literal>
   51.51 +			</binding>
   51.52 +			<binding name='p'>
   51.53 +				<uri>http://example.org/id</uri>
   51.54 +			</binding>
   51.55 +		</result>
   51.56 +		<result>
   51.57 +			<binding name='s'>
   51.58 +				<uri>http://example.org/item2</uri>
   51.59 +			</binding>
   51.60 +			<binding name='o'>
   51.61 +				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>20</literal>
   51.62 +			</binding>
   51.63 +			<binding name='p'>
   51.64 +				<uri>http://example.org/value</uri>
   51.65 +			</binding>
   51.66 +		</result>
   51.67 +		<result>
   51.68 +			<binding name='s'>
   51.69 +				<uri>http://example.org/item2</uri>
   51.70 +			</binding>
   51.71 +			<binding name='o'>
   51.72 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POINT(2 0)</literal>
   51.73 +			</binding>
   51.74 +			<binding name='p'>
   51.75 +				<uri>http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry</uri>
   51.76 +			</binding>
   51.77 +		</result>
   51.78 +		<result>
   51.79 +			<binding name='s'>
   51.80 +				<uri>http://example.org/item3</uri>
   51.81 +			</binding>
   51.82 +			<binding name='o'>
   51.83 +				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>3</literal>
   51.84 +			</binding>
   51.85 +			<binding name='p'>
   51.86 +				<uri>http://example.org/id</uri>
   51.87 +			</binding>
   51.88 +		</result>
   51.89 +		<result>
   51.90 +			<binding name='s'>
   51.91 +				<uri>http://example.org/item3</uri>
   51.92 +			</binding>
   51.93 +			<binding name='o'>
   51.94 +				<literal datatype='http://www.w3.org/2001/XMLSchema#int'>30</literal>
   51.95 +			</binding>
   51.96 +			<binding name='p'>
   51.97 +				<uri>http://example.org/value</uri>
   51.98 +			</binding>
   51.99 +		</result>
  51.100 +		<result>
  51.101 +			<binding name='s'>
  51.102 +				<uri>http://example.org/item3</uri>
  51.103 +			</binding>
  51.104 +			<binding name='o'>
  51.105 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POINT(3 0)</literal>
  51.106 +			</binding>
  51.107 +			<binding name='p'>
  51.108 +				<uri>http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry</uri>
  51.109 +			</binding>
  51.110 +		</result>
  51.111 +	</results>
  51.112 +</sparql>
  51.113 \ No newline at end of file
    52.1 --- a/testsuite/src/test/resources/databases.properties	Fri Apr 26 19:48:06 2013 +0300
    52.2 +++ b/testsuite/src/test/resources/databases.properties	Fri Apr 26 19:49:12 2013 +0300
    52.3 @@ -1,6 +1,5 @@
    52.4  # PostGIS
    52.5  postgis.databaseTemplateName = template_postgis
    52.6 -postgis.defaultUser = postgres
    52.7  postgis.serverName = localhost
    52.8  postgis.username = postgres
    52.9  postgis.password = postgres
    53.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.2 +++ b/testsuite/src/test/resources/geoSPARQL/FeatureClassTest/FeatureClassTest.nt	Fri Apr 26 19:49:12 2013 +0300
    53.3 @@ -0,0 +1,1 @@
    53.4 +<http://example.org#item> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geom>.
    53.5 \ No newline at end of file
    54.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.2 +++ b/testsuite/src/test/resources/geoSPARQL/FeatureClassTest/FeatureClassTest.rq	Fri Apr 26 19:49:12 2013 +0300
    54.3 @@ -0,0 +1,4 @@
    54.4 +SELECT ?type
    54.5 +WHERE
    54.6 +{?x geo:hasGeometry ?geo.
    54.7 +?x rdf:type ?type.}
    54.8 \ No newline at end of file
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/testsuite/src/test/resources/geoSPARQL/FeatureClassTest/FeatureClassTest.srx	Fri Apr 26 19:49:12 2013 +0300
    55.3 @@ -0,0 +1,18 @@
    55.4 +<?xml version='1.0' encoding='UTF-8'?>
    55.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    55.6 +	<head>
    55.7 +		<variable name='type'/>
    55.8 +	</head>
    55.9 +	<results>
   55.10 +		<result>
   55.11 +			<binding name='type'>
   55.12 +				<uri>http://www.opengis.net/ont/geosparql#SpatialObject</uri>
   55.13 +			</binding>
   55.14 +		</result>
   55.15 +		<result>
   55.16 +			<binding name='type'>
   55.17 +				<uri>http://www.opengis.net/ont/geosparql#Feature</uri>
   55.18 +			</binding>
   55.19 +		</result>
   55.20 +	</results>
   55.21 +</sparql>
   55.22 \ No newline at end of file
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/testsuite/src/test/resources/geoSPARQL/SfSpatialRelationsTest/SfSpatialRelationsTest.nt	Fri Apr 26 19:49:12 2013 +0300
    56.3 @@ -0,0 +1,12 @@
    56.4 +<http://example.org#A> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomA>.
    56.5 +<http://example.org#B> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomB>.
    56.6 +<http://example.org#C> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomC>.
    56.7 +<http://example.org#D> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomD>.
    56.8 +<http://example.org#E> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomE>.
    56.9 +<http://example.org#F> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomF>.
   56.10 +<http://example.org#geomA> <http://www.opengis.net/ont/geosparql#asWKT> "  <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 1 0, 1 1, 0 1, 0 0))  "^^<http://www.opengis.net/ont/geosparql#wktLiteral>.
   56.11 +<http://example.org#geomB> <http://www.opengis.net/ont/geosparql#asWKT> "  <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((1 0, 2 0, 2 1, 1 1 , 1 0))  "^^<http://www.opengis.net/ont/geosparql#wktLiteral>.
   56.12 +<http://example.org#geomC> <http://www.opengis.net/ont/geosparql#asWKT> "  <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((1 1, 2 1, 2 2, 1 2, 1 1))  "^^<http://www.opengis.net/ont/geosparql#wktLiteral>.
   56.13 +<http://example.org#geomD> <http://www.opengis.net/ont/geosparql#asWKT> "  <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 2 0, 2 2, 0 2, 0 0))  "^^<http://www.opengis.net/ont/geosparql#wktLiteral>.
   56.14 +<http://example.org#geomE> <http://www.opengis.net/ont/geosparql#asWKT> "  <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((3 2, 4 2, 4 3, 3 3, 3 2))  "^^<http://www.opengis.net/ont/geosparql#wktLiteral>.
   56.15 +<http://example.org#geomF> <http://www.opengis.net/ont/geosparql#asWKT> "  <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((3 2, 4 2, 4 3, 3 3, 3 2))  "^^<http://www.opengis.net/ont/geosparql#wktLiteral>.
   56.16 \ No newline at end of file
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/testsuite/src/test/resources/geoSPARQL/SpatialObjectClassTest/SpatialObjectClassTest.nt	Fri Apr 26 19:49:12 2013 +0300
    57.3 @@ -0,0 +1,1 @@
    57.4 +<http://example.org#Geom> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.opengis.net/ont/geosparql#Geometry>.
    57.5 \ No newline at end of file
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/testsuite/src/test/resources/geoSPARQL/SpatialObjectClassTest/SpatialObjectClassTest.rq	Fri Apr 26 19:49:12 2013 +0300
    58.3 @@ -0,0 +1,3 @@
    58.4 +SELECT ?o
    58.5 +WHERE
    58.6 +{<http://example.org#Geom> rdf:type ?o}
    58.7 \ No newline at end of file
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/testsuite/src/test/resources/geoSPARQL/SpatialObjectClassTest/SpatialObjectClassTest.srx	Fri Apr 26 19:49:12 2013 +0300
    59.3 @@ -0,0 +1,18 @@
    59.4 +<?xml version='1.0' encoding='UTF-8'?>
    59.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    59.6 +	<head>
    59.7 +		<variable name='o'/>
    59.8 +	</head>
    59.9 +	<results>
   59.10 +		<result>
   59.11 +			<binding name='o'>
   59.12 +				<uri>http://www.opengis.net/ont/geosparql#SpatialObject</uri>
   59.13 +			</binding>
   59.14 +		</result>
   59.15 +		<result>
   59.16 +			<binding name='o'>
   59.17 +				<uri>http://www.opengis.net/ont/geosparql#Geometry</uri>
   59.18 +			</binding>
   59.19 +		</result>
   59.20 +	</results>
   59.21 +</sparql>
   59.22 \ No newline at end of file
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/testsuite/src/test/resources/prefixes	Fri Apr 26 19:49:12 2013 +0300
    60.3 @@ -0,0 +1,13 @@
    60.4 +PREFIX lgd:<http://linkedgeodata.org/triplify/>
    60.5 +PREFIX lgdgeo:<http://www.w3.org/2003/01/geo/wgs84_pos#>
    60.6 +PREFIX lgdont:<http://linkedgeodata.org/ontology/>
    60.7 +PREFIX geonames:<http://www.geonames.org/ontology#>
    60.8 +PREFIX clc: <http://geo.linkedopendata.gr/corine/ontology#>
    60.9 +PREFIX gag: <http://geo.linkedopendata.gr/greekadministrativeregion/ontology#>
   60.10 +PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>
   60.11 +PREFIX dlr: <http://www.earthobservatory.eu/ontologies/dlrOntology-v2.owl#>
   60.12 +PREFIX strdf: <http://strdf.di.uoa.gr/ontology#>
   60.13 +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
   60.14 +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
   60.15 +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
   60.16 +PREFIX geo: <http://www.opengis.net/ont/geosparql#>
   60.17 \ No newline at end of file
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/testsuite/src/test/resources/stSPARQL/BufferTest/BufferTest.nt	Fri Apr 26 19:49:12 2013 +0300
    61.3 @@ -0,0 +1,3 @@
    61.4 +<http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> "POINT(23.6423757 37.9521198)"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    61.5 +<http://example.org/id/Point/5532> <http://example.org/ontology/hasGeometry> "POLYGON((-7 4.2,-7.1 4.2,-7.1 4.3,-7 4.2))"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    61.6 +<http://example.org/id/Point/5533> <http://example.org/ontology/hasGeometry> "POINT(21.841968 38.045047)"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    61.7 \ No newline at end of file
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/testsuite/src/test/resources/stSPARQL/BufferTest/BufferTestDegrees.rq	Fri Apr 26 19:49:12 2013 +0300
    62.3 @@ -0,0 +1,5 @@
    62.4 +select (strdf:buffer(?g, 0.2, <http://www.opengis.net/def/uom/OGC/1.0/degree>) as ?buf)
    62.5 +where
    62.6 +{
    62.7 +?x <http://example.org/ontology/hasGeometry> ?g
    62.8 +}
    62.9 \ No newline at end of file
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/testsuite/src/test/resources/stSPARQL/BufferTest/BufferTestDegrees.srx	Fri Apr 26 19:49:12 2013 +0300
    63.3 @@ -0,0 +1,23 @@
    63.4 +<?xml version='1.0' encoding='UTF-8'?>
    63.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    63.6 +	<head>
    63.7 +		<variable name='buf'/>
    63.8 +	</head>
    63.9 +	<results>
   63.10 +		<result>
   63.11 +			<binding name='buf'>
   63.12 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((23.842375699999998 37.9521198, 23.838532756080646 37.913101735596776, 23.827151606502255 37.87558311352698, 23.808669622460506 37.841005753396075, 23.783797056237308 37.81069844376269, 23.75348974660392 37.78582587753949, 23.71891238647302 37.76734389349774, 23.681393764403225 37.755962743919355, 23.6423757 37.752119799999996, 23.603357635596772 37.755962743919355, 23.565839013526983 37.76734389349774, 23.53126165339608 37.78582587753949, 23.50095434376269 37.81069844376269, 23.47608177753949 37.841005753396075, 23.457599793497742 37.87558311352698, 23.44621864391935 37.913101735596776, 23.4423757 37.9521198, 23.44621864391935 37.99113786440322, 23.457599793497742 38.02865648647302, 23.476081777539488 38.06323384660392, 23.50095434376269 38.09354115623731, 23.53126165339608 38.11841372246051, 23.56583901352698 38.13689570650226, 23.603357635596772 38.14827685608064, 23.6423757 38.1521198, 23.681393764403225 38.14827685608064, 23.718912386473015 38.13689570650226, 23.75348974660392 38.11841372246051, 23.783797056237308 38.09354115623731, 23.808669622460506 38.06323384660392, 23.827151606502255 38.02865648647302, 23.838532756080646 37.99113786440322, 23.842375699999998 37.9521198))</literal>
   63.13 +			</binding>
   63.14 +		</result>
   63.15 +		<result>
   63.16 +			<binding name='buf'>
   63.17 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((-6.858578643762691 4.341421356237309, -6.833706077539491 4.311114046603921, -6.815224093497743 4.276536686473018, -6.803842943919354 4.239018064403226, -6.8 4.2, -6.803842943919354 4.160981935596775, -6.815224093497743 4.123463313526982, -6.833706077539491 4.08888595339608, -6.858578643762691 4.058578643762691, -6.88888595339608 4.033706077539491, -6.923463313526982 4.015224093497743, -6.960981935596775 4.003842943919354, -7 4, -7.1 4, -7.139018064403227 4.003842943919354, -7.1765366864730185 4.015224093497743, -7.211114046603921 4.033706077539492, -7.24142135623731 4.058578643762691, -7.266293922460509 4.08888595339608, -7.284775906502257 4.123463313526982, -7.296157056080646 4.160981935596775, -7.3 4.2, -7.3 4.3, -7.296157056080646 4.339018064403225, -7.284775906502257 4.376536686473018, -7.266293922460509 4.41111404660392, -7.241421356237309 4.441421356237309, -7.21111404660392 4.466293922460509, -7.176536686473018 4.484775906502257, -7.139018064403225 4.496157056080646, -7.1 4.5, -7.060981935596774 4.496157056080646, -7.023463313526982 4.484775906502257, -6.988885953396079 4.466293922460509, -6.95857864376269 4.441421356237309, -6.858578643762691 4.341421356237309))</literal>
   63.18 +			</binding>
   63.19 +		</result>
   63.20 +		<result>
   63.21 +			<binding name='buf'>
   63.22 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((22.041968 38.045047, 22.03812505608065 38.006028935596774, 22.026743906502258 37.96851031352698, 22.00826192246051 37.933932953396074, 21.98338935623731 37.90362564376269, 21.95308204660392 37.878753077539486, 21.91850468647302 37.86027109349774, 21.880986064403228 37.84888994391935, 21.841968 37.845046999999994, 21.802949935596775 37.84888994391935, 21.765431313526985 37.86027109349774, 21.730853953396082 37.878753077539486, 21.700546643762692 37.90362564376269, 21.675674077539494 37.933932953396074, 21.657192093497745 37.96851031352698, 21.645810943919354 38.006028935596774, 21.641968000000002 38.045047, 21.645810943919354 38.08406506440322, 21.657192093497745 38.121583686473016, 21.67567407753949 38.15616104660392, 21.700546643762692 38.186468356237306, 21.730853953396082 38.21134092246051, 21.76543131352698 38.22982290650226, 21.802949935596775 38.24120405608064, 21.841968 38.245047, 21.880986064403228 38.24120405608064, 21.918504686473018 38.22982290650226, 21.95308204660392 38.21134092246051, 21.98338935623731 38.186468356237306, 22.00826192246051 38.15616104660392, 22.026743906502258 38.121583686473016, 22.03812505608065 38.08406506440322, 22.041968 38.045047))</literal>
   63.23 +			</binding>
   63.24 +		</result>
   63.25 +	</results>
   63.26 +</sparql>
   63.27 \ No newline at end of file
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/testsuite/src/test/resources/stSPARQL/BufferTest/BufferTestFilter.rq	Fri Apr 26 19:49:12 2013 +0300
    64.3 @@ -0,0 +1,6 @@
    64.4 +select ?g1
    64.5 +where
    64.6 +{
    64.7 +	<http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> ?g1 .
    64.8 +	FILTER(strdf:within(?g1, strdf:buffer(?g1, 30, <http://www.opengis.net/def/uom/OGC/1.0/metre>)))
    64.9 +}
   64.10 \ No newline at end of file
    65.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    65.2 +++ b/testsuite/src/test/resources/stSPARQL/BufferTest/BufferTestFilter.srx	Fri Apr 26 19:49:12 2013 +0300
    65.3 @@ -0,0 +1,13 @@
    65.4 +<?xml version='1.0' encoding='UTF-8'?>
    65.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    65.6 +	<head>
    65.7 +		<variable name='g1'/>
    65.8 +	</head>
    65.9 +	<results>
   65.10 +		<result>
   65.11 +			<binding name='g1'>
   65.12 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POINT (23.6423757 37.9521198)</literal>
   65.13 +			</binding>
   65.14 +		</result>
   65.15 +	</results>
   65.16 +</sparql>
   65.17 \ No newline at end of file
    66.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    66.2 +++ b/testsuite/src/test/resources/stSPARQL/BufferTest/BufferTestMetres.rq	Fri Apr 26 19:49:12 2013 +0300
    66.3 @@ -0,0 +1,5 @@
    66.4 +select (strdf:buffer(?g, 0.2, <http://www.opengis.net/def/uom/OGC/1.0/metre>) as ?buf)
    66.5 +where
    66.6 +{
    66.7 +?x <http://example.org/ontology/hasGeometry> ?g
    66.8 +}
    66.9 \ No newline at end of file
    67.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.2 +++ b/testsuite/src/test/resources/stSPARQL/BufferTest/BufferTestMetres.srx	Fri Apr 26 19:49:12 2013 +0300
    67.3 @@ -0,0 +1,24 @@
    67.4 +<?xml version='1.0' encoding='UTF-8'?>
    67.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    67.6 +	<head>
    67.7 +		<variable name='buf'/>
    67.8 +	</head>
    67.9 +	<results>
   67.10 +		<result>
   67.11 +			<binding name='buf'>
   67.12 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((23.642377974091588 37.95211974887083, 23.64237791780389 37.95211939855895, 23.642377776288168 37.952119063673464, 23.64237755498278 37.952118757083795, 23.64237726239237 37.952118490572026, 23.642376909761026 37.95211827438005, 23.642376510640172 37.952118116816, 23.642376080367796 37.95211802393498, 23.642375635479024 37.95211799930635, 23.64237519307068 37.95211804387658, 23.64237477014427 37.95211815593286, 23.642374382952614 37.952118331168926, 23.642374046375274 37.95211856285056, 23.642373773346723 37.95211884207436, 23.6423735743593 37.952119158109916, 23.642373457059982 37.95211949881216, 23.642373425956514 37.95211985108811, 23.64237348224418 37.95212020139997, 23.64237362375989 37.95212053628546, 23.64237384506527 37.95212084287514, 23.642374137655676 37.95212110938693, 23.642374490287025 37.952121325578915, 23.642374889407893 37.95212148314297, 23.64237531968029 37.95212157602399, 23.642375764569085 37.95212160065262, 23.64237620697745 37.95212155608239, 23.642376629903875 37.952121444026105, 23.64237701709554 37.95212126879002, 23.642377353672885 37.95212103710839, 23.64237762670143 37.95212075788458, 23.642377825688836 37.95212044184901, 23.642377942988137 37.95212010114676, 23.642377974091588 37.95211974887083))</literal>
   67.13 +			</binding>
   67.14 +		</result>
   67.15 +		<result>
   67.16 +			<binding name='buf'>
   67.17 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((-6.999998728930015 4.200001281097435, -6.9999985042528285 4.2000010072645715, -6.999998337153763 4.200000694657804, -6.999998234065173 4.200000355310692, -6.999998198955376 4.2000000022861546, -6.999998233175899 4.1999996491736065, -6.999998335409446 4.199999309565852, -6.999998501720614 4.199998996535837, -6.999998725707379 4.19999872213342, -6.999998998747537 4.199998496921517, -6.99999931033061 4.199998329569492, -6.999999648462441 4.199998226519436, -7.000000000126898 4.199998191738187, -7.099999999893686 4.199998191630642, -7.10000035129349 4.199998226356922, -7.100000689193024 4.199998329246345, -7.100001000606421 4.19999849634475, -7.100001273565705 4.199998721230353, -7.100001497580733 4.19999899526054, -7.100001664042355 4.199999307904017, -7.1000017665532535 4.199999647145535, -7.10000180117382 4.199999999947651, -7.100001801406124 4.300000000052062, -7.100001766842003 4.300000352545832, -7.100001664495917 4.3000006915146916, -7.100001498294219 4.300001003954596, -7.100001274613 4.300001277879246, -7.1000010020334585 4.300001502779922, -7.100000691012711 4.3000016700286405, -7.100000353482613 4.300001773209148, -7.100000002392014 4.300001808363074, -7.09999965120999 4.300001774141791, -7.0999993134091275 4.3000016718581495, -7.099999001948662 4.30000150543611, -7.099998728777317 4.3000012812602115, -6.999998728930015 4.200001281097435))</literal>
   67.18 +			</binding>
   67.19 +		</result>
   67.20 +		<result>
   67.21 +			<binding name='buf'>
   67.22 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((21.841970279121966 38.04504698367591, 21.841970231302223 38.045046632364425, 21.841970097734794 38.045046295180974, 21.841969883552594 38.04504598508332, 21.841969596986527 38.04504571398833, 21.841969249049175 38.045045492314046, 21.841968853111563 38.045045328579306, 21.84196842438936 38.04504522907631, 21.841967979358117 38.04504519762891, 21.84196753512013 38.04504523544562, 21.841967108747212 38.04504534107318, 21.841966716624647 38.04504551045233, 21.84196637382147 38.04504573707399, 21.841966093511427 38.045046012229186, 21.841965886466667 38.04504632534384, 21.84196576064381 38.045046664385154, 21.841965720878154 38.04504701632397, 21.841965768697875 38.04504736763546, 21.84196590226529 38.04504770481892, 21.84196611644748 38.04504801491659, 21.84196640301354 38.045048286011586, 21.8419667509509 38.04504850768586, 21.84196714688852 38.04504867142062, 21.841967575610745 38.04504877092362, 21.84196802064201 38.045048802371014, 21.84196846488002 38.045048764554295, 21.84196889125295 38.04504865892675, 21.84196928337553 38.045048489547575, 21.84196962617871 38.04504826292592, 21.841969906488746 38.04504798777072, 21.841970113533492 38.04504767465605, 21.841970239356336 38.045047335614726, 21.841970279121966 38.04504698367591))</literal>
   67.23 +			</binding>
   67.24 +		</result>
   67.25 +	</results>
   67.26 +</sparql>
   67.27 +
    68.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.2 +++ b/testsuite/src/test/resources/stSPARQL/BufferTest/BufferTestWithDistance.rq	Fri Apr 26 19:49:12 2013 +0300
    68.3 @@ -0,0 +1,6 @@
    68.4 +select (strdf:buffer(?g1, strdf:distance(?g1, ?g2, <http://www.opengis.net/def/uom/OGC/1.0/degree>), <http://www.opengis.net/def/uom/OGC/1.0/degree>) as ?buf)
    68.5 +where
    68.6 +{
    68.7 +	<http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> ?g1 .
    68.8 +	<http://example.org/id/Point/5532> <http://example.org/ontology/hasGeometry> ?g2 .
    68.9 +}
   68.10 \ No newline at end of file
    69.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    69.2 +++ b/testsuite/src/test/resources/stSPARQL/BufferTest/BufferTestWithDistance.srx	Fri Apr 26 19:49:12 2013 +0300
    69.3 @@ -0,0 +1,13 @@
    69.4 +<?xml version='1.0' encoding='UTF-8'?>
    69.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    69.6 +	<head>
    69.7 +		<variable name='buf'/>
    69.8 +	</head>
    69.9 +	<results>
   69.10 +		<result>
   69.11 +			<binding name='buf'>
   69.12 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON ((69.22262175806229 37.9521198, 68.34681011090487 29.059854918958273, 65.75303211987202 20.509314790455388, 61.540965218551676 12.629091876431552, 55.87247677580727 5.722018724192779, 48.965403623568506 0.05353028144836, 41.08518070954467 -4.158536619871988, 32.53464058104179 -6.752314610904847, 23.642375700000073 -7.628126258062288, 14.750110818958348 -6.752314610904875, 6.1995706904554595 -4.158536619872045, -1.6806522235683943 0.0535302814482819, -8.587725375807171 5.722018724192679, -14.256213818551597 12.629091876431435, -18.46828071987196 20.509314790455253, -21.062058710904832 29.05985491895813, -21.937870358062288 37.95211979999985, -21.06205871090489 46.844384681041575, -18.468280719872073 55.39492480954447, -14.256213818551768 63.275147723568324, -8.587725375807377 70.1822208758071, -1.6806522235686359 75.85070931855155, 6.199570690455197 80.06277621987194, 14.75011081895809 82.65655421090483, 23.64237569999983 83.53236585806229, 32.53464058104157 82.65655421090489, 41.08518070954449 80.06277621987206, 48.96540362356835 75.85070931855174, 55.872476775807144 70.18222087580733, 61.54096521855159 63.275147723568566, 65.75303211987196 55.39492480954473, 68.34681011090484 46.84438468104183, 69.22262175806229 37.9521198))</literal>
   69.13 +			</binding>
   69.14 +		</result>
   69.15 +	</results>
   69.16 +</sparql>
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTest.nt	Fri Apr 26 19:49:12 2013 +0300
    70.3 @@ -0,0 +1,3 @@
    70.4 +<http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> "POINT(23.6423757 37.9521198)"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    70.5 +<http://example.org/id/Point/5532> <http://example.org/ontology/hasGeometry> "POLYGON((-7 4.2,-7.1 4.2,-7.1 4.3,-7 4.2))"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    70.6 +<http://example.org/id/Point/5533> <http://example.org/ontology/hasGeometry> "POINT(21.841968 38.045047)"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    70.7 \ No newline at end of file
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestDegrees.rq	Fri Apr 26 19:49:12 2013 +0300
    71.3 @@ -0,0 +1,6 @@
    71.4 +select (strdf:distance(?g1, ?g2, <http://www.opengis.net/def/uom/OGC/1.0/degree>) as ?dist)
    71.5 +where
    71.6 +{
    71.7 +	<http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> ?g1 .
    71.8 +	<http://example.org/id/Point/5532> <http://example.org/ontology/hasGeometry> ?g2 .
    71.9 +}
   71.10 \ No newline at end of file
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestDegrees.srx	Fri Apr 26 19:49:12 2013 +0300
    72.3 @@ -0,0 +1,13 @@
    72.4 +<?xml version='1.0' encoding='UTF-8'?>
    72.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    72.6 +	<head>
    72.7 +		<variable name='dist'/>
    72.8 +	</head>
    72.9 +	<results>
   72.10 +		<result>
   72.11 +			<binding name='dist'>
   72.12 +				<literal datatype='http://www.w3.org/2001/XMLSchema#double'>45.58024597167969</literal>
   72.13 +			</binding>
   72.14 +		</result>
   72.15 +	</results>
   72.16 +</sparql>
   72.17 \ No newline at end of file
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestMetres.rq	Fri Apr 26 19:49:12 2013 +0300
    73.3 @@ -0,0 +1,6 @@
    73.4 +select (strdf:distance(?g1, ?g2, <http://www.opengis.net/def/uom/OGC/1.0/metre>) as ?dist)
    73.5 +where
    73.6 +{
    73.7 +	<http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> ?g1 .
    73.8 +	<http://example.org/id/Point/5532> <http://example.org/ontology/hasGeometry> ?g2 .
    73.9 +}
   73.10 \ No newline at end of file
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestMetres.srx	Fri Apr 26 19:49:12 2013 +0300
    74.3 @@ -0,0 +1,13 @@
    74.4 +<?xml version='1.0' encoding='UTF-8'?>
    74.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    74.6 +	<head>
    74.7 +		<variable name='dist'/>
    74.8 +	</head>
    74.9 +	<results>
   74.10 +		<result>
   74.11 +			<binding name='dist'>
   74.12 +				<literal datatype='http://www.w3.org/2001/XMLSchema#double'>4860346.0</literal>
   74.13 +			</binding>
   74.14 +		</result>
   74.15 +	</results>
   74.16 +</sparql>
    75.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.2 +++ b/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestWithUnion.rq	Fri Apr 26 19:49:12 2013 +0300
    75.3 @@ -0,0 +1,7 @@
    75.4 +select (strdf:distance(strdf:union(?g1, ?g2), ?g3, <http://www.opengis.net/def/uom/OGC/1.0/metre>) as ?dist)
    75.5 +where
    75.6 +{
    75.7 +	<http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> ?g1 .
    75.8 +	<http://example.org/id/Point/5532> <http://example.org/ontology/hasGeometry> ?g2 .
    75.9 +        <http://example.org/id/Point/5533> <http://example.org/ontology/hasGeometry> ?g3 .
   75.10 +}
   75.11 \ No newline at end of file
    76.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.2 +++ b/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestWithUnion.srx	Fri Apr 26 19:49:12 2013 +0300
    76.3 @@ -0,0 +1,13 @@
    76.4 +<?xml version='1.0' encoding='UTF-8'?>
    76.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    76.6 +	<head>
    76.7 +		<variable name='dist'/>
    76.8 +	</head>
    76.9 +	<results>
   76.10 +		<result>
   76.11 +			<binding name='dist'>
   76.12 +				<literal datatype='http://www.w3.org/2001/XMLSchema#double'>158470.796875</literal>
   76.13 +			</binding>
   76.14 +		</result>
   76.15 +	</results>
   76.16 +</sparql>
   76.17 \ No newline at end of file
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreGMLTest/StoreGMLTest.nt	Fri Apr 26 19:49:12 2013 +0300
    77.3 @@ -0,0 +1,4 @@
    77.4 +<http://example.org/point> <http://strdf.di.uoa.gr/ontology#hasGeometry> _:point.
    77.5 +_:point <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2003/01/geo/wgs84_pos#Point>.
    77.6 +_:point <http://www.w3.org/2003/01/geo/wgs84_pos#lat> "55.701".
    77.7 +_:point <http://www.w3.org/2003/01/geo/wgs84_pos#long> "12.552".
    77.8 \ No newline at end of file
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreGMLTest/StoreGMLTest.rq	Fri Apr 26 19:49:12 2013 +0300
    78.3 @@ -0,0 +1,3 @@
    78.4 +SELECT ?o
    78.5 +WHERE {?s strdf:hasGeometry ?geo.
    78.6 +?geo lgdgeo:lat ?o.}
    78.7 \ No newline at end of file
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreGMLTest/StoreGMLTest.srx	Fri Apr 26 19:49:12 2013 +0300
    79.3 @@ -0,0 +1,13 @@
    79.4 +<?xml version='1.0' encoding='UTF-8'?>
    79.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    79.6 +	<head>
    79.7 +		<variable name='o'/>
    79.8 +	</head>
    79.9 +	<results>
   79.10 +		<result>
   79.11 +			<binding name='o'>
   79.12 +				<literal>55.701</literal>
   79.13 +			</binding>
   79.14 +		</result>
   79.15 +	</results>
   79.16 +</sparql>
   79.17 \ No newline at end of file
    80.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    80.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreWKTTest/StoreWKTTest.nt	Fri Apr 26 19:49:12 2013 +0300
    80.3 @@ -0,0 +1,2 @@
    80.4 +<http://example.org/Area1> <http://strdf.di.uoa.gr/ontology#hasGeometry> "POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/4326"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    80.5 +<http://example.org/Area1> <http://strdf.di.uoa.gr/ontology#hasGeometry> "POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/32630"^^<http://strdf.di.uoa.gr/ontology#WKT> .
    80.6 \ No newline at end of file
    81.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    81.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreWKTTest/StoreWKTTest.rq	Fri Apr 26 19:49:12 2013 +0300
    81.3 @@ -0,0 +1,2 @@
    81.4 +SELECT ?o
    81.5 +WHERE {?s strdf:hasGeometry ?o}
    81.6 \ No newline at end of file
    82.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    82.2 +++ b/testsuite/src/test/resources/stSPARQL/StoreWKTTest/StoreWKTTest.srx	Fri Apr 26 19:49:12 2013 +0300
    82.3 @@ -0,0 +1,18 @@
    82.4 +<?xml version='1.0' encoding='UTF-8'?>
    82.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
    82.6 +	<head>
    82.7 +		<variable name='o'/>
    82.8 +	</head>
    82.9 +	<results>
   82.10 +		<result>
   82.11 +			<binding name='o'>
   82.12 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/4326</literal>
   82.13 +			</binding>
   82.14 +		</result>
   82.15 +		<result>
   82.16 +			<binding name='o'>
   82.17 +				<literal datatype='http://strdf.di.uoa.gr/ontology#WKT'>POLYGON((34.80 19.37,41.74 19.37,41.74 29.64 ,34.80 29.64,34.80 19.37));http://www.opengis.net/def/crs/EPSG/0/32630</literal>
   82.18 +			</binding>
   82.19 +		</result>
   82.20 +	</results>
   82.21 +</sparql>
   82.22 \ No newline at end of file
    83.1 --- a/vocab/pom.xml	Fri Apr 26 19:48:06 2013 +0300
    83.2 +++ b/vocab/pom.xml	Fri Apr 26 19:49:12 2013 +0300
    83.3 @@ -28,7 +28,7 @@
    83.4  									<pluginExecutionFilter>
    83.5  										<groupId>org.apache.maven.plugins</groupId>
    83.6  										<artifactId>maven-dependency-plugin</artifactId>
    83.7 -										<versionRange>[2.3,)</versionRange>
    83.8 +										<versionRange>[2.4,)</versionRange>
    83.9  										<goals>
   83.10  											<goal>copy-dependencies</goal>
   83.11  										</goals>
   83.12 @@ -75,7 +75,7 @@
   83.13  					</execution>
   83.14  				</executions>
   83.15  			</plugin>
   83.16 -
   83.17 +			
   83.18  			<plugin>
   83.19  				<groupId>org.apache.maven.plugins</groupId>
   83.20  				<artifactId>maven-jar-plugin</artifactId>
   83.21 @@ -95,3 +95,16 @@
   83.22  	</build>
   83.23  </project>
   83.24  
   83.25 +
   83.26 +
   83.27 +
   83.28 +
   83.29 +
   83.30 +
   83.31 +
   83.32 +
   83.33 +
   83.34 +
   83.35 +
   83.36 +
   83.37 +