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

[28/37] git commit: MARMOTTA-105: refactoring of packages in ldpath, ldcache, reasoner

MARMOTTA-105: refactoring of packages in ldpath, ldcache, reasoner


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

Branch: refs/heads/master
Commit: 5c0255c8445f59630b6c6bd0a2e5866615e0a907
Parents: 4d3eebd
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Fri Feb 22 15:47:54 2013 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Fri Feb 22 15:47:54 2013 +0100

----------------------------------------------------------------------
 .../src/main/resources/logback.xml                 |    2 +-
 .../lmf/client/test/ldpath/LDPathIT.java           |    2 +-
 .../marmotta-webapp/src/main/resources/logback.xml |    2 +-
 .../src/main/resources/META-INF/ehcache.xml        |    4 +-
 .../src/test/resources/ehcache-db.xml              |   10 +-
 .../marmotta-core/src/test/resources/logback.xml   |    2 +-
 .../api/endpoint/LinkedDataEndpointService.java    |   85 ----
 .../endpoint/LinkedDataEndpointServiceImpl.java    |  209 --------
 .../services/ldcache/LDCacheSailProvider.java      |  163 ------
 .../webservices/LinkedDataCachingWebService.java   |  287 -----------
 .../api/endpoint/LinkedDataEndpointService.java    |   85 ++++
 .../endpoint/LinkedDataEndpointServiceImpl.java    |  209 ++++++++
 .../services/ldcache/LDCacheSailProvider.java      |  163 ++++++
 .../webservices/LinkedDataCachingWebService.java   |  287 +++++++++++
 .../src/main/resources/kiwi-module.properties      |    2 +-
 .../newmedialab/lmf/ldpath/api/LDPathService.java  |   87 ----
 .../lmf/ldpath/api/LMFLDPathFunction.java          |   32 --
 .../newmedialab/lmf/ldpath/backend/LMFBackend.java |   54 --
 .../ldpath/model/functions/ContentFunction.java    |  131 -----
 .../lmf/ldpath/model/functions/JsoupFunction.java  |  143 ------
 .../lmf/ldpath/services/LDPathServiceImpl.java     |  190 -------
 .../ldpath/webservices/LDPathUtilWebService.java   |  392 ---------------
 .../lmf/ldpath/webservices/LDPathWebService.java   |  281 -----------
 .../platform/ldpath/api/LDPathService.java         |   87 ++++
 .../platform/ldpath/api/LMFLDPathFunction.java     |   32 ++
 .../platform/ldpath/backend/LMFBackend.java        |   54 ++
 .../ldpath/model/functions/ContentFunction.java    |  131 +++++
 .../ldpath/model/functions/JsoupFunction.java      |  143 ++++++
 .../ldpath/services/LDPathServiceImpl.java         |  190 +++++++
 .../ldpath/webservices/LDPathUtilWebService.java   |  392 +++++++++++++++
 .../ldpath/webservices/LDPathWebService.java       |  281 +++++++++++
 .../src/main/resources/kiwi-module.properties      |    4 +-
 .../reasoner/services/ReasoningSailProvider.java   |  222 --------
 .../reasoner/webservices/ProgramWebService.java    |  158 ------
 .../reasoner/webservices/ReasonerWebService.java   |  193 -------
 .../reasoner/services/ReasoningSailProvider.java   |  222 ++++++++
 .../reasoner/webservices/ProgramWebService.java    |  158 ++++++
 .../reasoner/webservices/ReasonerWebService.java   |  193 +++++++
 .../src/main/resources/kiwi-module.properties      |   12 +-
 .../kiwi/reasoner/test/engine/test-001.initial.ttl |    6 -
 .../kiwi/reasoner/test/engine/test-001.kwrl        |    3 -
 .../kiwi/reasoner/test/engine/test-001.result.ttl  |    6 -
 .../kiwi/reasoner/test/parser/test-001.kwrl        |    8 -
 .../kiwi/reasoner/test/parser/test-002.kwrl        |    3 -
 .../kiwi/reasoner/test/parser/test-003.kwrl        |   14 -
 .../kiwi/reasoner/test/parser/test-004.kwrl        |    5 -
 .../reasoner/test/engine/test-001.initial.ttl      |    6 +
 .../platform/reasoner/test/engine/test-001.kwrl    |    3 +
 .../reasoner/test/engine/test-001.result.ttl       |    6 +
 .../platform/reasoner/test/parser/test-001.kwrl    |    8 +
 .../platform/reasoner/test/parser/test-002.kwrl    |    3 +
 .../platform/reasoner/test/parser/test-003.kwrl    |   14 +
 .../platform/reasoner/test/parser/test-004.kwrl    |    5 +
 53 files changed, 2687 insertions(+), 2697 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/logback.xml
----------------------------------------------------------------------
diff --git a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/logback.xml b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/logback.xml
index 9ce3eca..53ab7e7 100644
--- a/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/logback.xml
+++ b/build/archetypes/marmotta-archetype-webapp/src/main/resources/archetype-resources/src/main/resources/logback.xml
@@ -48,7 +48,7 @@
 
     <logger name="org.apache.marmotta.platform.core" level="INFO" />
 
-    <logger name="kiwi.reasoner" level="INFO" />
+    <logger name="org.apache.marmotta.platform.reasoner" level="INFO" />
 
 	<logger name="at.newmedialab.sn" level="TRACE" />
     

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/ldpath/LDPathIT.java
----------------------------------------------------------------------
diff --git a/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/ldpath/LDPathIT.java b/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/ldpath/LDPathIT.java
index 054a8d7..6dfabed 100644
--- a/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/ldpath/LDPathIT.java
+++ b/client/marmotta-client-java/src/test/java/at/newmedialab/lmf/client/test/ldpath/LDPathIT.java
@@ -19,7 +19,7 @@ package at.newmedialab.lmf.client.test.ldpath;
 import at.newmedialab.lmf.client.ClientConfiguration;
 import at.newmedialab.lmf.client.clients.LDPathClient;
 import at.newmedialab.lmf.client.model.rdf.RDFNode;
-import at.newmedialab.lmf.ldpath.webservices.LDPathWebService;
+import org.apache.marmotta.platform.ldpath.webservices.LDPathWebService;
 import org.apache.marmotta.platform.core.api.importer.ImportService;
 import org.apache.marmotta.platform.core.exception.io.LMFImportException;
 import org.apache.marmotta.platform.core.test.base.JettyLMF;

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/launchers/marmotta-webapp/src/main/resources/logback.xml
----------------------------------------------------------------------
diff --git a/launchers/marmotta-webapp/src/main/resources/logback.xml b/launchers/marmotta-webapp/src/main/resources/logback.xml
index ae6ca77..caa75ae 100644
--- a/launchers/marmotta-webapp/src/main/resources/logback.xml
+++ b/launchers/marmotta-webapp/src/main/resources/logback.xml
@@ -29,7 +29,7 @@
 
     <logger name="org.apache.marmotta.platform.core" level="INFO" />
 
-    <logger name="kiwi.reasoner" level="INFO" />
+    <logger name="org.apache.marmotta.platform.reasoner" level="INFO" />
 
 	<logger name="at.newmedialab.sn" level="TRACE" />
     

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-core/src/main/resources/META-INF/ehcache.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/META-INF/ehcache.xml b/platform/marmotta-core/src/main/resources/META-INF/ehcache.xml
index 89c4efc..9cddaa1 100644
--- a/platform/marmotta-core/src/main/resources/META-INF/ehcache.xml
+++ b/platform/marmotta-core/src/main/resources/META-INF/ehcache.xml
@@ -392,14 +392,14 @@ are "on" and "off".  The default is "autodetect".
            overflowToDisk="false"
            memoryStoreEvictionPolicy="LRU"/>
 
-    <cache name="kiwi.reasoner.model.Pattern"
+    <cache name="org.apache.marmotta.platform.reasoner.model.Pattern"
            statistics="true"
            maxElementsInMemory="1000"
            eternal="true"
            overflowToDisk="false"
            memoryStoreEvictionPolicy="LRU"/>
 
-    <cache name="kiwi.reasoner.model.Field"
+    <cache name="org.apache.marmotta.platform.reasoner.model.Field"
            statistics="true"
            maxElementsInMemory="10000"
            eternal="true"

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-core/src/test/resources/ehcache-db.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/resources/ehcache-db.xml b/platform/marmotta-core/src/test/resources/ehcache-db.xml
index 53534fd..338da48 100644
--- a/platform/marmotta-core/src/test/resources/ehcache-db.xml
+++ b/platform/marmotta-core/src/test/resources/ehcache-db.xml
@@ -392,35 +392,35 @@ are "on" and "off".  The default is "autodetect".
            overflowToDisk="false"
            memoryStoreEvictionPolicy="LRU"/>
 
-    <cache name="kiwi.reasoner.model.Pattern"
+    <cache name="org.apache.marmotta.platform.reasoner.model.Pattern"
            statistics="true"
            maxElementsInMemory="1000"
            eternal="true"
            overflowToDisk="false"
            memoryStoreEvictionPolicy="LRU"/>
 
-    <cache name="kiwi.reasoner.model.Field"
+    <cache name="org.apache.marmotta.platform.reasoner.model.Field"
            statistics="true"
            maxElementsInMemory="10000"
            eternal="true"
            overflowToDisk="false"
            memoryStoreEvictionPolicy="LRU"/>
 
-    <cache name="kiwi.reasoner.model.Rule"
+    <cache name="org.apache.marmotta.platform.reasoner.model.Rule"
            statistics="true"
            maxElementsInMemory="100"
            eternal="true"
            overflowToDisk="false"
            memoryStoreEvictionPolicy="LRU"/>
 
-    <cache name="kiwi.reasoner.model.Rule.body"
+    <cache name="org.apache.marmotta.platform.reasoner.model.Rule.body"
            statistics="true"
            maxElementsInMemory="1000"
            eternal="true"
            overflowToDisk="false"
            memoryStoreEvictionPolicy="LRU"/>
 
-    <cache name="kiwi.reasoner.model.Program"
+    <cache name="org.apache.marmotta.platform.reasoner.model.Program"
            statistics="true"
            maxElementsInMemory="100"
            eternal="true"

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-core/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/resources/logback.xml b/platform/marmotta-core/src/test/resources/logback.xml
index 7dee862..9bd432a 100644
--- a/platform/marmotta-core/src/test/resources/logback.xml
+++ b/platform/marmotta-core/src/test/resources/logback.xml
@@ -28,7 +28,7 @@
 
     <logger name="org.apache.marmotta.platform.core" level="INFO" />
 
-    <logger name="kiwi.reasoner" level="INFO" />
+    <logger name="org.apache.marmotta.platform.reasoner" level="INFO" />
 
 	<logger name="at.newmedialab.sn" level="TRACE" />
     

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/api/endpoint/LinkedDataEndpointService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/api/endpoint/LinkedDataEndpointService.java b/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/api/endpoint/LinkedDataEndpointService.java
deleted file mode 100644
index 5fd0317..0000000
--- a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/api/endpoint/LinkedDataEndpointService.java
+++ /dev/null
@@ -1,85 +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.lmf.ldcache.api.endpoint;
-
-import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
-import org.openrdf.model.URI;
-
-import java.util.List;
-
-/**
- * A service for managing Linked Data endpoints.
- * <p/>
- * User: sschaffe
- */
-public interface LinkedDataEndpointService {
-
-    /**
-     * Add a new endpoint to the system. The endpoint will be persisted in the database.
-     *
-     * @param endpoint
-     */
-    public void addEndpoint(Endpoint endpoint);
-
-    /**`
-     * Update the endpoint passed as argument in the database.
-     *
-     * @param endpoint
-     */
-    public void updateEndpoint(Endpoint endpoint);
-
-    /**
-     * List all endpoints registered in the system.
-     *
-     * @return a list of endpoints in the order they were added to the database.
-     */
-    public List<Endpoint> listEndpoints();
-
-    /**
-     * Remove the endpoint given as argument. The endpoint will be deleted in the database.
-     *
-     * @param endpoint
-     */
-    public void removeEndpoint(Endpoint endpoint);
-
-    /**
-     * Return the endpoint with the given ID.
-     *
-     * @param id ID of the endpoint to return.
-     * @return
-     */
-    public Endpoint getEndpoint(String id);
-
-
-
-    /**
-     * Retrieve the endpoint matching the KiWiUriResource passed as argument. The endpoint is determined by
-     * matching the endpoint's URI prefix with the resource URI. If no matching endpoint exists, returns null.
-     * The LinkedDataClientService can then decide (based on configuration) whether to try with a standard
-     * LinkedDataRequest or ignore the request.
-     *
-     * @param resource the KiWiUriResource to check.
-     */
-    public Endpoint getEndpoint(URI resource);
-
-    /**
-     * Test whether an endpoint definition for the given url pattern already exists.
-     *
-     * @param urlPattern
-     * @return
-     */
-    public boolean hasEndpoint(String urlPattern);
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java b/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java
deleted file mode 100644
index 36b2c31..0000000
--- a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java
+++ /dev/null
@@ -1,209 +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.lmf.ldcache.services.endpoint;
-
-import at.newmedialab.lmf.ldcache.api.endpoint.LinkedDataEndpointService;
-import com.google.common.base.Joiner;
-import org.apache.marmotta.platform.core.api.config.ConfigurationService;
-import org.apache.marmotta.commons.http.ContentType;
-import org.apache.marmotta.commons.http.LMFHttpUtils;
-import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
-import org.openrdf.model.URI;
-import org.slf4j.Logger;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Add file description here!
- * <p/>
- * User: sschaffe
- */
-@ApplicationScoped
-public class LinkedDataEndpointServiceImpl implements LinkedDataEndpointService {
-
-    @Inject
-    private Logger log;
-
-
-    @Inject
-    private ConfigurationService configurationService;
-
-
-    private static Endpoint[] blacklist = new Endpoint[] {
-        new Endpoint("HolyGoat", "NONE","^http://www\\.holygoat\\.co\\.uk","","",86400l),
-        new Endpoint("KiWi Project","NONE","^http://www\\.kiwi-project\\.eu/","","",86400l)
-    };
-
-    @PostConstruct
-    public void initialize() {
-        log.trace("LDEndpointService staring up...");
-    }
-
-
-    /**
-     * Add a new endpoint to the system. The endpoint will be persisted in the database.
-     *
-     * @param endpoint
-     */
-    @Override
-    public void addEndpoint(Endpoint endpoint) {
-        storeEndpoint(endpoint);
-    }
-
-    /**
-     * `
-     * Update the endpoint passed as argument in the database.
-     *
-     * @param endpoint
-     */
-    @Override
-    public void updateEndpoint(Endpoint endpoint) {
-        storeEndpoint(endpoint);
-    }
-
-    /**
-     * List all endpoints registered in the system.
-     *
-     * @return a list of endpoints in the order they were added to the database.
-     */
-    @Override
-    public List<Endpoint> listEndpoints() {
-        List<Endpoint> result = new ArrayList<Endpoint>();
-        for(String label : listEndpointLabels()) {
-            result.add(getEndpointByLabel(label));
-        }
-        for(Endpoint e : blacklist) {
-            if(!result.contains(e)) {
-                result.add(e);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Remove the endpoint given as argument. The endpoint will be deleted in the database.
-     *
-     * @param endpoint
-     */
-    @Override
-    public void removeEndpoint(Endpoint endpoint) {
-        String label = endpoint.getName().replaceAll("[^A-Za-z0-9 ]", "").toLowerCase();
-
-        List<String> keys = configurationService.listConfigurationKeys("ldcache.endpoint."+label);
-        for(String key : keys) {
-            configurationService.removeConfiguration(key);
-        }
-    }
-
-    /**
-     * Return the endpoint with the given ID.
-     *
-     * @param id ID of the endpoint to return.
-     * @return
-     */
-    @Override
-    public Endpoint getEndpoint(String id) {
-        for(Endpoint endpoint : listEndpoints()) {
-            if(endpoint.getName().replaceAll("[^A-Za-z0-9 ]", "").toLowerCase().equals(id)) return endpoint;
-        }
-        return null;
-    }
-
-    /**
-     * Retrieve the endpoint matching the KiWiUriResource passed as argument. The endpoint is determined by
-     * matching the endpoint's URI prefix with the resource URI. If no matching endpoint exists, returns null.
-     * The LinkedDataClientService can then decide (based on configuration) whether to try with a standard
-     * LinkedDataRequest or ignore the request.
-     *
-     * @param resource the KiWiUriResource to check.
-     */
-    @Override
-    public Endpoint getEndpoint(URI resource) {
-        for(Endpoint endpoint : listEndpoints()) {
-            if (endpoint.handles(resource.stringValue())) return endpoint;
-        }
-
-        return null;
-    }
-
-    /**
-     * Test whether an endpoint definition for the given url pattern already exists.
-     *
-     * @param urlPattern
-     * @return
-     */
-    @Override
-    public boolean hasEndpoint(String urlPattern) {
-        for(Endpoint endpoint : listEndpoints()) {
-            if(endpoint.getUriPattern() != null && endpoint.getUriPattern().equals(urlPattern)) return true;
-        }
-        return false;
-    }
-
-
-    private void storeEndpoint(Endpoint endpoint) {
-
-        String label = endpoint.getName().replaceAll("[^A-Za-z0-9 ]", "").toLowerCase();
-        configurationService.setConfiguration("ldcache.endpoint."+label+".name", endpoint.getName());
-        configurationService.setIntConfiguration("ldcache.endpoint." + label + ".prio", endpoint.getPriority());
-        configurationService.setConfiguration("ldcache.endpoint." + label + ".provider", endpoint.getType());
-        configurationService.setConfiguration("ldcache.endpoint." + label + ".pattern", endpoint.getUriPattern());
-        configurationService.setConfiguration("ldcache.endpoint." + label + ".service", endpoint.getEndpointUrl());
-        configurationService.setLongConfiguration("ldcache.endpoint." + label + ".expiry", endpoint.getDefaultExpiry());
-        configurationService.setBooleanConfiguration("ldcache.endpoint." + label + ".active", endpoint.isActive());
-        configurationService.setConfiguration(
-                "ldcache.endpoint." + label + ".contenttype",
-                Joiner.on(",").join(endpoint.getContentTypes())
-        );
-    }
-
-
-    private Endpoint getEndpointByLabel(String label) {
-        Endpoint endpoint = new Endpoint();
-
-        endpoint.setName(configurationService.getStringConfiguration("ldcache.endpoint."+label+".name"));
-        endpoint.setPriority(configurationService.getIntConfiguration("ldcache.endpoint." + label + ".prio"));
-        endpoint.setType(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".provider"));
-        endpoint.setUriPattern(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".pattern"));
-        endpoint.setEndpointUrl(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".service"));
-        endpoint.setDefaultExpiry(configurationService.getLongConfiguration("ldcache.endpoint." + label + ".expiry"));
-        endpoint.setActive(configurationService.getBooleanConfiguration("ldcache.endpoint." + label + ".active"));
-        endpoint.setContentTypes(new HashSet<ContentType>(
-                LMFHttpUtils.parseAcceptHeader(
-                        configurationService.getStringConfiguration("ldcache.endpoint." + label + ".contenttype",""))
-        ));
-
-        return endpoint;
-    }
-
-
-    private Collection<String> listEndpointLabels() {
-        Set<String> labels = new HashSet<String>();
-        for(String key : configurationService.listConfigurationKeys("ldcache.endpoint")) {
-            String[] components = key.split("\\.");
-            labels.add(components[2]);
-        }
-        return labels;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/ldcache/LDCacheSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/ldcache/LDCacheSailProvider.java b/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/ldcache/LDCacheSailProvider.java
deleted file mode 100644
index 587eefc..0000000
--- a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/ldcache/LDCacheSailProvider.java
+++ /dev/null
@@ -1,163 +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.lmf.ldcache.services.ldcache;
-
-import at.newmedialab.lmf.ldcache.api.endpoint.LinkedDataEndpointService;
-import org.apache.marmotta.platform.core.api.config.ConfigurationService;
-import org.apache.marmotta.platform.core.api.http.HttpClientService;
-import org.apache.marmotta.platform.core.api.triplestore.NotifyingSailProvider;
-import org.apache.marmotta.platform.core.api.triplestore.SesameService;
-import org.apache.marmotta.platform.core.events.ConfigurationChangedEvent;
-import org.apache.marmotta.platform.core.model.filter.LMFLocalFilter;
-
-import org.apache.marmotta.commons.sesame.filter.NotFilter;
-import org.apache.marmotta.ldcache.sail.KiWiLinkedDataSail;
-import org.apache.marmotta.ldcache.services.LDCache;
-import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
-import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
-import org.apache.marmotta.ldclient.model.ClientConfiguration;
-import org.openrdf.model.Resource;
-import org.openrdf.sail.NotifyingSail;
-import org.openrdf.sail.helpers.NotifyingSailWrapper;
-import org.slf4j.Logger;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
-import java.util.HashSet;
-
-/**
- * A sail provider service that allows wrapping a transparent Linked Data caching component around the
- * main SAIL.
- *
- * <p/>
- * Author: Sebastian Schaffert (sschaffert@apache.org)
- */
-@ApplicationScoped
-public class LDCacheSailProvider implements NotifyingSailProvider {
-
-    public static final String LDCACHE_ENABLED = "ldcache.enabled";
-    @Inject
-    private Logger log;
-
-    @Inject
-    private LinkedDataEndpointService endpointService;
-
-    @Inject
-    private ConfigurationService configurationService;
-
-    @Inject
-    private SesameService sesameService;
-    
-    @Inject
-    private HttpClientService         httpClientService;
-
-    private ClientConfiguration ldclientConfig;
-
-    private KiWiLinkedDataSail  sail;
-
-    /**
-     * Return the name of the provider. Used e.g. for displaying status information or logging.
-     *
-     * @return
-     */
-    @Override
-    public String getName() {
-        return "Linked Data Caching";
-    }
-
-
-    /**
-     * Return true if this sail provider is enabled in the configuration.
-     *
-     * @return
-     */
-    @Override
-    public boolean isEnabled() {
-        return configurationService.getBooleanConfiguration(LDCACHE_ENABLED,true);
-    }
-
-    public void configurationChanged(@Observes ConfigurationChangedEvent e) {
-        if(e.containsChangedKey(LDCACHE_ENABLED)) {
-        	// FIXME: (jf) i don't like this dependency - i think it would be better to fire an event here
-            sesameService.shutdown();
-            sesameService.initialise();
-        }
-    }
-
-
-    @PostConstruct
-    public void initialize() {
-        ldclientConfig = new ClientConfiguration();
-        updateConfig();
-    }
-
-    public void updateEndpoints() {
-        ldclientConfig.setEndpoints(new HashSet<Endpoint>(endpointService.listEndpoints()));
-
-        if(sail != null &&  sail.getLDCache() != null) {
-            sail.getLDCache().reload();
-        }
-    }
-
-
-    public void updateConfig() {
-        ldclientConfig.setDefaultExpiry(configurationService.getLongConfiguration("ldcache.expiry", 86400L));
-        ldclientConfig.setMinimumExpiry(configurationService.getLongConfiguration("ldcache.minexpiry", 3600L));
-        ldclientConfig.setSocketTimeout(configurationService.getIntConfiguration("ldcache.so_timeout", 60000));
-        ldclientConfig.setConnectionTimeout(configurationService.getIntConfiguration("ldcache.connection_timeout", 10000));
-        ldclientConfig.setMaxParallelRequests(configurationService.getIntConfiguration("ldcache.max_parallel_requests",10));
-        ldclientConfig.setEndpoints(new HashSet<Endpoint>(endpointService.listEndpoints()));
-
-        ldclientConfig.setHttpClient(httpClientService.getHttpClient());
-
-        if(sail != null &&  sail.getLDCache() != null) {
-            sail.getLDCache().reload();
-        }
-    }
-
-    /**
-     * Create the sail wrapper provided by this SailProvider
-     *
-     * @param parent the parent sail to wrap by the provider
-     * @return the wrapped sail
-     */
-    @Override
-    public NotifyingSailWrapper createSail(NotifyingSail parent) {
-        String cache_context = configurationService.getCacheContext();
-        sail = new KiWiLinkedDataSail(parent, new NotFilter<Resource>(LMFLocalFilter.getInstance()), cache_context, ldclientConfig);
-        return sail;
-    }
-
-
-    /**
-     * Return the Linked Data Client used by the caching system (e.g. for debugging).
-     * @return
-     */
-    public LDClientService getLDClient() {
-        return sail.getLDCache().getLDClient();
-    }
-
-    /**
-     * Return the caching backend used by the caching system (e.g. for debugging)
-     * @return
-     */
-    public LDCache getLDCache() {
-        return sail.getLDCache();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/webservices/LinkedDataCachingWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/webservices/LinkedDataCachingWebService.java b/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/webservices/LinkedDataCachingWebService.java
deleted file mode 100644
index fc86471..0000000
--- a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/webservices/LinkedDataCachingWebService.java
+++ /dev/null
@@ -1,287 +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.lmf.ldcache.webservices;
-
-import at.newmedialab.lmf.ldcache.api.endpoint.LinkedDataEndpointService;
-import at.newmedialab.lmf.ldcache.services.ldcache.LDCacheSailProvider;
-import org.apache.marmotta.commons.sesame.model.Namespaces;
-import org.apache.marmotta.platform.core.api.triplestore.SesameService;
-import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
-import org.apache.marmotta.ldclient.api.provider.DataProvider;
-import org.apache.marmotta.ldclient.model.ClientResponse;
-import org.apache.marmotta.ldclient.provider.rdf.LinkedDataProvider;
-import org.openrdf.model.URI;
-import org.openrdf.repository.RepositoryConnection;
-import org.openrdf.rio.RDFHandler;
-import org.openrdf.rio.rdfxml.util.RDFXMLPrettyWriter;
-import org.slf4j.Logger;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import java.io.ByteArrayOutputStream;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-/**
- * Add file description here!
- * <p/>
- * User: sschaffe
- */
-@ApplicationScoped
-@Path("/cache")
-public class LinkedDataCachingWebService {
-
-    @Inject
-    private Logger log;
-
-    @Inject
-    private LinkedDataEndpointService endpointService;
-
-    @Inject
-    private SesameService sesameService;
-
-    @Inject
-    private LDCacheSailProvider cacheSailProvider;
-
-
-    @GET
-    @Path("/live")
-    public Response retrieveLive(@QueryParam("uri") String uri) {
-
-        try {
-            ClientResponse response = cacheSailProvider.getLDClient().retrieveResource(uri);
-
-            RepositoryConnection con = response.getTriples().getConnection();
-            con.begin();
-
-            ByteArrayOutputStream out = new ByteArrayOutputStream();
-            RDFHandler handler = new RDFXMLPrettyWriter(out);
-            con.export(handler);
-
-            con.commit();
-            con.close();
-
-
-            return Response.ok().entity( new String(out.toByteArray(), "utf-8")).build();
-        } catch (Exception e) {
-            log.error("exception while retrieving resource",e);
-            return Response.status(500).entity(e.getMessage()).build();
-        }
-    }
-
-    @GET
-    @Path("/cached")
-    public Response retrieveCached(@QueryParam("uri") String uri) {
-
-        URI resource = sesameService.getValueFactory().createURI(uri);
-
-
-        try {
-            cacheSailProvider.getLDCache().refreshResource(resource, false);
-
-            return Response.ok().build();
-        } catch (Exception e) {
-            log.error("exception while retrieving resource",e);
-            return Response.status(500).entity(e.getMessage()).build();
-        }
-    }
-
-    @GET
-    @Path("/refresh")
-    public Response refreshCached(@QueryParam("uri") String uri) {
-
-        URI resource = sesameService.getValueFactory().createURI(uri);
-
-
-        try {
-            cacheSailProvider.getLDCache().refreshResource(resource, true);
-
-            return Response.ok().build();
-        } catch (Exception e) {
-            log.error("exception while retrieving resource",e);
-            return Response.status(500).entity(e.getMessage()).build();
-        }
-    }
-
-    @POST
-    @Path("/expire")
-    public Response expireCache(@QueryParam("uri") String uri) {
-
-        if (uri != null) {
-            URI resource = sesameService.getValueFactory().createURI(uri);
-            cacheSailProvider.getLDCache().expire(resource);
-        } else {
-            cacheSailProvider.getLDCache().expireAll();
-        }
-
-        return Response.ok().build();
-    }
-
-    @POST
-    @Path("/endpoint")
-    public Response registerEndpoint(@QueryParam("name") String name,
-            @QueryParam("prefix") String prefix,
-            @QueryParam("endpoint") String endpointUrl,
-            @QueryParam("kind") String type,
-            @QueryParam("mimetype") String mimetype,
-            @QueryParam("expiry") long expiry) {
-
-        if (type == null || !getProviderNames().contains(type.toLowerCase())) {
-            type = LinkedDataProvider.PROVIDER_NAME;
-        }
-
-        // Check for valid Regex
-        if (prefix != null) {
-            try {
-                if (prefix.startsWith(Endpoint.REGEX_INDICATOR)) {
-                    Pattern.compile(prefix.substring(Endpoint.REGEX_INDICATOR.length()));
-                } else {
-                    Pattern.compile(prefix);
-                }
-            } catch (PatternSyntaxException pse) {
-                return Response.status(Status.BAD_REQUEST).entity("Invalid Regex in prefix detected").build();
-            }
-        }
-        if (endpointUrl != null) {
-            endpointUrl = endpointUrl.replace('<', '{').replace('>', '}');
-        } else {
-            endpointUrl = "";
-        }
-        if (mimetype == null) {
-            mimetype ="";
-        }
-        Endpoint endpoint = new Endpoint(name, type, prefix, endpointUrl, mimetype, expiry);
-        endpointService.addEndpoint(endpoint);
-
-        cacheSailProvider.updateEndpoints();
-
-
-        return Response.ok().build();
-    }
-
-    @GET
-    @Path("/endpoint/list")
-    @Produces("application/json")
-    public Response listEndpoints() {
-
-        List<Map<String, Object>> result = new LinkedList<Map<String, Object>>();
-        for(Endpoint endpoint : endpointService.listEndpoints()) {
-            result.add(buildEndpointJSON(endpoint));
-        }
-
-        return Response.ok().entity(result).build();
-    }
-
-    @GET
-    @Path("/provider/list")
-    @Produces(Namespaces.MIME_TYPE_JSON)
-    public Set<String> listProviders() {
-        return getProviderNames();
-    }
-
-
-    @GET
-    @Path("/endpoint/{id}")
-    @Produces("application/json")
-    public Response retrieveEndpoint(@PathParam("id") String id) {
-
-        Endpoint endpoint = endpointService.getEndpoint(id);
-        if (endpoint == null) return notFound(id);
-
-
-        return Response.ok().entity(buildEndpointJSON(endpoint)).build();
-    }
-
-    @DELETE
-    @Path("/endpoint/{id}")
-    public Response removeEndpoint(@PathParam("id") String id) {
-
-        Endpoint endpoint = endpointService.getEndpoint(id);
-        if (endpoint == null) return notFound(id);
-
-        endpointService.removeEndpoint(endpoint);
-
-        cacheSailProvider.updateEndpoints();
-
-        return Response.ok().build();
-    }
-
-    @POST
-    @Path("/endpoint/{id}/enable")
-    public Response enableEndpoint(@PathParam("id") String id, @QueryParam("enable") @DefaultValue("true") boolean enable) {
-        Endpoint endpoint = endpointService.getEndpoint(id);
-        if (endpoint == null) return notFound(id);
-
-        endpoint.setActive(enable);
-        endpointService.updateEndpoint(endpoint);
-
-        cacheSailProvider.updateEndpoints();
-
-        return Response.ok().build();
-    }
-
-    private Response notFound(String id) {
-        return Response.status(Status.NOT_FOUND).entity("No endpoint with id " + id + " found!").build();
-    }
-
-    @POST
-    @Path("/endpoint/{id}/disable")
-    public Response disableEndpoint(@PathParam("id") String id) {
-        return enableEndpoint(id, false);
-    }
-
-
-    private Map<String, Object> buildEndpointJSON(Endpoint endpoint) {
-        HashMap<String, Object> resultMap = new HashMap<String, Object>();
-        resultMap.put("id",endpoint.getName().replaceAll("[^A-Za-z0-9 ]", "").toLowerCase());
-        resultMap.put("name",endpoint.getName());
-        resultMap.put("endpoint",endpoint.getEndpointUrl());
-        resultMap.put("expiry", endpoint.getDefaultExpiry());
-        resultMap.put("prefix",endpoint.getUriPattern());
-        resultMap.put("kind",endpoint.getType().toString());
-        resultMap.put("mimetype",endpoint.getContentTypes());
-        resultMap.put("active", endpoint.isActive());
-
-        return resultMap;
-    }
-
-
-    private Set<String> getProviderNames() {
-        Set<String> result = new HashSet<String>();
-
-        for(DataProvider provider : cacheSailProvider.getLDClient().getDataProviders()) {
-            result.add(provider.getName().toLowerCase());
-        }
-
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/api/endpoint/LinkedDataEndpointService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/api/endpoint/LinkedDataEndpointService.java b/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/api/endpoint/LinkedDataEndpointService.java
new file mode 100644
index 0000000..0d9d677
--- /dev/null
+++ b/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/api/endpoint/LinkedDataEndpointService.java
@@ -0,0 +1,85 @@
+/**
+ * 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.platform.ldcache.api.endpoint;
+
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+import org.openrdf.model.URI;
+
+import java.util.List;
+
+/**
+ * A service for managing Linked Data endpoints.
+ * <p/>
+ * User: sschaffe
+ */
+public interface LinkedDataEndpointService {
+
+    /**
+     * Add a new endpoint to the system. The endpoint will be persisted in the database.
+     *
+     * @param endpoint
+     */
+    public void addEndpoint(Endpoint endpoint);
+
+    /**`
+     * Update the endpoint passed as argument in the database.
+     *
+     * @param endpoint
+     */
+    public void updateEndpoint(Endpoint endpoint);
+
+    /**
+     * List all endpoints registered in the system.
+     *
+     * @return a list of endpoints in the order they were added to the database.
+     */
+    public List<Endpoint> listEndpoints();
+
+    /**
+     * Remove the endpoint given as argument. The endpoint will be deleted in the database.
+     *
+     * @param endpoint
+     */
+    public void removeEndpoint(Endpoint endpoint);
+
+    /**
+     * Return the endpoint with the given ID.
+     *
+     * @param id ID of the endpoint to return.
+     * @return
+     */
+    public Endpoint getEndpoint(String id);
+
+
+
+    /**
+     * Retrieve the endpoint matching the KiWiUriResource passed as argument. The endpoint is determined by
+     * matching the endpoint's URI prefix with the resource URI. If no matching endpoint exists, returns null.
+     * The LinkedDataClientService can then decide (based on configuration) whether to try with a standard
+     * LinkedDataRequest or ignore the request.
+     *
+     * @param resource the KiWiUriResource to check.
+     */
+    public Endpoint getEndpoint(URI resource);
+
+    /**
+     * Test whether an endpoint definition for the given url pattern already exists.
+     *
+     * @param urlPattern
+     * @return
+     */
+    public boolean hasEndpoint(String urlPattern);
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java b/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java
new file mode 100644
index 0000000..1794514
--- /dev/null
+++ b/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java
@@ -0,0 +1,209 @@
+/**
+ * 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.platform.ldcache.services.endpoint;
+
+import org.apache.marmotta.platform.ldcache.api.endpoint.LinkedDataEndpointService;
+import com.google.common.base.Joiner;
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
+import org.apache.marmotta.commons.http.ContentType;
+import org.apache.marmotta.commons.http.LMFHttpUtils;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+import org.openrdf.model.URI;
+import org.slf4j.Logger;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Add file description here!
+ * <p/>
+ * User: sschaffe
+ */
+@ApplicationScoped
+public class LinkedDataEndpointServiceImpl implements LinkedDataEndpointService {
+
+    @Inject
+    private Logger log;
+
+
+    @Inject
+    private ConfigurationService configurationService;
+
+
+    private static Endpoint[] blacklist = new Endpoint[] {
+        new Endpoint("HolyGoat", "NONE","^http://www\\.holygoat\\.co\\.uk","","",86400l),
+        new Endpoint("KiWi Project","NONE","^http://www\\.kiwi-project\\.eu/","","",86400l)
+    };
+
+    @PostConstruct
+    public void initialize() {
+        log.trace("LDEndpointService staring up...");
+    }
+
+
+    /**
+     * Add a new endpoint to the system. The endpoint will be persisted in the database.
+     *
+     * @param endpoint
+     */
+    @Override
+    public void addEndpoint(Endpoint endpoint) {
+        storeEndpoint(endpoint);
+    }
+
+    /**
+     * `
+     * Update the endpoint passed as argument in the database.
+     *
+     * @param endpoint
+     */
+    @Override
+    public void updateEndpoint(Endpoint endpoint) {
+        storeEndpoint(endpoint);
+    }
+
+    /**
+     * List all endpoints registered in the system.
+     *
+     * @return a list of endpoints in the order they were added to the database.
+     */
+    @Override
+    public List<Endpoint> listEndpoints() {
+        List<Endpoint> result = new ArrayList<Endpoint>();
+        for(String label : listEndpointLabels()) {
+            result.add(getEndpointByLabel(label));
+        }
+        for(Endpoint e : blacklist) {
+            if(!result.contains(e)) {
+                result.add(e);
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Remove the endpoint given as argument. The endpoint will be deleted in the database.
+     *
+     * @param endpoint
+     */
+    @Override
+    public void removeEndpoint(Endpoint endpoint) {
+        String label = endpoint.getName().replaceAll("[^A-Za-z0-9 ]", "").toLowerCase();
+
+        List<String> keys = configurationService.listConfigurationKeys("ldcache.endpoint."+label);
+        for(String key : keys) {
+            configurationService.removeConfiguration(key);
+        }
+    }
+
+    /**
+     * Return the endpoint with the given ID.
+     *
+     * @param id ID of the endpoint to return.
+     * @return
+     */
+    @Override
+    public Endpoint getEndpoint(String id) {
+        for(Endpoint endpoint : listEndpoints()) {
+            if(endpoint.getName().replaceAll("[^A-Za-z0-9 ]", "").toLowerCase().equals(id)) return endpoint;
+        }
+        return null;
+    }
+
+    /**
+     * Retrieve the endpoint matching the KiWiUriResource passed as argument. The endpoint is determined by
+     * matching the endpoint's URI prefix with the resource URI. If no matching endpoint exists, returns null.
+     * The LinkedDataClientService can then decide (based on configuration) whether to try with a standard
+     * LinkedDataRequest or ignore the request.
+     *
+     * @param resource the KiWiUriResource to check.
+     */
+    @Override
+    public Endpoint getEndpoint(URI resource) {
+        for(Endpoint endpoint : listEndpoints()) {
+            if (endpoint.handles(resource.stringValue())) return endpoint;
+        }
+
+        return null;
+    }
+
+    /**
+     * Test whether an endpoint definition for the given url pattern already exists.
+     *
+     * @param urlPattern
+     * @return
+     */
+    @Override
+    public boolean hasEndpoint(String urlPattern) {
+        for(Endpoint endpoint : listEndpoints()) {
+            if(endpoint.getUriPattern() != null && endpoint.getUriPattern().equals(urlPattern)) return true;
+        }
+        return false;
+    }
+
+
+    private void storeEndpoint(Endpoint endpoint) {
+
+        String label = endpoint.getName().replaceAll("[^A-Za-z0-9 ]", "").toLowerCase();
+        configurationService.setConfiguration("ldcache.endpoint."+label+".name", endpoint.getName());
+        configurationService.setIntConfiguration("ldcache.endpoint." + label + ".prio", endpoint.getPriority());
+        configurationService.setConfiguration("ldcache.endpoint." + label + ".provider", endpoint.getType());
+        configurationService.setConfiguration("ldcache.endpoint." + label + ".pattern", endpoint.getUriPattern());
+        configurationService.setConfiguration("ldcache.endpoint." + label + ".service", endpoint.getEndpointUrl());
+        configurationService.setLongConfiguration("ldcache.endpoint." + label + ".expiry", endpoint.getDefaultExpiry());
+        configurationService.setBooleanConfiguration("ldcache.endpoint." + label + ".active", endpoint.isActive());
+        configurationService.setConfiguration(
+                "ldcache.endpoint." + label + ".contenttype",
+                Joiner.on(",").join(endpoint.getContentTypes())
+        );
+    }
+
+
+    private Endpoint getEndpointByLabel(String label) {
+        Endpoint endpoint = new Endpoint();
+
+        endpoint.setName(configurationService.getStringConfiguration("ldcache.endpoint."+label+".name"));
+        endpoint.setPriority(configurationService.getIntConfiguration("ldcache.endpoint." + label + ".prio"));
+        endpoint.setType(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".provider"));
+        endpoint.setUriPattern(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".pattern"));
+        endpoint.setEndpointUrl(configurationService.getStringConfiguration("ldcache.endpoint." + label + ".service"));
+        endpoint.setDefaultExpiry(configurationService.getLongConfiguration("ldcache.endpoint." + label + ".expiry"));
+        endpoint.setActive(configurationService.getBooleanConfiguration("ldcache.endpoint." + label + ".active"));
+        endpoint.setContentTypes(new HashSet<ContentType>(
+                LMFHttpUtils.parseAcceptHeader(
+                        configurationService.getStringConfiguration("ldcache.endpoint." + label + ".contenttype",""))
+        ));
+
+        return endpoint;
+    }
+
+
+    private Collection<String> listEndpointLabels() {
+        Set<String> labels = new HashSet<String>();
+        for(String key : configurationService.listConfigurationKeys("ldcache.endpoint")) {
+            String[] components = key.split("\\.");
+            labels.add(components[2]);
+        }
+        return labels;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/services/ldcache/LDCacheSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/services/ldcache/LDCacheSailProvider.java b/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/services/ldcache/LDCacheSailProvider.java
new file mode 100644
index 0000000..e9176d2
--- /dev/null
+++ b/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/services/ldcache/LDCacheSailProvider.java
@@ -0,0 +1,163 @@
+/**
+ * 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.platform.ldcache.services.ldcache;
+
+import org.apache.marmotta.platform.ldcache.api.endpoint.LinkedDataEndpointService;
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
+import org.apache.marmotta.platform.core.api.http.HttpClientService;
+import org.apache.marmotta.platform.core.api.triplestore.NotifyingSailProvider;
+import org.apache.marmotta.platform.core.api.triplestore.SesameService;
+import org.apache.marmotta.platform.core.events.ConfigurationChangedEvent;
+import org.apache.marmotta.platform.core.model.filter.LMFLocalFilter;
+
+import org.apache.marmotta.commons.sesame.filter.NotFilter;
+import org.apache.marmotta.ldcache.sail.KiWiLinkedDataSail;
+import org.apache.marmotta.ldcache.services.LDCache;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
+import org.apache.marmotta.ldclient.model.ClientConfiguration;
+import org.openrdf.model.Resource;
+import org.openrdf.sail.NotifyingSail;
+import org.openrdf.sail.helpers.NotifyingSailWrapper;
+import org.slf4j.Logger;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+import java.util.HashSet;
+
+/**
+ * A sail provider service that allows wrapping a transparent Linked Data caching component around the
+ * main SAIL.
+ *
+ * <p/>
+ * Author: Sebastian Schaffert (sschaffert@apache.org)
+ */
+@ApplicationScoped
+public class LDCacheSailProvider implements NotifyingSailProvider {
+
+    public static final String LDCACHE_ENABLED = "ldcache.enabled";
+    @Inject
+    private Logger log;
+
+    @Inject
+    private LinkedDataEndpointService endpointService;
+
+    @Inject
+    private ConfigurationService configurationService;
+
+    @Inject
+    private SesameService sesameService;
+    
+    @Inject
+    private HttpClientService         httpClientService;
+
+    private ClientConfiguration ldclientConfig;
+
+    private KiWiLinkedDataSail  sail;
+
+    /**
+     * Return the name of the provider. Used e.g. for displaying status information or logging.
+     *
+     * @return
+     */
+    @Override
+    public String getName() {
+        return "Linked Data Caching";
+    }
+
+
+    /**
+     * Return true if this sail provider is enabled in the configuration.
+     *
+     * @return
+     */
+    @Override
+    public boolean isEnabled() {
+        return configurationService.getBooleanConfiguration(LDCACHE_ENABLED,true);
+    }
+
+    public void configurationChanged(@Observes ConfigurationChangedEvent e) {
+        if(e.containsChangedKey(LDCACHE_ENABLED)) {
+        	// FIXME: (jf) i don't like this dependency - i think it would be better to fire an event here
+            sesameService.shutdown();
+            sesameService.initialise();
+        }
+    }
+
+
+    @PostConstruct
+    public void initialize() {
+        ldclientConfig = new ClientConfiguration();
+        updateConfig();
+    }
+
+    public void updateEndpoints() {
+        ldclientConfig.setEndpoints(new HashSet<Endpoint>(endpointService.listEndpoints()));
+
+        if(sail != null &&  sail.getLDCache() != null) {
+            sail.getLDCache().reload();
+        }
+    }
+
+
+    public void updateConfig() {
+        ldclientConfig.setDefaultExpiry(configurationService.getLongConfiguration("ldcache.expiry", 86400L));
+        ldclientConfig.setMinimumExpiry(configurationService.getLongConfiguration("ldcache.minexpiry", 3600L));
+        ldclientConfig.setSocketTimeout(configurationService.getIntConfiguration("ldcache.so_timeout", 60000));
+        ldclientConfig.setConnectionTimeout(configurationService.getIntConfiguration("ldcache.connection_timeout", 10000));
+        ldclientConfig.setMaxParallelRequests(configurationService.getIntConfiguration("ldcache.max_parallel_requests",10));
+        ldclientConfig.setEndpoints(new HashSet<Endpoint>(endpointService.listEndpoints()));
+
+        ldclientConfig.setHttpClient(httpClientService.getHttpClient());
+
+        if(sail != null &&  sail.getLDCache() != null) {
+            sail.getLDCache().reload();
+        }
+    }
+
+    /**
+     * Create the sail wrapper provided by this SailProvider
+     *
+     * @param parent the parent sail to wrap by the provider
+     * @return the wrapped sail
+     */
+    @Override
+    public NotifyingSailWrapper createSail(NotifyingSail parent) {
+        String cache_context = configurationService.getCacheContext();
+        sail = new KiWiLinkedDataSail(parent, new NotFilter<Resource>(LMFLocalFilter.getInstance()), cache_context, ldclientConfig);
+        return sail;
+    }
+
+
+    /**
+     * Return the Linked Data Client used by the caching system (e.g. for debugging).
+     * @return
+     */
+    public LDClientService getLDClient() {
+        return sail.getLDCache().getLDClient();
+    }
+
+    /**
+     * Return the caching backend used by the caching system (e.g. for debugging)
+     * @return
+     */
+    public LDCache getLDCache() {
+        return sail.getLDCache();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/webservices/LinkedDataCachingWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/webservices/LinkedDataCachingWebService.java b/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/webservices/LinkedDataCachingWebService.java
new file mode 100644
index 0000000..a21c1da
--- /dev/null
+++ b/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/webservices/LinkedDataCachingWebService.java
@@ -0,0 +1,287 @@
+/**
+ * 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.platform.ldcache.webservices;
+
+import org.apache.marmotta.platform.ldcache.api.endpoint.LinkedDataEndpointService;
+import org.apache.marmotta.platform.ldcache.services.ldcache.LDCacheSailProvider;
+import org.apache.marmotta.commons.sesame.model.Namespaces;
+import org.apache.marmotta.platform.core.api.triplestore.SesameService;
+import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
+import org.apache.marmotta.ldclient.api.provider.DataProvider;
+import org.apache.marmotta.ldclient.model.ClientResponse;
+import org.apache.marmotta.ldclient.provider.rdf.LinkedDataProvider;
+import org.openrdf.model.URI;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.rio.RDFHandler;
+import org.openrdf.rio.rdfxml.util.RDFXMLPrettyWriter;
+import org.slf4j.Logger;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+/**
+ * Add file description here!
+ * <p/>
+ * User: sschaffe
+ */
+@ApplicationScoped
+@Path("/cache")
+public class LinkedDataCachingWebService {
+
+    @Inject
+    private Logger log;
+
+    @Inject
+    private LinkedDataEndpointService endpointService;
+
+    @Inject
+    private SesameService sesameService;
+
+    @Inject
+    private LDCacheSailProvider cacheSailProvider;
+
+
+    @GET
+    @Path("/live")
+    public Response retrieveLive(@QueryParam("uri") String uri) {
+
+        try {
+            ClientResponse response = cacheSailProvider.getLDClient().retrieveResource(uri);
+
+            RepositoryConnection con = response.getTriples().getConnection();
+            con.begin();
+
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            RDFHandler handler = new RDFXMLPrettyWriter(out);
+            con.export(handler);
+
+            con.commit();
+            con.close();
+
+
+            return Response.ok().entity( new String(out.toByteArray(), "utf-8")).build();
+        } catch (Exception e) {
+            log.error("exception while retrieving resource",e);
+            return Response.status(500).entity(e.getMessage()).build();
+        }
+    }
+
+    @GET
+    @Path("/cached")
+    public Response retrieveCached(@QueryParam("uri") String uri) {
+
+        URI resource = sesameService.getValueFactory().createURI(uri);
+
+
+        try {
+            cacheSailProvider.getLDCache().refreshResource(resource, false);
+
+            return Response.ok().build();
+        } catch (Exception e) {
+            log.error("exception while retrieving resource",e);
+            return Response.status(500).entity(e.getMessage()).build();
+        }
+    }
+
+    @GET
+    @Path("/refresh")
+    public Response refreshCached(@QueryParam("uri") String uri) {
+
+        URI resource = sesameService.getValueFactory().createURI(uri);
+
+
+        try {
+            cacheSailProvider.getLDCache().refreshResource(resource, true);
+
+            return Response.ok().build();
+        } catch (Exception e) {
+            log.error("exception while retrieving resource",e);
+            return Response.status(500).entity(e.getMessage()).build();
+        }
+    }
+
+    @POST
+    @Path("/expire")
+    public Response expireCache(@QueryParam("uri") String uri) {
+
+        if (uri != null) {
+            URI resource = sesameService.getValueFactory().createURI(uri);
+            cacheSailProvider.getLDCache().expire(resource);
+        } else {
+            cacheSailProvider.getLDCache().expireAll();
+        }
+
+        return Response.ok().build();
+    }
+
+    @POST
+    @Path("/endpoint")
+    public Response registerEndpoint(@QueryParam("name") String name,
+            @QueryParam("prefix") String prefix,
+            @QueryParam("endpoint") String endpointUrl,
+            @QueryParam("kind") String type,
+            @QueryParam("mimetype") String mimetype,
+            @QueryParam("expiry") long expiry) {
+
+        if (type == null || !getProviderNames().contains(type.toLowerCase())) {
+            type = LinkedDataProvider.PROVIDER_NAME;
+        }
+
+        // Check for valid Regex
+        if (prefix != null) {
+            try {
+                if (prefix.startsWith(Endpoint.REGEX_INDICATOR)) {
+                    Pattern.compile(prefix.substring(Endpoint.REGEX_INDICATOR.length()));
+                } else {
+                    Pattern.compile(prefix);
+                }
+            } catch (PatternSyntaxException pse) {
+                return Response.status(Status.BAD_REQUEST).entity("Invalid Regex in prefix detected").build();
+            }
+        }
+        if (endpointUrl != null) {
+            endpointUrl = endpointUrl.replace('<', '{').replace('>', '}');
+        } else {
+            endpointUrl = "";
+        }
+        if (mimetype == null) {
+            mimetype ="";
+        }
+        Endpoint endpoint = new Endpoint(name, type, prefix, endpointUrl, mimetype, expiry);
+        endpointService.addEndpoint(endpoint);
+
+        cacheSailProvider.updateEndpoints();
+
+
+        return Response.ok().build();
+    }
+
+    @GET
+    @Path("/endpoint/list")
+    @Produces("application/json")
+    public Response listEndpoints() {
+
+        List<Map<String, Object>> result = new LinkedList<Map<String, Object>>();
+        for(Endpoint endpoint : endpointService.listEndpoints()) {
+            result.add(buildEndpointJSON(endpoint));
+        }
+
+        return Response.ok().entity(result).build();
+    }
+
+    @GET
+    @Path("/provider/list")
+    @Produces(Namespaces.MIME_TYPE_JSON)
+    public Set<String> listProviders() {
+        return getProviderNames();
+    }
+
+
+    @GET
+    @Path("/endpoint/{id}")
+    @Produces("application/json")
+    public Response retrieveEndpoint(@PathParam("id") String id) {
+
+        Endpoint endpoint = endpointService.getEndpoint(id);
+        if (endpoint == null) return notFound(id);
+
+
+        return Response.ok().entity(buildEndpointJSON(endpoint)).build();
+    }
+
+    @DELETE
+    @Path("/endpoint/{id}")
+    public Response removeEndpoint(@PathParam("id") String id) {
+
+        Endpoint endpoint = endpointService.getEndpoint(id);
+        if (endpoint == null) return notFound(id);
+
+        endpointService.removeEndpoint(endpoint);
+
+        cacheSailProvider.updateEndpoints();
+
+        return Response.ok().build();
+    }
+
+    @POST
+    @Path("/endpoint/{id}/enable")
+    public Response enableEndpoint(@PathParam("id") String id, @QueryParam("enable") @DefaultValue("true") boolean enable) {
+        Endpoint endpoint = endpointService.getEndpoint(id);
+        if (endpoint == null) return notFound(id);
+
+        endpoint.setActive(enable);
+        endpointService.updateEndpoint(endpoint);
+
+        cacheSailProvider.updateEndpoints();
+
+        return Response.ok().build();
+    }
+
+    private Response notFound(String id) {
+        return Response.status(Status.NOT_FOUND).entity("No endpoint with id " + id + " found!").build();
+    }
+
+    @POST
+    @Path("/endpoint/{id}/disable")
+    public Response disableEndpoint(@PathParam("id") String id) {
+        return enableEndpoint(id, false);
+    }
+
+
+    private Map<String, Object> buildEndpointJSON(Endpoint endpoint) {
+        HashMap<String, Object> resultMap = new HashMap<String, Object>();
+        resultMap.put("id",endpoint.getName().replaceAll("[^A-Za-z0-9 ]", "").toLowerCase());
+        resultMap.put("name",endpoint.getName());
+        resultMap.put("endpoint",endpoint.getEndpointUrl());
+        resultMap.put("expiry", endpoint.getDefaultExpiry());
+        resultMap.put("prefix",endpoint.getUriPattern());
+        resultMap.put("kind",endpoint.getType().toString());
+        resultMap.put("mimetype",endpoint.getContentTypes());
+        resultMap.put("active", endpoint.isActive());
+
+        return resultMap;
+    }
+
+
+    private Set<String> getProviderNames() {
+        Set<String> result = new HashSet<String>();
+
+        for(DataProvider provider : cacheSailProvider.getLDClient().getDataProviders()) {
+            result.add(provider.getName().toLowerCase());
+        }
+
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldcache/src/main/resources/kiwi-module.properties
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/resources/kiwi-module.properties b/platform/marmotta-ldcache/src/main/resources/kiwi-module.properties
index 9fba0d6..3390db1 100644
--- a/platform/marmotta-ldcache/src/main/resources/kiwi-module.properties
+++ b/platform/marmotta-ldcache/src/main/resources/kiwi-module.properties
@@ -21,7 +21,7 @@ icon_small = /admin/img/ld-caching.png
 
 baseurl=/cache
 
-webservices=at.newmedialab.lmf.ldcache.webservices.LinkedDataCachingWebService
+webservices=org.apache.marmotta.platform.ldcache.webservices.LinkedDataCachingWebService
 
 adminpages=/admin/about.html,/admin/configuration.html
 

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/api/LDPathService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/api/LDPathService.java b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/api/LDPathService.java
deleted file mode 100644
index df9f4da..0000000
--- a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/api/LDPathService.java
+++ /dev/null
@@ -1,87 +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.lmf.ldpath.api;
-
-
-import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
-import org.apache.marmotta.ldpath.api.transformers.NodeTransformer;
-import org.apache.marmotta.ldpath.exception.LDPathParseException;
-import org.openrdf.model.Value;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
- */
-public interface LDPathService {
-
-    /**
-     * Register an LDPath function in this LDPath service. Can be used by other modules to plug in
-     * their own LDPath functions as needed.
-     * 
-     * @param function {@link SelectorFunction} to register.
-     */
-    public void registerFunction(SelectorFunction<Value> function);
-
-
-    /**
-     * List all selector functions that are currently registered with LDPath.
-     */
-    public Set<SelectorFunction<Value>> getFunctions();
-
-    /**
-     * Run a path query starting from the given context node and return the result as a collection of KiWiNodes. The
-     * namespaces argument is optional and contains a map from prefixes to namespace URIs that can be used in the
-     * path expression.
-     *
-     * @param context    the context node where to start with the path query
-     * @param path       the path query to evaluate starting from the context node
-     * @param namespaces optional map from namespace prefixes to namespace URIs
-     * @return           a collection of KiWiNodes
-     * @throws LDPathParseException when the path passed as argument could not be parsed
-     */
-    public Collection<Value> pathQuery(Value context, String path, Map<String, String> namespaces) throws LDPathParseException;
-
-    /**
-     * Run a path program starting from the given context node and return the result as a collection of KiWiNodes for
-     * each field occurring in the path progrm.
-     *
-     * @param context    the context node where to start with the path query
-     * @param program    the path program to evaluate starting from the context node
-     * @return           a map mapping from field names to the resulting collection of KiWiNodes for the field
-     * @throws org.apache.marmotta.ldpath.exception.LDPathParseException when the path passed as argument could not be parsed
-     */
-    public Map<String, Collection<?>> programQuery(Value context, String program) throws LDPathParseException;
-
-    /**
-     * Register a result transformer for a type URI. Use this method in your own projects
-     * to register custom result transformers.
-     * 
-     * @param typeUri a URI identifying the type for which to use this transformer; can be specified
-     *            in path programs
-     * @param transformer instance of a node transformer
-     */
-    public void registerTransformer(String typeUri, NodeTransformer<?, Value> transformer);
-
-    /**
-     * List all types that have a transformer registered.
-     */
-    public Set<String> getTransformableTypes();
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/api/LMFLDPathFunction.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/api/LMFLDPathFunction.java b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/api/LMFLDPathFunction.java
deleted file mode 100644
index 0172d62..0000000
--- a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/api/LMFLDPathFunction.java
+++ /dev/null
@@ -1,32 +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.lmf.ldpath.api;
-
-import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
-import org.openrdf.model.Value;
-
-/**
- * Superclass of all LMF LDPath functions, used for auto-registry of functions provided by modules using
- * injection.
- * <p/>
- * Author: Sebastian Schaffert
- */
-public abstract class LMFLDPathFunction extends SelectorFunction<Value> {
-
-    @Override
-    public abstract String getLocalName();
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/backend/LMFBackend.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/backend/LMFBackend.java b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/backend/LMFBackend.java
deleted file mode 100644
index 53f49a1..0000000
--- a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/backend/LMFBackend.java
+++ /dev/null
@@ -1,54 +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.lmf.ldpath.backend;
-
-import org.apache.marmotta.platform.core.api.triplestore.SesameService;
-
-import org.apache.marmotta.ldpath.backend.sesame.SesameRepositoryBackend;
-import org.slf4j.Logger;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-
-/**
- * Implementation of the LDPath RDFBackend<KiWiNode>, making use of the LMF internal triple store
- * implementation.
- * <p/>
- * Author: Sebastian Schaffert
- * 
- * @deprecated Use a {@link org.apache.marmotta.ldpath.backend.sesame.SesameConnectionBackend} instead
- *             and handle transactions manually.
- */
-@ApplicationScoped
-@Deprecated
-public class LMFBackend extends SesameRepositoryBackend  {
-
-    @Inject
-    private Logger log;
-
-    @Inject
-    private SesameService sesameService;
-
-    @PostConstruct
-    public void initialize() {
-        log.info("LMF LDPath backend starting up ...");
-
-        setRepository(sesameService.getRepository());
-        log.warn("LMFBackend is deprecated. Use a SesameConnectionBackend instead.", new Throwable("Deprecated Usage of LMFBackend"));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/ContentFunction.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/ContentFunction.java b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/ContentFunction.java
deleted file mode 100644
index 99a4227..0000000
--- a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/ContentFunction.java
+++ /dev/null
@@ -1,131 +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.lmf.ldpath.model.functions;
-
-import at.newmedialab.lmf.ldpath.api.LMFLDPathFunction;
-import org.apache.marmotta.platform.core.api.content.ContentService;
-import org.apache.marmotta.kiwi.model.rdf.KiWiResource;
-import org.apache.marmotta.kiwi.model.rdf.KiWiStringLiteral;
-import org.apache.marmotta.ldpath.api.backend.RDFBackend;
-import org.openrdf.model.Resource;
-import org.openrdf.model.Value;
-import org.slf4j.Logger;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
- */
-@ApplicationScoped
-public class ContentFunction extends LMFLDPathFunction {
-
-    @Inject
-    private Logger log;
-
-    @Inject
-    private ContentService contentService;
-
-    private String[] allowedTypes = new String[] {
-            "text/.*", "application/([a-z]+\\+)?xml", "application/([a-z]+\\+)?json"
-    };
-
-    public ContentFunction() {
-    }
-
-
-    @PostConstruct
-    public void initialise() {
-        log.info("initialising LMF LDPath fn:content(...) function ...");
-    }
-
-
-    /**
-     * 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 context the context of the execution. Same as using the
-     *                {@link org.apache.marmotta.ldpath.api.selectors.NodeSelector} '.' as parameter.
-     * @param args    a nested list of KiWiNodes
-     * @return
-     */
-    @Override
-    public Collection<Value> apply(RDFBackend<Value> kiWiNodeRDFBackend, Value context, Collection<Value>... args) throws IllegalArgumentException {
-        List<Value> result = new LinkedList<Value>();
-
-        for(Collection<? extends Value> nodes : args) {
-            for(Value n : nodes) {
-                if(n instanceof KiWiResource) {
-                    Resource r = (Resource)n;
-
-                    String type = contentService.getContentType(r);
-
-                    if(type != null) {
-                        for(String allowedType : allowedTypes) {
-                            if(type.matches(allowedType)) {
-                                byte[] data = contentService.getContentData(r,type);
-                                String content = new String(data);
-                                result.add(new KiWiStringLiteral(content));
-                                break;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Return the representation of the NodeFunction or NodeSelector in the RDF Path Language
-     *
-     * @param backend
-     * @return
-     */
-    @Override
-    public String getLocalName() {
-        return "content";
-    }
-
-    /**
-     * 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:content(nodes : URIResourceList) : LiteralList";
-    }
-
-    /**
-     * A short human-readable description of what the node function does.
-     *
-     * @return
-     */
-    @Override
-    public String getDescription() {
-        return "Resolve the URIs passed as argument and retrieve their content using the content reader applicable for the resource.";
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/5c0255c8/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/JsoupFunction.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/JsoupFunction.java b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/JsoupFunction.java
deleted file mode 100644
index 410f4da..0000000
--- a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/JsoupFunction.java
+++ /dev/null
@@ -1,143 +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.lmf.ldpath.model.functions;
-
-import at.newmedialab.lmf.ldpath.api.LMFLDPathFunction;
-
-import org.apache.marmotta.ldpath.api.backend.RDFBackend;
-import org.apache.marmotta.ldpath.model.transformers.StringTransformer;
-import org.jsoup.Jsoup;
-import org.jsoup.nodes.Document;
-import org.jsoup.nodes.Element;
-import org.jsoup.select.Selector.SelectorParseException;
-import org.openrdf.model.Value;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-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 JsoupFunction extends LMFLDPathFunction {
-
-    private static final Logger               log         = LoggerFactory.getLogger(JsoupFunction.class);
-
-    private final StringTransformer<Value> transformer = new StringTransformer<Value>();
-
-    /**
-     * 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<Value> apply(RDFBackend<Value> rdfBackend, Value context, Collection<Value>... args)
-            throws IllegalArgumentException {
-        if (args.length < 1) throw new IllegalArgumentException("CSS-Selector is required as first argument.");
-        Set<String> jsoupSelectors = new HashSet<String>();
-        for (Value xpath : args[0]) {
-            try {
-                jsoupSelectors.add(transformer.transform(rdfBackend, xpath));
-            } catch (IllegalArgumentException iae) {
-                throw new IllegalArgumentException("First argument must not contain anything else than String-Literals!");
-            }
-        }
-        Iterator<Value> it;
-        if (args.length < 2) {
-            log.debug("Use context {} to apply css-selector {}", context, jsoupSelectors);
-            it = Collections.singleton(context).iterator();
-        } else {
-            log.debug("apply css-selector {} on parsed parameters", jsoupSelectors);
-            it = org.apache.marmotta.ldpath.util.Collections.iterator(1, args);
-        }
-        List<Value> result = new ArrayList<Value>();
-        while (it.hasNext()) {
-            Value n = it.next();
-            try {
-                final String string = transformer.transform(rdfBackend, n);
-                final Document jsoup = Jsoup.parse(string);
-                if (rdfBackend.isURI(context)) {
-                    jsoup.setBaseUri(rdfBackend.stringValue(context));
-                }
-                for (String r : doFilter(jsoup, jsoupSelectors)) {
-                    result.add(rdfBackend.createLiteral(r));
-                }
-            } catch (IOException e) {
-                // This should never happen, since validation is turned off.
-            }
-        }
-
-        return result;
-    }
-
-    private LinkedList<String> doFilter(Document jsoup, Set<String> jsoupSelectors) throws IOException {
-        LinkedList<String> result = new LinkedList<String>();
-        for (String jsoupSel : jsoupSelectors) {
-            try {
-                for (Element e : jsoup.select(jsoupSel)) {
-                    result.add(e.outerHtml());
-                }
-            } catch (SelectorParseException xpe) {
-                throw new IllegalArgumentException("error while processing jsoup selector: '" + jsoupSel + "'", xpe);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Return the name of the NodeFunction for registration in the function registry
-     * 
-     * @return
-     * @param backend
-     */
-    @Override
-    public String getLocalName() {
-        return "jsoup";
-    }
-
-    /**
-     * 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:jsoup(jsoup: String [, nodes: XMLLiteralList]) : LiteralList";
-    }
-
-    /**
-     * A short human-readable description of what the node function does.
-     * 
-     * @return
-     */
-    @Override
-    public String getDescription() {
-        return "Evaluate an JSoup CSS selector on either the value of the context node or the values of the nodes passed as arguments.";
-    }
-}