Strabon
changeset 1218:b28b826845e5
Added tests for spatial metric functions of stSPARQL.
line diff
1.1 --- a/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/DistanceTest.java Tue Jul 16 18:32:54 2013 +0300 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,20 +0,0 @@ 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 Pyravlos Team 1.10 - * 1.11 - * http://www.strabon.di.uoa.gr/ 1.12 - */ 1.13 -package eu.earthobservatory.testsuite.stSPARQL; 1.14 - 1.15 -import eu.earthobservatory.testsuite.utils.TemplateTest; 1.16 - 1.17 -/** 1.18 - * A test for the strdf:distance function. 1.19 - * 1.20 - * @author Stella Giannakopoulou <sgian@di.uoa.gr 1.21 - */ 1.22 - 1.23 -public class DistanceTest extends TemplateTest {}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/stSPARQL/MetricFunctionsTest.java Tue Jul 16 19:30:35 2013 +0300 2.3 @@ -0,0 +1,20 @@ 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.stSPARQL; 2.14 + 2.15 +import eu.earthobservatory.testsuite.utils.TemplateTest; 2.16 + 2.17 +/** 2.18 + * A test for the metric functions of stSPARQL. 2.19 + * 2.20 + * @author Panayiotis Smeros <psmeros@di.uoa.gr> 2.21 + */ 2.22 + 2.23 +public class MetricFunctionsTest extends TemplateTest {}
3.1 --- a/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTest.nt Tue Jul 16 18:32:54 2013 +0300 3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 3.3 @@ -1,3 +0,0 @@ 3.4 -<http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> "POINT(23.6423757 37.9521198)"^^<http://strdf.di.uoa.gr/ontology#WKT> . 3.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> . 3.6 -<http://example.org/id/Point/5533> <http://example.org/ontology/hasGeometry> "POINT(21.841968 38.045047)"^^<http://strdf.di.uoa.gr/ontology#WKT> . 3.7 \ No newline at end of file
4.1 --- a/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestDegrees.rq Tue Jul 16 18:32:54 2013 +0300 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,6 +0,0 @@ 4.4 -select (strdf:distance(?g1, ?g2, ogc:degree) as ?dist) 4.5 -where 4.6 -{ 4.7 - <http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> ?g1 . 4.8 - <http://example.org/id/Point/5532> <http://example.org/ontology/hasGeometry> ?g2 . 4.9 -} 4.10 \ No newline at end of file
5.1 --- a/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestDegrees.srx Tue Jul 16 18:32:54 2013 +0300 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,13 +0,0 @@ 5.4 -<?xml version='1.0' encoding='UTF-8'?> 5.5 -<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 5.6 - <head> 5.7 - <variable name='dist'/> 5.8 - </head> 5.9 - <results> 5.10 - <result> 5.11 - <binding name='dist'> 5.12 - <literal datatype='http://www.w3.org/2001/XMLSchema#double'>45.58024597167969</literal> 5.13 - </binding> 5.14 - </result> 5.15 - </results> 5.16 -</sparql> 5.17 \ No newline at end of file
6.1 --- a/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestFilter.rq Tue Jul 16 18:32:54 2013 +0300 6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 6.3 @@ -1,7 +0,0 @@ 6.4 -select ?x ?y 6.5 -where 6.6 -{ 6.7 - ?x <http://example.org/ontology/hasGeometry> ?g1 . 6.8 - ?y <http://example.org/ontology/hasGeometry> ?g2 . 6.9 - FILTER(strdf:distance(?g1, ?g2, ogc:metre) < 5) 6.10 -} 6.11 \ No newline at end of file
7.1 --- a/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestFilter.srx Tue Jul 16 18:32:54 2013 +0300 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,33 +0,0 @@ 7.4 -<?xml version='1.0' encoding='UTF-8'?> 7.5 -<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 7.6 - <head> 7.7 - <variable name='x'/> 7.8 - <variable name='y'/> 7.9 - </head> 7.10 - <results> 7.11 - <result> 7.12 - <binding name='y'> 7.13 - <uri>http://example.org/id/Point/5531</uri> 7.14 - </binding> 7.15 - <binding name='x'> 7.16 - <uri>http://example.org/id/Point/5531</uri> 7.17 - </binding> 7.18 - </result> 7.19 - <result> 7.20 - <binding name='y'> 7.21 - <uri>http://example.org/id/Point/5532</uri> 7.22 - </binding> 7.23 - <binding name='x'> 7.24 - <uri>http://example.org/id/Point/5532</uri> 7.25 - </binding> 7.26 - </result> 7.27 - <result> 7.28 - <binding name='y'> 7.29 - <uri>http://example.org/id/Point/5533</uri> 7.30 - </binding> 7.31 - <binding name='x'> 7.32 - <uri>http://example.org/id/Point/5533</uri> 7.33 - </binding> 7.34 - </result> 7.35 - </results> 7.36 -</sparql> 7.37 \ No newline at end of file
8.1 --- a/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestMetres.rq Tue Jul 16 18:32:54 2013 +0300 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,6 +0,0 @@ 8.4 -select (strdf:distance(?g1, ?g2, ogc:metre) as ?dist) 8.5 -where 8.6 -{ 8.7 - <http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> ?g1 . 8.8 - <http://example.org/id/Point/5532> <http://example.org/ontology/hasGeometry> ?g2 . 8.9 -} 8.10 \ No newline at end of file
9.1 --- a/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestMetres.srx Tue Jul 16 18:32:54 2013 +0300 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,13 +0,0 @@ 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='dist'/> 9.8 - </head> 9.9 - <results> 9.10 - <result> 9.11 - <binding name='dist'> 9.12 - <literal datatype='http://www.w3.org/2001/XMLSchema#double'>4860346.0</literal> 9.13 - </binding> 9.14 - </result> 9.15 - </results> 9.16 -</sparql>
10.1 --- a/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestWithUnion.rq Tue Jul 16 18:32:54 2013 +0300 10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 10.3 @@ -1,7 +0,0 @@ 10.4 -select (strdf:distance(strdf:union(?g1, ?g2), ?g3, ogc:metre) as ?dist) 10.5 -where 10.6 -{ 10.7 - <http://example.org/id/Point/5531> <http://example.org/ontology/hasGeometry> ?g1 . 10.8 - <http://example.org/id/Point/5532> <http://example.org/ontology/hasGeometry> ?g2 . 10.9 - <http://example.org/id/Point/5533> <http://example.org/ontology/hasGeometry> ?g3 . 10.10 -} 10.11 \ No newline at end of file
11.1 --- a/testsuite/src/test/resources/stSPARQL/DistanceTest/DistanceTestWithUnion.srx Tue Jul 16 18:32:54 2013 +0300 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,13 +0,0 @@ 11.4 -<?xml version='1.0' encoding='UTF-8'?> 11.5 -<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 11.6 - <head> 11.7 - <variable name='dist'/> 11.8 - </head> 11.9 - <results> 11.10 - <result> 11.11 - <binding name='dist'> 11.12 - <literal datatype='http://www.w3.org/2001/XMLSchema#double'>158470.796875</literal> 11.13 - </binding> 11.14 - </result> 11.15 - </results> 11.16 -</sparql> 11.17 \ No newline at end of file
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/AreaTest.rq Tue Jul 16 19:30:35 2013 +0300 12.3 @@ -0,0 +1,5 @@ 12.4 +select (strdf:area(?g) as ?area) 12.5 +where 12.6 +{ 12.7 + ex:A ex:hasGeometry ?g . 12.8 +} 12.9 \ No newline at end of file
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/AreaTest.srx Tue Jul 16 19:30:35 2013 +0300 13.3 @@ -0,0 +1,13 @@ 13.4 +<?xml version='1.0' encoding='UTF-8'?> 13.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 13.6 + <head> 13.7 + <variable name='area'/> 13.8 + </head> 13.9 + <results> 13.10 + <result> 13.11 + <binding name='area'> 13.12 + <literal datatype='http://www.w3.org/2001/XMLSchema#double'>1.0</literal> 13.13 + </binding> 13.14 + </result> 13.15 + </results> 13.16 +</sparql>
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/DistanceDegreesTest.rq Tue Jul 16 19:30:35 2013 +0300 14.3 @@ -0,0 +1,6 @@ 14.4 +select (strdf:distance(?g1, ?g2, ogc:degree) as ?dist) 14.5 +where 14.6 +{ 14.7 + ex:A ex:hasGeometry ?g1 . 14.8 + ex:D ex:hasGeometry ?g2 . 14.9 +} 14.10 \ No newline at end of file
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/DistanceDegreesTest.srx Tue Jul 16 19:30:35 2013 +0300 15.3 @@ -0,0 +1,13 @@ 15.4 +<?xml version='1.0' encoding='UTF-8'?> 15.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 15.6 + <head> 15.7 + <variable name='dist'/> 15.8 + </head> 15.9 + <results> 15.10 + <result> 15.11 + <binding name='dist'> 15.12 + <literal datatype='http://www.w3.org/2001/XMLSchema#double'>2.0</literal> 15.13 + </binding> 15.14 + </result> 15.15 + </results> 15.16 +</sparql>
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/DistanceFilterTest.rq Tue Jul 16 19:30:35 2013 +0300 16.3 @@ -0,0 +1,7 @@ 16.4 +select ?x ?y 16.5 +where 16.6 +{ 16.7 + ?x ex:hasGeometry ?g1 . 16.8 + ?y ex:hasGeometry ?g2 . 16.9 + FILTER(strdf:distance(?g1, ?g2, ogc:degree) > 2) 16.10 +} 16.11 \ No newline at end of file
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/DistanceFilterTest.srx Tue Jul 16 19:30:35 2013 +0300 17.3 @@ -0,0 +1,41 @@ 17.4 +<?xml version='1.0' encoding='UTF-8'?> 17.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 17.6 + <head> 17.7 + <variable name='x'/> 17.8 + <variable name='y'/> 17.9 + </head> 17.10 + <results> 17.11 + <result> 17.12 + <binding name='y'> 17.13 + <uri>http://example.org#F</uri> 17.14 + </binding> 17.15 + <binding name='x'> 17.16 + <uri>http://example.org#A</uri> 17.17 + </binding> 17.18 + </result> 17.19 + <result> 17.20 + <binding name='y'> 17.21 + <uri>http://example.org#A</uri> 17.22 + </binding> 17.23 + <binding name='x'> 17.24 + <uri>http://example.org#F</uri> 17.25 + </binding> 17.26 + </result> 17.27 + <result> 17.28 + <binding name='y'> 17.29 + <uri>http://example.org#G</uri> 17.30 + </binding> 17.31 + <binding name='x'> 17.32 + <uri>http://example.org#F</uri> 17.33 + </binding> 17.34 + </result> 17.35 + <result> 17.36 + <binding name='y'> 17.37 + <uri>http://example.org#F</uri> 17.38 + </binding> 17.39 + <binding name='x'> 17.40 + <uri>http://example.org#G</uri> 17.41 + </binding> 17.42 + </result> 17.43 + </results> 17.44 +</sparql>
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/DistanceMetresTest.rq Tue Jul 16 19:30:35 2013 +0300 18.3 @@ -0,0 +1,6 @@ 18.4 +select (strdf:distance(?g1, ?g2, ogc:metre) as ?dist) 18.5 +where 18.6 +{ 18.7 + ex:A ex:hasGeometry ?g1 . 18.8 + ex:D ex:hasGeometry ?g2 . 18.9 +} 18.10 \ No newline at end of file
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/DistanceMetresTest.srx Tue Jul 16 19:30:35 2013 +0300 19.3 @@ -0,0 +1,13 @@ 19.4 +<?xml version='1.0' encoding='UTF-8'?> 19.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 19.6 + <head> 19.7 + <variable name='dist'/> 19.8 + </head> 19.9 + <results> 19.10 + <result> 19.11 + <binding name='dist'> 19.12 + <literal datatype='http://www.w3.org/2001/XMLSchema#double'>222605.28125</literal> 19.13 + </binding> 19.14 + </result> 19.15 + </results> 19.16 +</sparql>
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/DistanceUnionTest.rq Tue Jul 16 19:30:35 2013 +0300 20.3 @@ -0,0 +1,7 @@ 20.4 +select (strdf:distance(strdf:union(?g1, ?g2), ?g3, ogc:metre) as ?dist) 20.5 +where 20.6 +{ 20.7 + ex:A ex:hasGeometry ?g1 . 20.8 + ex:B ex:hasGeometry ?g2 . 20.9 + ex:D ex:hasGeometry ?g3 . 20.10 +} 20.11 \ No newline at end of file
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/DistanceUnionTest.srx Tue Jul 16 19:30:35 2013 +0300 21.3 @@ -0,0 +1,13 @@ 21.4 +<?xml version='1.0' encoding='UTF-8'?> 21.5 +<sparql xmlns='http://www.w3.org/2005/sparql-results#'> 21.6 + <head> 21.7 + <variable name='dist'/> 21.8 + </head> 21.9 + <results> 21.10 + <result> 21.11 + <binding name='dist'> 21.12 + <literal datatype='http://www.w3.org/2001/XMLSchema#double'>111252.1328125</literal> 21.13 + </binding> 21.14 + </result> 21.15 + </results> 21.16 +</sparql> 21.17 \ No newline at end of file
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/testsuite/src/test/resources/stSPARQL/MetricFunctionsTest/MetricFunctionsTest.nt Tue Jul 16 19:30:35 2013 +0300 22.3 @@ -0,0 +1,8 @@ 22.4 +<http://example.org#A> <http://example.org#hasGeometry> "Polygon((0 0, 1 0, 1 1, 0 1, 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT>. 22.5 +<http://example.org#B> <http://example.org#hasGeometry> "Polygon((0 0, 2 0, 2 2, 0 2 , 0 0))"^^<http://strdf.di.uoa.gr/ontology#WKT>. 22.6 +<http://example.org#C> <http://example.org#hasGeometry> "Polygon((1 1, 3 1, 3 2, 1 2, 1 1))"^^<http://strdf.di.uoa.gr/ontology#WKT>. 22.7 +<http://example.org#D> <http://example.org#hasGeometry> "Polygon((3 1, 4 1, 4 2, 3 2, 3 1))"^^<http://strdf.di.uoa.gr/ontology#WKT>. 22.8 +<http://example.org#E> <http://example.org#hasGeometry> "Polygon((3 1, 4 1, 4 2, 3 2, 3 1))"^^<http://strdf.di.uoa.gr/ontology#WKT>. 22.9 +<http://example.org#F> <http://example.org#hasGeometry> "Linestring(3 2, 4 0)"^^<http://strdf.di.uoa.gr/ontology#WKT>. 22.10 +<http://example.org#G> <http://example.org#hasGeometry> "Point(1 1)"^^<http://strdf.di.uoa.gr/ontology#WKT>. 22.11 +<http://example.org#H> <http://example.org#hasGeometry> "Polygon((2.1 1.1, 2.9 1.1, 2.9 1.9, 2.1 1.9, 2.1 1.1))"^^<http://strdf.di.uoa.gr/ontology#WKT>.