Strabon
changeset 1346:cd3fec856743
Tests for Bug #62
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/bugs/SpatialFunctionInOrderBy.java Tue Jul 01 18:48:46 2014 +0300 1.3 @@ -0,0 +1,20 @@ 1.4 +/** 1.5 + * This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + * 1.9 + * Copyright (C) 2010, 2011, 2012, 2013, 2014 Pyravlos Team 1.10 + * 1.11 + * http://www.strabon.di.uoa.gr/ 1.12 + */ 1.13 +package eu.earthobservatory.testsuite.bugs; 1.14 + 1.15 +import eu.earthobservatory.testsuite.utils.TemplateOrderByTest; 1.16 + 1.17 + 1.18 +/** 1.19 + * Test for Bug #62 (http://bug.strabon.di.uoa.gr/ticket/62). 1.20 + * 1.21 + * @author Dimitrianos Savva <dimis@di.uoa.gr> 1.22 + */ 1.23 +public class SpatialFunctionInOrderBy extends TemplateOrderByTest{}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/TemplateOrderByTest.java Tue Jul 01 18:48:46 2014 +0300 2.3 @@ -0,0 +1,42 @@ 2.4 +/** 2.5 + * This Source Code Form is subject to the terms of the Mozilla Public 2.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 2.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 2.8 + * 2.9 + * Copyright (C) 2010, 2011, 2012, 2013 Pyravlos Team 2.10 + * 2.11 + * http://www.strabon.di.uoa.gr/ 2.12 + */ 2.13 +package eu.earthobservatory.testsuite.utils; 2.14 + 2.15 +import java.io.File; 2.16 +import java.net.URISyntaxException; 2.17 +import java.util.ArrayList; 2.18 +import java.util.Iterator; 2.19 + 2.20 +import org.junit.After; 2.21 +import org.junit.Before; 2.22 +import org.junit.Test; 2.23 + 2.24 + 2.25 +/** 2.26 + * 4) checks if the results of the query are the expected considering ORDER of results 2.27 + * If you don't explicitly use ORDER BY do NOT use this class. Use instead {@link TemplateTest} 2.28 + * @author Dimitrianos Savva <dimis@di.uoa.gr> 2.29 + */ 2.30 +public abstract class TemplateOrderByTest extends TemplateTest 2.31 +{ 2.32 + @Override 2.33 + @Test 2.34 + public void test() throws Exception 2.35 + { 2.36 + Iterator<String> queryFileIterator = queryFile.iterator(); 2.37 + Iterator<String> resultsFileIterator = resultsFile.iterator(); 2.38 + 2.39 + while(queryFileIterator.hasNext() && resultsFileIterator.hasNext()) 2.40 + { 2.41 + boolean take_into_account_order=true; 2.42 + Utils.testQuery(queryFileIterator.next(), resultsFileIterator.next(),take_into_account_order); 2.43 + } 2.44 + } 2.45 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/Area_stRDF.rq Tue Jul 01 18:48:46 2014 +0300 3.3 @@ -0,0 +1,7 @@ 3.4 +SELECT ?x 3.5 +WHERE 3.6 +{ 3.7 +?x geo:hasGeometry ?geom1. 3.8 +?geom1 geo:asWKT ?g 3.9 +} 3.10 +ORDER BY DESC(strdf:area(?g)) 3.11 \ No newline at end of file
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/Area_stRDF.srx Tue Jul 01 18:48:46 2014 +0300 4.3 @@ -0,0 +1,48 @@ 4.4 +<?xml version='1.0' encoding='UTF-8'?> 4.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 4.6 + <head> 4.7 + <variable name='x'/> 4.8 + </head> 4.9 + <results> 4.10 + <result> 4.11 + <binding name='x'> 4.12 + <uri>http://example.org#E</uri> 4.13 + </binding> 4.14 + </result> 4.15 + <result> 4.16 + <binding name='x'> 4.17 + <uri>http://example.org#D</uri> 4.18 + </binding> 4.19 + </result> 4.20 + <result> 4.21 + <binding name='x'> 4.22 + <uri>http://example.org#C</uri> 4.23 + </binding> 4.24 + </result> 4.25 + <result> 4.26 + <binding name='x'> 4.27 + <uri>http://example.org#B</uri> 4.28 + </binding> 4.29 + </result> 4.30 + <result> 4.31 + <binding name='x'> 4.32 + <uri>http://example.org#A</uri> 4.33 + </binding> 4.34 + </result> 4.35 + <result> 4.36 + <binding name='x'> 4.37 + <uri>http://example.org#H</uri> 4.38 + </binding> 4.39 + </result> 4.40 + <result> 4.41 + <binding name='x'> 4.42 + <uri>http://example.org#F</uri> 4.43 + </binding> 4.44 + </result> 4.45 + <result> 4.46 + <binding name='x'> 4.47 + <uri>http://example.org#G</uri> 4.48 + </binding> 4.49 + </result> 4.50 + </results> 4.51 +</sparql> 4.52 \ No newline at end of file
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/Distance_stRDF.rq Tue Jul 01 18:48:46 2014 +0300 5.3 @@ -0,0 +1,13 @@ 5.4 +SELECT ?x ?y 5.5 +WHERE 5.6 +{ 5.7 +?x geo:hasGeometry ?geom1 . 5.8 +?geom1 geo:asWKT ?g1 . 5.9 + 5.10 +?y geo:hasGeometry ?geom2 . 5.11 +?geom2 geo:asWKT ?g2 . 5.12 + 5.13 +FILTER(str(?x) < str(?y)) 5.14 +} 5.15 +ORDER BY DESC(strdf:distance(?g1,?g2)) 5.16 +LIMIT 2 5.17 \ No newline at end of file
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/Distance_stRDF.srx Tue Jul 01 18:48:46 2014 +0300 6.3 @@ -0,0 +1,25 @@ 6.4 +<?xml version='1.0' encoding='UTF-8'?> 6.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 6.6 + <head> 6.7 + <variable name='x'/> 6.8 + <variable name='y'/> 6.9 + </head> 6.10 + <results> 6.11 + <result> 6.12 + <binding name='x'> 6.13 + <uri>http://example.org#A</uri> 6.14 + </binding> 6.15 + <binding name='y'> 6.16 + <uri>http://example.org#F</uri> 6.17 + </binding> 6.18 + </result> 6.19 + <result> 6.20 + <binding name='x'> 6.21 + <uri>http://example.org#F</uri> 6.22 + </binding> 6.23 + <binding name='y'> 6.24 + <uri>http://example.org#G</uri> 6.25 + </binding> 6.26 + </result> 6.27 + </results> 6.28 +</sparql> 6.29 \ No newline at end of file
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/SpatialFunctionInOrderBy.nt Tue Jul 01 18:48:46 2014 +0300 7.3 @@ -0,0 +1,16 @@ 7.4 +<http://example.org#B> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomB>. 7.5 +<http://example.org#C> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomC>. 7.6 +<http://example.org#D> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomD>. 7.7 +<http://example.org#E> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomE>. 7.8 +<http://example.org#A> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomA>. 7.9 +<http://example.org#F> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomF>. 7.10 +<http://example.org#G> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomG>. 7.11 +<http://example.org#H> <http://www.opengis.net/ont/geosparql#hasGeometry> <http://example.org#geomH>. 7.12 +<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>. 7.13 +<http://example.org#geomB> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 1.5 0, 1.5 1.5, 0 1.5 , 0 0)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 7.14 +<http://example.org#geomC> <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>. 7.15 +<http://example.org#geomD> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 3 0, 3 3, 0 3 , 0 0)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 7.16 +<http://example.org#geomE> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((0 0, 4 0, 4 4, 0 4 , 0 0)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 7.17 +<http://example.org#geomF> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Linestring(3 2, 4 0) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 7.18 +<http://example.org#geomG> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Point(1 1) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>. 7.19 +<http://example.org#geomH> <http://www.opengis.net/ont/geosparql#asWKT> " <http://www.opengis.net/def/crs/OGC/1.3/CRS84> Polygon((2.1 1.1, 2.9 1.1, 2.9 1.9, 2.1 1.9, 2.1 1.1)) "^^<http://www.opengis.net/ont/geosparql#wktLiteral>.
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/StrExample.rq Tue Jul 01 18:48:46 2014 +0300 8.3 @@ -0,0 +1,8 @@ 8.4 +#Test also a non spatial function to be sure 8.5 + 8.6 +SELECT ?x 8.7 +WHERE 8.8 +{ 8.9 +?x geo:hasGeometry ?geom1 8.10 +} 8.11 +ORDER BY (str(?x)) 8.12 \ No newline at end of file
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/testsuite/src/test/resources/bugs/SpatialFunctionInOrderBy/StrExample.srx Tue Jul 01 18:48:46 2014 +0300 9.3 @@ -0,0 +1,48 @@ 9.4 +<?xml version='1.0' encoding='UTF-8'?> 9.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 9.6 + <head> 9.7 + <variable name='x'/> 9.8 + </head> 9.9 + <results> 9.10 + <result> 9.11 + <binding name='x'> 9.12 + <uri>http://example.org#A</uri> 9.13 + </binding> 9.14 + </result> 9.15 + <result> 9.16 + <binding name='x'> 9.17 + <uri>http://example.org#B</uri> 9.18 + </binding> 9.19 + </result> 9.20 + <result> 9.21 + <binding name='x'> 9.22 + <uri>http://example.org#C</uri> 9.23 + </binding> 9.24 + </result> 9.25 + <result> 9.26 + <binding name='x'> 9.27 + <uri>http://example.org#D</uri> 9.28 + </binding> 9.29 + </result> 9.30 + <result> 9.31 + <binding name='x'> 9.32 + <uri>http://example.org#E</uri> 9.33 + </binding> 9.34 + </result> 9.35 + <result> 9.36 + <binding name='x'> 9.37 + <uri>http://example.org#F</uri> 9.38 + </binding> 9.39 + </result> 9.40 + <result> 9.41 + <binding name='x'> 9.42 + <uri>http://example.org#G</uri> 9.43 + </binding> 9.44 + </result> 9.45 + <result> 9.46 + <binding name='x'> 9.47 + <uri>http://example.org#H</uri> 9.48 + </binding> 9.49 + </result> 9.50 + </results> 9.51 +</sparql> 9.52 \ No newline at end of file