Added test Cases of GeoSPARQL functions. Fixed getSRID function. Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/93407837 Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/93407837 Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/93407837
Branch: refs/heads/MARMOTTA-584 Commit: 934078370330ce93ff1006bf00cafa07cbceddc8 Parents: 52188c0 Author: cuent <[email protected]> Authored: Sun Aug 16 16:49:45 2015 -0500 Committer: cuent <[email protected]> Committed: Sun Aug 16 16:49:45 2015 -0500 ---------------------------------------------------------------------- .../function/geosparql/GetSRIDFunction.java | 16 +---- .../testgeosparql/GeoSPARQLFunctionsTest.java | 76 ++++++++++++++++++-- .../testgeosparql/demo_data_spain_towns.rdf | 10 +++ .../kiwi/sparql/testgeosparql/ehContains.sparql | 35 +++++++++ .../sparql/testgeosparql/ehCoveredBy.sparql | 35 +++++++++ .../kiwi/sparql/testgeosparql/ehCovers.sparql | 35 +++++++++ .../kiwi/sparql/testgeosparql/ehDisjoint.sparql | 35 +++++++++ .../kiwi/sparql/testgeosparql/ehEquals.sparql | 34 +++++++++ .../kiwi/sparql/testgeosparql/ehInside.sparql | 35 +++++++++ .../kiwi/sparql/testgeosparql/ehOverlap.sparql | 35 +++++++++ .../kiwi/sparql/testgeosparql/rcc8dc.sparql | 35 +++++++++ .../kiwi/sparql/testgeosparql/rcc8eq.sparql | 35 +++++++++ .../kiwi/sparql/testgeosparql/rcc8ntpp.sparql | 35 +++++++++ .../kiwi/sparql/testgeosparql/rcc8ntppi.sparql | 35 +++++++++ .../kiwi/sparql/testgeosparql/rcc8tpp.sparql | 35 +++++++++ .../kiwi/sparql/testgeosparql/rcc8tppi.sparql | 35 +++++++++ 16 files changed, 538 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/GetSRIDFunction.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/GetSRIDFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/GetSRIDFunction.java index 4192d2c..637df20 100644 --- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/GetSRIDFunction.java +++ b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/GetSRIDFunction.java @@ -33,7 +33,7 @@ import org.openrdf.query.algebra.evaluation.function.FunctionRegistry; * <p/> * The function can be called either as: * <ul> - * <li>geof:getSRID(?geometryA) </li> + * <li>geof:getSRID(?geometryA) </li> * </ul> * Its necesary enable postgis in your database with the next command "CREATE * EXTENSION postgis;" Note that for performance reasons it might be preferrable @@ -85,19 +85,7 @@ public class GetSRIDFunction implements NativeFunction { public String getNative(KiWiDialect dialect, String... args) { if (dialect instanceof PostgreSQLDialect) { if (args.length == 1) { - String geom1 = args[0]; - String SRID_default = "4326"; - /* - * The following condition is required to read WKT inserted directly into args[0] and create a geometries with SRID - * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: - * example: geof:boundary("POLYGON(( -7 43, -2 43, -2 38, -7 38, -7 43))"^^geo:wktLiteral) - * st_AsText condition: It is to use the geometry that is the result of another function geosparql. - * example: geof:boundary(geof:buffer(?geom, 50, units:meter)) - */ - if (args[0].contains("POINT") || args[0].contains("MULTIPOINT") || args[0].contains("LINESTRING") || args[0].contains("MULTILINESTRING") || args[0].contains("POLYGON") || args[0].contains("MULTIPOLYGON") || args[0].contains("ST_AsText")) { - geom1 = String.format("ST_GeomFromText(%s,%s)", args[0], SRID_default); - } - return String.format("ST_AsText(ST_Boundary(%s)) ", geom1); + return String.format("ST_SRID(%s)", args[0]); } } throw new UnsupportedOperationException("getSRID function not supported by dialect " + dialect); http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/testgeosparql/GeoSPARQLFunctionsTest.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/testgeosparql/GeoSPARQLFunctionsTest.java b/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/testgeosparql/GeoSPARQLFunctionsTest.java index 346cf2f..b5cb4c7 100644 --- a/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/testgeosparql/GeoSPARQLFunctionsTest.java +++ b/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/testgeosparql/GeoSPARQLFunctionsTest.java @@ -36,14 +36,18 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.sql.SQLException; import java.util.List; -import org.apache.marmotta.kiwi.persistence.KiWiDialect; import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect; import org.apache.marmotta.kiwi.test.helper.DBConnectionChecker; import org.apache.marmotta.kiwi.test.junit.KiWiDatabaseRunner; /** - * A collection of tests from the SPARQL 1.1 testsuite, for testing compliance. - * + * Test suite for all the functions of GeoSPARQL implemented. There is 35 test + * cases for each function. + * Simple Features Topological Relations (8) + * Egenhofer Topological Relations (8) + * RCC8 Topological Relations (8) + * Non-Topological Functions (11) + * * @author Xavier Sumba ([email protected]) */ public class GeoSPARQLFunctionsTest { @@ -56,7 +60,6 @@ public class GeoSPARQLFunctionsTest { public GeoSPARQLFunctionsTest() { logger.info("creating test setup..."); - dbConfig = KiWiDatabaseRunner.createKiWiConfig("PostgreSQL", new PostgreSQLDialect()); DBConnectionChecker.checkDatabaseAvailability(dbConfig); @@ -205,6 +208,71 @@ public class GeoSPARQLFunctionsTest { testQueryGeometry("union.sparql"); } + @Test + public void testEhEquals() throws Exception { + testQueryBoolean("ehEquals.sparql", "equals"); + } + + @Test + public void testEhDisjoint() throws Exception { + testQueryBoolean("ehDisjoint.sparql", "disjoint"); + } + + @Test + public void testEhOverlap() throws Exception { + testQueryBoolean("ehOverlap.sparql", "overlap"); + } + + @Test + public void testEhCovers() throws Exception { + testQueryBoolean("ehCovers.sparql", "covers"); + } + + @Test + public void testEhCoveredBy() throws Exception { + testQueryBoolean("ehCoveredBy.sparql", "coveredBy"); + } + + @Test + public void testEhInside() throws Exception { + testQueryBoolean("ehInside.sparql", "inside"); + } + + @Test + public void testEhContains() throws Exception { + testQueryBoolean("ehContains.sparql", "contains"); + } + + @Test + public void testRcc8eq() throws Exception { + testQueryBoolean("rcc8eq.sparql", "rcc8eq"); + } + + @Test + public void testRcc8dc() throws Exception { + testQueryBoolean("rcc8dc.sparql", "rcc8dc"); + } + + @Test + public void testRcc8tppi() throws Exception { + testQueryBoolean("rcc8tppi.sparql", "rcc8tppi"); + } + + @Test + public void testRcc8tpp() throws Exception { + testQueryBoolean("rcc8tpp.sparql", "rcc8tpp"); + } + + @Test + public void testRcc8ntpp() throws Exception { + testQueryBoolean("rcc8ntpp.sparql", "rcc8ntpp"); + } + + @Test + public void testRcc8ntppi() throws Exception { + testQueryBoolean("rcc8ntppi.sparql", "rcc8ntppi"); + } + private void testQueryBoolean(String filename, String function) throws Exception { String queryString = IOUtils.toString(this.getClass().getResourceAsStream(filename), "UTF-8"); http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/demo_data_spain_towns.rdf ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/demo_data_spain_towns.rdf b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/demo_data_spain_towns.rdf index d27cda8..c423907 100644 --- a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/demo_data_spain_towns.rdf +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/demo_data_spain_towns.rdf @@ -72,4 +72,14 @@ <rdfs:comment>ID: 6843 - Recurso: Aldea en Cabo - GeometryHash: cccbec8b7f1c90e3f88aad956082d503bf18c89f - EncResource: Aldea%20en%20Cabocccbec8b7f1c90e3f88aad956082d503bf18c89f</rdfs:comment> <rdfs:label xml:lang="es">Aldea en Cabo</rdfs:label> </geontology:municipio> + <geontology:municipio rdf:about="http://geo.marmotta.es/resource/municipio/Alpens648033c9365f541638eee331d442c7689fafc4a4"> + <geontology:hasExactGeometry> + <sf:Multipolygon rdf:about="http://geo.marmotta.es/resource/municipio/648033c9365f541638eee331d442c7689fafc4a4"> + <geo:asWKT rdf:datatype="http://www.opengis.net/ont/geosparql#wktLiteral" + ><http://www.opengis.net/def/crs/OGC/1.3/CRS84> MULTIPOLYGON (((2.1262817696290166 42.11309875069004, 2.128740157625046 42.10865821642916, 2.1333602290614255 42.10568717966523, 2.130298687031967 42.1017641476623, 2.130446732085826 42.100605140695784, 2.1238159687370004 42.09963282779977, 2.116630716685801 42.101826947528984, 2.1128856330820405 42.100058718401506, 2.1121582303656066 42.103935470459696, 2.107001730855745 42.10761384875215, 2.104265462501395 42.112075317869355, 2.097332911929525 42.11142103571309, 2.1001504499691483 42.10796443886723, 2.096671872255483 42.106201812578085, 2.094969809134686 42.10638559349778, 2.094000804522994 42.10786921654633, 2.0789195587577427 42.1088726656442, 2.0726093870648343 42.11312283145593, 2.0707934085829938 42.11309531486509, 2.0693488655048364 42.10984619371323, 2.067558617467553 42.11074477579545, 2.0619056056250593 42.11824233063992, 2.0647411234446045 42.12179909082538, 2.0685832179127606 42.12251128654532, 2.067814313030 4267 42.12363469746635, 2.0701591656521883 42.126492780566764, 2.0705987337778686 42.1318390694964, 2.0678605502154843 42.13420210091015, 2.06138475164236 42.135659113488614, 2.065904663619403 42.13863713501267, 2.0702194650645245 42.13874315155795, 2.071158437199333 42.14186158344794, 2.074939439041738 42.141189793455574, 2.089057826468344 42.1419581887602, 2.0926808326183317 42.14429079586463, 2.0958532995179726 42.14206987878955, 2.0954688708823856 42.14044845453908, 2.1013623707085562 42.14017685381833, 2.0979288974060673 42.13027362937363, 2.1006328740205222 42.12975698879069, 2.1010592611670966 42.12393109593349, 2.105497977120703 42.122733803494455, 2.113274467054321 42.11748900273882, 2.1158387556420517 42.11779752276099, 2.1184317337251852 42.115763932941476, 2.1230569605927805 42.115989085765776, 2.1262817696290166 42.11309875069004)))</geo:asWKT> + </sf:Multipolygon> + </geontology:hasExactGeometry> + <rdfs:comment>ID: 864 - Recurso: Alpens - GeometryHash: 648033c9365f541638eee331d442c7689fafc4a4 - EncResource: Alpens648033c9365f541638eee331d442c7689fafc4a4</rdfs:comment> + <rdfs:label xml:lang="es">Alpens</rdfs:label> + </geontology:municipio> </rdf:RDF> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehContains.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehContains.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehContains.sparql new file mode 100644 index 0000000..8228053 --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehContains.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:ehContains (?wkt,?wkt2) as ?contains) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Madrid"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#municipio>. + ?subject2 rdfs:label ?labelMunicipios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:ehContains (?wkt,?wkt2)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehCoveredBy.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehCoveredBy.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehCoveredBy.sparql new file mode 100644 index 0000000..416b205 --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehCoveredBy.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:ehCoveredBy (?wkt2,?wkt) as ?coveredBy) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Barcelona"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#municipio>. + ?subject2 rdfs:label ?labelMunicipios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:ehCoveredBy (?wkt2,?wkt)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehCovers.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehCovers.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehCovers.sparql new file mode 100644 index 0000000..0ba4c4d --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehCovers.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:ehCovers (?wkt, ?wkt2) as ?covers) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Barcelona"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#municipio>. + ?subject2 rdfs:label ?labelMunicipios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:ehCovers (?wkt, ?wkt2)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehDisjoint.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehDisjoint.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehDisjoint.sparql new file mode 100644 index 0000000..cc4df99 --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehDisjoint.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:ehDisjoint(?wkt, ?wkt2) as ?disjoint) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Barcelona"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#rio>. + ?subject2 rdfs:label ?labelRios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:ehDisjoint(?wkt, ?wkt2)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehEquals.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehEquals.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehEquals.sparql new file mode 100644 index 0000000..262ae59 --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehEquals.sparql @@ -0,0 +1,34 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> + +SELECT (geof:ehEquals (?wkt, ?wkt2) as ?equals) WHERE { + ?subject ?property <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Madrid"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#provincia>. + ?subject2 rdfs:label "Madrid"@es. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:ehEquals (?wkt, ?wkt2)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehInside.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehInside.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehInside.sparql new file mode 100644 index 0000000..4b5e73f --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehInside.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:ehInside(?wkt2,?wkt) as ?inside) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Madrid"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#municipio>. + ?subject2 rdfs:label ?labelMunicipios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:ehInside(?wkt2,?wkt)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehOverlap.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehOverlap.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehOverlap.sparql new file mode 100644 index 0000000..0fb456f --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehOverlap.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:ehOverlap (?wkt, ?wkt2) as ?overlap) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Madrid"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#rio>. + ?subject2 rdfs:label ?labelRios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:ehOverlap (?wkt, ?wkt2)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8dc.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8dc.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8dc.sparql new file mode 100644 index 0000000..e555405 --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8dc.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:rcc8dc (?wkt, ?wkt2) as ?rcc8dc) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Barcelona"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#rio>. + ?subject2 rdfs:label ?labelRios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:rcc8dc (?wkt, ?wkt2)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8eq.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8eq.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8eq.sparql new file mode 100644 index 0000000..4484ed4 --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8eq.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:rcc8eq (?wkt,?wkt2) as ?rcc8eq) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Barcelona"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#provincia>. + ?subject2 rdfs:label "Barcelona"@es. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:rcc8eq (?wkt,?wkt2)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ntpp.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ntpp.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ntpp.sparql new file mode 100644 index 0000000..ad0e0c2 --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ntpp.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:rcc8ntpp (?wkt2,?wkt) as ?rcc8ntpp) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Madrid"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#municipio>. + ?subject2 rdfs:label ?labelMunicipios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:rcc8ntpp (?wkt2,?wkt)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ntppi.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ntppi.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ntppi.sparql new file mode 100644 index 0000000..7e5d515 --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ntppi.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:rcc8ntppi (?wkt,?wkt2) as ?rcc8ntppi) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Madrid"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#municipio>. + ?subject2 rdfs:label ?labelMunicipios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:rcc8ntppi (?wkt,?wkt2)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8tpp.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8tpp.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8tpp.sparql new file mode 100644 index 0000000..1ff438c --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8tpp.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:rcc8tpp (?wkt2,?wkt) as ?rcc8tpp ) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Barcelona"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#municipio>. + ?subject2 rdfs:label ?labelMunicipios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:rcc8tpp (?wkt2,?wkt)) +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/93407837/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8tppi.sparql ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8tppi.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8tppi.sparql new file mode 100644 index 0000000..4b3d5b8 --- /dev/null +++ b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8tppi.sparql @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +PREFIX geoes: <http://geo.marmotta.es/ontology#> +PREFIX geo: <http://www.opengis.net/ont/geosparql#> +PREFIX geof: <http://www.opengis.net/def/function/geosparql/> + +SELECT DISTINCT (geof:rcc8tppi (?wkt, ?wkt2) as ?rcc8tppi) +WHERE { + ?subject a <http://geo.marmotta.es/ontology#provincia>. + ?subject rdfs:label "Barcelona"@es. + ?subject geoes:hasExactGeometry ?geo. + ?geo geo:asWKT ?wkt. + + ?subject2 a <http://geo.marmotta.es/ontology#municipio>. + ?subject2 rdfs:label ?labelMunicipios. + ?subject2 geoes:hasExactGeometry ?geo2. + ?geo2 geo:asWKT ?wkt2. + + FILTER (geof:rcc8tppi (?wkt, ?wkt2)) +} \ No newline at end of file
