You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by wi...@apache.org on 2015/09/11 14:04:51 UTC

[05/22] marmotta git commit: MARMOTTA-584: extracted geosparql support to a separated module

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfCrossesFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfCrossesFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfCrossesFunction.java
deleted file mode 100644
index 9fc402a..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfCrossesFunction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.marmotta.kiwi.sparql.function.geosparql;
-
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sparql.builder.ValueType;
-import org.apache.marmotta.kiwi.sparql.function.NativeFunction;
-import org.apache.marmotta.kiwi.vocabulary.FN_GEOSPARQL;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException;
-import org.openrdf.query.algebra.evaluation.function.FunctionRegistry;
-
-/**
- * A SPARQL function for doing a crosses between two geometries. Should be
- * implemented directly in the database, as the in-memory implementation is
- * non-functional. Only support by postgres - POSTGIS
- * <p/>
- * The function can be called either as:
- * <ul>
- *      <li>geof:sfCrosses(?geometryA, ?geometryB) </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
- * to create a geometry index for your database. Please consult your database
- * documentation on how to do this.
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class SfCrossesFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.SF_CROSSES.toString())) {
-            FunctionRegistry.getInstance().add(new SfCrossesFunction());
-        }
-    }
-
-    @Override
-    public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException {
-        throw new UnsupportedOperationException("cannot evaluate in-memory, needs to be supported by the database");
-    }
-
-    @Override
-    public String getURI() {
-        return FN_GEOSPARQL.SF_CROSSES.toString();
-    }
-
-    /**
-     * Return true if this function has available native support for the given
-     * dialect
-     *
-     * @param dialect
-     * @return
-     */
-    @Override
-    public boolean isSupported(KiWiDialect dialect) {
-        return dialect instanceof PostgreSQLDialect;
-    }
-
-    /**
-     * Return a string representing how this GeoSPARQL function is translated
-     * into SQL ( Postgis Function ) in the given dialect
-     *
-     * @param dialect
-     * @param args
-     * @return
-     */
-    @Override
-    public String getNative(KiWiDialect dialect, String... args) {
-        if (dialect instanceof PostgreSQLDialect) {
-            if (args.length == 2) {
-                String geom1 = args[0];
-                String geom2 = args[1];
-                String SRID_default = "4326";
-                /*
-                 * The following condition is required to read WKT  inserted directly into args[0] or args[1] and create a geometries with SRID
-                 * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: 
-                 *   example: geof:sfCrosses(?wkt, "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:sfCrosses(?wkt, geof:buffer(?wkt2, 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);
-                }
-                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_Crosses(%s , %s )", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("Crosses function not supported by dialect " + dialect);
-    }
-
-    /**
-     * Get the return type of the function. This is needed for SQL type casting
-     * inside KiWi.
-     *
-     * @return
-     */
-    @Override
-    public ValueType getReturnType() {
-        return ValueType.BOOL;
-    }
-
-    /**
-     * Get the argument type of the function for the arg'th argument (starting
-     * to count at 0). This is needed for SQL type casting inside KiWi.
-     *
-     * @param arg
-     * @return
-     */
-    @Override
-    public ValueType getArgumentType(int arg) {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Return the minimum number of arguments this function requires.
-     *
-     * @return
-     */
-    @Override
-    public int getMinArgs() {
-        return 2;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfDisjointFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfDisjointFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfDisjointFunction.java
deleted file mode 100644
index c089f3c..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfDisjointFunction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.marmotta.kiwi.sparql.function.geosparql;
-
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sparql.builder.ValueType;
-import org.apache.marmotta.kiwi.sparql.function.NativeFunction;
-import org.apache.marmotta.kiwi.vocabulary.FN_GEOSPARQL;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException;
-import org.openrdf.query.algebra.evaluation.function.FunctionRegistry;
-
-/**
- * A SPARQL function for doing a Disjoint between two geometries. Should be
- * implemented directly in the database, as the in-memory implementation is
- * non-functional. Only support by postgres - POSTGIS
- * <p/>
- * The function can be called either as:
- * <ul>
- *      <li>geof:sfDisjoint(?geometryA, ?geometryB) </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
- * to create a geometry index for your database. Please consult your database
- * documentation on how to do this.
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class SfDisjointFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.SF_DISJOINT.toString())) {
-            FunctionRegistry.getInstance().add(new SfDisjointFunction());
-        }
-    }
-
-    @Override
-    public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException {
-        throw new UnsupportedOperationException("cannot evaluate in-memory, needs to be supported by the database");
-    }
-
-    @Override
-    public String getURI() {
-        return FN_GEOSPARQL.SF_DISJOINT.toString();
-    }
-
-    /**
-     * Return true if this function has available native support for the given
-     * dialect
-     *
-     * @param dialect
-     * @return
-     */
-    @Override
-    public boolean isSupported(KiWiDialect dialect) {
-        return dialect instanceof PostgreSQLDialect;
-    }
-
-    /**
-     * Return a string representing how this GeoSPARQL function is translated
-     * into SQL ( Postgis Function ) in the given dialect
-     *
-     * @param dialect
-     * @param args
-     * @return
-     */
-    @Override
-    public String getNative(KiWiDialect dialect, String... args) {
-        if (dialect instanceof PostgreSQLDialect) {
-            if (args.length == 2) {
-                String geom1 = args[0];
-                String geom2 = args[1];
-                String SRID_default = "4326";
-                /*
-                 * The following condition is required to read WKT  inserted directly into args[0] or args[1] and create a geometries with SRID
-                 * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: 
-                 *   example: geof:sfDisjoint(?wkt, "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:sfDisjoint(?wkt, geof:buffer(?wkt2, 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);
-                }
-                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_Disjoint(%s , %s )", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("Disjoint function not supported by dialect " + dialect);
-    }
-
-    /**
-     * Get the return type of the function. This is needed for SQL type casting
-     * inside KiWi.
-     *
-     * @return
-     */
-    @Override
-    public ValueType getReturnType() {
-        return ValueType.BOOL;
-    }
-
-    /**
-     * Get the argument type of the function for the arg'th argument (starting
-     * to count at 0). This is needed for SQL type casting inside KiWi.
-     *
-     * @param arg
-     * @return
-     */
-    @Override
-    public ValueType getArgumentType(int arg) {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Return the minimum number of arguments this function requires.
-     *
-     * @return
-     */
-    @Override
-    public int getMinArgs() {
-        return 2;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfEqualsFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfEqualsFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfEqualsFunction.java
deleted file mode 100644
index 5169a64..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfEqualsFunction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.marmotta.kiwi.sparql.function.geosparql;
-
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sparql.builder.ValueType;
-import org.apache.marmotta.kiwi.sparql.function.NativeFunction;
-import org.apache.marmotta.kiwi.vocabulary.FN_GEOSPARQL;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException;
-import org.openrdf.query.algebra.evaluation.function.FunctionRegistry;
-
-/**
- * A SPARQL function for doing a equals between two geometries. Should be
- * implemented directly in the database, as the in-memory implementation is
- * non-functional. Only support by postgres - POSTGIS
- * <p/>
- * The function can be called either as:
- * <ul>
- *      <li>geof:sfEquals(?geometryA, ?geometryB) </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
- * to create a geometry index for your database. Please consult your database
- * documentation on how to do this.
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class SfEqualsFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.SF_EQUALS.toString())) {
-            FunctionRegistry.getInstance().add(new SfEqualsFunction());
-        }
-    }
-
-    @Override
-    public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException {
-        throw new UnsupportedOperationException("cannot evaluate in-memory, needs to be supported by the database");
-    }
-
-    @Override
-    public String getURI() {
-        return FN_GEOSPARQL.SF_EQUALS.toString();
-    }
-
-    /**
-     * Return true if this function has available native support for the given
-     * dialect
-     *
-     * @param dialect
-     * @return
-     */
-    @Override
-    public boolean isSupported(KiWiDialect dialect) {
-        return dialect instanceof PostgreSQLDialect;
-    }
-
-    /**
-     * Return a string representing how this GeoSPARQL function is translated
-     * into SQL ( Postgis Function ) in the given dialect
-     *
-     * @param dialect
-     * @param args
-     * @return
-     */
-    @Override
-    public String getNative(KiWiDialect dialect, String... args) {
-        if (dialect instanceof PostgreSQLDialect) {
-            if (args.length == 2) {
-                String geom1 = args[0];
-                String geom2 = args[1];
-                String SRID_default = "4326";
-                /*
-                 * The following condition is required to read WKT  inserted directly into args[0] or args[1] and create a geometries with SRID
-                 * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: 
-                 *   example: geof:sfEquals(?wkt, "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:sfEquals(?wkt, geof:buffer(?wkt2, 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);
-                }
-                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_Equals(%s , %s )", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("Equals function not supported by dialect " + dialect);
-    }
-
-    /**
-     * Get the return type of the function. This is needed for SQL type casting
-     * inside KiWi.
-     *
-     * @return
-     */
-    @Override
-    public ValueType getReturnType() {
-        return ValueType.BOOL;
-    }
-
-    /**
-     * Get the argument type of the function for the arg'th argument (starting
-     * to count at 0). This is needed for SQL type casting inside KiWi.
-     *
-     * @param arg
-     * @return
-     */
-    @Override
-    public ValueType getArgumentType(int arg) {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Return the minimum number of arguments this function requires.
-     *
-     * @return
-     */
-    @Override
-    public int getMinArgs() {
-        return 2;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfIntersectsFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfIntersectsFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfIntersectsFunction.java
deleted file mode 100644
index c289e32..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfIntersectsFunction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.marmotta.kiwi.sparql.function.geosparql;
-
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sparql.builder.ValueType;
-import org.apache.marmotta.kiwi.sparql.function.NativeFunction;
-import org.apache.marmotta.kiwi.vocabulary.FN_GEOSPARQL;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException;
-import org.openrdf.query.algebra.evaluation.function.FunctionRegistry;
-
-/**
- * A SPARQL function for doing a intersection between two geometries. Should be
- * implemented directly in the database, as the in-memory implementation is
- * non-functional. Only support by postgres - POSTGIS.
- * <p/>
- * The function can be called either as:
- * <ul>
- *      <li>geof:sfIntersects(?geometryA, ?geometryB) </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
- * to create a geometry index for your database. Please consult your database
- * documentation on how to do this.
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class SfIntersectsFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.SF_INTERSECTS.toString())) {
-            FunctionRegistry.getInstance().add(new SfIntersectsFunction());
-        }
-    }
-
-    @Override
-    public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException {
-        throw new UnsupportedOperationException("cannot evaluate in-memory, needs to be supported by the database");
-    }
-
-    @Override
-    public String getURI() {
-        return FN_GEOSPARQL.SF_INTERSECTS.toString();
-    }
-
-    /**
-     * Return true if this function has available native support for the given
-     * dialect
-     *
-     * @param dialect
-     * @return
-     */
-    @Override
-    public boolean isSupported(KiWiDialect dialect) {
-        return dialect instanceof PostgreSQLDialect;
-    }
-
-    /**
-     * Return a string representing how this GeoSPARQL function is translated
-     * into SQL ( Postgis Function ) in the given dialect
-     *
-     * @param dialect
-     * @param args
-     * @return
-     */
-    @Override
-    public String getNative(KiWiDialect dialect, String... args) {
-        if (dialect instanceof PostgreSQLDialect) {
-            if (args.length == 2) {
-                String geom1 = args[0];
-                String geom2 = args[1];
-                String SRID_default = "4326";
-                /*
-                 * The following condition is required to read WKT  inserted directly into args[0] or args[1] and create a geometries with SRID
-                 * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: 
-                 *   example: geof:sfIntersects(?wkt, "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:sfIntersects(?wkt, geof:buffer(?wkt2, 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);
-                }
-                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_Intersects(%s , %s ) ", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("Intersects function not supported by dialect " + dialect);
-    }
-
-    /**
-     * Get the return type of the function. This is needed for SQL type casting
-     * inside KiWi.
-     *
-     * @return
-     */
-    @Override
-    public ValueType getReturnType() {
-        return ValueType.BOOL;
-    }
-
-    /**
-     * Get the argument type of the function for the arg'th argument (starting
-     * to count at 0). This is needed for SQL type casting inside KiWi.
-     *
-     * @param arg
-     * @return
-     */
-    @Override
-    public ValueType getArgumentType(int arg) {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Return the minimum number of arguments this function requires.
-     *
-     * @return
-     */
-    @Override
-    public int getMinArgs() {
-        return 2;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfOverlapsFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfOverlapsFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfOverlapsFunction.java
deleted file mode 100644
index bb2a2dc..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfOverlapsFunction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.marmotta.kiwi.sparql.function.geosparql;
-
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sparql.builder.ValueType;
-import org.apache.marmotta.kiwi.sparql.function.NativeFunction;
-import org.apache.marmotta.kiwi.vocabulary.FN_GEOSPARQL;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException;
-import org.openrdf.query.algebra.evaluation.function.FunctionRegistry;
-
-/**
- * A SPARQL function for doing a overlaps between geometries. Should be
- * implemented directly in the database, as the in-memory implementation is
- * non-functional. Only support by postgres - POSTGIS
- * <p/>
- * The function can be called either as:
- * <ul>
- *      <li>geof:sfOverlaps(?geometryA, ?geometryB) </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
- * to create a geometry index for your database. Please consult your database
- * documentation on how to do this.
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class SfOverlapsFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.SF_OVERLAPS.toString())) {
-            FunctionRegistry.getInstance().add(new SfOverlapsFunction());
-        }
-    }
-
-    @Override
-    public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException {
-        throw new UnsupportedOperationException("cannot evaluate in-memory, needs to be supported by the database");
-    }
-
-    @Override
-    public String getURI() {
-        return FN_GEOSPARQL.SF_OVERLAPS.toString();
-    }
-
-    /**
-     * Return true if this function has available native support for the given
-     * dialect
-     *
-     * @param dialect
-     * @return
-     */
-    @Override
-    public boolean isSupported(KiWiDialect dialect) {
-        return dialect instanceof PostgreSQLDialect;
-    }
-
-    /**
-     * Return a string representing how this GeoSPARQL function is translated
-     * into SQL ( Postgis Function ) in the given dialect
-     *
-     * @param dialect
-     * @param args
-     * @return
-     */
-    @Override
-    public String getNative(KiWiDialect dialect, String... args) {
-        if (dialect instanceof PostgreSQLDialect) {
-            if (args.length == 2) {
-                String geom1 = args[0];
-                String geom2 = args[1];
-                String SRID_default = "4326";
-                /*
-                 * The following condition is required to read WKT  inserted directly into args[0] or args[1] and create a geometries with SRID
-                 * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: 
-                 *   example: geof:sfOverlaps(?wkt, "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:sfOverlaps(?wkt, geof:buffer(?wkt2, 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);
-                }
-                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_Overlaps(%s , %s )", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("Overlaps function not supported by dialect " + dialect);
-    }
-
-    /**
-     * Get the return type of the function. This is needed for SQL type casting
-     * inside KiWi.
-     *
-     * @return
-     */
-    @Override
-    public ValueType getReturnType() {
-        return ValueType.BOOL;
-    }
-
-    /**
-     * Get the argument type of the function for the arg'th argument (starting
-     * to count at 0). This is needed for SQL type casting inside KiWi.
-     *
-     * @param arg
-     * @return
-     */
-    @Override
-    public ValueType getArgumentType(int arg) {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Return the minimum number of arguments this function requires.
-     *
-     * @return
-     */
-    @Override
-    public int getMinArgs() {
-        return 2;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfTouchesFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfTouchesFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfTouchesFunction.java
deleted file mode 100644
index 8affc61..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfTouchesFunction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.marmotta.kiwi.sparql.function.geosparql;
-
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sparql.builder.ValueType;
-import org.apache.marmotta.kiwi.sparql.function.NativeFunction;
-import org.apache.marmotta.kiwi.vocabulary.FN_GEOSPARQL;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException;
-import org.openrdf.query.algebra.evaluation.function.FunctionRegistry;
-
-/**
- * A SPARQL function for doing touches analyzer between two geometries. Should
- * be implemented directly in the database, as the in-memory implementation is
- * non-functional. Only support by postgres - POSTGIS
- * <p/>
- * The function can be called either as:
- * <ul>
- *      <li>geof:sfTouches(?geometryA, ?geometryB) </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
- * to create a geometry index for your database. Please consult your database
- * documentation on how to do this.
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class SfTouchesFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.SF_TOUCHES.toString())) {
-            FunctionRegistry.getInstance().add(new SfTouchesFunction());
-        }
-    }
-
-    @Override
-    public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException {
-        throw new UnsupportedOperationException("cannot evaluate in-memory, needs to be supported by the database");
-    }
-
-    @Override
-    public String getURI() {
-        return FN_GEOSPARQL.SF_TOUCHES.toString();
-    }
-
-    /**
-     * Return true if this function has available native support for the given
-     * dialect
-     *
-     * @param dialect
-     * @return
-     */
-    @Override
-    public boolean isSupported(KiWiDialect dialect) {
-        return dialect instanceof PostgreSQLDialect;
-    }
-
-    /**
-     * Return a string representing how this GeoSPARQL function is translated
-     * into SQL ( Postgis Function ) in the given dialect
-     *
-     * @param dialect
-     * @param args
-     * @return
-     */
-    @Override
-    public String getNative(KiWiDialect dialect, String... args) {
-        if (dialect instanceof PostgreSQLDialect) {
-            if (args.length == 2) {
-                String geom1 = args[0];
-                String geom2 = args[1];
-                String SRID_default = "4326";
-                /*
-                 * The following condition is required to read WKT  inserted directly into args[0] or args[1] and create a geometries with SRID
-                 * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: 
-                 *   example: geof:sfTouches(?wkt, "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:sfTouches(?wkt, geof:buffer(?wkt2, 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);
-                }
-                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_Touches(%s , %s )", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("Touches function not supported by dialect " + dialect);
-    }
-
-    /**
-     * Get the return type of the function. This is needed for SQL type casting
-     * inside KiWi.
-     *
-     * @return
-     */
-    @Override
-    public ValueType getReturnType() {
-        return ValueType.BOOL;
-    }
-
-    /**
-     * Get the argument type of the function for the arg'th argument (starting
-     * to count at 0). This is needed for SQL type casting inside KiWi.
-     *
-     * @param arg
-     * @return
-     */
-    @Override
-    public ValueType getArgumentType(int arg) {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Return the minimum number of arguments this function requires.
-     *
-     * @return
-     */
-    @Override
-    public int getMinArgs() {
-        return 2;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfWithinFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfWithinFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfWithinFunction.java
deleted file mode 100644
index e6dfae3..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfWithinFunction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.marmotta.kiwi.sparql.function.geosparql;
-
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sparql.builder.ValueType;
-import org.apache.marmotta.kiwi.sparql.function.NativeFunction;
-import org.apache.marmotta.kiwi.vocabulary.FN_GEOSPARQL;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException;
-import org.openrdf.query.algebra.evaluation.function.FunctionRegistry;
-
-/**
- * A SPARQL function for doing a within between two geometries. Should be
- * implemented directly in the database, as the in-memory implementation is
- * non-functional. Only support by postgres - POSTGIS
- * <p/>
- * The function can be called either as:
- * <ul>
- *      <li>geof:sfWithin(?geometryA, ?geometryB) </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
- * to create a geometry index for your database. Please consult your database
- * documentation on how to do this.
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class SfWithinFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.SF_WITHIN.toString())) {
-            FunctionRegistry.getInstance().add(new SfWithinFunction());
-        }
-    }
-
-    @Override
-    public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException {
-        throw new UnsupportedOperationException("cannot evaluate in-memory, needs to be supported by the database");
-    }
-
-    @Override
-    public String getURI() {
-        return FN_GEOSPARQL.SF_WITHIN.toString();
-    }
-
-    /**
-     * Return true if this function has available native support for the given
-     * dialect
-     *
-     * @param dialect
-     * @return
-     */
-    @Override
-    public boolean isSupported(KiWiDialect dialect) {
-        return dialect instanceof PostgreSQLDialect;
-    }
-
-    /**
-     * Return a string representing how this GeoSPARQL function is translated
-     * into SQL ( Postgis Function ) in the given dialect
-     *
-     * @param dialect
-     * @param args
-     * @return
-     */
-    @Override
-    public String getNative(KiWiDialect dialect, String... args) {
-        if (dialect instanceof PostgreSQLDialect) {
-            if (args.length == 2) {
-                String geom1 = args[0];
-                String geom2 = args[1];
-                String SRID_default = "4326";
-                /*
-                 * The following condition is required to read WKT  inserted directly into args[0] or args[1] and create a geometries with SRID
-                 * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: 
-                 *   example: geof:sfWithin(?wkt, "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:sfWithin(?wkt, geof:buffer(?wkt2, 5, units:degree))
-                 */
-                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);
-                }
-                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_Within(%s,%s)", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("Within function not supported by dialect " + dialect);
-    }
-
-    /**
-     * Get the return type of the function. This is needed for SQL type casting
-     * inside KiWi.
-     *
-     * @return
-     */
-    @Override
-    public ValueType getReturnType() {
-        return ValueType.BOOL;
-    }
-
-    /**
-     * Get the argument type of the function for the arg'th argument (starting
-     * to count at 0). This is needed for SQL type casting inside KiWi.
-     *
-     * @param arg
-     * @return
-     */
-    @Override
-    public ValueType getArgumentType(int arg) {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Return the minimum number of arguments this function requires.
-     *
-     * @return
-     */
-    @Override
-    public int getMinArgs() {
-        return 2;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SymDifferenceFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SymDifferenceFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SymDifferenceFunction.java
deleted file mode 100644
index c9bc838..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SymDifferenceFunction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.marmotta.kiwi.sparql.function.geosparql;
-
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sparql.builder.ValueType;
-import org.apache.marmotta.kiwi.sparql.function.NativeFunction;
-import org.apache.marmotta.kiwi.vocabulary.FN_GEOSPARQL;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException;
-import org.openrdf.query.algebra.evaluation.function.FunctionRegistry;
-
-/**
- * A SPARQL function for doing a symDifference of a geometry. Should be
- * implemented directly in the database, as the in-memory implementation is
- * non-functional. Only support by postgres - POSTGIS
- * <p/>
- * The function can be called either as:
- * <ul>
- *      <li>geof:symDifference(?geometryA, ?geometryB) </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
- * to create a geometry index for your database. Please consult your database
- * documentation on how to do this.
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class SymDifferenceFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.SYM_DIFFERENCE.toString())) {
-            FunctionRegistry.getInstance().add(new SymDifferenceFunction());
-        }
-    }
-
-    @Override
-    public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException {
-        throw new UnsupportedOperationException("cannot evaluate in-memory, needs to be supported by the database");
-    }
-
-    @Override
-    public String getURI() {
-        return FN_GEOSPARQL.SYM_DIFFERENCE.toString();
-    }
-
-    /**
-     * Return true if this function has available native support for the given
-     * dialect
-     *
-     * @param dialect
-     * @return
-     */
-    @Override
-    public boolean isSupported(KiWiDialect dialect) {
-        return dialect instanceof PostgreSQLDialect;
-    }
-
-    /**
-     * Return a string representing how this GeoSPARQL function is translated
-     * into SQL ( Postgis Function ) in the given dialect
-     *
-     * @param dialect
-     * @param args
-     * @return
-     */
-    @Override
-    public String getNative(KiWiDialect dialect, String... args) {
-        if (dialect instanceof PostgreSQLDialect) {
-            if (args.length == 2) {
-                String geom1 = args[0];
-                String geom2 = args[1];
-                String SRID_default = "4326";
-                /*
-                 * The following condition is required to read WKT  inserted directly into args[0] or args[1] and create a geometries with SRID
-                 * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: 
-                 *   example: geof:symDifference(?wkt, "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:symDifference(?wkt, geof:buffer(?wkt2, 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);
-                }
-                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_AsText(ST_SymDifference(%s , %s )) ", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("SymDifference function not supported by dialect " + dialect);
-    }
-
-    /**
-     * Get the return type of the function. This is needed for SQL type casting
-     * inside KiWi.
-     *
-     * @return
-     */
-    @Override
-    public ValueType getReturnType() {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Get the argument type of the function for the arg'th argument (starting
-     * to count at 0). This is needed for SQL type casting inside KiWi.
-     *
-     * @param arg
-     * @return
-     */
-    @Override
-    public ValueType getArgumentType(int arg) {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Return the minimum number of arguments this function requires.
-     *
-     * @return
-     */
-    @Override
-    public int getMinArgs() {
-        return 2;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/UnionFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/UnionFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/UnionFunction.java
deleted file mode 100644
index 6a64696..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/UnionFunction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.marmotta.kiwi.sparql.function.geosparql;
-
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sparql.builder.ValueType;
-import org.apache.marmotta.kiwi.sparql.function.NativeFunction;
-import org.apache.marmotta.kiwi.vocabulary.FN_GEOSPARQL;
-import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.query.algebra.evaluation.ValueExprEvaluationException;
-import org.openrdf.query.algebra.evaluation.function.FunctionRegistry;
-
-/**
- * A SPARQL function for doing a union between two geometries. Should be
- * implemented directly in the database, as the in-memory implementation is
- * non-functional. Only support by postgres - POSTGIS
- * <p/>
- * The function can be called either as:
- * <ul>
- *      <li>geof:union(?geometryA, ?geometryB) </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
- * to create a geometry index for your database. Please consult your database
- * documentation on how to do this.
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class UnionFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.UNION.toString())) {
-            FunctionRegistry.getInstance().add(new UnionFunction());
-        }
-    }
-
-    @Override
-    public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException {
-        throw new UnsupportedOperationException("cannot evaluate in-memory, needs to be supported by the database");
-    }
-
-    @Override
-    public String getURI() {
-        return FN_GEOSPARQL.UNION.toString();
-    }
-
-    /**
-     * Return true if this function has available native support for the given
-     * dialect
-     *
-     * @param dialect
-     * @return
-     */
-    @Override
-    public boolean isSupported(KiWiDialect dialect) {
-        return dialect instanceof PostgreSQLDialect;
-    }
-
-    /**
-     * Return a string representing how this GeoSPARQL function is translated
-     * into SQL ( Postgis Function ) in the given dialect
-     *
-     * @param dialect
-     * @param args
-     * @return
-     */
-    @Override
-    public String getNative(KiWiDialect dialect, String... args) {
-        if (dialect instanceof PostgreSQLDialect) {
-            if (args.length == 2) {
-                String geom1 = args[0];
-                String geom2 = args[1];
-                String SRID_default = "4326";
-                /*
-                 * The following condition is required to read WKT  inserted directly into args[0] or args[1] and create a geometries with SRID
-                 * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: 
-                 *   example: geof:union(?geom1, "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:union(?geom1, geof:buffer(?geom2, 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);
-                }
-                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_AsText(ST_Union(%s , %s ) )", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("union function not supported by dialect " + dialect);
-    }
-
-    /**
-     * Get the return type of the function. This is needed for SQL type casting
-     * inside KiWi.
-     *
-     * @return
-     */
-    @Override
-    public ValueType getReturnType() {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Get the argument type of the function for the arg'th argument (starting
-     * to count at 0). This is needed for SQL type casting inside KiWi.
-     *
-     * @param arg
-     * @return
-     */
-    @Override
-    public ValueType getArgumentType(int arg) {
-        return ValueType.GEOMETRY;
-    }
-
-    /**
-     * Return the minimum number of arguments this function requires.
-     *
-     * @return
-     */
-    @Override
-    public int getMinArgs() {
-        return 2;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 2;
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/resources/META-INF/services/org.apache.marmotta.kiwi.sparql.function.NativeFunction
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/resources/META-INF/services/org.apache.marmotta.kiwi.sparql.function.NativeFunction b/libraries/kiwi/kiwi-sparql/src/main/resources/META-INF/services/org.apache.marmotta.kiwi.sparql.function.NativeFunction
index 85353e5..4197dc0 100644
--- a/libraries/kiwi/kiwi-sparql/src/main/resources/META-INF/services/org.apache.marmotta.kiwi.sparql.function.NativeFunction
+++ b/libraries/kiwi/kiwi-sparql/src/main/resources/META-INF/services/org.apache.marmotta.kiwi.sparql.function.NativeFunction
@@ -15,45 +15,6 @@
 # limitations under the License.
 #
 
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfIntersectsFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfWithinFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfTouchesFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfContainsFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfCrossesFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfDisjointFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfEqualsFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfOverlapsFunction
-
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8DCFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8ECFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8EQFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8NTPPFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8NTPPiFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8POFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8TPPFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8TPPiFunction
-
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhContainsFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhCoveredByFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhDisjointFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhEqualsFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhInsideFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhMeetFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhOverlapFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhCoversFunction
-
-org.apache.marmotta.kiwi.sparql.function.geosparql.BufferFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.ConvexHullFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.IntersectionFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.DistanceFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.DifferenceFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SymDifferenceFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EnvelopeFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.BoundaryFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.UnionFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.RelateFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.GetSRIDFunction
-
 org.apache.marmotta.kiwi.sparql.function.cast.NBooleanCast
 org.apache.marmotta.kiwi.sparql.function.cast.NDateTimeCast
 org.apache.marmotta.kiwi.sparql.function.cast.NDecimalCast
@@ -100,4 +61,4 @@ org.apache.marmotta.kiwi.sparql.function.string.NStrEnds
 org.apache.marmotta.kiwi.sparql.function.string.NStrLen
 org.apache.marmotta.kiwi.sparql.function.string.NStrStarts
 org.apache.marmotta.kiwi.sparql.function.string.NUpperCase
-org.apache.marmotta.kiwi.sparql.function.string.NSubstring
\ No newline at end of file
+org.apache.marmotta.kiwi.sparql.function.string.NSubstring

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function b/libraries/kiwi/kiwi-sparql/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function
index 4fc9486..5065949 100644
--- a/libraries/kiwi/kiwi-sparql/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function
+++ b/libraries/kiwi/kiwi-sparql/src/main/resources/META-INF/services/org.openrdf.query.algebra.evaluation.function.Function
@@ -1,43 +1,21 @@
+#
+# 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.
+#
+
 org.apache.marmotta.kiwi.sparql.function.custom.FulltextSearchFunction
 org.apache.marmotta.kiwi.sparql.function.custom.FulltextQueryFunction
 org.apache.marmotta.kiwi.sparql.function.custom.Stddev
 org.apache.marmotta.kiwi.sparql.function.custom.Variance
-
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfIntersectsFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfWithinFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfTouchesFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfContainsFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfCrossesFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfDisjointFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfEqualsFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SfOverlapsFunction
-
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8DCFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8ECFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8EQFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8NTPPFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8NTPPiFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8POFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8TPPFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.Rcc8TPPiFunction
-
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhContainsFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhCoveredByFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhDisjointFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhEqualsFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhInsideFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhMeetFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhOverlapFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EhCoversFunction
-
-org.apache.marmotta.kiwi.sparql.function.geosparql.BufferFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.ConvexHullFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.IntersectionFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.DistanceFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.DifferenceFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.SymDifferenceFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.EnvelopeFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.BoundaryFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.UnionFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.RelateFunction
-org.apache.marmotta.kiwi.sparql.function.geosparql.GetSRIDFunction

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/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
deleted file mode 100644
index b0678e5..0000000
--- a/libraries/kiwi/kiwi-sparql/src/test/java/org/apache/marmotta/kiwi/sparql/testgeosparql/GeoSPARQLFunctionsTest.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * 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.
- */
-package org.apache.marmotta.kiwi.sparql.testgeosparql;
-
-import info.aduna.iteration.Iterations;
-import org.apache.commons.io.IOUtils;
-import org.apache.marmotta.kiwi.config.KiWiConfiguration;
-import org.apache.marmotta.kiwi.sail.KiWiStore;
-import org.apache.marmotta.kiwi.sparql.sail.KiWiSparqlSail;
-import org.junit.*;
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-import org.openrdf.query.*;
-import org.openrdf.repository.Repository;
-import org.openrdf.repository.RepositoryConnection;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.sail.SailRepository;
-import org.openrdf.rio.RDFFormat;
-import org.openrdf.rio.RDFParseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.List;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.test.helper.DBConnectionChecker;
-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) 
- *      RCC8 Topological Relations (8) 
- *      Non-Topological Functions (11)
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec)
- */
-public class GeoSPARQLFunctionsTest {
-
-    private KiWiStore store;
-    private KiWiSparqlSail sail;
-    private Repository repository;
-
-    private final KiWiConfiguration dbConfig;
-
-    public GeoSPARQLFunctionsTest() {
-        logger.info("creating test setup...");
-        dbConfig = KiWiDatabaseRunner.createKiWiConfig("PostgreSQL", new PostgreSQLDialect());
-        DBConnectionChecker.checkDatabaseAvailability(dbConfig);
-
-        dbConfig.setFulltextEnabled(true);
-        dbConfig.setFulltextLanguages(new String[]{"en"});
-    }
-
-    @Before
-    public void initDatabase() throws RepositoryException, IOException, RDFParseException {
-        store = new KiWiStore(dbConfig);
-        store.setDropTablesOnShutdown(true);
-        sail = new KiWiSparqlSail(store);
-        repository = new SailRepository(sail);
-        repository.initialize();
-
-        logger.info("loading data to test...");
-
-        // load demo data spain provinces
-        RepositoryConnection con = repository.getConnection();
-        try {
-            con.begin();
-            con.add(this.getClass().getResourceAsStream("demo_data_spain_provinces.rdf"), "http://localhost/test/", RDFFormat.RDFXML);
-            con.add(this.getClass().getResourceAsStream("demo_data_spain_towns.rdf"), "http://localhost/test/", RDFFormat.RDFXML);
-            con.add(this.getClass().getResourceAsStream("demo_data_spain_rivers.rdf"), "http://localhost/test/", RDFFormat.RDFXML);
-            con.commit();
-        } finally {
-            con.close();
-        }
-    }
-
-    @After
-    public void dropDatabase() throws RepositoryException, SQLException {
-        logger.info("cleaning up test setup...");
-        if (store != null && store.isInitialized()) {
-            store.getPersistence().dropDatabase();
-            repository.shutDown();
-        }
-    }
-
-    final Logger logger
-            = LoggerFactory.getLogger(this.getClass());
-
-    @Rule
-    public TestWatcher watchman = new TestWatcher() {
-        /**
-         * Invoked when a test is about to start
-         */
-        @Override
-        protected void starting(Description description) {
-            logger.info("{} being run...", description.getMethodName());
-        }
-    };
-
-    @Test
-    public void testSfContains() throws Exception {
-        testQueryBoolean("sfContains.sparql", "contains");
-    }
-
-    @Test
-    public void testSfCrosses() throws Exception {
-        testQueryBoolean("sfCrosses.sparql", "crosses");
-    }
-
-    @Test
-    public void testSfDisjoint() throws Exception {
-        testQueryBoolean("sfDisjoint.sparql", "disjoint");
-    }
-
-    @Test
-    public void testSfEquals() throws Exception {
-        testQueryBoolean("sfEquals.sparql", "equals");
-    }
-
-    @Test
-    public void testSfIntersects() throws Exception {
-        testQueryBoolean("sfIntersects.sparql", "intersects");
-    }
-
-    @Test
-    public void testSfOverlaps() throws Exception {
-        testQueryBoolean("sfOverlaps.sparql", "overlaps");
-    }
-
-    @Test
-    public void testSfTouches() throws Exception {
-        testQueryBoolean("sfTouches.sparql", "touches");
-    }
-
-    @Test
-    public void testSfWithin() throws Exception {
-        testQueryBoolean("sfWithin.sparql", "within");
-    }
-
-    @Test
-    public void testBoundary() throws Exception {
-        testQueryGeometry("boundary.sparql");
-    }
-
-    @Test
-    public void testBuffer() throws Exception {
-        testQueryGeometry("buffer.sparql");
-    }
-
-    @Test
-    public void testConvexHull() throws Exception {
-        testQueryGeometry("convexHull.sparql");
-    }
-
-    @Test
-    public void testDifference() throws Exception {
-        testQueryGeometry("difference.sparql");
-    }
-
-    @Test
-    public void testDistance() throws Exception {
-        testQueryGeometry("distance.sparql");
-    }
-
-    @Test
-    public void testEnvelope() throws Exception {
-        testQueryGeometry("envelope.sparql");
-    }
-
-    @Test
-    public void testGetSRID() throws Exception {
-        testQueryGeometry("getSRID.sparql");
-    }
-
-    @Test
-    public void testIntersection() throws Exception {
-        testQueryGeometry("intersection.sparql");
-    }
-
-    @Test
-    public void testRelate() throws Exception {
-        testQueryBoolean("relate.sparql", "relate");
-    }
-
-    @Test
-    public void testSymDifference() throws Exception {
-        testQueryGeometry("symDifference.sparql");
-    }
-
-    @Test
-    public void testUnion() throws Exception {
-        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 testEhMeet() throws Exception {
-        testQueryBoolean("ehMeet.sparql", "ehMeet");
-    }
-
-    @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 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");
-    }
-
-    @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");
-
-        RepositoryConnection conn = repository.getConnection();
-        try {
-
-            conn.begin();
-
-            TupleQuery query1 = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
-            TupleQueryResult result1 = query1.evaluate();
-
-            conn.commit();
-
-            Assert.assertTrue(result1.hasNext());
-
-            List<BindingSet> results = Iterations.asList(result1);
-
-            Assert.assertTrue(Boolean.parseBoolean(results.get(0).getValue(function).stringValue()));
-        } catch (RepositoryException ex) {
-            conn.rollback();
-        } finally {
-            conn.close();
-        }
-    }
-
-    private void testQueryGeometry(String filename) throws Exception {
-        String queryString = IOUtils.toString(this.getClass().getResourceAsStream(filename), "UTF-8");
-
-        RepositoryConnection conn = repository.getConnection();
-        try {
-
-            conn.begin();
-
-            TupleQuery query1 = conn.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
-            TupleQueryResult result1 = query1.evaluate();
-
-            conn.commit();
-
-            Assert.assertTrue(result1.hasNext());
-
-            List<BindingSet> results = Iterations.asList(result1);
-
-            Assert.assertEquals(1, results.size());
-        } catch (RepositoryException ex) {
-            conn.rollback();
-        } finally {
-            conn.close();
-        }
-    }
-}

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

http://git-wip-us.apache.org/repos/asf/marmotta/blob/b93cdc78/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/buffer.sparql
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/buffer.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/buffer.sparql
deleted file mode 100644
index d2eadb7..0000000
--- a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/buffer.sparql
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# 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 ?municipio ?wkt (geof:buffer(?wkt, 100, units:metre) as ?buffer)
-WHERE {  
-  ?subject a <http://geo.marmotta.es/ontology#municipio>.
-  ?subject rdfs:label ?municipio.
-  ?subject rdfs:label "Ajalvir" @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/b93cdc78/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/convexHull.sparql
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/convexHull.sparql b/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/convexHull.sparql
deleted file mode 100644
index f203271..0000000
--- a/libraries/kiwi/kiwi-sparql/src/test/resources/org/apache/marmotta/kiwi/sparql/testgeosparql/convexHull.sparql
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# 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:convexHull(?wkt) as ?convexHull)
-WHERE {  
-  ?subject a <http://geo.marmotta.es/ontology#provincia>.
-  ?subject rdfs:label "Barcelona"@es.
-  ?subject geoes:hasExactGeometry ?geo.
-  ?geo geo:asWKT ?wkt.
-}
\ No newline at end of file