Strabon

changeset 197:a92eae721a40

Remove strdf:dimension from testQuerySpatialProperties[Const)] only in MonetDB tests
author George Garbis <ggarbis@di.uoa.gr>
date Thu May 24 14:43:15 2012 +0300 (2012-05-24)
parents 6a9493a4fe5e
children b0891a609ae3
files runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java runtime/src/test/java/eu/earthobservatory/runtime/monetdb/GeneralTests.java runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java
line diff
     1.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java	Thu May 24 14:36:56 2012 +0300
     1.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java	Thu May 24 14:43:15 2012 +0300
     1.3 @@ -18,7 +18,7 @@
     1.4  import eu.earthobservatory.runtime.generaldb.Strabon;
     1.5  import eu.earthobservatory.runtime.postgis.SimpleTests;
     1.6  
     1.7 -public class GeneralTests {
     1.8 +abstract public class GeneralTests {
     1.9  	public static Strabon strabon;
    1.10  	
    1.11  	
    1.12 @@ -42,14 +42,14 @@
    1.13  	
    1.14  	
    1.15  
    1.16 -	String prefixes = 
    1.17 +	protected String prefixes = 
    1.18  			"PREFIX lgdo:<http://linkedgeodata.org/ontology/> "+
    1.19  					"PREFIX geo:<http://www.w3.org/2003/01/geo/wgs84_pos#> "+
    1.20  					"PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "+
    1.21  					"PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> "+
    1.22  					"PREFIX geonames:<http://www.geonames.org/ontology/>";
    1.23  
    1.24 -	String query1 = 
    1.25 +	protected String query1 = 
    1.26  			prefixes+
    1.27  			"SELECT ?place ?placegeo "+ 
    1.28  			"WHERE { "+
    1.29 @@ -60,7 +60,7 @@
    1.30  			"FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)) "+
    1.31  			"}";
    1.32  
    1.33 -	String query2 = 
    1.34 +	protected String query2 = 
    1.35  			prefixes+
    1.36  			"SELECT ?place (?placegeo AS ?tt1) (strdf:union(?placegeo,?placegeo) AS ?constr) "+
    1.37  			"WHERE { "+
    1.38 @@ -71,7 +71,7 @@
    1.39  			"FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)) "+
    1.40  			"}";
    1.41  
    1.42 -	String query3 = 
    1.43 +	protected String query3 = 
    1.44  			prefixes+
    1.45  			"SELECT ?place (?placegeo AS ?constr) "+
    1.46  			"WHERE { "+
    1.47 @@ -82,7 +82,7 @@
    1.48  			"FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)) "+
    1.49  			"}";
    1.50  
    1.51 -	String query4 =
    1.52 +	protected String query4 =
    1.53  			prefixes+
    1.54  			"SELECT ?place ?placegeo "+
    1.55  			"WHERE { "+
    1.56 @@ -94,7 +94,7 @@
    1.57  			"&& strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)) "+
    1.58  			"}";
    1.59  
    1.60 -	String query5 =
    1.61 +	protected String query5 =
    1.62  			prefixes+
    1.63  			"SELECT ?place ?placegeo "+
    1.64  			"WHERE { "+
    1.65 @@ -106,7 +106,7 @@
    1.66  			"FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)). "+
    1.67  			"}";
    1.68  
    1.69 -	String query6 =
    1.70 +	protected String query6 =
    1.71  			prefixes+
    1.72  			"SELECT (strdf:union(?placegeo,strdf:union(?placegeo,?placegeo)) AS ?constr1) " +
    1.73  			"?place (?placegeo AS ?tt1) (strdf:union(?placegeo,?placegeo) AS ?constr2) "+
    1.74 @@ -118,7 +118,7 @@
    1.75  			"FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo)) "+
    1.76  			"}";
    1.77  
    1.78 -	String query7 = 
    1.79 +	protected String query7 = 
    1.80  			prefixes+
    1.81  			"SELECT ?place (?placegeo AS ?tt1) (strdf:union(?placegeo,?placegeo) AS ?constr) "+
    1.82  			"WHERE { "+
    1.83 @@ -128,7 +128,7 @@
    1.84  			"   rdfs:label ?placename . "+
    1.85  			"} ";
    1.86  
    1.87 -	String query8 = 
    1.88 +	protected String query8 = 
    1.89  			prefixes+
    1.90  			"SELECT ?place "+  
    1.91  			"WHERE { "+
    1.92 @@ -139,7 +139,7 @@
    1.93  			"FILTER(strdf:anyInteract(?placegeo,?placegeo)) "+
    1.94  			"}";
    1.95  
    1.96 -	String queryBufferVar =
    1.97 +	protected String queryBufferVar =
    1.98  			prefixes+
    1.99  			"SELECT  ?place (?placegeo AS ?tt1)  "+
   1.100  			"WHERE {  ?x lgdo:bufferExtent ?ext .  "+ 
   1.101 @@ -150,7 +150,7 @@
   1.102  			"FILTER(strdf:anyInteract(strdf:buffer(?placegeo,?ext),?placegeo)) "+
   1.103  			"}";
   1.104  
   1.105 -	String queryBufferConst =
   1.106 +	protected String queryBufferConst =
   1.107  			prefixes+
   1.108  			"SELECT  ?place (?placegeo AS ?tt1)  "+
   1.109  			"WHERE {  ?x lgdo:bufferExtent ?ext .  "+ 
   1.110 @@ -161,7 +161,7 @@
   1.111  			"FILTER(strdf:anyInteract(strdf:buffer(?placegeo,2),?placegeo)) "+
   1.112  			"}";
   1.113  
   1.114 -	String queryBufferConst2 =
   1.115 +	protected String queryBufferConst2 =
   1.116  			prefixes+
   1.117  			"SELECT  ?place (?placegeo AS ?tt1)  "+
   1.118  			"WHERE {  ?x lgdo:bufferExtent ?ext .  "+ 
   1.119 @@ -172,19 +172,19 @@
   1.120  			"FILTER(strdf:anyInteract(strdf:buffer(\"POINT(23.72873 37.97205)\"^^<http://strdf.di.uoa.gr/ontology#WKT>,0.0572),?placegeo)) "+
   1.121  			"}";
   1.122  
   1.123 -	String queryBufferConstInSelect =
   1.124 +	protected String queryBufferConstInSelect =
   1.125  			prefixes+
   1.126 -			"SELECT  ?place (?placegeo AS ?tt1) (strdf:buffer(?placegeo,2) AS ?buf) "+
   1.127 +			"SELECT  ?place (?placegeo AS ?tt1) (strdf:buffer(?placegeo,2.5) AS ?buf) "+
   1.128  			"WHERE {  ?x lgdo:bufferExtent ?ext .  "+ 
   1.129  			"?place "+
   1.130  			"	a ?type ; "+
   1.131  			"	geo:geometry ?placegeo ; "+
   1.132  			"	rdfs:label ?placename . "+
   1.133 -			"FILTER(strdf:anyInteract(strdf:buffer(?placegeo,2),?placegeo)) "+
   1.134 +			"FILTER(strdf:anyInteract(strdf:buffer(?placegeo,2.5),?placegeo)) "+
   1.135  			"}";
   1.136  
   1.137  
   1.138 -	String queryBufferSelectFilterA =
   1.139 +	protected String queryBufferSelectFilterA =
   1.140  			prefixes+
   1.141  			"SELECT  ?place (?placegeo AS ?tt1) (strdf:buffer(?placegeo,?ext) AS ?buf) "+
   1.142  			"WHERE { ?x lgdo:bufferExtent ?ext . "+ 
   1.143 @@ -195,7 +195,7 @@
   1.144  			"FILTER(strdf:anyInteract(strdf:buffer(?placegeo,2),?placegeo)) "+
   1.145  			"}";
   1.146  
   1.147 -	String queryBufferSelectFilterB =
   1.148 +	protected String queryBufferSelectFilterB =
   1.149  			prefixes+
   1.150  			"SELECT  ?place (?placegeo AS ?tt1) (strdf:buffer(?placegeo,3) AS ?buf) "+
   1.151  			"WHERE { ?x lgdo:bufferExtent ?ext . "+ 
   1.152 @@ -206,7 +206,7 @@
   1.153  			"FILTER(strdf:anyInteract(strdf:buffer(?placegeo,?ext),?placegeo)) "+
   1.154  			"}";
   1.155  
   1.156 -	String queryEnvelopeConvexHull = 
   1.157 +	protected String queryEnvelopeConvexHull = 
   1.158  			prefixes+
   1.159  			"SELECT ?place (?placegeo AS ?tt1) (strdf:envelope(?placegeo) AS ?constr)  (strdf:convexHull(?placegeo) AS ?constr2) "+ 
   1.160  			"WHERE { "+
   1.161 @@ -217,7 +217,7 @@
   1.162  			"FILTER(strdf:anyInteract(strdf:union(?placegeo,strdf:envelope(?placegeo)),?placegeo) && strdf:anyInteract(strdf:convexHull(?placegeo),?placegeo)) "+
   1.163  			"}";
   1.164  
   1.165 -	String queryMetrics1 =
   1.166 +	protected String queryMetrics1 =
   1.167  			prefixes+
   1.168  			"SELECT ?place ?placegeo  ( strdf:area(?placegeo) AS ?area) "+
   1.169  			"( strdf:envelope(?placegeo) AS ?mbb) "+
   1.170 @@ -230,7 +230,7 @@
   1.171  			"< ?ext + 8 - strdf:distance(?placegeo,?placegeo)) "+
   1.172  			"}";
   1.173  
   1.174 -	String queryMetricsLightOptimized = 
   1.175 +	protected String queryMetricsLightOptimized = 
   1.176  			prefixes+
   1.177  			"SELECT ?place ?placegeo  ( 33*strdf:area(?placegeo) + 114 AS ?area) ( strdf:envelope(?placegeo) AS ?mbb) "+
   1.178  			"WHERE {   ?x lgdo:bufferExtent ?ext . "+ 
   1.179 @@ -242,7 +242,7 @@
   1.180  			"}";
   1.181  
   1.182  	//Metrics with only one var must not be optimized
   1.183 -	String queryMetricsAreaMustNotBeOptimized =
   1.184 +	protected String queryMetricsAreaMustNotBeOptimized =
   1.185  			prefixes+
   1.186  			"SELECT ?place ?placegeo  ( 33*strdf:area(?placegeo) + 114 AS ?area) ( strdf:envelope(?placegeo) AS ?mbb) "+
   1.187  			"WHERE {   ?x lgdo:bufferExtent ?ext . "+ 
   1.188 @@ -253,7 +253,7 @@
   1.189  			"FILTER(2*strdf:area(?placegeo) < 8) "+
   1.190  			"}";
   1.191  
   1.192 -	String queryMetricsMathInSelect =
   1.193 +	protected String queryMetricsMathInSelect =
   1.194  			prefixes+
   1.195  			"SELECT ?place ?placegeo  ( 33*strdf:area(?placegeo) + 114 AS ?area) ( strdf:envelope(?placegeo) AS ?mbb) "+
   1.196  			"WHERE {   ?x lgdo:bufferExtent ?ext . "+ 
   1.197 @@ -265,7 +265,7 @@
   1.198  			"< ?ext + 8 - strdf:distance(?placegeo,?placegeo)) "+
   1.199  			"}";
   1.200  
   1.201 -	String querySpatialProperties = 
   1.202 +	protected String querySpatialPropertiesMonetDB = 
   1.203  			prefixes+
   1.204  			"SELECT ?place ?placegeo (strdf:dimension(?placegeo) + 2 AS ?dim) (strdf:srid(?placegeo) AS ?srid) "+
   1.205  			"WHERE { "+
   1.206 @@ -274,10 +274,23 @@
   1.207  			"	geo:geometry ?placegeo ; "+
   1.208  			"	a ?type. "+
   1.209  			"FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo) && strdf:isSimple(?placegeo) "+ 
   1.210 -			"&& strdf:dimension(?placegeo) - 1 < 3) "+
   1.211 +//			"&& strdf:dimension(?placegeo) - 1 < 3" +
   1.212 +			") "+
   1.213  			"}";
   1.214 +	
   1.215 +	protected String querySpatialPropertiesPostGIS = 
   1.216 +		prefixes+
   1.217 +		"SELECT ?place ?placegeo (strdf:dimension(?placegeo) + 2 AS ?dim) (strdf:srid(?placegeo) AS ?srid) "+
   1.218 +		"WHERE { "+
   1.219 +		"?place "+
   1.220 +		"	rdfs:label ?placename ; "+	
   1.221 +		"	geo:geometry ?placegeo ; "+
   1.222 +		"	a ?type. "+
   1.223 +		"FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo) && strdf:isSimple(?placegeo) "+ 
   1.224 +		"&& strdf:dimension(?placegeo) - 1 < 3) "+
   1.225 +		"}";
   1.226  
   1.227 -	String querySpatialPropertiesConst = 
   1.228 +	protected String querySpatialPropertiesConstMonetDB = 
   1.229  			prefixes+
   1.230  			"SELECT ?place ?placegeo (strdf:srid(?placegeo) AS ?srid) (strdf:dimension(?placegeo) + 2 AS ?dim)  "+
   1.231  			"WHERE { "+
   1.232 @@ -286,10 +299,23 @@
   1.233  			"	geo:geometry ?placegeo ; "+
   1.234  			"	a ?type. "+
   1.235  			"FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo) && strdf:isSimple(?placegeo) "+ 
   1.236 -			"&& strdf:dimension(\"POINT(0 0)\") - 1 < 3) "+
   1.237 +//			"&& strdf:dimension(\"POINT(0 0)\") - 1 < 3" +
   1.238 +			") "+
   1.239  			"}";
   1.240  
   1.241 -	String queryRelate = 
   1.242 +	protected String querySpatialPropertiesConstPostGIS = 
   1.243 +		prefixes+
   1.244 +		"SELECT ?place ?placegeo (strdf:srid(?placegeo) AS ?srid) (strdf:dimension(?placegeo) + 2 AS ?dim)  "+
   1.245 +		"WHERE { "+
   1.246 +		"?place "+
   1.247 +		"	rdfs:label ?placename ; "+	
   1.248 +		"	geo:geometry ?placegeo ; "+
   1.249 +		"	a ?type. "+
   1.250 +		"FILTER(strdf:anyInteract(strdf:union(?placegeo,?placegeo),?placegeo) && strdf:isSimple(?placegeo) "+ 
   1.251 +		"&& strdf:dimension(\"POINT(0 0)\") - 1 < 3) "+
   1.252 +		"}";
   1.253 +	
   1.254 +	protected String queryRelate = 
   1.255  			prefixes+
   1.256  			"SELECT ?place ?placegeo "+
   1.257  			"WHERE { "+
   1.258 @@ -300,7 +326,7 @@
   1.259  			"FILTER(strdf:relate(?placegeo,?placegeo,\"0FFFFF212\")) "+
   1.260  			"}";
   1.261  
   1.262 -	//	String queryThematicUnion = 
   1.263 +	//	protected String queryThematicUnion = 
   1.264  	//			prefixes+
   1.265  	//			"SELECT ?place "+
   1.266  	//			"WHERE { "+
   1.267 @@ -316,7 +342,7 @@
   1.268  	 * The following three queries test potential bugs noticed during the evaluation process for www2012.
   1.269  	 * No issue seems to be present.
   1.270  	 */
   1.271 -	String queryThematicUnion = 
   1.272 +	protected String queryThematicUnion = 
   1.273  			prefixes+
   1.274  			"SELECT ?place2 ?placename "+
   1.275  			" WHERE { "+
   1.276 @@ -333,7 +359,7 @@
   1.277  			"FILTER(strdf:disjoint(?placegeo,?ar))" +
   1.278  			"}";
   1.279  
   1.280 -	String query6_real = prefixes+
   1.281 +	protected String query6_real = prefixes+
   1.282  			"SELECT ?capital ?pierLabel "+
   1.283  			"WHERE  "+
   1.284  			"{ "+
   1.285 @@ -351,7 +377,7 @@
   1.286  			"} "+
   1.287  			"} ";
   1.288  
   1.289 -	String query6_real_union = prefixes+
   1.290 +	protected String query6_real_union = prefixes+
   1.291  			"SELECT ?capital ?pierLabel "+
   1.292  			"WHERE  "+
   1.293  			"{ "+
   1.294 @@ -375,7 +401,7 @@
   1.295  			"} "+
   1.296  			"} ";
   1.297  
   1.298 -	String queryNegation = prefixes+
   1.299 +	protected String queryNegation = prefixes+
   1.300  			"SELECT ?capital ?pier "+
   1.301  			"WHERE  "+
   1.302  			"{ "+
   1.303 @@ -396,7 +422,7 @@
   1.304  			"";
   1.305  	
   1.306  	//Representative of functionality. If I remove !bound, 3 more results appear
   1.307 -	String queryNegation2 = prefixes+
   1.308 +	protected String queryNegation2 = prefixes+
   1.309  			"SELECT ?s ?pier "+
   1.310  			"WHERE  "+
   1.311  			"{ "+
   1.312 @@ -413,7 +439,7 @@
   1.313  			"";
   1.314  	
   1.315  	
   1.316 -	String queryNotExists = 
   1.317 +	protected String queryNotExists = 
   1.318  		prefixes+
   1.319  		"SELECT ?capital ?pierLabel "+
   1.320  		"WHERE  "+
   1.321 @@ -568,19 +594,13 @@
   1.322  	}
   1.323  
   1.324  	@Test
   1.325 -	public void testQuerySpatialProperties() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   1.326 -	{
   1.327 -		strabon.query(querySpatialProperties,strabon.getSailRepoConnection());
   1.328 -
   1.329 -	}
   1.330 +	// MonetDB has not function Dimension
   1.331 +	abstract public void testQuerySpatialProperties() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException ;
   1.332  
   1.333  	@Test
   1.334 -	public void testQuerySpatialPropertiesConst() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   1.335 -	{
   1.336 -		strabon.query(querySpatialPropertiesConst,strabon.getSailRepoConnection());
   1.337 -
   1.338 -	}
   1.339 -
   1.340 +	// MonetDB has not function Dimension
   1.341 +	abstract public void testQuerySpatialPropertiesConst() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException ;
   1.342 +	
   1.343  	@Test
   1.344  	public void testQueryRelate() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
   1.345  	{
     2.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/GeneralTests.java	Thu May 24 14:36:56 2012 +0300
     2.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/GeneralTests.java	Thu May 24 14:43:15 2012 +0300
     2.3 @@ -10,6 +10,10 @@
     2.4  
     2.5  import org.junit.AfterClass;
     2.6  import org.junit.BeforeClass;
     2.7 +import org.junit.Test;
     2.8 +import org.openrdf.query.MalformedQueryException;
     2.9 +import org.openrdf.query.QueryEvaluationException;
    2.10 +import org.openrdf.query.TupleQueryResultHandlerException;
    2.11  import org.openrdf.repository.RepositoryException;
    2.12  import org.openrdf.rio.RDFHandlerException;
    2.13  import org.openrdf.rio.RDFParseException;
    2.14 @@ -36,6 +40,20 @@
    2.15  		TemplateTests.afterClass(strabon);
    2.16  	}
    2.17  	
    2.18 +	@Test
    2.19 +	public void testQuerySpatialProperties() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
    2.20 +	{
    2.21 +		strabon.query(querySpatialPropertiesMonetDB,strabon.getSailRepoConnection());
    2.22 +
    2.23 +	}
    2.24 +
    2.25 +	@Test
    2.26 +	public void testQuerySpatialPropertiesConst() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
    2.27 +	{
    2.28 +		strabon.query(querySpatialPropertiesConstMonetDB,strabon.getSailRepoConnection());
    2.29 +
    2.30 +	}
    2.31 +	
    2.32  //	/**
    2.33  //	 * @throws java.lang.Exception
    2.34  //	 */
     3.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java	Thu May 24 14:36:56 2012 +0300
     3.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java	Thu May 24 14:43:15 2012 +0300
     3.3 @@ -11,6 +11,10 @@
     3.4  
     3.5  import org.junit.AfterClass;
     3.6  import org.junit.BeforeClass;
     3.7 +import org.junit.Test;
     3.8 +import org.openrdf.query.MalformedQueryException;
     3.9 +import org.openrdf.query.QueryEvaluationException;
    3.10 +import org.openrdf.query.TupleQueryResultHandlerException;
    3.11  import org.openrdf.repository.RepositoryException;
    3.12  import org.openrdf.rio.RDFHandlerException;
    3.13  import org.openrdf.rio.RDFParseException;
    3.14 @@ -37,6 +41,19 @@
    3.15  		TemplateTests.afterClass(strabon);
    3.16  	}
    3.17  	
    3.18 +	@Test
    3.19 +	public void testQuerySpatialProperties() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
    3.20 +	{
    3.21 +		strabon.query(querySpatialPropertiesPostGIS,strabon.getSailRepoConnection());
    3.22 +
    3.23 +	}
    3.24 +
    3.25 +	@Test
    3.26 +	public void testQuerySpatialPropertiesConst() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
    3.27 +	{
    3.28 +		strabon.query(querySpatialPropertiesConstPostGIS,strabon.getSailRepoConnection());
    3.29 +
    3.30 +	}
    3.31  
    3.32  	
    3.33  //	/**