Strabon

changeset 154:aaba72872423

added some more tests
author Konstantina Mpereta <grad1110@di.uoa.gr>
date Thu May 17 18:04:12 2012 +0300 (2012-05-17)
parents 3c20be4822f7
children 1c755c037ade
files mod.txt runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java runtime/src/test/java/eu/earthobservatory/runtime/generaldb/HavingTests.java runtime/src/test/java/eu/earthobservatory/runtime/generaldb/JoinTests.java runtime/src/test/java/eu/earthobservatory/runtime/generaldb/MeaningfulAggregateTests.java runtime/src/test/java/eu/earthobservatory/runtime/generaldb/NOATests.java runtime/src/test/java/eu/earthobservatory/runtime/generaldb/TransformTests.java runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java runtime/src/test/java/eu/earthobservatory/runtime/postgis/TransformTests.java
line diff
     1.1 --- a/mod.txt	Thu May 17 16:35:56 2012 +0300
     1.2 +++ b/mod.txt	Thu May 17 18:04:12 2012 +0300
     1.3 @@ -1,7 +1,9 @@
     1.4  mod.txt
     1.5 -runtime/src/test/java/eu/earthobservatory/runtime/generaldb/AggregateTests.java
     1.6  runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java
     1.7  runtime/src/test/java/eu/earthobservatory/runtime/generaldb/HavingTests.java
     1.8 -runtime/src/test/java/eu/earthobservatory/runtime/postgis/AggregateTests.java
     1.9  runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java
    1.10 -runtime/src/test/java/eu/earthobservatory/runtime/postgis/HavingTests.java
    1.11 +runtime/src/test/java/eu/earthobservatory/runtime/generaldb/JoinTests.java
    1.12 +runtime/src/test/java/eu/earthobservatory/runtime/generaldb/MeaningfulAggregateTests.java
    1.13 +runtime/src/test/java/eu/earthobservatory/runtime/generaldb/NOATests.java
    1.14 +runtime/src/test/java/eu/earthobservatory/runtime/generaldb/TransformTests.java
    1.15 +runtime/src/test/java/eu/earthobservatory/runtime/postgis/TransformTests.java
     2.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java	Thu May 17 16:35:56 2012 +0300
     2.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java	Thu May 17 18:04:12 2012 +0300
     2.3 @@ -1,6 +1,7 @@
     2.4  package eu.earthobservatory.runtime.generaldb;
     2.5  
     2.6  import java.io.IOException;
     2.7 +import java.net.URL;
     2.8  import java.sql.DriverManager;
     2.9  import java.sql.SQLException;
    2.10  import java.sql.Statement;
    2.11 @@ -10,8 +11,12 @@
    2.12  import org.openrdf.query.MalformedQueryException;
    2.13  import org.openrdf.query.QueryEvaluationException;
    2.14  import org.openrdf.query.TupleQueryResultHandlerException;
    2.15 +import org.openrdf.repository.RepositoryException;
    2.16 +import org.openrdf.rio.RDFHandlerException;
    2.17 +import org.openrdf.rio.RDFParseException;
    2.18  
    2.19  import eu.earthobservatory.runtime.generaldb.Strabon;
    2.20 +import eu.earthobservatory.runtime.postgis.SimpleTests;
    2.21  
    2.22  public class GeneralTests {
    2.23  	public static Strabon strabon;
    2.24 @@ -44,6 +49,12 @@
    2.25  		stmt.executeUpdate("DROP DATABASE \""+databaseName+"\"");
    2.26  		conn.close();
    2.27  	}
    2.28 +	protected static void loadTestData()
    2.29 +			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    2.30 +		{
    2.31 +			URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    2.32 +			strabon.storeInRepo(src, "NTRIPLES");
    2.33 +		}
    2.34  	
    2.35  	
    2.36  
     3.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/HavingTests.java	Thu May 17 16:35:56 2012 +0300
     3.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/HavingTests.java	Thu May 17 18:04:12 2012 +0300
     3.3 @@ -47,6 +47,8 @@
     3.4  		stmt.executeUpdate("DROP DATABASE \""+databaseName+"\"");
     3.5  		conn.close();
     3.6  	}
     3.7 +	
     3.8 +
     3.9  
    3.10  	String prefixes =
    3.11  			" PREFIX noa:<http://www.earthobservatory.eu/ontologies/noaOntology.owl#>"+
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/JoinTests.java	Thu May 17 18:04:12 2012 +0300
     4.3 @@ -0,0 +1,228 @@
     4.4 +package eu.earthobservatory.runtime.generaldb;
     4.5 +
     4.6 +import java.io.IOException;
     4.7 +import java.net.URL;
     4.8 +import java.sql.DriverManager;
     4.9 +import java.sql.SQLException;
    4.10 +import java.sql.Statement;
    4.11 +
    4.12 +import org.junit.AfterClass;
    4.13 +import org.junit.Test;
    4.14 +import org.openrdf.query.MalformedQueryException;
    4.15 +import org.openrdf.query.QueryEvaluationException;
    4.16 +import org.openrdf.query.TupleQueryResultHandlerException;
    4.17 +import org.openrdf.repository.RepositoryException;
    4.18 +import org.openrdf.rio.RDFHandlerException;
    4.19 +import org.openrdf.rio.RDFParseException;
    4.20 +
    4.21 +import eu.earthobservatory.runtime.generaldb.Strabon;
    4.22 +import eu.earthobservatory.runtime.postgis.SimpleTests;
    4.23 +
    4.24 +public class JoinTests {
    4.25 +
    4.26 +	public static Strabon strabon;
    4.27 +
    4.28 +	protected static String jdbcDriver= "org.postgresql.Driver";  
    4.29 +	protected static String serverName = "localhost";
    4.30 +	protected static String username = "postgres";
    4.31 +	protected static String password = "postgres";
    4.32 +	protected static Integer port = 5432;
    4.33 +	protected static java.sql.Connection conn = null;
    4.34 +	protected static String databaseName = null; 
    4.35 +	
    4.36 +
    4.37 +//	@BeforeClass
    4.38 +//	public static void initialize() throws SQLException, ClassNotFoundException
    4.39 +//	{
    4.40 +//		strabon = new Strabon("join-tests","postgres","p1r3as", 5432, "localhost", true);
    4.41 +//
    4.42 +//	}
    4.43 +
    4.44 +	@AfterClass
    4.45 +	public static void afterClass() throws SQLException
    4.46 +	{
    4.47 +		strabon.close();
    4.48 +		
    4.49 +		conn.close();
    4.50 +		String url = "jdbc:postgresql://"+serverName+":"+port+"/template1";
    4.51 +		conn = DriverManager.getConnection(url, username, password);
    4.52 +		Statement stmt = conn.createStatement();
    4.53 +		stmt.executeUpdate("DROP DATABASE \""+databaseName+"\"");
    4.54 +		conn.close();
    4.55 +	}
    4.56 +	
    4.57 +	protected static void loadTestData()
    4.58 +			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    4.59 +		{
    4.60 +			URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    4.61 +			strabon.storeInRepo(src, "NTRIPLES");
    4.62 +		}
    4.63 +
    4.64 +
    4.65 +	String query5a = 
    4.66 +		"PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> "+
    4.67 +		"SELECT ?sensor ?place WHERE "+
    4.68 +		"{"+
    4.69 +		"?place a <http://linkedgeodata.org/ontology/NaturalWood> . "+
    4.70 +		"?place <http://www.w3.org/2003/01/geo/wgs84_pos#geometry> ?placeGeo. "+
    4.71 +		"?areaOfInterest <http://www.geonames.org/ontology#name>  \"London\". "+	
    4.72 +		"?areaOfInterest <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeography> ?areaGeo . "+
    4.73 +		"?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedSystem> ?sensorSystem . "+	
    4.74 +		"?sensorSystem <http://purl.oclc.org/NET/ssnx/ssn#hasSubSystem> ?sensor . "+
    4.75 +		"?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedOnPlatform> ?sensorPlatform . "+
    4.76 +		"?sensorPlatform <http://www.loa-cnr.it/ontologies/DUL.owl#hasLocation> ?spaceRegion . "+
    4.77 +		"?spaceRegion <http://dbpedia.org/property/hasGeometry> ?sensorsGeo . "+
    4.78 +		"FILTER(strdf:anyInteract(?sensorsGeo,?areaGeo) && strdf:anyInteract(?sensorsGeo,?placeGeo)) . "+ 
    4.79 +		"}";
    4.80 +
    4.81 +	String query5b = 
    4.82 +		"PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> "+
    4.83 +		"SELECT ?sensor ?place WHERE "+
    4.84 +		"{ "+
    4.85 +		"?place a <http://linkedgeodata.org/ontology/NaturalWood> . "+ 
    4.86 +		"?place <http://www.w3.org/2003/01/geo/wgs84_pos#geometry> ?placeGeo. "+
    4.87 +		"?sensorSystem <http://purl.oclc.org/NET/ssnx/ssn#hasSubSystem> ?sensor . "+
    4.88 +		"?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedSystem> ?sensorSystem . "+	
    4.89 +		"?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedOnPlatform> ?sensorPlatform . "+
    4.90 +		"?sensorPlatform <http://www.loa-cnr.it/ontologies/DUL.owl#hasLocation> ?spaceRegion . "+
    4.91 +		"?spaceRegion <http://dbpedia.org/property/hasGeometry> ?sensorsGeo . "+
    4.92 +		"?areaOfInterest <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeography> ?areaGeo . "+
    4.93 +		"?areaOfInterest <http://www.geonames.org/ontology#name>  \"London\". "+	
    4.94 +		"FILTER(strdf:anyInteract(?sensorsGeo,?areaGeo)) . "+
    4.95 +		"FILTER(strdf:anyInteract(?sensorsGeo,?placeGeo)). }";
    4.96 +
    4.97 +	String query5c = 
    4.98 +		"PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> "+
    4.99 +		"SELECT ?sensor ?place WHERE "+
   4.100 +		"{ "+
   4.101 +		"?place a <http://linkedgeodata.org/ontology/NaturalWood> . "+ 
   4.102 +		"?place <http://www.w3.org/2003/01/geo/wgs84_pos#geometry> ?placeGeo. "+
   4.103 +		"?areaOfInterest <http://www.geonames.org/ontology#name>  \"London\". "+	
   4.104 +		"?areaOfInterest <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeography> ?areaGeo . "+
   4.105 +		"?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedSystem> ?sensorSystem . "+	
   4.106 +		"?sensorSystem <http://purl.oclc.org/NET/ssnx/ssn#hasSubSystem> ?sensor . "+
   4.107 +		"?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedOnPlatform> ?sensorPlatform . "+
   4.108 +		"?sensorPlatform <http://www.loa-cnr.it/ontologies/DUL.owl#hasLocation> ?spaceRegion . "+
   4.109 +		"?spaceRegion <http://dbpedia.org/property/hasGeometry> ?sensorsGeo . "+
   4.110 +		"FILTER(strdf:anyInteract(?sensorsGeo,?areaGeo)) . "+
   4.111 +		"FILTER(strdf:anyInteract(?sensorsGeo,?placeGeo)). }";
   4.112 +
   4.113 +	String query9a =
   4.114 +		"PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> " +
   4.115 +		"SELECT ?populatedArea ?sensor ?portArea " +
   4.116 +		"WHERE " +
   4.117 +		"{ " +
   4.118 +		"?sensorSystem <http://purl.oclc.org/NET/ssnx/ssn#hasSubSystem> ?sensor . " +
   4.119 +		" ?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedSystem> ?sensorSystem . " +	
   4.120 +		" ?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedOnPlatform> ?sensorPlatform . " +
   4.121 +		" ?sensorPlatform <http://www.loa-cnr.it/ontologies/DUL.owl#hasLocation> ?spaceRegion . " +
   4.122 +		" ?spaceRegion <http://dbpedia.org/property/hasGeometry> ?sensorsGeo . " +
   4.123 +		" ?portArea <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasLandUse>  <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#portAreas> . " +	
   4.124 +		" ?portArea a <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#Area> . " +
   4.125 +		" ?portArea <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeometry> ?seaGeo . " +
   4.126 +		" ?populatedArea <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/PopulatedPlace> . " +
   4.127 +		" ?populatedAreaGeoNames <http://www.w3.org/2002/07/owl#sameAs> ?populatedArea .			 " +
   4.128 +		" ?populatedAreaGeoNames <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeography> ?areaGeo .  " +
   4.129 +		"  FILTER( strdf:anyInteract(?areaGeo,?sensorsGeo) ) . " +
   4.130 +		" FILTER( strdf:anyInteract(?seaGeo,?sensorsGeo) ) . " +
   4.131 +		"}";
   4.132 +
   4.133 +	String query3way = 
   4.134 +		"PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> "+
   4.135 +		"SELECT ?sensor ?place WHERE "+
   4.136 +		"{ "+
   4.137 +		"?place a <http://linkedgeodata.org/ontology/NaturalWood> . "+ 
   4.138 +		"?place <http://www.w3.org/2003/01/geo/wgs84_pos#geometry> ?placeGeo. "+
   4.139 +		"?areaOfInterest <http://www.geonames.org/ontology#name>  \"London\". "+	
   4.140 +		"?areaOfInterest <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeography> ?areaGeo . "+
   4.141 +		"?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedSystem> ?sensorSystem . "+	
   4.142 +		"?sensorSystem <http://purl.oclc.org/NET/ssnx/ssn#hasSubSystem> ?sensor . "+
   4.143 +		"?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedOnPlatform> ?sensorPlatform . "+
   4.144 +		"?sensorPlatform <http://www.loa-cnr.it/ontologies/DUL.owl#hasLocation> ?spaceRegion . "+
   4.145 +		"?spaceRegion <http://dbpedia.org/property/hasGeometry> ?sensorsGeo . "+
   4.146 +		"FILTER(strdf:anyInteract(?sensorsGeo,strdf:union(?areaGeo,?placeGeo)) " +
   4.147 +		"&& strdf:anyInteract(?sensorsGeo,?placeGeo) && ?place = ?spaceRegion) . "+
   4.148 +		"}";
   4.149 +
   4.150 +	String query5_3filters = 
   4.151 +		"PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> "+
   4.152 +		"SELECT ?sensor ?place WHERE "+
   4.153 +		"{ "+
   4.154 +		"	?place a <http://linkedgeodata.org/ontology/NaturalWood> .  "+
   4.155 +		"	?place <http://www.w3.org/2003/01/geo/wgs84_pos#geometry> ?placeGeo. "+
   4.156 +		"	?sensorSystem <http://purl.oclc.org/NET/ssnx/ssn#hasSubSystem> ?sensor . "+
   4.157 +		"	?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedSystem> ?sensorSystem .	 "+
   4.158 +		"	?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedOnPlatform> ?sensorPlatform . "+
   4.159 +		"?sensorPlatform <http://www.loa-cnr.it/ontologies/DUL.owl#hasLocation> ?spaceRegion . "+
   4.160 +		"	?spaceRegion <http://dbpedia.org/property/hasGeometry> ?sensorsGeo . "+
   4.161 +		"?areaOfInterest <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeography> ?areaGeo . "+
   4.162 +		"?areaOfInterest <http://www.geonames.org/ontology#name>  \"London\".	 "+
   4.163 +		"	FILTER(strdf:anyInteract(?sensorsGeo,?areaGeo)) .  "+
   4.164 +		"FILTER(strdf:anyInteract(?sensorsGeo,?placeGeo)).  "+
   4.165 +		"      FILTER(strdf:anyInteract(?areaGeo,?placeGeo)).}";
   4.166 +	
   4.167 +	String query5_properties = 
   4.168 +		"PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> "+
   4.169 +		"SELECT ?sensor ?place WHERE "+
   4.170 +		"{ "+
   4.171 +		"	?place a <http://linkedgeodata.org/ontology/NaturalWood> .  "+
   4.172 +		"	?place <http://www.w3.org/2003/01/geo/wgs84_pos#geometry> ?placeGeo. "+
   4.173 +		"	?sensorSystem <http://purl.oclc.org/NET/ssnx/ssn#hasSubSystem> ?sensor . "+
   4.174 +		"	?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedSystem> ?sensorSystem .	 "+
   4.175 +		"	?sensorsDeployment <http://purl.oclc.org/NET/ssnx/ssn#deployedOnPlatform> ?sensorPlatform . "+
   4.176 +		"?sensorPlatform <http://www.loa-cnr.it/ontologies/DUL.owl#hasLocation> ?spaceRegion . "+
   4.177 +		"	?spaceRegion <http://dbpedia.org/property/hasGeometry> ?sensorsGeo . "+
   4.178 +		"?areaOfInterest <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#hasGeography> ?areaGeo . "+
   4.179 +		"?areaOfInterest <http://www.geonames.org/ontology#name>  \"London\".	 "+
   4.180 +		"	FILTER(strdf:anyInteract(?sensorsGeo,?areaGeo)) .  "+
   4.181 +		"FILTER(strdf:dimension(?sensorsGeo) = strdf:dimension(?placeGeo)).  }";
   4.182 +
   4.183 +	@Test
   4.184 +	public void testQuery5a() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   4.185 +	{
   4.186 +		strabon.query(query5a,strabon.getSailRepoConnection());
   4.187 +
   4.188 +	}
   4.189 +
   4.190 +	@Test
   4.191 +	public void testQuery5b() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   4.192 +	{
   4.193 +		strabon.query(query5b,strabon.getSailRepoConnection());
   4.194 +
   4.195 +	}
   4.196 +
   4.197 +	@Test
   4.198 +	public void testQuery5c() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   4.199 +	{
   4.200 +		strabon.query(query5c,strabon.getSailRepoConnection());
   4.201 +
   4.202 +	}
   4.203 +
   4.204 +	@Test
   4.205 +	public void testQuery9a() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   4.206 +	{
   4.207 +		strabon.query(query9a,strabon.getSailRepoConnection());
   4.208 +
   4.209 +	}
   4.210 +
   4.211 +	@Test
   4.212 +	public void testQuery3way() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   4.213 +	{
   4.214 +		strabon.query(query3way,strabon.getSailRepoConnection());
   4.215 +
   4.216 +	}
   4.217 +	
   4.218 +	@Test
   4.219 +	public void testQuery5_3filters() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   4.220 +	{
   4.221 +		strabon.query(query5_3filters,strabon.getSailRepoConnection());
   4.222 +
   4.223 +	}
   4.224 +	
   4.225 +	@Test
   4.226 +	public void testQuery5_properties() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   4.227 +	{
   4.228 +		strabon.query(query5_properties,strabon.getSailRepoConnection());
   4.229 +
   4.230 +	}
   4.231 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/MeaningfulAggregateTests.java	Thu May 17 18:04:12 2012 +0300
     5.3 @@ -0,0 +1,214 @@
     5.4 +package eu.earthobservatory.runtime.generaldb;
     5.5 +
     5.6 +import java.io.IOException;
     5.7 +import java.net.URL;
     5.8 +import java.sql.DriverManager;
     5.9 +import java.sql.SQLException;
    5.10 +import java.sql.Statement;
    5.11 +
    5.12 +import org.junit.AfterClass;
    5.13 +import org.junit.Test;
    5.14 +import org.openrdf.query.MalformedQueryException;
    5.15 +import org.openrdf.query.QueryEvaluationException;
    5.16 +import org.openrdf.query.TupleQueryResultHandlerException;
    5.17 +import org.openrdf.repository.RepositoryException;
    5.18 +import org.openrdf.rio.RDFHandlerException;
    5.19 +import org.openrdf.rio.RDFParseException;
    5.20 +
    5.21 +import eu.earthobservatory.runtime.generaldb.Strabon;
    5.22 +import eu.earthobservatory.runtime.postgis.SimpleTests;
    5.23 +
    5.24 +public class MeaningfulAggregateTests {
    5.25 +	public static Strabon strabon;
    5.26 +
    5.27 +	protected static String jdbcDriver= "org.postgresql.Driver";  
    5.28 +	protected static String serverName = "localhost";
    5.29 +	protected static String username = "postgres";
    5.30 +	protected static String password = "postgres";
    5.31 +	protected static Integer port = 5432;
    5.32 +	protected static java.sql.Connection conn = null;
    5.33 +	protected static String databaseName = null; 
    5.34 +	
    5.35 +
    5.36 +//	@BeforeClass
    5.37 +//	public abstract static void initialize() throws SQLException, ClassNotFoundException
    5.38 +//	{
    5.39 +//		strabon = new Strabon("cco2","postgres","p1r3as", 5432, "localhost", true);
    5.40 +//	}
    5.41 +
    5.42 +	@AfterClass
    5.43 +	public static void afterClass() throws SQLException
    5.44 +	{
    5.45 +		strabon.close();
    5.46 +		
    5.47 +		conn.close();
    5.48 +		String url = "jdbc:postgresql://"+serverName+":"+port+"/template1";
    5.49 +		conn = DriverManager.getConnection(url, username, password);
    5.50 +		Statement stmt = conn.createStatement();
    5.51 +		stmt.executeUpdate("DROP DATABASE \""+databaseName+"\"");
    5.52 +		conn.close();
    5.53 +	}
    5.54 +	
    5.55 +	protected static void loadTestData()
    5.56 +			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    5.57 +		{
    5.58 +			URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    5.59 +			strabon.storeInRepo(src, "NTRIPLES");
    5.60 +		}
    5.61 +	
    5.62 +
    5.63 +	String prefixes =
    5.64 +		" PREFIX noa:<http://www.earthobservatory.eu/ontologies/noaOntology.owl#>"+
    5.65 +		" PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>"+
    5.66 +		" PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> ";
    5.67 +
    5.68 +	
    5.69 +	/**
    5.70 +	 * May seem like this query has a spatial dimension, 
    5.71 +	 * but since the spatial literal is not involved in any
    5.72 +	 * spatial operations, it is evaluated as a plain literal
    5.73 +	 */
    5.74 +	String query1NotSpatial = prefixes +
    5.75 +			"SELECT ( COUNT(?hotspot) AS ?count) ?geo "+
    5.76 +			"WHERE " +
    5.77 +			"{ " +
    5.78 +			"	?hotspot a noa:Hotspot;" +
    5.79 +			"			 strdf:hasGeometry ?geo. " +
    5.80 +			"}"+
    5.81 +			"GROUP BY ?geo";
    5.82 +		
    5.83 +	/**
    5.84 +	 * Current results: 6 - 4 - 2
    5.85 +	 */
    5.86 +	String query1Spatial = prefixes +
    5.87 +			"SELECT ( COUNT(?hotspot) AS ?count) ?geo "+
    5.88 +			"WHERE " +
    5.89 +			"{ " +
    5.90 +			"	?hotspot a noa:Hotspot;" +
    5.91 +			"			 strdf:hasGeometry ?geo. " +
    5.92 +			"   ?urbanArea a noa:UrbanArea; " +
    5.93 +			" 			   strdf:hasGeometry ?uaGeo."+
    5.94 +			"	FILTER(strdf:disjoint(?geo,?uaGeo)) "+	
    5.95 +			"}"+
    5.96 +			"GROUP BY ?geo";
    5.97 +	
    5.98 +	
    5.99 +	/**
   5.100 +	 * Functionality seems ok
   5.101 +	 */
   5.102 +	String query2simple = prefixes + 
   5.103 +			"SELECT ?burntArea ?baGeo " +
   5.104 +			"(strdf:union(?uaGeo) AS ?urban) "+
   5.105 +			"WHERE { " +
   5.106 +			" ?burntArea a noa:BurntArea; " +
   5.107 +			" 		     strdf:hasGeometry ?baGeo. " +
   5.108 +			" ?urbanArea a noa:UrbanArea; " +
   5.109 +			"			 strdf:hasGeometry ?uaGeo. " +
   5.110 +			" FILTER(strdf:anyInteract(?baGeo,?uaGeo))" +
   5.111 +			" } " +
   5.112 +			" GROUP BY ?burntArea ?baGeo "+ 
   5.113 +			" ";
   5.114 +	
   5.115 +	String query2complexA = prefixes + 
   5.116 +			"SELECT ?burntArea " +
   5.117 +//			"?baGeo " +
   5.118 +			"(strdf:difference(?baGeo, strdf:union(?uaGeo)) AS ?urbanPiece) "+
   5.119 +			" WHERE { " +
   5.120 +			" ?burntArea a noa:BurntArea; " +
   5.121 +			" 		     strdf:hasGeometry ?baGeo. " +
   5.122 +			" ?urbanArea a noa:UrbanArea; " +
   5.123 +			"			 strdf:hasGeometry ?uaGeo. " +
   5.124 +			" FILTER(strdf:anyInteract(?baGeo,?uaGeo))" +
   5.125 +			" } " +
   5.126 +			" GROUP BY ?burntArea" +
   5.127 +//			" ?baGeo "+ 
   5.128 +			" ";
   5.129 +	
   5.130 +	String query2complexB = prefixes + 
   5.131 +			"SELECT ?burntArea ?baGeo " +
   5.132 +			"(strdf:difference(strdf:union(?uaGeo) , ?baGeo) AS ?urbanPiece) "+
   5.133 +			" WHERE { " +
   5.134 +			" ?burntArea a noa:BurntArea; " +
   5.135 +			" 		     strdf:hasGeometry ?baGeo. " +
   5.136 +			" ?urbanArea a noa:UrbanArea; " +
   5.137 +			"			 strdf:hasGeometry ?uaGeo. " +
   5.138 +			" FILTER(strdf:anyInteract(?baGeo,?uaGeo))" +
   5.139 +			" } " +
   5.140 +			" GROUP BY ?burntArea ?baGeo "+ 
   5.141 +			" ";
   5.142 +	
   5.143 +	String query2complexC = prefixes + 
   5.144 +			"SELECT ?burntArea ?baGeo " +
   5.145 +			"(strdf:buffer(strdf:union(?uaGeo) , 5) AS ?urbanPiece) "+
   5.146 +			" WHERE { " +
   5.147 +			" ?burntArea a noa:BurntArea; " +
   5.148 +			" 		     strdf:hasGeometry ?baGeo. " +
   5.149 +			" ?urbanArea a noa:UrbanArea; " +
   5.150 +			"			 strdf:hasGeometry ?uaGeo. " +
   5.151 +			" FILTER(strdf:anyInteract(?baGeo,?uaGeo))" +
   5.152 +			" } " +
   5.153 +			" GROUP BY ?burntArea ?baGeo "+ 
   5.154 +			" ";
   5.155 +	
   5.156 +	String query2complexD = prefixes + 
   5.157 +	"SELECT " +
   5.158 +	" ?burntArea " +
   5.159 +//	" ?baGeo " +
   5.160 +//	" (strdf:union(?uaGeo) AS ?urban) " +
   5.161 +	" (COUNT(?uaGeo) AS ?urbanNo) "+
   5.162 +	"WHERE { " +
   5.163 +	" ?burntArea a noa:BurntArea; " +
   5.164 +	" 		     strdf:hasGeometry ?baGeo. " +
   5.165 +	" ?urbanArea a noa:UrbanArea; " +
   5.166 +	"			 strdf:hasGeometry ?uaGeo. " +
   5.167 +	" FILTER(strdf:anyInteract(?baGeo,?uaGeo))" +
   5.168 +	" } " +
   5.169 +	" GROUP BY ?burntArea ?baGeo "+ 
   5.170 +	" HAVING (COUNT(?uaGeo) > 1 )"+
   5.171 +	" "
   5.172 +	;
   5.173 +	
   5.174 +	@Test
   5.175 +	public void testQuery1NotSpatial() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   5.176 +	{
   5.177 +		strabon.query(query1NotSpatial,strabon.getSailRepoConnection());
   5.178 +
   5.179 +	}
   5.180 +	@Test
   5.181 +	public void testQuery1Spatial() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   5.182 +	{
   5.183 +		strabon.query(query1Spatial,strabon.getSailRepoConnection());
   5.184 +
   5.185 +	}
   5.186 +	@Test
   5.187 +	public void testQuery2() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   5.188 +	{
   5.189 +		strabon.query(query2simple,strabon.getSailRepoConnection());
   5.190 +
   5.191 +	}
   5.192 +	@Test
   5.193 +	public void testQuery2complexA() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   5.194 +	{
   5.195 +		strabon.query(query2complexA,strabon.getSailRepoConnection());
   5.196 +
   5.197 +	}
   5.198 +	@Test
   5.199 +	public void testQuery2complexB() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   5.200 +	{
   5.201 +		strabon.query(query2complexB,strabon.getSailRepoConnection());
   5.202 +
   5.203 +	}
   5.204 +	@Test
   5.205 +	public void testQuery2complexC() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   5.206 +	{
   5.207 +		strabon.query(query2complexC,strabon.getSailRepoConnection());
   5.208 +
   5.209 +	}
   5.210 +	@Test
   5.211 +	public void testQuery2complexD() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   5.212 +	{
   5.213 +		strabon.query(query2complexD,strabon.getSailRepoConnection());
   5.214 +
   5.215 +	}
   5.216 +
   5.217 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/NOATests.java	Thu May 17 18:04:12 2012 +0300
     6.3 @@ -0,0 +1,188 @@
     6.4 +package eu.earthobservatory.runtime.generaldb;
     6.5 +
     6.6 +import java.io.IOException;
     6.7 +import java.net.URL;
     6.8 +import java.sql.DriverManager;
     6.9 +import java.sql.SQLException;
    6.10 +import java.sql.Statement;
    6.11 +
    6.12 +import org.junit.AfterClass;
    6.13 +import org.junit.Test;
    6.14 +import org.openrdf.query.MalformedQueryException;
    6.15 +import org.openrdf.query.QueryEvaluationException;
    6.16 +import org.openrdf.query.TupleQueryResultHandlerException;
    6.17 +import org.openrdf.repository.RepositoryException;
    6.18 +import org.openrdf.rio.RDFHandlerException;
    6.19 +import org.openrdf.rio.RDFParseException;
    6.20 +
    6.21 +import eu.earthobservatory.runtime.generaldb.Strabon;
    6.22 +import eu.earthobservatory.runtime.postgis.SimpleTests;
    6.23 +
    6.24 +public class NOATests {
    6.25 +	public static Strabon strabon;
    6.26 +	
    6.27 +
    6.28 +	protected static String jdbcDriver= "org.postgresql.Driver";  
    6.29 +	protected static String serverName = "localhost";
    6.30 +	protected static String username = "postgres";
    6.31 +	protected static String password = "postgres";
    6.32 +	protected static Integer port = 5432;
    6.33 +	protected static java.sql.Connection conn = null;
    6.34 +	protected static String databaseName = null; 
    6.35 +	
    6.36 +
    6.37 +	@AfterClass
    6.38 +	public static void afterClass() throws SQLException
    6.39 +	{
    6.40 +		strabon.close();
    6.41 +		
    6.42 +		conn.close();
    6.43 +		String url = "jdbc:postgresql://"+serverName+":"+port+"/template1";
    6.44 +		conn = DriverManager.getConnection(url, username, password);
    6.45 +		Statement stmt = conn.createStatement();
    6.46 +		stmt.executeUpdate("DROP DATABASE \""+databaseName+"\"");
    6.47 +		conn.close();
    6.48 +	}
    6.49 +	
    6.50 +	protected static void loadTestData()
    6.51 +			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    6.52 +		{
    6.53 +			URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    6.54 +			strabon.storeInRepo(src, "NTRIPLES");
    6.55 +		}
    6.56 +
    6.57 +	String prefixes = 
    6.58 +		"PREFIX imAn: <http://teleios.di.uoa.gr/ontologies/imageAnnotationOntology.owl#> "+
    6.59 +		"PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> "+
    6.60 +		"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "+
    6.61 +		"PREFIX eolo:<http://www.dlr.de/ontologies/EOLO.owl#> "+
    6.62 +		"PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> "+
    6.63 +		"PREFIX base: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> "+
    6.64 +		"PREFIX ex: <http://www.example.org/ontology#> "+
    6.65 +		"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> ";
    6.66 +
    6.67 +	String query1 = prefixes+
    6.68 +	"SELECT ?FILENAME { "+
    6.69 +	"?COLLECTION rdf:type imAn:NOA-UC . "+
    6.70 +	"?FILE noa:belongToCollection ?COLLECTION . "+
    6.71 +	"?FILE noa:hasFilename ?FILENAME .}";
    6.72 +
    6.73 +	String query2 = prefixes+
    6.74 +	"SELECT ?FILENAME { "+
    6.75 +	"?COLLECTION rdf:type imAn:NOA-UC . "+
    6.76 +	"?FILE noa:belongToCollection ?COLLECTION . "+
    6.77 +	"?FILE noa:hasFilename ?FILENAME . "+
    6.78 +	"?COLLECTION eolo:hasProcessingLevel eolo:L1 . "+
    6.79 +	"?COLLECTION eolo:hasResolution eolo:LowResolution .}";
    6.80 +
    6.81 +	String query3 = prefixes+
    6.82 +	"SELECT     ?FILENAME "+
    6.83 +	"WHERE {    ?FILE rdf:type noa:ShpFile . "+
    6.84 +	"?FILE noa:hasFilename ?FILENAME . "+
    6.85 +	"?FILE noa:hasAcquisitionTime ?SENSING_TIME . "+
    6.86 +	"FILTER( str(?SENSING_TIME) > \"2010-08-21T20:00:00\" ) . "+
    6.87 +	"FILTER( str(?SENSING_TIME) < \"2010-08-21T20:30:00\" ) . "+
    6.88 +	"?FILE noa:isDerivedFromSensor ?SENSOR . "+
    6.89 +	"FILTER( str(?SENSOR) = \"MSG1_RSS\" ) . }";
    6.90 +
    6.91 +
    6.92 +	protected String query4 = prefixes+
    6.93 +	"SELECT DISTINCT ?H1 ?HGEO1 ?CONFIRMATION1 ?SATTELITE1 ?HCONF1 ?PC1 "+
    6.94 +	"WHERE { "+
    6.95 +	"?H1 rdf:type noa:Hotspot . "+
    6.96 +	"?H1 noa:hasConfidence ?HCONF1 . "+
    6.97 +	"?H1 noa:hasGeometry ?HGEO1 . "+
    6.98 +	"?H1 noa:hasAcquisitionTime ?HAT1 . "+
    6.99 +	"?H1 noa:isDerivedFromSensor ?SENSOR1 . "+
   6.100 +	"?H1 noa:isDerivedFromSatellite ?SATTELITE1 . "+
   6.101 +	"?H1 noa:producedFromProcessingChain ?PC1 . "+
   6.102 +	"?H1 noa:hasConfirmation ?CONFIRMATION1 . "+
   6.103 +	"FILTER( \"2010-08-22T15:35:00\" < str(?HAT1) " +
   6.104 +	"&& str(?HAT1) < \"2010-08-22T16:10:00\" && str(?SENSOR1) = \"MSG1_RSS\" && str(?PC1) = \"plain\" ) . "+
   6.105 +	"OPTIONAL { "+
   6.106 +	"?H2 rdf:type noa:Hotspot . "+
   6.107 +	"?H2 noa:hasGeometry  ?HGEO2 . "+
   6.108 +	"?H2 noa:hasAcquisitionTime ?HAT2 . "+
   6.109 +	"?H2 noa:isDerivedFromSensor ?SENSOR2 . "+
   6.110 +	"?H2 noa:producedFromProcessingChain ?PC2 . "+
   6.111 +	"FILTER( strdf:equals(?HGEO1 , ?HGEO2) ) . "+
   6.112 +	"FILTER( str(?HAT2) = \"2010-08-22T16:10:00\" && str(?SENSOR2) = \"MSG1_RSS\" " +
   6.113 +	"&& str(?PC2) = \"plain\" ) . "+
   6.114 +	"} . "+
   6.115 +	"FILTER (!bound(?H2)) .} ";
   6.116 +
   6.117 +	String query5 = prefixes+
   6.118 +	"SELECT DISTINCT ?H "+
   6.119 +	"WHERE { "+
   6.120 +	"?H rdf:type noa:Hotspot . "+
   6.121 +	"?H noa:hasGeometry ?HGEO . "+
   6.122 +	"?H noa:isDerivedFromSensor ?HS . "+
   6.123 +	"FILTER( str(?HS) = \"MSG2\" ) . "+
   6.124 +	"?H noa:hasAcquisitionTime ?HAT . "+
   6.125 +	"FILTER(str(?HAT) = \"2007-08-24T12:45:00\") . "+
   6.126 +	"OPTIONAL { "+
   6.127 +	"?C rdf:type noa:Coastline . "+
   6.128 +	"?C noa:hasGeometry ?CGEO . "+
   6.129 +	"filter ( strdf:anyInteract(?HGEO , ?CGEO) ) . "+
   6.130 +	"} FILTER( !bound(?C) ) "+
   6.131 +	"}";
   6.132 +
   6.133 +	protected String query6 = prefixes+
   6.134 +	"SELECT ?H (strdf:intersection(?HGEO, ?CGEO) AS ?REFINEDGEO) "+
   6.135 +	"WHERE { "+ 
   6.136 +	"?H rdf:type noa:Hotspot . "+
   6.137 +	"?H noa:hasGeometry ?HGEO . "+
   6.138 +	"?H noa:isDerivedFromSensor ?HS . "+
   6.139 +	"FILTER( str(?HS) = \"MSG2\" ) . "+
   6.140 +	"?H noa:hasAcquisitionTime ?HAT . "+
   6.141 +	"FILTER(str(?HAT) = \"2007-08-24T12:45:00\") . "+
   6.142 +	"?C rdf:type noa:Coastline . "+
   6.143 +	"?C noa:hasGeometry ?CGEO . "+
   6.144 +	"FILTER( strdf:overlap(?HGEO,?CGEO) ) . "+
   6.145 +	"} ORDER BY ?H ";
   6.146 +	
   6.147 +	protected String query7 = prefixes+
   6.148 +	//"SELECT ?H (strdf:intersection(?HGEO, ?CGEO) AS ?REFINEDGEO) "+
   6.149 +			"INSERT  {?H noa:hasGeometry (strdf:intersection(?HGEO, ?CGEO) AS ?REFINEDGEO)} \n"+
   6.150 +	"WHERE { "+ 
   6.151 +	"?H rdf:type noa:Hotspot . "+
   6.152 +	"?H noa:hasGeometry ?HGEO . "+
   6.153 +	"?H noa:isDerivedFromSensor ?HS . "+
   6.154 +	"FILTER( str(?HS) = \"MSG2\" ) . "+
   6.155 +	"?H noa:hasAcquisitionTime ?HAT . "+
   6.156 +	"FILTER(str(?HAT) = \"2007-08-24T12:45:00\") . "+
   6.157 +	"?C rdf:type noa:Coastline . "+
   6.158 +	"?C noa:hasGeometry ?CGEO . "+
   6.159 +	"FILTER( strdf:overlap(?HGEO,?CGEO) ) . "+
   6.160 +	"}  ";
   6.161 +
   6.162 +
   6.163 +	@Test
   6.164 +	public void testQuery1() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   6.165 +	{
   6.166 +		strabon.query(query1,strabon.getSailRepoConnection());
   6.167 +
   6.168 +	}
   6.169 +
   6.170 +	@Test
   6.171 +	public void testQuery2() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   6.172 +	{
   6.173 +		strabon.query(query2,strabon.getSailRepoConnection());
   6.174 +
   6.175 +	}
   6.176 +
   6.177 +	@Test
   6.178 +	public void testQuery3() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   6.179 +	{
   6.180 +		strabon.query(query3,strabon.getSailRepoConnection());
   6.181 +
   6.182 +	}
   6.183 +	
   6.184 +	@Test
   6.185 +	public void testQuery7() throws MalformedQueryException
   6.186 +	{
   6.187 +		strabon.update(query7,strabon.getSailRepoConnection());
   6.188 +
   6.189 +	}
   6.190 +
   6.191 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/TransformTests.java	Thu May 17 18:04:12 2012 +0300
     7.3 @@ -0,0 +1,100 @@
     7.4 +package eu.earthobservatory.runtime.generaldb;
     7.5 +import java.io.IOException;
     7.6 +import java.sql.DriverManager;
     7.7 +import java.sql.SQLException;
     7.8 +import java.sql.Statement;
     7.9 +
    7.10 +import org.junit.AfterClass;
    7.11 +import org.junit.Test;
    7.12 +import org.openrdf.query.MalformedQueryException;
    7.13 +import org.openrdf.query.QueryEvaluationException;
    7.14 +import org.openrdf.query.TupleQueryResultHandlerException;
    7.15 +//import eu.earthobservatory.generaldb.main.Strabon;
    7.16 +import eu.earthobservatory.runtime.generaldb.Strabon;
    7.17 +
    7.18 +public class TransformTests {
    7.19 +
    7.20 +	public static Strabon strabon;
    7.21 +
    7.22 +	protected static String jdbcDriver= "org.postgresql.Driver";  
    7.23 +	protected static String serverName = "localhost";
    7.24 +	protected static String username = "postgres";
    7.25 +	protected static String password = "postgres";
    7.26 +	protected static Integer port = 5432;
    7.27 +	protected static java.sql.Connection conn = null;
    7.28 +	protected static String databaseName = null; 
    7.29 +	
    7.30 +	@AfterClass
    7.31 +	public static void afterClass() throws SQLException
    7.32 +	{
    7.33 +		strabon.close();
    7.34 +	
    7.35 +		conn.close();
    7.36 +		String url = "jdbc:postgresql://"+serverName+":"+port+"/template1";
    7.37 +		conn = DriverManager.getConnection(url, username, password);
    7.38 +		Statement stmt = conn.createStatement();
    7.39 +		stmt.executeUpdate("DROP DATABASE \""+databaseName+"\"");
    7.40 +		conn.close();
    7.41 +	}
    7.42 +
    7.43 +
    7.44 +	String prefixes = "PREFIX gag: <http://www.semanticweb.org/ontologies/2011/gagKallikratis.rdf#> \n"+
    7.45 +			"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"+
    7.46 +			"PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> \n"+
    7.47 +			"PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> \n"+
    7.48 +			"PREFIX base: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> \n"+
    7.49 +			"PREFIX ex: <http://www.example.org/ontology#> \n"+
    7.50 +			"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" +
    7.51 +			"PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> \n";
    7.52 +
    7.53 +	protected String query1 = prefixes +
    7.54 +			"SELECT    ?H1 ?HAT1 ?HGEO1 " +
    7.55 +			"(strdf:transform(?HGEO1, <http://www.opengis.net/def/crs/EPSG/0/4326> ) AS ?converted)" +
    7.56 +			"(strdf:transform(strdf:union(?HGEO1,?HGEO1),<http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?united) "  +
    7.57 +			"WHERE { \n"+
    7.58 +			"?H1 rdf:type noa:Hotspot . \n"+
    7.59 +			"?H1 noa:hasConfidence ?HCONF1 . \n"+
    7.60 +			"?H1 noa:hasGeometry ?HGEO1 . \n"+
    7.61 +			"?H1 noa:hasAcquisitionTime ?HAT1 . \n"+
    7.62 +//			" FILTER(strdf:anyInteract(?HGEO1,?HGEO1)) "+
    7.63 +			"}" +
    7.64 +			" LIMIT 5 \n";
    7.65 +
    7.66 +//	protected String query2 = prefixes +
    7.67 +//			"SELECT    ?H1 ?H2 (strdf:transform(strdf:union(?HGEO1,?HGEO2),<http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?united)"  +
    7.68 +//			"WHERE { \n"+
    7.69 +////			"?H1 rdf:type noa:Hotspot . \n"+
    7.70 +////			"?H2 rdf:type noa:Hotspot . \n"+
    7.71 +//			"?H1 noa:hasGeometry ?HGEO1 . \n"+
    7.72 +//			"?H2 noa:hasGeometry ?HGEO2 . \n"+
    7.73 +////			"?H1 noa:producedFromProcessingChain ?PC1 . \n"+
    7.74 +////			"?H2 noa:producedFromProcessingChain ?PC2 . \n"+
    7.75 +////			" FILTER(strdf:anyInteract(?HGEO1,?HGEO2)) "+
    7.76 +//			" FILTER(?H1 != ?H2) "+
    7.77 +//			"}" +
    7.78 +//			" LIMIT 5 \n";
    7.79 +
    7.80 +
    7.81 +
    7.82 +	protected String query3= prefixes +
    7.83 +			"SELECT ?H ?HGEO ?HAT " +
    7.84 +			"(strdf:transform(strdf:intersection(?HGEO, strdf:union(?CGEO)),<http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?DIF) \n"+                                                      
    7.85 +			"WHERE { \n"+ 
    7.86 +			"	?H rdf:type noa:Hotspot ; \n"+
    7.87 +			"      noa:hasAcquisitionTime ?HAT ; \n"+    
    7.88 +			"	   noa:isDerivedFromSensor ?HS ; \n"+    
    7.89 +			"	   noa:hasGeometry ?HGEO . \n"+
    7.90 +			"	FILTER(str(?HS) = \"MSG2\") . \n"+  
    7.91 +			"	FILTER(str(?HAT) = \"2007-08-24T14:45:00\") . \n"+
    7.92 +			"	?C rdf:type noa:Coastline ; \n"+
    7.93 +			"	   noa:hasGeometry ?CGEO . \n"+    
    7.94 +			"	FILTER( strdf:anyInteract(?HGEO, ?CGEO) ) . \n"+
    7.95 +			"} \n"+
    7.96 +			"GROUP BY ?H ?HAT ?HGEO\n"+
    7.97 +			"HAVING strdf:overlap(strdf:union(?CGEO), ?HGEO) " +
    7.98 +			" ";
    7.99 +
   7.100 +	
   7.101 +
   7.102 +
   7.103 +}
     8.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java	Thu May 17 16:35:56 2012 +0300
     8.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java	Thu May 17 18:04:12 2012 +0300
     8.3 @@ -49,10 +49,5 @@
     8.4  		loadTestData();
     8.5  	}
     8.6  	
     8.7 -	protected static void loadTestData()
     8.8 -			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
     8.9 -		{
    8.10 -			URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    8.11 -			strabon.storeInRepo(src, "NTRIPLES");
    8.12 -		}
    8.13 +	
    8.14  }
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/TransformTests.java	Thu May 17 18:04:12 2012 +0300
     9.3 @@ -0,0 +1,83 @@
     9.4 +package eu.earthobservatory.runtime.postgis;
     9.5 +import java.io.IOException;
     9.6 +
     9.7 +import org.junit.AfterClass;
     9.8 +import org.junit.Test;
     9.9 +import org.openrdf.query.MalformedQueryException;
    9.10 +import org.openrdf.query.QueryEvaluationException;
    9.11 +import org.openrdf.query.TupleQueryResultHandlerException;
    9.12 +//import eu.earthobservatory.generaldb.main.Strabon;
    9.13 +import eu.earthobservatory.runtime.generaldb.Strabon;
    9.14 +
    9.15 +public class TransformTests {
    9.16 +
    9.17 +	public static Strabon strabon;
    9.18 +
    9.19 +	@AfterClass
    9.20 +	public static void shutDown()
    9.21 +	{
    9.22 +		strabon.close();
    9.23 +
    9.24 +	}
    9.25 +
    9.26 +
    9.27 +	String prefixes = "PREFIX gag: <http://www.semanticweb.org/ontologies/2011/gagKallikratis.rdf#> \n"+
    9.28 +			"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"+
    9.29 +			"PREFIX strdf: <http://strdf.di.uoa.gr/ontology#> \n"+
    9.30 +			"PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> \n"+
    9.31 +			"PREFIX base: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> \n"+
    9.32 +			"PREFIX ex: <http://www.example.org/ontology#> \n"+
    9.33 +			"PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" +
    9.34 +			"PREFIX geof: <http://www.opengis.net/def/queryLanguage/OGC-GeoSPARQL/1.0/function/> \n";
    9.35 +
    9.36 +	protected String query1 = prefixes +
    9.37 +			"SELECT    ?H1 ?HAT1 ?HGEO1 " +
    9.38 +			"(strdf:transform(?HGEO1, <http://www.opengis.net/def/crs/EPSG/0/4326> ) AS ?converted)" +
    9.39 +			"(strdf:transform(strdf:union(?HGEO1,?HGEO1),<http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?united) "  +
    9.40 +			"WHERE { \n"+
    9.41 +			"?H1 rdf:type noa:Hotspot . \n"+
    9.42 +			"?H1 noa:hasConfidence ?HCONF1 . \n"+
    9.43 +			"?H1 noa:hasGeometry ?HGEO1 . \n"+
    9.44 +			"?H1 noa:hasAcquisitionTime ?HAT1 . \n"+
    9.45 +//			" FILTER(strdf:anyInteract(?HGEO1,?HGEO1)) "+
    9.46 +			"}" +
    9.47 +			" LIMIT 5 \n";
    9.48 +
    9.49 +//	protected String query2 = prefixes +
    9.50 +//			"SELECT    ?H1 ?H2 (strdf:transform(strdf:union(?HGEO1,?HGEO2),<http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?united)"  +
    9.51 +//			"WHERE { \n"+
    9.52 +////			"?H1 rdf:type noa:Hotspot . \n"+
    9.53 +////			"?H2 rdf:type noa:Hotspot . \n"+
    9.54 +//			"?H1 noa:hasGeometry ?HGEO1 . \n"+
    9.55 +//			"?H2 noa:hasGeometry ?HGEO2 . \n"+
    9.56 +////			"?H1 noa:producedFromProcessingChain ?PC1 . \n"+
    9.57 +////			"?H2 noa:producedFromProcessingChain ?PC2 . \n"+
    9.58 +////			" FILTER(strdf:anyInteract(?HGEO1,?HGEO2)) "+
    9.59 +//			" FILTER(?H1 != ?H2) "+
    9.60 +//			"}" +
    9.61 +//			" LIMIT 5 \n";
    9.62 +
    9.63 +
    9.64 +
    9.65 +	protected String query3= prefixes +
    9.66 +			"SELECT ?H ?HGEO ?HAT " +
    9.67 +			"(strdf:transform(strdf:intersection(?HGEO, strdf:union(?CGEO)),<http://www.opengis.net/def/crs/EPSG/0/4326>) AS ?DIF) \n"+                                                      
    9.68 +			"WHERE { \n"+ 
    9.69 +			"	?H rdf:type noa:Hotspot ; \n"+
    9.70 +			"      noa:hasAcquisitionTime ?HAT ; \n"+    
    9.71 +			"	   noa:isDerivedFromSensor ?HS ; \n"+    
    9.72 +			"	   noa:hasGeometry ?HGEO . \n"+
    9.73 +			"	FILTER(str(?HS) = \"MSG2\") . \n"+  
    9.74 +			"	FILTER(str(?HAT) = \"2007-08-24T14:45:00\") . \n"+
    9.75 +			"	?C rdf:type noa:Coastline ; \n"+
    9.76 +			"	   noa:hasGeometry ?CGEO . \n"+    
    9.77 +			"	FILTER( strdf:anyInteract(?HGEO, ?CGEO) ) . \n"+
    9.78 +			"} \n"+
    9.79 +			"GROUP BY ?H ?HAT ?HGEO\n"+
    9.80 +			"HAVING strdf:overlap(strdf:union(?CGEO), ?HGEO) " +
    9.81 +			" ";
    9.82 +
    9.83 +	
    9.84 +
    9.85 +
    9.86 +}