Added test Cases of GeoSPARQL functions.
Fixed ehMeet function.

Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/7bb01ae1
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/7bb01ae1
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/7bb01ae1

Branch: refs/heads/MARMOTTA-584
Commit: 7bb01ae14c5ed2b4ce8f41406239108df6e7559a
Parents: 9340783
Author: cuent <[email protected]>
Authored: Sun Aug 16 23:42:21 2015 -0500
Committer: cuent <[email protected]>
Committed: Sun Aug 16 23:42:21 2015 -0500

----------------------------------------------------------------------
 .../function/geosparql/EhMeetFunction.java      |  2 +-
 .../testgeosparql/GeoSPARQLFunctionsTest.java   | 21 +++++++++--
 .../testgeosparql/demo_data_spain_towns.rdf     | 10 ++++++
 .../kiwi/sparql/testgeosparql/ehMeet.sparql     | 37 ++++++++++++++++++++
 .../kiwi/sparql/testgeosparql/rcc8ec.sparql     | 37 ++++++++++++++++++++
 .../kiwi/sparql/testgeosparql/rcc8po.sparql     | 37 ++++++++++++++++++++
 6 files changed, 140 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/7bb01ae1/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/EhMeetFunction.java
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/EhMeetFunction.java
 
b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/EhMeetFunction.java
index 379e3ed..61ecb8f 100644
--- 
a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/EhMeetFunction.java
+++ 
b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/EhMeetFunction.java
@@ -101,7 +101,7 @@ public class EhMeetFunction implements NativeFunction {
                 if (args[1].contains("POINT") || 
args[1].contains("MULTIPOINT") || args[1].contains("LINESTRING") || 
args[1].contains("MULTILINESTRING") || args[1].contains("POLYGON") || 
args[1].contains("MULTIPOLYGON") || args[1].contains("ST_AsText")) {
                     geom2 = String.format("ST_GeomFromText(%s,%s)", args[1], 
SRID_default);
                 }
-                return String.format("ST_Relate(%s, %s, 'F**T*****')", geom1, 
geom2);
+                return String.format("ST_Relate(%s, %s, 'F***T****')", geom1, 
geom2);
             }
         }
         throw new UnsupportedOperationException("ehMeet function not supported 
by dialect " + dialect);

http://git-wip-us.apache.org/repos/asf/marmotta/blob/7bb01ae1/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 b5cb4c7..b0678e5 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
@@ -43,11 +43,11 @@ import 
org.apache.marmotta.kiwi.test.junit.KiWiDatabaseRunner;
 /**
  * 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)
+ *      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 {
@@ -219,6 +219,11 @@ public class GeoSPARQLFunctionsTest {
     }
 
     @Test
+    public void testEhMeet() throws Exception {
+        testQueryBoolean("ehMeet.sparql", "ehMeet");
+    }
+
+    @Test
     public void testEhOverlap() throws Exception {
         testQueryBoolean("ehOverlap.sparql", "overlap");
     }
@@ -254,6 +259,16 @@ public class GeoSPARQLFunctionsTest {
     }
 
     @Test
+    public void testRcc8ec() throws Exception {
+        testQueryBoolean("rcc8ec.sparql", "rcc8ec");
+    }
+
+    @Test
+    public void testRcc8po() throws Exception {
+        testQueryBoolean("rcc8po.sparql", "rcc8po");
+    }
+
+    @Test
     public void testRcc8tppi() throws Exception {
         testQueryBoolean("rcc8tppi.sparql", "rcc8tppi");
     }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/7bb01ae1/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 c423907..27bd60f 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
@@ -82,4 +82,14 @@
     <rdfs:comment>ID: 864  -  Recurso: Alpens  -  GeometryHash: 
648033c9365f541638eee331d442c7689fafc4a4  -  EncResource: 
Alpens648033c9365f541638eee331d442c7689fafc4a4</rdfs:comment>
     <rdfs:label xml:lang="es">Alpens</rdfs:label>
   </geontology:municipio>
+  <geontology:municipio 
rdf:about="http://geo.marmotta.es/resource/municipio/Almonacid%20de%20Toledo276c3a0ba680dbfc72674db012b6c468ec73267e";>
+    <geontology:hasExactGeometry>
+      <sf:Multipolygon 
rdf:about="http://geo.marmotta.es/resource/municipio/276c3a0ba680dbfc72674db012b6c468ec73267e";>
+        <geo:asWKT 
rdf:datatype="http://www.opengis.net/ont/geosparql#wktLiteral";
+        >&lt;http://www.opengis.net/def/crs/OGC/1.3/CRS84&gt; MULTIPOLYGON 
(((-3.814835801653312 39.88580266425805, -3.8044554729995594 39.88479540912861, 
-3.7923870006195166 39.87565315523903, -3.792938613814676 39.87175709972403, 
-3.7960236566724217 39.86551020085308, -3.7943598510020995 39.86520625074435, 
-3.7956475913518193 39.8623052778144, -3.79399938223146 39.86131645800888, 
-3.799451687983752 39.85663001526565, -3.8007956772432707 39.85054812087224, 
-3.804612089777833 39.846016756285934, -3.8097797598407497 39.84413379691675, 
-3.813996197561225 39.839905691722535, -3.8120511078158383 39.834522410267155, 
-3.814625027243255 39.831783411657796, -3.815999354406552 39.826448926656646, 
-3.815129368393201 39.825013438885875, -3.818123342742444 39.820298236685964, 
-3.813100664359528 39.8114948079219, -3.8145036441870994 39.8046464791816, 
-3.813223947352478 39.79416792474942, -3.8162053704405663 39.79047092768822, 
-3.814027535289935 39.78900858796791, -3.8128774779272017 39.780592362
 86816, -3.8153327856010955 39.77787213489266, -3.8104260824163485 
39.7756810112342, -3.8067409496774594 39.772084686180364, -3.7997126773198753 
39.77316044132511, -3.7932248961159107 39.775574532085336, -3.7927922306442223 
39.772460057165276, -3.789703689746727 39.76886811404385, -3.7927803117970167 
39.76836055915556, -3.797552740202964 39.77013886985078, -3.8033143700436454 
39.767585376944304, -3.809883775767534 39.7682516036713, -3.8071763648923107 
39.755350074737784, -3.8092398876263864 39.75411939898886, -3.8086413976447906 
39.746852470718075, -3.812255207743364 39.74547574787765, -3.81305293327524 
39.74283917280479, -3.8260411610303056 39.74268447926366, -3.844341279773929 
39.736903591257374, -3.8492365608798362 39.734498261066406, -3.8578825202993943 
39.72590222521217, -3.868111912222435 39.72467294076339, -3.8656071019864884 
39.7315212751696, -3.872560668648351 39.7323431661223, -3.8802858135791904 
39.73509601893376, -3.881946495807236 39.73720975930266, -3.8861383340619016 3
 9.73738513630119, -3.8927499399429637 39.73967705675396, -3.8965847930936333 
39.746522129671355, -3.901863302686256 39.747634530720426, -3.8946079272416965 
39.7570250346826, -3.8919405327191154 39.75838800313308, -3.8981085460212412 
39.7605118707779, -3.903523581570802 39.77020962612729, -3.909240016271189 
39.77429158302501, -3.9064502631220663 39.778818309828495, -3.9057124408465564 
39.78400477900291, -3.9071046651452788 39.790427012177894, -3.9065225640277195 
39.791458723831774, -3.9023439525672248 39.78897748227294, -3.889986455329339 
39.790703638285386, -3.8812742226997927 39.78891404767882, -3.8747774071390086 
39.79326990968066, -3.8680455743335997 39.7919960379435, -3.861007264201077 
39.79329175885624, -3.8598091846999534 39.8021394038724, -3.865312138366307 
39.81062188176667, -3.8661007801340395 39.81482359768417, -3.8706851327605265 
39.820735779161886, -3.8757745353077255 39.82126514193856, -3.8783004613427736 
39.82326432918588, -3.8728514407294163 39.82850407474958, -3.8687
 540980561423 39.828850195042385, -3.8520349899580024 39.8357404948345, 
-3.8559594482616264 39.8412076472271, -3.855969112337449 39.84481150673593, 
-3.859346243308136 39.84756157383398, -3.8576896205668088 39.85909744887363, 
-3.8599159449798774 39.8595044158436, -3.861812276866554 39.862499631979006, 
-3.865130529558583 39.86419579022411, -3.865207899657388 39.86942992332197, 
-3.8678809472780395 39.87277960973206, -3.8642287333026997 39.877131587960996, 
-3.8603129868606967 39.88007986698928, -3.849008016895145 39.880370332240325, 
-3.839411630023607 39.88269257821659, -3.8312278807672118 39.880012489943496, 
-3.8206148633020285 39.88146653005717, -3.8177233427093107 39.88516290500254, 
-3.814871162936162 39.885827328059115, -3.814835801653312 
39.88580266425805)))</geo:asWKT>
+      </sf:Multipolygon>
+    </geontology:hasExactGeometry>
+    <rdfs:comment>ID: 6847  -  Recurso: Almonacid de Toledo  -  GeometryHash: 
276c3a0ba680dbfc72674db012b6c468ec73267e  -  EncResource: 
Almonacid%20de%20Toledo276c3a0ba680dbfc72674db012b6c468ec73267e</rdfs:comment>
+    <rdfs:label xml:lang="es">Almonacid de Toledo</rdfs:label>
+  </geontology:municipio>
 </rdf:RDF>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/7bb01ae1/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehMeet.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehMeet.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehMeet.sparql
new file mode 100644
index 0000000..47907c4
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/ehMeet.sparql
@@ -0,0 +1,37 @@
+#
+# 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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+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  (geof:ehMeet (?wkt2,?wkt) as ?ehMeet)
+Where {
+  ?subject ?property <http://geo.marmotta.es/ontology#provincia>.
+  ?subject geoes:hasExactGeometry ?geo.
+  ?subject rdfs:label  "Madrid"@es.
+  ?subject rdfs:label  ?madrid.
+  ?geo geo:asWKT ?wkt.
+  
+  ?subject2 ?property <http://geo.marmotta.es/ontology#municipio>.
+  ?subject2 geoes:hasExactGeometry ?geo2.
+  ?subject2 rdfs:label  ?towns.
+  ?geo2 geo:asWKT ?wkt2.
+  
+  FILTER (geof:ehMeet (?wkt2,?wkt))
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/7bb01ae1/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ec.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ec.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ec.sparql
new file mode 100644
index 0000000..36c6836
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8ec.sparql
@@ -0,0 +1,37 @@
+#
+# 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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+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  (geof:rcc8ec (?wkt2,?wkt) as ?rcc8ec)
+Where {
+  ?subject ?property <http://geo.marmotta.es/ontology#provincia>.
+  ?subject geoes:hasExactGeometry ?geo.
+  ?subject rdfs:label  "Madrid"@es.
+  ?subject rdfs:label  ?madrid.
+  ?geo geo:asWKT ?wkt.
+  
+  ?subject2 ?property <http://geo.marmotta.es/ontology#municipio>.
+  ?subject2 geoes:hasExactGeometry ?geo2.
+  ?subject2 rdfs:label  ?towns.
+  ?geo2 geo:asWKT ?wkt2.
+  
+  FILTER (geof:rcc8ec (?wkt2,?wkt))
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/7bb01ae1/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8po.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8po.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8po.sparql
new file mode 100644
index 0000000..054653d
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/rcc8po.sparql
@@ -0,0 +1,37 @@
+#
+# 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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+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:rcc8po (?wkt2,?wkt) as ?rcc8po)
+Where {
+  ?subject ?property <http://geo.marmotta.es/ontology#provincia>.
+  ?subject geoes:hasExactGeometry ?geo.
+  ?subject rdfs:label  "Madrid"@es.
+  ?subject rdfs:label  ?madrid.
+  ?geo geo:asWKT ?wkt.
+  
+  ?subject2 ?property <http://geo.marmotta.es/ontology#municipio>.
+  ?subject2 geoes:hasExactGeometry ?geo2.
+  ?subject2 rdfs:label  ?towns.
+  ?geo2 geo:asWKT ?wkt2.
+  
+  FILTER (geof:rcc8po (?wkt2,?wkt))
+} 
\ No newline at end of file

Reply via email to