You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2013/02/21 12:23:28 UTC

[7/19] MARMOTTA-104: renamed packages in ldpath (resolved)

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/pom.xml b/libraries/ldpath/ldpath-functions-text/pom.xml
index ea8d431..e05cfe7 100644
--- a/libraries/ldpath/ldpath-functions-text/pom.xml
+++ b/libraries/ldpath/ldpath-functions-text/pom.xml
@@ -77,7 +77,7 @@
                         <!-- Enable this for including your enhancement chain configuration -->
                         <!-- <Install-Path>config</Install-Path> -->
                         <Export-Package>
-                            at.newmedialab.ldpath.model.*;version=${project.version},
+                            org.apache.marmotta.ldpath.model.*;version=${project.version},
                         </Export-Package>
                         <_include>src/main/resources/META-INF/MANIFEST.MF</_include>
                     </instructions>

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/ReplaceFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/ReplaceFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/ReplaceFunction.java
deleted file mode 100644
index ce14fbe..0000000
--- a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/ReplaceFunction.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed 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 at.newmedialab.ldpath.model.functions.text;
-
-import at.newmedialab.ldpath.api.backend.RDFBackend;
-import at.newmedialab.ldpath.api.functions.SelectorFunction;
-import at.newmedialab.ldpath.model.transformers.StringTransformer;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Set;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-/**
- * Apply a {@link String#replaceAll(String, String)} to the passed Nodes.
- * 
- * @author Jakob Frank <ja...@salzburgresearch.at>
- * 
- * @see String#replaceAll(String, String)
- */
-public class ReplaceFunction<Node> extends SelectorFunction<Node> {
-
-    private final StringTransformer<Node> transformer = new StringTransformer<Node>();
-
-    @Override
-    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
-        if (args.length != 3 || args[1].size() != 1 || args[2].size() != 1) {
-            throw new IllegalArgumentException("wrong usage: " + getSignature());
-        }
-
-        Collection<Node> nodes = args[0];
-        String regex = transformer.transform(backend, args[1].iterator().next());
-        String replace = transformer.transform(backend, args[2].iterator().next());
-
-        try {
-            final Pattern pattern = Pattern.compile(regex);
-
-            Set<Node> result = new HashSet<Node>();
-            for (Node node : nodes) {
-                final String string = backend.stringValue(node);
-
-                final String replaced = pattern.matcher(string).replaceAll(replace);
-
-                if (backend.isURI(node)) {
-                    result.add(backend.createURI(replaced));
-                } else if (backend.isLiteral(node)) {
-                    final Locale lang = backend.getLiteralLanguage(node);
-                    final URI type = backend.getLiteralType(node);
-                    result.add(backend.createLiteral(replaced, lang, type));
-                }
-            }
-
-            return result;
-
-        } catch (PatternSyntaxException pex) {
-            throw new IllegalArgumentException("could not parse regex pattern: '" + regex + "'", pex);
-        } catch (IndexOutOfBoundsException iobex) {
-            throw new IllegalArgumentException("invalid replacement string: '" + replace + "'");
-        }
-    }
-
-    @Override
-    public String getSignature() {
-        return "fn:replace(nodes: NodeList, regex: String, replace: String) :: NodeList";
-    }
-
-    @Override
-    public String getDescription() {
-        return "applies a String.replaceAll on the nodes (URI or LiteralContent resp.).";
-    }
-
-    @Override
-    public String getLocalName() {
-        return "replace";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrLeftFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrLeftFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrLeftFunction.java
deleted file mode 100644
index 6914779..0000000
--- a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrLeftFunction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed 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 at.newmedialab.ldpath.model.functions.text;
-
-import at.newmedialab.ldpath.api.backend.RDFBackend;
-import at.newmedialab.ldpath.api.functions.SelectorFunction;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-public class StrLeftFunction<Node> extends SelectorFunction<Node> {
-    @Override
-    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
-        try {
-            if (args.length != 2) { throw new IllegalArgumentException("LdPath function " + getLocalName() + " requires 2 arguments"); }
-            if (args[1].size() != 1) { throw new IllegalArgumentException("len argument must be a single literal for function " + getLocalName()); }
-
-            final Collection<Node> nodes = args[0];
-            final int length = Math.max(backend.intValue(args[1].iterator().next()), 0);
-
-            final Collection<Node> result = new LinkedList<Node>();
-            for (Node node : nodes) {
-                final String str = backend.stringValue(node);
-                result.add(backend.createLiteral(str.substring(0, Math.min(length, str.length()))));
-            }
-
-            return result;
-        } catch (NumberFormatException nfe) {
-            throw new IllegalArgumentException(nfe);
-        } catch (ArithmeticException ae) {
-            throw new IllegalArgumentException(ae);
-        }
-    }
-
-    @Override
-    public String getSignature() {
-        return "fn:strLeft(node::Node, length::NumericLiteral) :: StringLiteral";
-    }
-
-    @Override
-    public String getDescription() {
-        return "take the first n chars from the string representation";
-    }
-
-    @Override
-    protected String getLocalName() {
-        return "strLeft";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrLenFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrLenFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrLenFunction.java
deleted file mode 100644
index ce18144..0000000
--- a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrLenFunction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed 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 at.newmedialab.ldpath.model.functions.text;
-
-
-import at.newmedialab.ldpath.api.backend.RDFBackend;
-import at.newmedialab.ldpath.api.functions.SelectorFunction;
-import com.google.common.base.Preconditions;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.LinkedList;
-
-public class StrLenFunction<Node> extends SelectorFunction<Node> {
-
-    private static final URI dataType = URI.create("http://www.w3.org/2001/XMLSchema#integer");
-
-    @Override
-    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
-        Preconditions.checkArgument(args.length == 1, "Check usage: " + getSignature());
-
-        LinkedList<Node> result = new LinkedList<Node>();
-        for (Node node : args[0]) {
-            final String stringValue = backend.stringValue(node);
-            final int c = stringValue.length();
-            result.add(backend.createLiteral(String.valueOf(c), null, dataType));
-        }
-
-        return result;
-
-    }
-
-    @Override
-    public String getSignature() {
-        return "fn:strlen(text: Literal) : IntegerLiteralList";
-    }
-
-    @Override
-    public String getDescription() {
-        return "returns the length of the given StringLiterals";
-    }
-
-    @Override
-    public String getLocalName() {
-        return "strlen";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrRightFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrRightFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrRightFunction.java
deleted file mode 100644
index 73af139..0000000
--- a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/StrRightFunction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed 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 at.newmedialab.ldpath.model.functions.text;
-
-import at.newmedialab.ldpath.api.backend.RDFBackend;
-import at.newmedialab.ldpath.api.functions.SelectorFunction;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-public class StrRightFunction<Node> extends SelectorFunction<Node> {
-
-    @Override
-    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
-        try {
-            if (args.length != 2) { throw new IllegalArgumentException("LdPath function " + getLocalName() + " requires 2 arguments"); }
-            if (args[1].size() != 1) { throw new IllegalArgumentException("len argument must be a single literal for function " + getLocalName()); }
-
-            final Collection<Node> nodes = args[0];
-            final int length = Math.max(backend.intValue(args[1].iterator().next()), 0);
-
-            final Collection<Node> result = new LinkedList<Node>();
-            for (Node node : nodes) {
-                final String str = backend.stringValue(node);
-                result.add(backend.createLiteral(str.substring(Math.max(0, str.length() - length))));
-            }
-
-            return result;
-        } catch (NumberFormatException nfe) {
-            throw new IllegalArgumentException(nfe);
-        } catch (ArithmeticException ae) {
-            throw new IllegalArgumentException(ae);
-        }
-    }
-
-    @Override
-    public String getSignature() {
-        return "fn:strRight(node::Node, length::NumericLiteral) :: StringLiteral";
-    }
-
-    @Override
-    public String getDescription() {
-        return "take the last n chars from the string representation";
-    }
-
-    @Override
-    protected String getLocalName() {
-        return "strRight";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/SubstringFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/SubstringFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/SubstringFunction.java
deleted file mode 100644
index cdd77a4..0000000
--- a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/SubstringFunction.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed 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 at.newmedialab.ldpath.model.functions.text;
-
-import at.newmedialab.ldpath.api.backend.RDFBackend;
-import at.newmedialab.ldpath.api.functions.SelectorFunction;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-public class SubstringFunction<Node> extends SelectorFunction<Node> {
-
-    @Override
-    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
-        try {
-            if (args.length < 2 || args.length > 3) { throw new IllegalArgumentException("LdPath function " + getLocalName() + " requires 2 or 3 arguments"); }
-            if (args[1].size() != 1) { throw new IllegalArgumentException("start argument must be a single literal for function " + getLocalName()); }
-            if (args.length > 2 && args[2].size() != 1) { throw new IllegalArgumentException("end argument must be a single literal for function " + getLocalName()); }
-
-            final Collection<Node> nodes = args[0];
-            final int start = Math.max(backend.intValue(args[1].iterator().next()), 0);
-            final int end;
-            if (args.length > 2) {
-                end = Math.max(backend.intValue(args[2].iterator().next()), 0);
-            } else {
-                end = Integer.MAX_VALUE;
-            }
-
-            if (end < start) {
-                throw new IllegalArgumentException(getLocalName() + " does not allow end beeing smaller than start (end:" + end + " < start:" + start + ")");
-            }
-
-            final Collection<Node> result = new LinkedList<Node>();
-            for (Node node : nodes) {
-                final String str = backend.stringValue(node);
-                result.add(backend.createLiteral(str.substring(Math.min(start, str.length()), Math.min(end, str.length()))));
-            }
-
-            return result;
-        } catch (NumberFormatException nfe) {
-            throw new IllegalArgumentException(nfe);
-        } catch (ArithmeticException ae) {
-            throw new IllegalArgumentException(ae);
-        }
-    }
-
-    @Override
-    public String getSignature() {
-        return "fn:substr(node::Node, start::NumericLiteral [, end::NumericLiteral]) :: StringLiteral";
-    }
-
-    @Override
-    public String getDescription() {
-        return "Extract a substring for the string representation of a node";
-    }
-
-    @Override
-    public String getLocalName() {
-        return "substr";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/WordCountFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/WordCountFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/WordCountFunction.java
deleted file mode 100644
index ae4e7c4..0000000
--- a/libraries/ldpath/ldpath-functions-text/src/main/java/at/newmedialab/ldpath/model/functions/text/WordCountFunction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed 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 at.newmedialab.ldpath.model.functions.text;
-
-import at.newmedialab.ldpath.api.backend.RDFBackend;
-import at.newmedialab.ldpath.api.functions.SelectorFunction;
-import com.google.common.base.Preconditions;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.LinkedList;
-
-public class WordCountFunction<Node> extends SelectorFunction<Node> {
-
-    private final URI dataType = URI.create("http://www.w3.org/2001/XMLSchema#integer");
-
-    @Override
-    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
-        Preconditions.checkArgument(args.length == 1, "Check usage: " + getSignature());
-
-        LinkedList<Node> result = new LinkedList<Node>();
-        for (Node node : args[0]) {
-            final String stringValue = backend.stringValue(node);
-            boolean isWordChar = false;
-            int c = 0;
-            for (int i = 0; i < stringValue.length(); i++) {
-                final boolean isWC = Character.isLetterOrDigit(stringValue.codePointAt(i));
-                if (!isWordChar && isWC) {
-                    c++;
-                }
-                isWordChar = isWC;
-            }
-            result.add(backend.createLiteral(String.valueOf(c), null, dataType));
-        }
-
-        return result;
-    }
-
-    @Override
-    public String getSignature() {
-        return "fn:wc(text : LiteralList) : IntegerLiteralList";
-    }
-
-    @Override
-    public String getDescription() {
-        return "Calculates the length of the provided literals (counting continuous chunks of letters+digits)";
-    }
-
-    @Override
-    public String getLocalName() {
-        return "wc";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/ReplaceFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/ReplaceFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/ReplaceFunction.java
new file mode 100644
index 0000000..68fc373
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/ReplaceFunction.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed 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.ldpath.model.functions.text;
+
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+import org.apache.marmotta.ldpath.api.backend.RDFBackend;
+import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
+import org.apache.marmotta.ldpath.model.transformers.StringTransformer;
+
+/**
+ * Apply a {@link String#replaceAll(String, String)} to the passed Nodes.
+ * 
+ * @author Jakob Frank <ja...@salzburgresearch.at>
+ * 
+ * @see String#replaceAll(String, String)
+ */
+public class ReplaceFunction<Node> extends SelectorFunction<Node> {
+
+    private final StringTransformer<Node> transformer = new StringTransformer<Node>();
+
+    @Override
+    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
+        if (args.length != 3 || args[1].size() != 1 || args[2].size() != 1) {
+            throw new IllegalArgumentException("wrong usage: " + getSignature());
+        }
+
+        Collection<Node> nodes = args[0];
+        String regex = transformer.transform(backend, args[1].iterator().next());
+        String replace = transformer.transform(backend, args[2].iterator().next());
+
+        try {
+            final Pattern pattern = Pattern.compile(regex);
+
+            Set<Node> result = new HashSet<Node>();
+            for (Node node : nodes) {
+                final String string = backend.stringValue(node);
+
+                final String replaced = pattern.matcher(string).replaceAll(replace);
+
+                if (backend.isURI(node)) {
+                    result.add(backend.createURI(replaced));
+                } else if (backend.isLiteral(node)) {
+                    final Locale lang = backend.getLiteralLanguage(node);
+                    final URI type = backend.getLiteralType(node);
+                    result.add(backend.createLiteral(replaced, lang, type));
+                }
+            }
+
+            return result;
+
+        } catch (PatternSyntaxException pex) {
+            throw new IllegalArgumentException("could not parse regex pattern: '" + regex + "'", pex);
+        } catch (IndexOutOfBoundsException iobex) {
+            throw new IllegalArgumentException("invalid replacement string: '" + replace + "'");
+        }
+    }
+
+    @Override
+    public String getSignature() {
+        return "fn:replace(nodes: NodeList, regex: String, replace: String) :: NodeList";
+    }
+
+    @Override
+    public String getDescription() {
+        return "applies a String.replaceAll on the nodes (URI or LiteralContent resp.).";
+    }
+
+    @Override
+    public String getLocalName() {
+        return "replace";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrLeftFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrLeftFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrLeftFunction.java
new file mode 100644
index 0000000..cb5697c
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrLeftFunction.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed 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.ldpath.model.functions.text;
+
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.apache.marmotta.ldpath.api.backend.RDFBackend;
+import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
+
+public class StrLeftFunction<Node> extends SelectorFunction<Node> {
+    @Override
+    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
+        try {
+            if (args.length != 2) { throw new IllegalArgumentException("LdPath function " + getLocalName() + " requires 2 arguments"); }
+            if (args[1].size() != 1) { throw new IllegalArgumentException("len argument must be a single literal for function " + getLocalName()); }
+
+            final Collection<Node> nodes = args[0];
+            final int length = Math.max(backend.intValue(args[1].iterator().next()), 0);
+
+            final Collection<Node> result = new LinkedList<Node>();
+            for (Node node : nodes) {
+                final String str = backend.stringValue(node);
+                result.add(backend.createLiteral(str.substring(0, Math.min(length, str.length()))));
+            }
+
+            return result;
+        } catch (NumberFormatException nfe) {
+            throw new IllegalArgumentException(nfe);
+        } catch (ArithmeticException ae) {
+            throw new IllegalArgumentException(ae);
+        }
+    }
+
+    @Override
+    public String getSignature() {
+        return "fn:strLeft(node::Node, length::NumericLiteral) :: StringLiteral";
+    }
+
+    @Override
+    public String getDescription() {
+        return "take the first n chars from the string representation";
+    }
+
+    @Override
+    protected String getLocalName() {
+        return "strLeft";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrLenFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrLenFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrLenFunction.java
new file mode 100644
index 0000000..425bdca
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrLenFunction.java
@@ -0,0 +1,62 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed 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.ldpath.model.functions.text;
+
+
+import com.google.common.base.Preconditions;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.apache.marmotta.ldpath.api.backend.RDFBackend;
+import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
+
+public class StrLenFunction<Node> extends SelectorFunction<Node> {
+
+    private static final URI dataType = URI.create("http://www.w3.org/2001/XMLSchema#integer");
+
+    @Override
+    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
+        Preconditions.checkArgument(args.length == 1, "Check usage: " + getSignature());
+
+        LinkedList<Node> result = new LinkedList<Node>();
+        for (Node node : args[0]) {
+            final String stringValue = backend.stringValue(node);
+            final int c = stringValue.length();
+            result.add(backend.createLiteral(String.valueOf(c), null, dataType));
+        }
+
+        return result;
+
+    }
+
+    @Override
+    public String getSignature() {
+        return "fn:strlen(text: Literal) : IntegerLiteralList";
+    }
+
+    @Override
+    public String getDescription() {
+        return "returns the length of the given StringLiterals";
+    }
+
+    @Override
+    public String getLocalName() {
+        return "strlen";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrRightFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrRightFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrRightFunction.java
new file mode 100644
index 0000000..0217bdb
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/StrRightFunction.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed 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.ldpath.model.functions.text;
+
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.apache.marmotta.ldpath.api.backend.RDFBackend;
+import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
+
+public class StrRightFunction<Node> extends SelectorFunction<Node> {
+
+    @Override
+    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
+        try {
+            if (args.length != 2) { throw new IllegalArgumentException("LdPath function " + getLocalName() + " requires 2 arguments"); }
+            if (args[1].size() != 1) { throw new IllegalArgumentException("len argument must be a single literal for function " + getLocalName()); }
+
+            final Collection<Node> nodes = args[0];
+            final int length = Math.max(backend.intValue(args[1].iterator().next()), 0);
+
+            final Collection<Node> result = new LinkedList<Node>();
+            for (Node node : nodes) {
+                final String str = backend.stringValue(node);
+                result.add(backend.createLiteral(str.substring(Math.max(0, str.length() - length))));
+            }
+
+            return result;
+        } catch (NumberFormatException nfe) {
+            throw new IllegalArgumentException(nfe);
+        } catch (ArithmeticException ae) {
+            throw new IllegalArgumentException(ae);
+        }
+    }
+
+    @Override
+    public String getSignature() {
+        return "fn:strRight(node::Node, length::NumericLiteral) :: StringLiteral";
+    }
+
+    @Override
+    public String getDescription() {
+        return "take the last n chars from the string representation";
+    }
+
+    @Override
+    protected String getLocalName() {
+        return "strRight";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/SubstringFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/SubstringFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/SubstringFunction.java
new file mode 100644
index 0000000..da164a5
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/SubstringFunction.java
@@ -0,0 +1,76 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed 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.ldpath.model.functions.text;
+
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.apache.marmotta.ldpath.api.backend.RDFBackend;
+import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
+
+public class SubstringFunction<Node> extends SelectorFunction<Node> {
+
+    @Override
+    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
+        try {
+            if (args.length < 2 || args.length > 3) { throw new IllegalArgumentException("LdPath function " + getLocalName() + " requires 2 or 3 arguments"); }
+            if (args[1].size() != 1) { throw new IllegalArgumentException("start argument must be a single literal for function " + getLocalName()); }
+            if (args.length > 2 && args[2].size() != 1) { throw new IllegalArgumentException("end argument must be a single literal for function " + getLocalName()); }
+
+            final Collection<Node> nodes = args[0];
+            final int start = Math.max(backend.intValue(args[1].iterator().next()), 0);
+            final int end;
+            if (args.length > 2) {
+                end = Math.max(backend.intValue(args[2].iterator().next()), 0);
+            } else {
+                end = Integer.MAX_VALUE;
+            }
+
+            if (end < start) {
+                throw new IllegalArgumentException(getLocalName() + " does not allow end beeing smaller than start (end:" + end + " < start:" + start + ")");
+            }
+
+            final Collection<Node> result = new LinkedList<Node>();
+            for (Node node : nodes) {
+                final String str = backend.stringValue(node);
+                result.add(backend.createLiteral(str.substring(Math.min(start, str.length()), Math.min(end, str.length()))));
+            }
+
+            return result;
+        } catch (NumberFormatException nfe) {
+            throw new IllegalArgumentException(nfe);
+        } catch (ArithmeticException ae) {
+            throw new IllegalArgumentException(ae);
+        }
+    }
+
+    @Override
+    public String getSignature() {
+        return "fn:substr(node::Node, start::NumericLiteral [, end::NumericLiteral]) :: StringLiteral";
+    }
+
+    @Override
+    public String getDescription() {
+        return "Extract a substring for the string representation of a node";
+    }
+
+    @Override
+    public String getLocalName() {
+        return "substr";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/WordCountFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/WordCountFunction.java b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/WordCountFunction.java
new file mode 100644
index 0000000..e12ac5d
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-text/src/main/java/org/apache/marmotta/ldpath/model/functions/text/WordCountFunction.java
@@ -0,0 +1,68 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed 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.ldpath.model.functions.text;
+
+import com.google.common.base.Preconditions;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.apache.marmotta.ldpath.api.backend.RDFBackend;
+import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
+
+public class WordCountFunction<Node> extends SelectorFunction<Node> {
+
+    private final URI dataType = URI.create("http://www.w3.org/2001/XMLSchema#integer");
+
+    @Override
+    public Collection<Node> apply(RDFBackend<Node> backend, Node context, Collection<Node>... args) throws IllegalArgumentException {
+        Preconditions.checkArgument(args.length == 1, "Check usage: " + getSignature());
+
+        LinkedList<Node> result = new LinkedList<Node>();
+        for (Node node : args[0]) {
+            final String stringValue = backend.stringValue(node);
+            boolean isWordChar = false;
+            int c = 0;
+            for (int i = 0; i < stringValue.length(); i++) {
+                final boolean isWC = Character.isLetterOrDigit(stringValue.codePointAt(i));
+                if (!isWordChar && isWC) {
+                    c++;
+                }
+                isWordChar = isWC;
+            }
+            result.add(backend.createLiteral(String.valueOf(c), null, dataType));
+        }
+
+        return result;
+    }
+
+    @Override
+    public String getSignature() {
+        return "fn:wc(text : LiteralList) : IntegerLiteralList";
+    }
+
+    @Override
+    public String getDescription() {
+        return "Calculates the length of the provided literals (counting continuous chunks of letters+digits)";
+    }
+
+    @Override
+    public String getLocalName() {
+        return "wc";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/resources/META-INF/services/at.newmedialab.ldpath.api.functions.SelectorFunction
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/resources/META-INF/services/at.newmedialab.ldpath.api.functions.SelectorFunction b/libraries/ldpath/ldpath-functions-text/src/main/resources/META-INF/services/at.newmedialab.ldpath.api.functions.SelectorFunction
deleted file mode 100644
index 280473c..0000000
--- a/libraries/ldpath/ldpath-functions-text/src/main/resources/META-INF/services/at.newmedialab.ldpath.api.functions.SelectorFunction
+++ /dev/null
@@ -1,6 +0,0 @@
-at.newmedialab.ldpath.model.functions.text.ReplaceFunction
-at.newmedialab.ldpath.model.functions.text.StrLeftFunction
-at.newmedialab.ldpath.model.functions.text.StrRightFunction
-at.newmedialab.ldpath.model.functions.text.StrLenFunction
-at.newmedialab.ldpath.model.functions.text.SubstringFunction
-at.newmedialab.ldpath.model.functions.text.WordCountFunction

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/main/resources/META-INF/services/org.apache.marmotta.ldpath.api.functions.SelectorFunction
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/main/resources/META-INF/services/org.apache.marmotta.ldpath.api.functions.SelectorFunction b/libraries/ldpath/ldpath-functions-text/src/main/resources/META-INF/services/org.apache.marmotta.ldpath.api.functions.SelectorFunction
new file mode 100644
index 0000000..f217bfe
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-text/src/main/resources/META-INF/services/org.apache.marmotta.ldpath.api.functions.SelectorFunction
@@ -0,0 +1,6 @@
+org.apache.marmotta.ldpath.model.functions.text.ReplaceFunction
+org.apache.marmotta.ldpath.model.functions.text.StrLeftFunction
+org.apache.marmotta.ldpath.model.functions.text.StrRightFunction
+org.apache.marmotta.ldpath.model.functions.text.StrLenFunction
+org.apache.marmotta.ldpath.model.functions.text.SubstringFunction
+org.apache.marmotta.ldpath.model.functions.text.WordCountFunction

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/test/java/org/apache/marmotta/ldpath/model/functions/text/TextFunctionsTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/test/java/org/apache/marmotta/ldpath/model/functions/text/TextFunctionsTest.java b/libraries/ldpath/ldpath-functions-text/src/test/java/org/apache/marmotta/ldpath/model/functions/text/TextFunctionsTest.java
new file mode 100644
index 0000000..b8040b2
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-text/src/test/java/org/apache/marmotta/ldpath/model/functions/text/TextFunctionsTest.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2013 Salzburg Research.
+ *
+ *  Licensed 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.ldpath.model.functions.text;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+
+import org.apache.marmotta.ldpath.parser.ParseException;
+import org.apache.marmotta.ldpath.test.AbstractTestBase;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
+import org.openrdf.model.URI;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.repository.sail.SailRepositoryConnection;
+
+
+@RunWith(Parameterized.class)
+public class TextFunctionsTest extends AbstractTestBase {
+
+    private static final int LOOP_STEP = 5;
+
+    @Parameters(name = "Case-{index}")
+    public static List<String[]> data() {
+        return Arrays.asList(
+                new String[] { "LD Path is a simple path-based query language similar to XPath or SPARQL Property Paths that is particularly well-suited for querying and retrieving resources from the Linked Data Cloud by following RDF links between resources and servers." },
+                new String[] { "The LDPath project is a collection of generic libraries that are independent of the underlying RDF implementation."},
+                new String[] { "Currently, there are backends for sesame, for RDF files, and for Linked Data. You can easily implement your own backends by implementing a straightforward interface (RDFBackend)." }
+                );
+    }
+
+    @Parameter
+    public String text;
+
+    private URI subject, predicate;
+    final private Random rnd = new Random();
+
+    @Before
+    public void setUp() throws RepositoryException {
+
+        subject = repository.getValueFactory().createURI(ns("foo", UUID.randomUUID().toString()));
+        predicate = repository.getValueFactory().createURI(ns("foo", UUID.randomUUID().toString()));
+
+        final SailRepositoryConnection con = repository.getConnection();
+        try {
+            final ValueFactory vf = con.getValueFactory();
+
+            con.add(vf.createStatement(subject, predicate, vf.createLiteral(text)));
+
+            con.commit();
+        } finally {
+            con.close();
+        }
+    }
+
+    @Test
+    public void testReplace() throws ParseException {
+        final String regex = "RDF", replace = "Linked Data";
+        final String ldPath = String.format("fn:replace(<%s>, \"%s\", \"%s\") :: xsd:string", predicate.stringValue(), regex, replace);
+        final String expected = text.replaceAll(regex, replace);
+
+        final Collection<Object> values = evaluateRule(ldPath, subject);
+
+        Assert.assertEquals(1, values.size());
+        Assert.assertEquals(expected, values.iterator().next().toString());
+    }
+
+    @Test
+    public void testStrLen() throws ParseException {
+        final String ldPath = String.format("fn:strlen(<%s>) :: xsd:int", predicate.stringValue());
+        final Collection<Object> values = evaluateRule(ldPath, subject);
+
+        Assert.assertEquals(1, values.size());
+        Assert.assertEquals(text.length(), values.iterator().next());
+    }
+
+    @Test
+    public void testWordCount() throws ParseException {
+        final String ldPath = String.format("fn:wc(<%s>) :: xsd:int", predicate.stringValue());
+        final Collection<Object> values = evaluateRule(ldPath, subject);
+
+        boolean isWordChar = false;
+        int wc = 0;
+        for (int i = 0; i < text.length(); i++) {
+            final boolean isWC = Character.isLetterOrDigit(text.codePointAt(i));
+            if (!isWordChar && isWC) {
+                wc++;
+            }
+            isWordChar = isWC;
+        }
+
+        Assert.assertEquals(1, values.size());
+        Assert.assertEquals(wc, values.iterator().next());
+    }
+
+    @Test
+    public void testStrLeft() throws ParseException {
+        for (int len = -1; len <= text.length() + 2 * LOOP_STEP; len += rnd.nextInt(2 * LOOP_STEP) + 1) {
+            final String ldPath = String.format("fn:strLeft(<%s>, \"%d\") :: xsd:string", predicate.stringValue(), len);
+            final Collection<Object> values = evaluateRule(ldPath, subject);
+
+            Assert.assertEquals("strLeft(<>, " + len + ")", 1, values.size());
+            final Object val = values.iterator().next();
+
+            int expSize = Math.min(Math.max(0, len), text.length());
+
+            Assert.assertEquals("strLeft(<>, " + len + ")", expSize, val.toString().length());
+            Assert.assertEquals("strLeft(<>, " + len + ")", text.substring(0, expSize), val);
+        }
+    }
+
+    @Test
+    public void testStrRight() throws ParseException {
+        for (int len = -1; len <= text.length() + 2 * LOOP_STEP; len += rnd.nextInt(2 * LOOP_STEP) + 1) {
+            final String ldPath = String.format("fn:strRight(<%s>, \"%d\") :: xsd:string", predicate.stringValue(), len);
+            final Collection<Object> values = evaluateRule(ldPath, subject);
+
+            Assert.assertEquals("strRight(<>, " + len + ")", 1, values.size());
+            final Object val = values.iterator().next();
+
+            int expSize = Math.min(Math.max(0, len), text.length());
+
+            Assert.assertEquals("strRight(<>, " + len + ")", expSize, val.toString().length());
+            Assert.assertEquals("strRight(<>, " + len + ")", text.substring(text.length() - expSize), val);
+        }
+    }
+
+    @Test
+    public void testSubstr() throws ParseException {
+        for (int start = -1; start <= text.length() + 2 * LOOP_STEP; start += rnd.nextInt(2 * LOOP_STEP) + 1) {
+            // 2-Arg usage
+            final String ldPath_2Arg = String.format("fn:substr(<%s>, \"%d\") :: xsd:string", predicate.stringValue(), start);
+            final Collection<Object> values_2Arg = evaluateRule(ldPath_2Arg, subject);
+
+            Assert.assertEquals("substr(<>, " + start + ")", 1, values_2Arg.size());
+            final Object val_2Arg = values_2Arg.iterator().next();
+
+            int expStart = Math.min(Math.max(0, start), text.length());
+
+            Assert.assertEquals("substr(<>, " + start + ")", text.length() - expStart, val_2Arg.toString().length());
+            Assert.assertEquals("substr(<>, " + start + ")", text.substring(expStart), val_2Arg);
+
+            // 3-Arg usage
+            for (int end = start; end <= text.length() + 2 * LOOP_STEP; end += rnd.nextInt(2 * LOOP_STEP) + 1) {
+                final String ldPath_3Arg = String.format("fn:substr(<%s>, \"%d\", \"%d\") :: xsd:string", predicate.stringValue(), start, end);
+                final Collection<Object> values_3Arg = evaluateRule(ldPath_3Arg, subject);
+
+                Assert.assertEquals("substr(<>, " + start + ", " + end + ")", 1, values_3Arg.size());
+                final Object val_3Arg = values_3Arg.iterator().next();
+
+                int expEnd = Math.min(Math.max(0, end), text.length());
+
+                Assert.assertEquals("substr(<>, " + start + ", " + end + ")", expEnd - expStart, val_3Arg.toString().length());
+                Assert.assertEquals("substr(<>, " + start + ", " + end + ")", text.substring(expStart, expEnd), val_3Arg);
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-text/src/test/java/text/TextFunctionsTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-text/src/test/java/text/TextFunctionsTest.java b/libraries/ldpath/ldpath-functions-text/src/test/java/text/TextFunctionsTest.java
deleted file mode 100644
index c6f6ff7..0000000
--- a/libraries/ldpath/ldpath-functions-text/src/test/java/text/TextFunctionsTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2013 Salzburg Research.
- *
- *  Licensed 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 text;
-
-import at.newmedialab.ldpath.parser.ParseException;
-import core.AbstractTestBase;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameter;
-import org.junit.runners.Parameterized.Parameters;
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.sail.SailRepositoryConnection;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Random;
-import java.util.UUID;
-
-@RunWith(Parameterized.class)
-public class TextFunctionsTest extends AbstractTestBase {
-
-    private static final int LOOP_STEP = 5;
-
-    @Parameters(name = "Case-{index}")
-    public static List<String[]> data() {
-        return Arrays.asList(
-                new String[] { "LD Path is a simple path-based query language similar to XPath or SPARQL Property Paths that is particularly well-suited for querying and retrieving resources from the Linked Data Cloud by following RDF links between resources and servers." },
-                new String[] { "The LDPath project is a collection of generic libraries that are independent of the underlying RDF implementation."},
-                new String[] { "Currently, there are backends for sesame, for RDF files, and for Linked Data. You can easily implement your own backends by implementing a straightforward interface (RDFBackend)." }
-                );
-    }
-
-    @Parameter
-    public String text;
-
-    private URI subject, predicate;
-    final private Random rnd = new Random();
-
-    @Before
-    public void setUp() throws RepositoryException {
-
-        subject = repository.getValueFactory().createURI(ns("foo", UUID.randomUUID().toString()));
-        predicate = repository.getValueFactory().createURI(ns("foo", UUID.randomUUID().toString()));
-
-        final SailRepositoryConnection con = repository.getConnection();
-        try {
-            final ValueFactory vf = con.getValueFactory();
-
-            con.add(vf.createStatement(subject, predicate, vf.createLiteral(text)));
-
-            con.commit();
-        } finally {
-            con.close();
-        }
-    }
-
-    @Test
-    public void testReplace() throws ParseException {
-        final String regex = "RDF", replace = "Linked Data";
-        final String ldPath = String.format("fn:replace(<%s>, \"%s\", \"%s\") :: xsd:string", predicate.stringValue(), regex, replace);
-        final String expected = text.replaceAll(regex, replace);
-
-        final Collection<Object> values = evaluateRule(ldPath, subject);
-
-        Assert.assertEquals(1, values.size());
-        Assert.assertEquals(expected, values.iterator().next().toString());
-    }
-
-    @Test
-    public void testStrLen() throws ParseException {
-        final String ldPath = String.format("fn:strlen(<%s>) :: xsd:int", predicate.stringValue());
-        final Collection<Object> values = evaluateRule(ldPath, subject);
-
-        Assert.assertEquals(1, values.size());
-        Assert.assertEquals(text.length(), values.iterator().next());
-    }
-
-    @Test
-    public void testWordCount() throws ParseException {
-        final String ldPath = String.format("fn:wc(<%s>) :: xsd:int", predicate.stringValue());
-        final Collection<Object> values = evaluateRule(ldPath, subject);
-
-        boolean isWordChar = false;
-        int wc = 0;
-        for (int i = 0; i < text.length(); i++) {
-            final boolean isWC = Character.isLetterOrDigit(text.codePointAt(i));
-            if (!isWordChar && isWC) {
-                wc++;
-            }
-            isWordChar = isWC;
-        }
-
-        Assert.assertEquals(1, values.size());
-        Assert.assertEquals(wc, values.iterator().next());
-    }
-
-    @Test
-    public void testStrLeft() throws ParseException {
-        for (int len = -1; len <= text.length() + 2 * LOOP_STEP; len += rnd.nextInt(2 * LOOP_STEP) + 1) {
-            final String ldPath = String.format("fn:strLeft(<%s>, \"%d\") :: xsd:string", predicate.stringValue(), len);
-            final Collection<Object> values = evaluateRule(ldPath, subject);
-
-            Assert.assertEquals("strLeft(<>, " + len + ")", 1, values.size());
-            final Object val = values.iterator().next();
-
-            int expSize = Math.min(Math.max(0, len), text.length());
-
-            Assert.assertEquals("strLeft(<>, " + len + ")", expSize, val.toString().length());
-            Assert.assertEquals("strLeft(<>, " + len + ")", text.substring(0, expSize), val);
-        }
-    }
-
-    @Test
-    public void testStrRight() throws ParseException {
-        for (int len = -1; len <= text.length() + 2 * LOOP_STEP; len += rnd.nextInt(2 * LOOP_STEP) + 1) {
-            final String ldPath = String.format("fn:strRight(<%s>, \"%d\") :: xsd:string", predicate.stringValue(), len);
-            final Collection<Object> values = evaluateRule(ldPath, subject);
-
-            Assert.assertEquals("strRight(<>, " + len + ")", 1, values.size());
-            final Object val = values.iterator().next();
-
-            int expSize = Math.min(Math.max(0, len), text.length());
-
-            Assert.assertEquals("strRight(<>, " + len + ")", expSize, val.toString().length());
-            Assert.assertEquals("strRight(<>, " + len + ")", text.substring(text.length() - expSize), val);
-        }
-    }
-
-    @Test
-    public void testSubstr() throws ParseException {
-        for (int start = -1; start <= text.length() + 2 * LOOP_STEP; start += rnd.nextInt(2 * LOOP_STEP) + 1) {
-            // 2-Arg usage
-            final String ldPath_2Arg = String.format("fn:substr(<%s>, \"%d\") :: xsd:string", predicate.stringValue(), start);
-            final Collection<Object> values_2Arg = evaluateRule(ldPath_2Arg, subject);
-
-            Assert.assertEquals("substr(<>, " + start + ")", 1, values_2Arg.size());
-            final Object val_2Arg = values_2Arg.iterator().next();
-
-            int expStart = Math.min(Math.max(0, start), text.length());
-
-            Assert.assertEquals("substr(<>, " + start + ")", text.length() - expStart, val_2Arg.toString().length());
-            Assert.assertEquals("substr(<>, " + start + ")", text.substring(expStart), val_2Arg);
-
-            // 3-Arg usage
-            for (int end = start; end <= text.length() + 2 * LOOP_STEP; end += rnd.nextInt(2 * LOOP_STEP) + 1) {
-                final String ldPath_3Arg = String.format("fn:substr(<%s>, \"%d\", \"%d\") :: xsd:string", predicate.stringValue(), start, end);
-                final Collection<Object> values_3Arg = evaluateRule(ldPath_3Arg, subject);
-
-                Assert.assertEquals("substr(<>, " + start + ", " + end + ")", 1, values_3Arg.size());
-                final Object val_3Arg = values_3Arg.iterator().next();
-
-                int expEnd = Math.min(Math.max(0, end), text.length());
-
-                Assert.assertEquals("substr(<>, " + start + ", " + end + ")", expEnd - expStart, val_3Arg.toString().length());
-                Assert.assertEquals("substr(<>, " + start + ", " + end + ")", text.substring(expStart, expEnd), val_3Arg);
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-xml/pom.xml
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-xml/pom.xml b/libraries/ldpath/ldpath-functions-xml/pom.xml
index 63a52a8..79b8f13 100644
--- a/libraries/ldpath/ldpath-functions-xml/pom.xml
+++ b/libraries/ldpath/ldpath-functions-xml/pom.xml
@@ -46,7 +46,7 @@
         <dependency>
             <groupId>jaxen</groupId>
             <artifactId>jaxen</artifactId>
-        </dependency>
+            </dependency>
 
         <dependency>
            <groupId>org.apache.marmotta</groupId>
@@ -94,7 +94,7 @@
                         <!-- Enable this for including your enhancement chain configuration -->
                         <!-- <Install-Path>config</Install-Path> -->
                         <Export-Package>
-                            at.newmedialab.ldpath.model.*;version=${project.version},
+                            org.apache.marmotta.ldpath.model.*;version=${project.version},
                         </Export-Package>
                         <Import-Package>
                             !nu.xom.*,!org.dom4j.*,!org.dom4j.io.*,*

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-xml/src/main/java/at/newmedialab/ldpath/model/functions/RemoveXmlTagsFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-xml/src/main/java/at/newmedialab/ldpath/model/functions/RemoveXmlTagsFunction.java b/libraries/ldpath/ldpath-functions-xml/src/main/java/at/newmedialab/ldpath/model/functions/RemoveXmlTagsFunction.java
deleted file mode 100644
index 3801170..0000000
--- a/libraries/ldpath/ldpath-functions-xml/src/main/java/at/newmedialab/ldpath/model/functions/RemoveXmlTagsFunction.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed 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 at.newmedialab.ldpath.model.functions;
-
-import at.newmedialab.ldpath.api.backend.RDFBackend;
-import at.newmedialab.ldpath.api.functions.SelectorFunction;
-import at.newmedialab.ldpath.model.transformers.StringTransformer;
-import at.newmedialab.ldpath.util.Collections;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Pattern;
-
-public class RemoveXmlTagsFunction<Node> extends SelectorFunction<Node> {
-
-    private final static Logger log = LoggerFactory.getLogger(RemoveXmlTagsFunction.class);
-
-    private final StringTransformer<Node> transformer = new StringTransformer<Node>();
-
-    private static Pattern XML_TAG = Pattern.compile("<(\"[^\"]*\"|'[^']*'|[^>])*>", Pattern.MULTILINE);
-
-    /**
-     * Apply the function to the list of nodes passed as arguments and return the result as type T.
-     * Throws IllegalArgumentException if the function cannot be applied to the nodes passed as argument
-     * or the number of arguments is not correct.
-     *
-     * @param args a nested list of KiWiNodes
-     * @return
-     */
-    @Override
-    public Collection<Node> apply(RDFBackend<Node> rdfBackend, Node context, Collection<Node>... args) throws IllegalArgumentException {
-        if(args.length < 1){
-            log.debug("remove XML tags from context {}",context);
-            return java.util.Collections.singleton(
-                    rdfBackend.createLiteral(doFilter(transformer.transform(rdfBackend, context))));
-        } else {
-            log.debug("remove XML tags from parameters");
-            Iterator<Node> it = Collections.iterator(args);
-            List<Node> result = new ArrayList<Node>();
-            while (it.hasNext()) {
-                result.add(rdfBackend.createLiteral(doFilter(transformer.transform(rdfBackend, it.next()))));
-            }
-            return result;
-        }
-    }
-
-    private String doFilter(String in) {
-        return XML_TAG.matcher(in).replaceAll("");
-    }
-
-    /**
-     * Return the name of the NodeFunction for registration in the function registry
-     *
-     * @return
-     */
-    @Override
-    public String getLocalName() {
-        return "removeTags";
-
-    }
-
-    /**
-     * A string describing the signature of this node function, e.g. "fn:content(uris : Nodes) : Nodes". The
-     * syntax for representing the signature can be chosen by the implementer. This method is for informational
-     * purposes only.
-     *
-     * @return
-     */
-    @Override
-    public String getSignature() {
-        return "fn:removeTags(content: LiteralList) : LiteralList";
-    }
-
-    /**
-     * A short human-readable description of what the node function does.
-     *
-     * @return
-     */
-    @Override
-    public String getDescription() {
-        return "Function to remove all XML or HTML tags from the content. Can be used in-path, using the current context nodes as argument.";
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-xml/src/main/java/at/newmedialab/ldpath/model/functions/XPathFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-xml/src/main/java/at/newmedialab/ldpath/model/functions/XPathFunction.java b/libraries/ldpath/ldpath-functions-xml/src/main/java/at/newmedialab/ldpath/model/functions/XPathFunction.java
deleted file mode 100644
index 7ca07e9..0000000
--- a/libraries/ldpath/ldpath-functions-xml/src/main/java/at/newmedialab/ldpath/model/functions/XPathFunction.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed 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 at.newmedialab.ldpath.model.functions;
-
-import at.newmedialab.ldpath.api.backend.RDFBackend;
-import at.newmedialab.ldpath.api.functions.SelectorFunction;
-import at.newmedialab.ldpath.model.transformers.StringTransformer;
-import org.jdom2.Content;
-import org.jdom2.Document;
-import org.jdom2.Element;
-import org.jdom2.JDOMException;
-import org.jdom2.Text;
-import org.jdom2.filter.Filters;
-import org.jdom2.input.SAXBuilder;
-import org.jdom2.input.sax.XMLReaders;
-import org.jdom2.output.XMLOutputter;
-import org.jdom2.xpath.XPathExpression;
-import org.jdom2.xpath.XPathFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-public class XPathFunction<Node> extends SelectorFunction<Node> {
-
-    private static final Logger log = LoggerFactory.getLogger(XPathFunction.class);
-
-    private final StringTransformer<Node> transformer = new StringTransformer<Node>();
-
-
-    /**
-     * Apply the function to the list of nodes passed as arguments and return the result as type T.
-     * Throws IllegalArgumentException if the function cannot be applied to the nodes passed as argument
-     * or the number of arguments is not correct.
-     *
-     * @param args a nested list of KiWiNodes
-     * @return
-     */
-    @Override
-    public Collection<Node> apply(RDFBackend<Node> rdfBackend, Node context, Collection<Node>... args) throws IllegalArgumentException {
-        if (args.length < 1) { throw new IllegalArgumentException("XPath expression is required as first argument."); }
-        Set<String> xpaths = new HashSet<String>();
-        for (Node xpath : args[0]) {
-            try {
-                xpaths.add(transformer.transform(rdfBackend,xpath));
-            } catch (IllegalArgumentException iae) {
-                throw new IllegalArgumentException("First argument must not contain anything else than String-Literals!");
-            }
-        }
-        Iterator<Node> it;
-        if(args.length < 2){
-            log.debug("Use context {} to execute xpaths {}",context,xpaths);
-            it = Collections.singleton(context).iterator();
-        } else {
-            log.debug("execute xpaths {} on parsed parameters",xpaths);
-            it = at.newmedialab.ldpath.util.Collections.iterator(1,args);
-        }
-        List<Node> result = new ArrayList<Node>();
-        while (it.hasNext()) {
-            Node n = it.next();
-            try {
-                for (String r : doFilter(transformer.transform(rdfBackend,n), xpaths)) {
-                    result.add(rdfBackend.createLiteral(r));
-                }
-            } catch (IOException e) {
-                // This should never happen, since validation is turned off.
-            }
-        }
-
-        return result;
-    }
-
-    private LinkedList<String> doFilter(String in, Set<String> xpaths) throws IOException {
-        LinkedList<String> result = new LinkedList<String>();
-        try {
-            Document doc = new SAXBuilder(XMLReaders.NONVALIDATING).build(new StringReader(in));
-            XMLOutputter out = new XMLOutputter();
-
-            for (String xp : xpaths) {
-                XPathExpression<Content> xpath = XPathFactory.instance().compile(xp, Filters.content());
-                for (Content node : xpath.evaluate(doc)) {
-                    if(node instanceof Element) {
-                        result.add(out.outputString((Element) node));
-                    } else if(node instanceof Text) {
-                        result.add(out.outputString((Text) node));
-                    }
-                }
-            }
-            return result;
-        } catch (JDOMException xpe) {
-            throw new IllegalArgumentException("error while processing xpath expressions: '" + xpaths + "'", xpe);
-        }
-    }
-
-
-    /**
-     * Return the name of the NodeFunction for registration in the function registry
-     *
-     * @return
-     * @param backend
-     */
-    @Override
-    public String getLocalName() {
-        return "xpath";
-    }
-
-
-    /**
-     * A string describing the signature of this node function, e.g. "fn:content(uris : Nodes) : Nodes". The
-     * syntax for representing the signature can be chosen by the implementer. This method is for informational
-     * purposes only.
-     *
-     * @return
-     */
-    @Override
-    public String getSignature() {
-        return "fn:xpath(xpath: String [, nodes: XMLLiteralList]) : LiteralList";
-    }
-
-    /**
-     * A short human-readable description of what the node function does.
-     *
-     * @return
-     */
-    @Override
-    public String getDescription() {
-        return "Evaluate an XPath expression on either the value of the context node or the values of the nodes passed as arguments.";
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-xml/src/main/java/org/apache/marmotta/ldpath/model/functions/xml/RemoveXmlTagsFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-xml/src/main/java/org/apache/marmotta/ldpath/model/functions/xml/RemoveXmlTagsFunction.java b/libraries/ldpath/ldpath-functions-xml/src/main/java/org/apache/marmotta/ldpath/model/functions/xml/RemoveXmlTagsFunction.java
new file mode 100644
index 0000000..708f056
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-xml/src/main/java/org/apache/marmotta/ldpath/model/functions/xml/RemoveXmlTagsFunction.java
@@ -0,0 +1,101 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed 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.ldpath.model.functions.xml;
+
+
+import org.apache.marmotta.ldpath.api.backend.RDFBackend;
+import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
+import org.apache.marmotta.ldpath.model.transformers.StringTransformer;
+import org.apache.marmotta.ldpath.util.Collections;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Pattern;
+
+public class RemoveXmlTagsFunction<Node> extends SelectorFunction<Node> {
+
+    private final static Logger log = LoggerFactory.getLogger(RemoveXmlTagsFunction.class);
+
+    private final StringTransformer<Node> transformer = new StringTransformer<Node>();
+
+    private static Pattern XML_TAG = Pattern.compile("<(\"[^\"]*\"|'[^']*'|[^>])*>", Pattern.MULTILINE);
+
+    /**
+     * Apply the function to the list of nodes passed as arguments and return the result as type T.
+     * Throws IllegalArgumentException if the function cannot be applied to the nodes passed as argument
+     * or the number of arguments is not correct.
+     *
+     * @param args a nested list of KiWiNodes
+     * @return
+     */
+    @Override
+    public Collection<Node> apply(RDFBackend<Node> rdfBackend, Node context, Collection<Node>... args) throws IllegalArgumentException {
+        if(args.length < 1){
+            log.debug("remove XML tags from context {}",context);
+            return java.util.Collections.singleton(
+                    rdfBackend.createLiteral(doFilter(transformer.transform(rdfBackend, context))));
+        } else {
+            log.debug("remove XML tags from parameters");
+            Iterator<Node> it = Collections.iterator(args);
+            List<Node> result = new ArrayList<Node>();
+            while (it.hasNext()) {
+                result.add(rdfBackend.createLiteral(doFilter(transformer.transform(rdfBackend, it.next()))));
+            }
+            return result;
+        }
+    }
+
+    private String doFilter(String in) {
+        return XML_TAG.matcher(in).replaceAll("");
+    }
+
+    /**
+     * Return the name of the NodeFunction for registration in the function registry
+     *
+     * @return
+     */
+    @Override
+    public String getLocalName() {
+        return "removeTags";
+
+    }
+
+    /**
+     * A string describing the signature of this node function, e.g. "fn:content(uris : Nodes) : Nodes". The
+     * syntax for representing the signature can be chosen by the implementer. This method is for informational
+     * purposes only.
+     *
+     * @return
+     */
+    @Override
+    public String getSignature() {
+        return "fn:removeTags(content: LiteralList) : LiteralList";
+    }
+
+    /**
+     * A short human-readable description of what the node function does.
+     *
+     * @return
+     */
+    @Override
+    public String getDescription() {
+        return "Function to remove all XML or HTML tags from the content. Can be used in-path, using the current context nodes as argument.";
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-xml/src/main/java/org/apache/marmotta/ldpath/model/functions/xml/XPathFunction.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-xml/src/main/java/org/apache/marmotta/ldpath/model/functions/xml/XPathFunction.java b/libraries/ldpath/ldpath-functions-xml/src/main/java/org/apache/marmotta/ldpath/model/functions/xml/XPathFunction.java
new file mode 100644
index 0000000..46d6554
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-xml/src/main/java/org/apache/marmotta/ldpath/model/functions/xml/XPathFunction.java
@@ -0,0 +1,152 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed 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.ldpath.model.functions.xml;
+
+
+import org.apache.marmotta.ldpath.api.backend.RDFBackend;
+import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
+import org.apache.marmotta.ldpath.model.transformers.StringTransformer;
+import org.jdom2.Content;
+import org.jdom2.Document;
+import org.jdom2.Element;
+import org.jdom2.JDOMException;
+import org.jdom2.Text;
+import org.jdom2.filter.Filters;
+import org.jdom2.input.SAXBuilder;
+import org.jdom2.input.sax.XMLReaders;
+import org.jdom2.output.XMLOutputter;
+import org.jdom2.xpath.XPathExpression;
+import org.jdom2.xpath.XPathFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+public class XPathFunction<Node> extends SelectorFunction<Node> {
+
+    private static final Logger log = LoggerFactory.getLogger(XPathFunction.class);
+
+    private final StringTransformer<Node> transformer = new StringTransformer<Node>();
+
+
+    /**
+     * Apply the function to the list of nodes passed as arguments and return the result as type T.
+     * Throws IllegalArgumentException if the function cannot be applied to the nodes passed as argument
+     * or the number of arguments is not correct.
+     *
+     * @param args a nested list of KiWiNodes
+     * @return
+     */
+    @Override
+    public Collection<Node> apply(RDFBackend<Node> rdfBackend, Node context, Collection<Node>... args) throws IllegalArgumentException {
+        if (args.length < 1) { throw new IllegalArgumentException("XPath expression is required as first argument."); }
+        Set<String> xpaths = new HashSet<String>();
+        for (Node xpath : args[0]) {
+            try {
+                xpaths.add(transformer.transform(rdfBackend,xpath));
+            } catch (IllegalArgumentException iae) {
+                throw new IllegalArgumentException("First argument must not contain anything else than String-Literals!");
+            }
+        }
+        Iterator<Node> it;
+        if(args.length < 2){
+            log.debug("Use context {} to execute xpaths {}",context,xpaths);
+            it = Collections.singleton(context).iterator();
+        } else {
+            log.debug("execute xpaths {} on parsed parameters",xpaths);
+            it = org.apache.marmotta.ldpath.util.Collections.iterator(1,args);
+        }
+        List<Node> result = new ArrayList<Node>();
+        while (it.hasNext()) {
+            Node n = it.next();
+            try {
+                for (String r : doFilter(transformer.transform(rdfBackend,n), xpaths)) {
+                    result.add(rdfBackend.createLiteral(r));
+                }
+            } catch (IOException e) {
+                // This should never happen, since validation is turned off.
+            }
+        }
+
+        return result;
+    }
+
+    private LinkedList<String> doFilter(String in, Set<String> xpaths) throws IOException {
+        LinkedList<String> result = new LinkedList<String>();
+        try {
+            Document doc = new SAXBuilder(XMLReaders.NONVALIDATING).build(new StringReader(in));
+            XMLOutputter out = new XMLOutputter();
+
+            for (String xp : xpaths) {
+                XPathExpression<Content> xpath = XPathFactory.instance().compile(xp, Filters.content());
+                for (Content node : xpath.evaluate(doc)) {
+                    if(node instanceof Element) {
+                        result.add(out.outputString((Element) node));
+                    } else if(node instanceof Text) {
+                        result.add(out.outputString((Text) node));
+                    }
+                }
+            }
+            return result;
+        } catch (JDOMException xpe) {
+            throw new IllegalArgumentException("error while processing xpath expressions: '" + xpaths + "'", xpe);
+        }
+    }
+
+
+    /**
+     * Return the name of the NodeFunction for registration in the function registry
+     *
+     * @return
+     * @param backend
+     */
+    @Override
+    public String getLocalName() {
+        return "xpath";
+    }
+
+
+    /**
+     * A string describing the signature of this node function, e.g. "fn:content(uris : Nodes) : Nodes". The
+     * syntax for representing the signature can be chosen by the implementer. This method is for informational
+     * purposes only.
+     *
+     * @return
+     */
+    @Override
+    public String getSignature() {
+        return "fn:xpath(xpath: String [, nodes: XMLLiteralList]) : LiteralList";
+    }
+
+    /**
+     * A short human-readable description of what the node function does.
+     *
+     * @return
+     */
+    @Override
+    public String getDescription() {
+        return "Evaluate an XPath expression on either the value of the context node or the values of the nodes passed as arguments.";
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-xml/src/main/resources/META-INF/services/at.newmedialab.ldpath.api.functions.SelectorFunction
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-xml/src/main/resources/META-INF/services/at.newmedialab.ldpath.api.functions.SelectorFunction b/libraries/ldpath/ldpath-functions-xml/src/main/resources/META-INF/services/at.newmedialab.ldpath.api.functions.SelectorFunction
deleted file mode 100644
index e3885b7..0000000
--- a/libraries/ldpath/ldpath-functions-xml/src/main/resources/META-INF/services/at.newmedialab.ldpath.api.functions.SelectorFunction
+++ /dev/null
@@ -1,2 +0,0 @@
-at.newmedialab.ldpath.model.functions.RemoveXmlTagsFunction
-at.newmedialab.ldpath.model.functions.XPathFunction
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-xml/src/main/resources/META-INF/services/org.apache.marmotta.ldpath.api.functions.SelectorFunction
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-xml/src/main/resources/META-INF/services/org.apache.marmotta.ldpath.api.functions.SelectorFunction b/libraries/ldpath/ldpath-functions-xml/src/main/resources/META-INF/services/org.apache.marmotta.ldpath.api.functions.SelectorFunction
new file mode 100644
index 0000000..2d371ad
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-xml/src/main/resources/META-INF/services/org.apache.marmotta.ldpath.api.functions.SelectorFunction
@@ -0,0 +1,2 @@
+org.apache.marmotta.ldpath.model.functions.xml.RemoveXmlTagsFunction
+org.apache.marmotta.ldpath.model.functions.xml.XPathFunction
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5b8766b3/libraries/ldpath/ldpath-functions-xml/src/test/java/org/apache/marmotta/ldpath/model/functions/xml/RemoveXmlTagsFunctionTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldpath/ldpath-functions-xml/src/test/java/org/apache/marmotta/ldpath/model/functions/xml/RemoveXmlTagsFunctionTest.java b/libraries/ldpath/ldpath-functions-xml/src/test/java/org/apache/marmotta/ldpath/model/functions/xml/RemoveXmlTagsFunctionTest.java
new file mode 100644
index 0000000..f2e0560
--- /dev/null
+++ b/libraries/ldpath/ldpath-functions-xml/src/test/java/org/apache/marmotta/ldpath/model/functions/xml/RemoveXmlTagsFunctionTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2013 Salzburg Research.
+ *
+ *  Licensed 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.ldpath.model.functions.xml;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.apache.marmotta.ldpath.model.fields.FieldMapping;
+import org.apache.marmotta.ldpath.parser.ParseException;
+import org.apache.marmotta.ldpath.parser.RdfPathParser;
+import org.apache.marmotta.ldpath.test.AbstractTestBase;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.openrdf.model.URI;
+import org.openrdf.model.Value;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.rio.RDFFormat;
+import org.openrdf.rio.RDFParseException;
+
+
+public class RemoveXmlTagsFunctionTest extends AbstractTestBase {
+
+    @Before
+    public void loadData() throws RepositoryException, RDFParseException, IOException {
+        super.loadData("data.n3", RDFFormat.N3);
+    }
+
+    @Test
+    public void testRemoveTags() throws ParseException {
+        String result = "A quiz is a form of game or mind sport in which the players (as individuals or in teams) attempt to answer questions correctly.";
+
+        final URI context = repository.getValueFactory().createURI(NSS.get("ex") + "Text");
+
+        final RdfPathParser<Value> parser = createParserFromString("fn:removeTags(foo:formatted) :: xsd:string");
+        final FieldMapping<Object, Value> rule = parser.parseRule(NSS);
+        final Collection<Object> values = rule.getValues(backend, context);
+
+        Assert.assertEquals(1, values.size());
+        Assert.assertEquals(result, values.iterator().next());
+    }
+}