http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/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
new file mode 100644
index 0000000..d27cda8
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/demo_data_spain_towns.rdf
@@ -0,0 +1,75 @@
+<!--
+  ~ 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.
+  -->
+<rdf:RDF
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+    xmlns="http://geo.marmotta.es/resource/";
+    xmlns:owl="http://www.w3.org/2002/07/owl#";
+    xmlns:geo="http://www.opengis.net/ont/geosparql#";
+    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
+    xmlns:sf="http://www.opengis.net/ont/sf#";
+    xmlns:geontology="http://geo.marmotta.es/ontology#";
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema#";>
+  <rdfs:Class rdf:about="http://geo.marmotta.es/ontology#municipio";>
+    <rdfs:subClassOf 
rdf:resource="http://www.opengis.net/ont/geosparql#Feature"/>
+  </rdfs:Class>
+  <rdf:Property rdf:about="http://geo.marmotta.es/ontology#hasExactGeometry";>
+    <rdfs:subPropertyOf 
rdf:resource="http://www.opengis.net/ont/geosparql#hasDefaultGeometry"/>
+    <rdfs:subPropertyOf 
rdf:resource="http://www.opengis.net/ont/geosparql#hasGeometry"/>
+  </rdf:Property>
+  <rdf:Property rdf:about="http://www.opengis.net/ont/geosparql#asWKT"/>
+  <rdf:Property rdf:about="http://www.opengis.net/ont/sf#Multipolygon"/>
+  <geontology:municipio 
rdf:about="http://geo.marmotta.es/resource/municipio/Ajalvira10fa28f3b7ee1131086895c6c6777d5262ce5ae";>
+    <geontology:hasExactGeometry>
+      <sf:Multipolygon 
rdf:about="http://geo.marmotta.es/resource/municipio/a10fa28f3b7ee1131086895c6c6777d5262ce5ae";>
+        <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.482916811216865 40.55757426297483, -3.4831891651396534 40.5554909759126, 
-3.481346771695933 40.55583316478596, -3.4824090340109453 40.55208721312814, 
-3.4787951664202015 40.54496631000561, -3.475638717378826 40.54504285625366, 
-3.475718288350088 40.54230626825658, -3.472123308736436 40.538493424820004, 
-3.4685352380656655 40.53944628225582, -3.4708512008693786 40.53314791331607, 
-3.4685272475511986 40.53280352682229, -3.46869062594862 40.53126351422799, 
-3.4610851384102514 40.52669769518355, -3.463045672890323 40.52343345023234, 
-3.461653386607823 40.52163316772794, -3.463151952571577 40.5203000319117, 
-3.4613504091170495 40.51771380385662, -3.463124818958432 40.51375941484645, 
-3.4616181358177744 40.51228245120931, -3.462578078225367 40.5111090691955, 
-3.4561662909011517 40.50983342399824, -3.4526274200602365 40.51219805720241, 
-3.4491006980351564 40.51144353095437, -3.43883039863069 40.51347079723535,
  -3.4364377727023485 40.50917206326759, -3.4350994850499252 
40.508886812878174, -3.4517910121739375 40.50311065220639, -3.467652002800191 
40.493191630745855, -3.479609123610939 40.494622935721374, -3.485179828215997 
40.50035402193987, -3.4897544035790315 40.50931857694917, -3.4926241481109064 
40.51162714795243, -3.4962129122811025 40.517617252102205, -3.5015399362889412 
40.52183846773612, -3.5030662637881873 40.52608950187778, -3.508089765027858 
40.52983601380918, -3.5122160316567443 40.53863706378575, -3.5081064036235774 
40.53967192618552, -3.502636998439774 40.543300539316014, -3.5017764141942247 
40.55205531397593, -3.496216849596925 40.555199538322135, -3.493106033175392 
40.554359240044896, -3.4887675171028025 40.555616488299606, -3.4875892553351346 
40.55994479217618, -3.4851949118279566 40.560425696114656, -3.4842399784264537 
40.56194624832554, -3.480962865879486 40.562144474735916, -3.482916811216865 
40.55757426297483)))</geo:asWKT>
+      </sf:Multipolygon>
+    </geontology:hasExactGeometry>
+    <rdfs:comment>ID: 4279  -  Recurso: Ajalvir  -  GeometryHash: 
a10fa28f3b7ee1131086895c6c6777d5262ce5ae  -  EncResource: 
Ajalvira10fa28f3b7ee1131086895c6c6777d5262ce5ae</rdfs:comment>
+    <rdfs:label xml:lang="es">Ajalvir</rdfs:label>
+  </geontology:municipio>
+  <geontology:municipio 
rdf:about="http://geo.marmotta.es/resource/municipio/Algetead99a05d256f64defda2919803dcb33ee64b98ff";>
+    <geontology:hasExactGeometry>
+      <sf:Multipolygon 
rdf:about="http://geo.marmotta.es/resource/municipio/ad99a05d256f64defda2919803dcb33ee64b98ff";>
+        <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.5847993667260813 40.64601250671929, -3.5848390300408495 
40.645266396952316, -3.577036675809627 40.64567943410856, -3.5677221982405567 
40.64366294765923, -3.5666016658062896 40.650184922925725, -3.559188452773045 
40.6505407701894, -3.5604427847773366 40.64466189692117, -3.556330362085352 
40.640077338104554, -3.555818375373967 40.63708620301839, -3.558995817145193 
40.63565743694796, -3.5601953411373417 40.63853262789521, -3.561962260825934 
40.63883669777563, -3.5642265282799177 40.63301862085856, -3.56071449820133 
40.62721061486542, -3.560927493246732 40.62369707609412, -3.558316485076244 
40.62463937703067, -3.5598577066428794 40.6228725061013, -3.5596380892171613 
40.612267552160276, -3.5553931991567156 40.61114025518554, -3.5517823570918394 
40.61149084272242, -3.5497152437915602 40.6134222968205, -3.545318906757413 
40.61358270315377, -3.543194871709084 40.61245286291635, -3.5363744317790604 
40.6163667638
 489, -3.529418456733882 40.61353037482804, -3.528982437851171 
40.61430981823862, -3.524433286607349 40.613985457908875, -3.5237892816852656 
40.615692878162335, -3.5024218869635177 40.61991988095119, -3.5038795373609997 
40.62557559525419, -3.490661480132106 40.625060321257735, -3.485841527254312 
40.62595087684797, -3.4852920691175377 40.623219020881855, -3.487906142339773 
40.620367008240166, -3.4855474053555895 40.61659230600461, -3.482742512000633 
40.61641811415797, -3.4817844488686576 40.61387981305826, -3.47952398937311 
40.61402071123689, -3.476168034388647 40.60905267200372, -3.475831268565015 
40.604737041133944, -3.472928687914538 40.605972339940756, -3.4713519828941584 
40.60481122609366, -3.4685675711277018 40.60673779715798, -3.4633669993691076 
40.60766806973922, -3.461990159617949 40.606666029970114, -3.4562128137514163 
40.60622046415837, -3.4539019264291104 40.60727007607584, -3.4648597999453377 
40.59823578490558, -3.4660843716625136 40.59546522426918, -3.4686112472168142 40
 .59554142833455, -3.4747650222216824 40.59268035826818, -3.4828748347403016 
40.587623498224296, -3.482453620991777 40.586400934096055, -3.487424276139932 
40.58532160195751, -3.4955571600899695 40.585887030079626, -3.5080556236571816 
40.58226538872967, -3.5210990978022267 40.58084887220218, -3.524647004796617 
40.58094639715955, -3.5266405568549475 40.582330116099435, -3.52889439307188 
40.581797352734306, -3.5292661931915013 40.58385144572904, -3.533600262603511 
40.58471533473279, -3.539789945965218 40.58371190776613, -3.539625459046781 
40.582300205777535, -3.5444662267880136 40.58354889183741, -3.5488789374148557 
40.58706090907851, -3.558614791327591 40.58574636730523, -3.558281198353559 
40.58665420790031, -3.5605902216716485 40.58716891715269, -3.5609927513605735 
40.59172151127635, -3.5643322213613033 40.59186520727427, -3.564717725280642 
40.59841652097376, -3.5671100233238855 40.59904512130229, -3.57077404116203 
40.597899223151494, -3.573411931417441 40.59904911484994, -3.577410984
 025629 40.60749521723954, -3.5733762736905264 40.61070211024175, 
-3.573504918727442 40.61899832209853, -3.580308232276579 40.61955617832233, 
-3.5811008167500935 40.620998014975456, -3.5798628574402027 40.623550413722526, 
-3.5845620758454846 40.62736490315497, -3.589094139335888 40.633520824135324, 
-3.5911212533515133 40.64107061929495, -3.589675249611723 40.645951734970886, 
-3.5917910632785373 40.649165141207156, -3.5936825712120943 40.65480305288735, 
-3.588846881647214 40.65600788383366, -3.5847556888403167 40.65335033713372, 
-3.5847993667260813 40.64601250671929)))</geo:asWKT>
+      </sf:Multipolygon>
+    </geontology:hasExactGeometry>
+    <rdfs:comment>ID: 4286  -  Recurso: Algete  -  GeometryHash: 
ad99a05d256f64defda2919803dcb33ee64b98ff  -  EncResource: 
Algetead99a05d256f64defda2919803dcb33ee64b98ff</rdfs:comment>
+    <rdfs:label xml:lang="es">Algete</rdfs:label>
+  </geontology:municipio>
+  <geontology:municipio 
rdf:about="http://geo.marmotta.es/resource/municipio/Alcobendas4e69043d8eaa048ec31c31a6fae51e0b03bd6e86";>
+    <geontology:hasExactGeometry>
+      <sf:Multipolygon 
rdf:about="http://geo.marmotta.es/resource/municipio/4e69043d8eaa048ec31c31a6fae51e0b03bd6e86";>
+        <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.6726813596303662 40.586156424319036, -3.654167581986242 
40.555141459094145, -3.645693082208371 40.55525662579614, -3.640844758737324 
40.55415836419632, -3.6367490536927654 40.54794492084954, -3.628312759263954 
40.543602862194014, -3.6280546041125374 40.54128787212598, -3.6261951965772625 
40.5402828457021, -3.615184868634987 40.53981033330522, -3.6121580312177697 
40.53829037069117, -3.605947250921605 40.5383320252685, -3.6032972208334435 
40.53699904478363, -3.6003241556708026 40.53807302779391, -3.5967095209187647 
40.53713316388725, -3.5918000626010227 40.5375583778102, -3.5785981337247397 
40.53368364267974, -3.562686521235499 40.53441067686968, -3.553089038419278 
40.53224972607099, -3.556167337624166 40.53138723128788, -3.5571791730107765 
40.52868057280323, -3.550274000389827 40.52310189985996, -3.551344818259642 
40.52008513614666, -3.555762546875718 40.51680908393499, -3.5523698498977474 
40.51119199686
 9734, -3.554260153190587 40.511334301781886, -3.5616290999415434 
40.510699710734364, -3.5649551077893946 40.51206190897223, -3.5721262347350065 
40.512369083847474, -3.582994577658444 40.50849054826447, -3.594848499110962 
40.501173549147, -3.6029817055561986 40.50137926904857, -3.606639999329354 
40.505932210854986, -3.6150265576341836 40.51079788290388, -3.6332018680454707 
40.50756480592084, -3.6448927497655252 40.50785161508524, -3.6480504959741915 
40.510433088242046, -3.6562037914441055 40.513103346776475, -3.658604822908568 
40.51163481287824, -3.662936847754936 40.52005140802473, -3.6662183234191756 
40.52109565670684, -3.6659152004013187 40.52446670174923, -3.672071860794869 
40.52435455691417, -3.6772585338194004 40.526981980783795, -3.6692963162986203 
40.53444263767914, -3.6782192254219352 40.54335453295835, -3.678518165883824 
40.546541957312684, -3.682507475364488 40.55085629071329, -3.68243436417841 
40.55376657777296, -3.6895324859392047 40.57023773624187, -3.6907604236437965 4
 0.56912683776643, -3.698268434092333 40.57688341569848, -3.701601863821071 
40.57831368511918, -3.6916335241162206 40.58050429570737, -3.6741427398328734 
40.58885956078641, -3.6730861333108216 40.58690515376601, -3.6726813596303662 
40.586156424319036)))</geo:asWKT>
+      </sf:Multipolygon>
+    </geontology:hasExactGeometry>
+    <rdfs:comment>ID: 4283  -  Recurso: Alcobendas  -  GeometryHash: 
4e69043d8eaa048ec31c31a6fae51e0b03bd6e86  -  EncResource: 
Alcobendas4e69043d8eaa048ec31c31a6fae51e0b03bd6e86</rdfs:comment>
+    <rdfs:label xml:lang="es">Alcobendas</rdfs:label>
+  </geontology:municipio>
+  <geontology:municipio 
rdf:about="http://geo.marmotta.es/resource/municipio/Aldea%20en%20Cabocccbec8b7f1c90e3f88aad956082d503bf18c89f";>
+    <geontology:hasExactGeometry>
+      <sf:Multipolygon 
rdf:about="http://geo.marmotta.es/resource/municipio/cccbec8b7f1c90e3f88aad956082d503bf18c89f";>
+        <geo:asWKT 
rdf:datatype="http://www.opengis.net/ont/geosparql#wktLiteral";
+        >&lt;http://www.opengis.net/def/crs/OGC/1.3/CRS84&gt; MULTIPOLYGON 
(((-4.496519277379322 40.22113837895887, -4.49192286936169 40.21787338005155, 
-4.483634798751355 40.21504298326683, -4.469134018263615 40.216155848968185, 
-4.462345933853455 40.20652104702021, -4.459687597942178 40.20474381219837, 
-4.450327416786342 40.20770831230473, -4.445609081333516 40.20795649377298, 
-4.44052447219664 40.20089375027648, -4.443555497559726 40.19534248282751, 
-4.44501035689163 40.18861259985668, -4.440387303046017 40.187192736807646, 
-4.440399595592398 40.188886288170465, -4.438817789039536 40.18851853003071, 
-4.438279923661463 40.18307474620543, -4.436773743577366 40.182390734790985, 
-4.438371578769897 40.18129881232573, -4.432376961877185 40.17494967115597, 
-4.434580495133146 40.17194943878003, -4.439339242197327 40.169836267718765, 
-4.441385793959042 40.16443243715861, -4.440707732107887 40.162909367022635, 
-4.447079586622708 40.16492001728718, -4.460959758809928 40.15889884510906, -4.4
 62400308877599 40.1603671281053, -4.467277670390252 40.16111628191041, 
-4.471137950355024 40.16315738429721, -4.472024382724586 40.168857883082104, 
-4.470072022015293 40.171990784880414, -4.470997869764583 40.17407816083655, 
-4.475112237309209 40.1764222132156, -4.4770515823283095 40.179739849942955, 
-4.476161555799303 40.18257100496677, -4.479738575395401 40.18610189701915, 
-4.488578959886871 40.18857421405256, -4.492299807844786 40.19219300924322, 
-4.498499266673477 40.19364441626322, -4.503567410589499 40.19758772723262, 
-4.507856739408689 40.19764002587473, -4.518734836239515 40.201281665287844, 
-4.522143586111516 40.202399034823294, -4.5189106221675415 40.20336941620288, 
-4.516880887766201 40.20550879371024, -4.517330899706142 40.21366934420939, 
-4.5144187537944935 40.21688211033836, -4.504938570293098 40.22078098988078, 
-4.4979387709367735 40.22166903074711, -4.496519277379322 
40.22113837895887)))</geo:asWKT>
+      </sf:Multipolygon>
+    </geontology:hasExactGeometry>
+    <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>
+</rdf:RDF>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/difference.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/difference.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/difference.sparql
new file mode 100644
index 0000000..c502bed
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/difference.sparql
@@ -0,0 +1,33 @@
+#
+# 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 ?wkt ?wkt2 (geof:difference(?wkt,?wkt2) as ?difference)
+WHERE {  
+  ?subject a <http://geo.marmotta.es/ontology#rio>.
+  ?subject rdfs:label "Río Ebro" @es.
+  ?subject geoes:hasExactGeometry ?geo.
+  ?geo geo:asWKT ?wkt.
+  
+  ?subject2 a <http://geo.marmotta.es/ontology#rio>.
+  ?subject2 rdfs:label "Río Matarraña" @es.
+  ?subject2 geoes:hasExactGeometry ?geo2.
+  ?geo2 geo:asWKT ?wkt2.
+}  
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/distance.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/distance.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/distance.sparql
new file mode 100644
index 0000000..50811cc
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/distance.sparql
@@ -0,0 +1,36 @@
+#
+# 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/>
+PREFIX units: <http://www.opengis.net/def/uom/OGC/1.0/>
+
+SELECT DISTINCT ?provinceA ?provinceB (geof:distance(?wktA, ?wktB, 
units:meter) as ?distance)
+WHERE {  
+  ?subject a <http://geo.marmotta.es/ontology#provincia>.
+  ?subject rdfs:label ?provinceA.
+  ?subject rdfs:label "Barcelona" @es.
+  ?subject geoes:hasExactGeometry ?geo.
+  ?geo geo:asWKT ?wktA.
+  
+  ?subject2 a <http://geo.marmotta.es/ontology#provincia>.
+  ?subject2 rdfs:label ?provinceB.
+  ?subject2 rdfs:label "Madrid" @es.
+  ?subject2 geoes:hasExactGeometry ?geo2.
+  ?geo2 geo:asWKT ?wktB.
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/envelope.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/envelope.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/envelope.sparql
new file mode 100644
index 0000000..7c94aa0
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/envelope.sparql
@@ -0,0 +1,28 @@
+#
+# 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 ?wkt (geof:envelope(?wkt) as ?envelope)
+WHERE {  
+  ?subject a <http://geo.marmotta.es/ontology#provincia>.
+  ?subject rdfs:label "Madrid" @es.
+  ?subject geoes:hasExactGeometry ?geo.
+  ?geo geo:asWKT ?wkt.
+} 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/getSRID.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/getSRID.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/getSRID.sparql
new file mode 100644
index 0000000..ee90301
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/getSRID.sparql
@@ -0,0 +1,30 @@
+#
+# 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/>
+PREFIX units: <http://www.opengis.net/def/uom/OGC/1.0/>
+
+SELECT DISTINCT ?provinceMadrid (geof:getSRID(?wkt) as ?getSRID)
+WHERE {  
+  ?subject a <http://geo.marmotta.es/ontology#provincia>.
+  ?subject rdfs:label ?provinceMadrid.
+  ?subject rdfs:label "Madrid"@es.
+  ?subject geoes:hasExactGeometry ?geo.
+  ?geo geo:asWKT ?wkt.
+} 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/intersection.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/intersection.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/intersection.sparql
new file mode 100644
index 0000000..10be32b
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/intersection.sparql
@@ -0,0 +1,33 @@
+#
+# 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 ?wktA ?wktB (geof:intersection(?wktA,?wktB) as ?intersection)
+WHERE {  
+  ?subject a <http://geo.marmotta.es/ontology#provincia>.
+  ?subject rdfs:label "Madrid"@es.
+  ?subject geoes:hasExactGeometry ?geo.
+  ?geo geo:asWKT ?wktA.
+  
+  ?subject2 a <http://geo.marmotta.es/ontology#municipio>.
+  ?subject2 rdfs:label "Ajalvir" @es.
+  ?subject2 geoes:hasExactGeometry ?geo2.
+  ?geo2 geo:asWKT ?wktB.
+} 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/relate.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/relate.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/relate.sparql
new file mode 100644
index 0000000..e82a79e
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/relate.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:relate(?wkt, ?wkt2, 'T********') as ?relate)
+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:relate(?wkt, ?wkt2, 'T********'))      
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfContains.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfContains.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfContains.sparql
new file mode 100644
index 0000000..a7d6e23
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfContains.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:sfContains(?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:sfContains(?wkt, ?wkt2))
+} 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfCrosses.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfCrosses.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfCrosses.sparql
new file mode 100644
index 0000000..d6032c6
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfCrosses.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:sfCrosses(?wkt, ?wkt2) as ?crosses)
+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:sfCrosses(?wkt, ?wkt2))      
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfDisjoint.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfDisjoint.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfDisjoint.sparql
new file mode 100644
index 0000000..f55d670
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfDisjoint.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:sfDisjoint(?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:sfDisjoint(?wkt, ?wkt2))      
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfEquals.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfEquals.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfEquals.sparql
new file mode 100644
index 0000000..41efb05
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfEquals.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:sfEquals (?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:sfEquals (?wkt, ?wkt2)) 
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfIntersects.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfIntersects.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfIntersects.sparql
new file mode 100644
index 0000000..21fed5f
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfIntersects.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:sfIntersects(?wkt, ?wkt2) as ?intersects)
+WHERE {  
+  ?subject a <http://geo.marmotta.es/ontology#rio>.
+  ?subject rdfs:label ?labelRios.
+  ?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:sfIntersects(?wkt, ?wkt2))      
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfOverlaps.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfOverlaps.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfOverlaps.sparql
new file mode 100644
index 0000000..b52d834
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfOverlaps.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:sfOverlaps(?wkt, ?wkt2) as ?overlaps)
+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:sfOverlaps(?wkt, ?wkt2))      
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfTouches.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfTouches.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfTouches.sparql
new file mode 100644
index 0000000..64ef773
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfTouches.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:sfTouches(?wkt, ?wkt2) as ?touches)
+WHERE {  
+  ?subject a <http://geo.marmotta.es/ontology#provincia>.
+  ?subject rdfs:label "Cuenca"@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:sfTouches(?wkt, ?wkt2))  
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfWithin.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfWithin.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfWithin.sparql
new file mode 100644
index 0000000..0227ea3
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/sfWithin.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:sfWithin(?wkt, ?wkt2) as ?within)
+WHERE {  
+  ?subject a <http://geo.marmotta.es/ontology#municipio>.
+  ?subject rdfs:label ?labelMunicipios.
+  ?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:sfWithin(?wkt, ?wkt2))  
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/symDifference.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/symDifference.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/symDifference.sparql
new file mode 100644
index 0000000..b01d891
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/symDifference.sparql
@@ -0,0 +1,33 @@
+#
+# 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 ?wktA ?wktB (geof:symDifference(?wktA,?wktB) as ?symDifference)
+WHERE {  
+  ?subject a <http://geo.marmotta.es/ontology#provincia>.
+  ?subject rdfs:label "Madrid"@es.
+  ?subject geoes:hasExactGeometry ?geo.
+  ?geo geo:asWKT ?wktA.
+  
+  ?subject2 a <http://geo.marmotta.es/ontology#municipio>.
+  ?subject2 rdfs:label "Ajalvir" @es.
+  ?subject2 geoes:hasExactGeometry ?geo2.
+  ?geo2 geo:asWKT ?wktB.
+} 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/marmotta/blob/eef29ef0/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/union.sparql
----------------------------------------------------------------------
diff --git 
a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/union.sparql
 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/union.sparql
new file mode 100644
index 0000000..0c63722
--- /dev/null
+++ 
b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/union.sparql
@@ -0,0 +1,33 @@
+#
+# 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 ?wktA ?wktB (geof:union(?wktA,?wktB) as ?union)
+WHERE {  
+  ?subject a <http://geo.marmotta.es/ontology#provincia>.
+  ?subject rdfs:label "Madrid"@es.
+  ?subject geoes:hasExactGeometry ?geo.
+  ?geo geo:asWKT ?wktA.
+  
+  ?subject2 a <http://geo.marmotta.es/ontology#provincia>.
+  ?subject2 rdfs:label "Barcelona" @es.
+  ?subject2 geoes:hasExactGeometry ?geo2.
+  ?geo2 geo:asWKT ?wktB.
+} 
\ No newline at end of file

Reply via email to