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:52 UTC

[06/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/EnvelopeFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/EnvelopeFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/EnvelopeFunction.java
deleted file mode 100644
index fea2bfd..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/EnvelopeFunction.java
+++ /dev/null
@@ -1,148 +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 an envelope 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:envelope(?geometryA) </li>
- * </ul>
- * Its necesary enable postgis in your database with the next command "CREATE
- * EXTENSION postgis;" Note that for performance reasons it might be preferrable
- * 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 EnvelopeFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.ENVELOPE.toString())) {
-            FunctionRegistry.getInstance().add(new EnvelopeFunction());
-        }
-    }
-
-    @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.ENVELOPE.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 == 1) {
-                String geom1 = args[0];
-                String SRID_default = "4326";
-                /*
-                 * The following conditions is required to read WKT  inserted directly into args[0] and create a geometries with SRID
-                 * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions: 
-                 *   example: geof:envelope("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:envelope(geof:buffer(?geom, 50, units:meter))
-                 */
-                if (args[0].contains("POINT") || args[0].contains("MULTIPOINT") || args[0].contains("LINESTRING") || args[0].contains("MULTILINESTRING") || args[0].contains("POLYGON") || args[0].contains("MULTIPOLYGON") || args[0].contains("ST_AsText")) {
-                    geom1 = String.format("ST_GeomFromText(%s,%s)", args[0], SRID_default);
-                }
-                return String.format("ST_AsText(ST_Envelope(%s)) ", geom1);
-            }
-        }
-        throw new UnsupportedOperationException("Envelope 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 1;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 1;
-    }
-}

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/GetSRIDFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/GetSRIDFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/GetSRIDFunction.java
deleted file mode 100644
index 637df20..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/GetSRIDFunction.java
+++ /dev/null
@@ -1,136 +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;
-
-/**
- * Returns the spatial reference system URI for geom.. 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:getSRID(?geometryA) </li>
- * </ul>
- * Its necesary enable postgis in your database with the next command "CREATE
- * EXTENSION postgis;" Note that for performance reasons it might be preferrable
- * 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 GetSRIDFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.GETSRID.toString())) {
-            FunctionRegistry.getInstance().add(new GetSRIDFunction());
-        }
-    }
-
-    @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.GETSRID.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 == 1) {
-                return String.format("ST_SRID(%s)", args[0]);
-            }
-        }
-        throw new UnsupportedOperationException("getSRID 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.INT;
-    }
-
-    /**
-     * 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 1;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 1;
-    }
-}

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/IntersectionFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/IntersectionFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/IntersectionFunction.java
deleted file mode 100644
index 394f700..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/IntersectionFunction.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:intersection(?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 IntersectionFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.INTERSECTION.toString())) {
-            FunctionRegistry.getInstance().add(new IntersectionFunction());
-        }
-    }
-
-    @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.INTERSECTION.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:intersection(?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:intersection(?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_Intersection(%s , %s ) )", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("Intersection 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/Rcc8DCFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8DCFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8DCFunction.java
deleted file mode 100644
index 4517408..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8DCFunction.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 analyze the DisconnecTion 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:rcc8dc(?geometryA, ?geometryB) </li>
- * </ul>
- * DisconnecTion is calculated with "DE-9IM Intersection Pattern": defined in
- * "RCC8 Query Functions Table 7" from "DE-9IM Intersection Pattern" from OGC
- * GEOSPARQL DOCUMENT (
- * https://portal.opengeospatial.org/files/?artifact_id=47664 )
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class Rcc8DCFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.RCC8_DC.toString())) {
-            FunctionRegistry.getInstance().add(new Rcc8DCFunction());
-        }
-    }
-
-    @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.RCC8_DC.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:rcc8dc(?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:rcc8dc(?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_Relate(%s, %s, 'FFTFFTTTT')", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("rcc8dc 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/Rcc8ECFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8ECFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8ECFunction.java
deleted file mode 100644
index 4ed5b94..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8ECFunction.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 analyze the External Connection 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:rcc8ec(?geometryA, ?geometryB) </li>
- * </ul>
- * External Connection is calculated with "DE-9IM Intersection Pattern": defined
- * in "RCC8 Query Functions Table 7" from "DE-9IM Intersection Pattern" from OGC
- * GEOSPARQL DOCUMENT (
- * https://portal.opengeospatial.org/files/?artifact_id=47664 )
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class Rcc8ECFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.RCC8_EC.toString())) {
-            FunctionRegistry.getInstance().add(new Rcc8ECFunction());
-        }
-    }
-
-    @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.RCC8_EC.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:rcc8ec(?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:rcc8ec(?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_Relate(%s, %s, 'FFTFTTTTT')", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("rcc8ec 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/Rcc8EQFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8EQFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8EQFunction.java
deleted file mode 100644
index 92da0a5..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8EQFunction.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 analyze the EQuality 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:rcc8eq(?geometryA, ?geometryB) </li>
- * </ul>
- * EQuals is calculated with "DE-9IM Intersection Pattern": defined in "RCC8
- * Query Functions Table 7" from "DE-9IM Intersection Pattern" from OGC
- * GEOSPARQL DOCUMENT (
- * https://portal.opengeospatial.org/files/?artifact_id=47664 )
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class Rcc8EQFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.RCC8_EQ.toString())) {
-            FunctionRegistry.getInstance().add(new Rcc8EQFunction());
-        }
-    }
-
-    @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.RCC8_EQ.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:rcc8eq(?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:rcc8eq(?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_Relate(%s, %s, 'TFFFTFFFT')", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("rcc8eq 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/Rcc8NTPPFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8NTPPFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8NTPPFunction.java
deleted file mode 100644
index 9088559..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8NTPPFunction.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 analyze the Non-Tangential Proper Part 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:rcc8ntpp(?geometryA, ?geometryB) </li>
- * </ul>
- * Non-Tangential Proper Part is calculated with "DE-9IM Intersection Pattern":
- * defined in "RCC8 Query Functions Table 7" from "DE-9IM Intersection Pattern"
- * from OGC GEOSPARQL DOCUMENT (
- * https://portal.opengeospatial.org/files/?artifact_id=47664 )
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class Rcc8NTPPFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.RCC8_NTPP.toString())) {
-            FunctionRegistry.getInstance().add(new Rcc8NTPPFunction());
-        }
-    }
-
-    @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.RCC8_NTPP.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:rcc8ntpp(?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:rcc8ntpp(?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_Relate(%s, %s, 'TFFTFFTTT')", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("rcc8ntpp 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/Rcc8NTPPiFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8NTPPiFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8NTPPiFunction.java
deleted file mode 100644
index 75c5c67..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8NTPPiFunction.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 analyze the Non-Tangential Proper Part Inverse 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:rcc8ntppi(?geometryA, ?geometryB) </li>
- * </ul>
- * Non-Tangential Proper Part Inverse is calculated with "DE-9IM Intersection
- * Pattern": defined in "RCC8 Query Functions Table 7" from "DE-9IM Intersection
- * Pattern" from OGC GEOSPARQL DOCUMENT (
- * https://portal.opengeospatial.org/files/?artifact_id=47664 )
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class Rcc8NTPPiFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.RCC8_NTPPI.toString())) {
-            FunctionRegistry.getInstance().add(new Rcc8NTPPiFunction());
-        }
-    }
-
-    @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.RCC8_NTPPI.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:rcc8ntppi(?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:rcc8ntppi(?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_Relate(%s, %s, 'TTTFFTFFT')", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("rcc8ntppi 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/Rcc8POFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8POFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8POFunction.java
deleted file mode 100644
index d98285d..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8POFunction.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 analyze the Partially Overlapping 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:rcc8po(?geometryA, ?geometryB) </li>
- * </ul>
- * Define Partial Overlapping with "DE-9IM Intersection Pattern": defined in
- * "RCC8 Query Functions Table 7" from "DE-9IM Intersection Pattern" from OGC
- * GEOSPARQL DOCUMENT (
- * https://portal.opengeospatial.org/files/?artifact_id=47664 )
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class Rcc8POFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.RCC8_PO.toString())) {
-            FunctionRegistry.getInstance().add(new Rcc8POFunction());
-        }
-    }
-
-    @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.RCC8_PO.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:rcc8po(?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:rcc8po(?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_Relate(%s, %s, 'TTTTTTTTT')", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("rcc8po 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/Rcc8TPPFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8TPPFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8TPPFunction.java
deleted file mode 100644
index 67275c0..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8TPPFunction.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 analyze the Tangential Proper Part 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:rcc8tpp(?geometryA, ?geometryB) </li>
- * </ul>
- * Tangential Proper Part is calculated with "DE-9IM Intersection Pattern":
- * defined in "RCC8 Query Functions Table 7" from "DE-9IM Intersection Pattern"
- * from OGC GEOSPARQL DOCUMENT (
- * https://portal.opengeospatial.org/files/?artifact_id=47664 )
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class Rcc8TPPFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.RCC8_TPP.toString())) {
-            FunctionRegistry.getInstance().add(new Rcc8TPPFunction());
-        }
-    }
-
-    @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.RCC8_TPP.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:rcc8tpp(?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:rcc8tpp(?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_Relate(%s, %s, 'TFFTTFTTT')", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("rcc8tpp 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/Rcc8TPPiFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8TPPiFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8TPPiFunction.java
deleted file mode 100644
index 318c2ac..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/Rcc8TPPiFunction.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 analyze the Tangential Proper Part Inverse 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:rcc8tppi(?geometryA, ?geometryB) </li>
- * </ul>
- * Tangential Proper Part Inverse is calculated with "DE-9IM Intersection
- * Pattern": defined in "RCC8 Query Functions Table 7" from "DE-9IM Intersection
- * Pattern" from OGC GEOSPARQL DOCUMENT (
- * https://portal.opengeospatial.org/files/?artifact_id=47664 )
- *
- * @author Xavier Sumba (xavier.sumba93@ucuenca.ec))
- */
-public class Rcc8TPPiFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.RCC8_TPPI.toString())) {
-            FunctionRegistry.getInstance().add(new Rcc8TPPiFunction());
-        }
-    }
-
-    @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.RCC8_TPPI.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:rcc8tppi(?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:rcc8tppi(?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_Relate(%s, %s, 'TTTFTTFFT')", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("rcc8tppi 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/RelateFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/RelateFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/RelateFunction.java
deleted file mode 100644
index b78a0ff..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/RelateFunction.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 relate 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:relate (?geom1, ?geom2, ?pattern-matrix)</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 RelateFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.RELATE.toString())) {
-            FunctionRegistry.getInstance().add(new RelateFunction());
-        }
-    }
-
-    @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.RELATE.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 == 3) {
-                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:relate(?wkt, "POLYGON(( -7 43, -2 43, -2 38, -7 38, -7 43))"^^geo:wktLiteral), "F**T*****")
-                 * st_AsText condition: It is to use the geometry that is the result of another function geosparql.
-                 *   example: geof:relate(?wkt, geof:buffer(?wkt2, 50, units:meter), "F**T*****")
-                 */
-                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_Relate(%s, %s , %s)", geom1, geom2, args[2]);
-            }
-        }
-        throw new UnsupportedOperationException("Relate 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 3;
-    }
-
-    /**
-     * Return the maximum number of arguments this function can take
-     *
-     * @return
-     */
-    @Override
-    public int getMaxArgs() {
-        return 3;
-    }
-}

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/SfContainsFunction.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfContainsFunction.java b/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfContainsFunction.java
deleted file mode 100644
index 001560a..0000000
--- a/libraries/kiwi/kiwi-sparql/src/main/java/org/apache/marmotta/kiwi/sparql/function/geosparql/SfContainsFunction.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 geometry that contains another 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:sfContains(?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 SfContainsFunction implements NativeFunction {
-
-    // auto-register for SPARQL environment
-    static {
-        if (!FunctionRegistry.getInstance().has(FN_GEOSPARQL.SF_CONTAINS.toString())) {
-            FunctionRegistry.getInstance().add(new SfContainsFunction());
-        }
-    }
-
-    @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_CONTAINS.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:sfContains(?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:sfContains(?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_Contains(%s , %s )", geom1, geom2);
-            }
-        }
-        throw new UnsupportedOperationException("Contains 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;
-    }
-}