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/10/21 17:27:45 UTC
[4/6] reorganize platform modules to give more overview over
different backends
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-common/src/main/java/org/apache/marmotta/platform/ldcache/webservices/LinkedDataCachingWebService.java
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-common/src/main/java/org/apache/marmotta/platform/ldcache/webservices/LinkedDataCachingWebService.java b/platform/ldcache/marmotta-ldcache-common/src/main/java/org/apache/marmotta/platform/ldcache/webservices/LinkedDataCachingWebService.java
new file mode 100644
index 0000000..c1e6c81
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-common/src/main/java/org/apache/marmotta/platform/ldcache/webservices/LinkedDataCachingWebService.java
@@ -0,0 +1,313 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.marmotta.platform.ldcache.webservices;
+
+import org.apache.marmotta.commons.sesame.model.Namespaces;
+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.apache.marmotta.platform.core.api.triplestore.SesameService;
+import org.apache.marmotta.platform.ldcache.api.endpoint.LinkedDataEndpointService;
+import org.apache.marmotta.platform.ldcache.api.ldcache.LDCacheSailProvider;
+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.core.Response;
+import javax.ws.rs.core.Response.Status;
+import java.io.ByteArrayOutputStream;
+import java.util.*;
+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) {
+ if(cacheSailProvider.isEnabled()) {
+ 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();
+ }
+ } else {
+ return Response.status(Status.SERVICE_UNAVAILABLE).entity("caching is disabled").build();
+ }
+ }
+
+ @GET
+ @Path("/cached")
+ public Response retrieveCached(@QueryParam("uri") String uri) {
+ if(cacheSailProvider.isEnabled()) {
+ 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();
+ }
+ } else {
+ return Response.status(Status.SERVICE_UNAVAILABLE).entity("caching is disabled").build();
+ }
+
+ }
+
+ @GET
+ @Path("/refresh")
+ public Response refreshCached(@QueryParam("uri") String uri) {
+
+ if(cacheSailProvider.isEnabled()) {
+ 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();
+ }
+ } else {
+ return Response.status(Status.SERVICE_UNAVAILABLE).entity("caching is disabled").build();
+ }
+
+ }
+
+ @POST
+ @Path("/expire")
+ public Response expireCache(@QueryParam("uri") String uri) {
+
+ if(cacheSailProvider.isEnabled()) {
+ if (uri != null) {
+ URI resource = sesameService.getValueFactory().createURI(uri);
+ cacheSailProvider.getLDCache().expire(resource);
+ } else {
+ cacheSailProvider.getLDCache().expireAll();
+ }
+
+ return Response.ok().build();
+ } else {
+ return Response.status(Status.SERVICE_UNAVAILABLE).entity("caching is disabled").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(cacheSailProvider.isEnabled()) {
+ 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();
+ } else {
+ return Response.status(Status.SERVICE_UNAVAILABLE).entity("caching is disabled").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, false));
+ }
+ for(Endpoint endpoint : cacheSailProvider.getVolatileEndpoints()) {
+ result.add(buildEndpointJSON(endpoint, true));
+ }
+
+ return Response.ok().entity(result).build();
+ }
+
+ @GET
+ @Path("/provider/list")
+ @Produces(Namespaces.MIME_TYPE_JSON)
+ public Response listProviders() {
+ if(cacheSailProvider.isEnabled()) {
+ return Response.ok(getProviderNames()).build();
+ } else {
+ return Response.status(Status.SERVICE_UNAVAILABLE).entity("caching is disabled").build();
+ }
+ }
+
+
+ @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, false)).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);
+ }
+
+ @GET
+ @Path("/info")
+ @Produces("application/json")
+ public Response getInformation() {
+ Map<String,String> result = new HashMap<>();
+ result.put("backend", cacheSailProvider.getName());
+ return Response.ok(result).build();
+ }
+
+ private Map<String, Object> buildEndpointJSON(Endpoint endpoint, boolean isVolatile) {
+ 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());
+ resultMap.put("volatile", isVolatile);
+
+ 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/47855a4b/platform/ldcache/marmotta-ldcache-common/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-common/src/main/resources/META-INF/beans.xml b/platform/ldcache/marmotta-ldcache-common/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..461858e
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-common/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-common/src/main/resources/config-defaults.properties
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-common/src/main/resources/config-defaults.properties b/platform/ldcache/marmotta-ldcache-common/src/main/resources/config-defaults.properties
new file mode 100644
index 0000000..750de20
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-common/src/main/resources/config-defaults.properties
@@ -0,0 +1,49 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+###############################################################################
+# LMF LD caching configuration
+###############################################################################
+
+# enable/disable automatic caching of remote resources from the Linked Data Cloud; enabling leads to many
+# HTTP requests when querying and should be considered with care
+ldcache.enabled = true
+
+# default expiry time in seconds if not otherwise given (default: 1 day)
+ldcache.expiry = 86400
+
+# minimum expiry time before which a resource is refreshed from the linked data cloud (use to avoid too short expiry times returned by servers)
+ldcache.minexpiry = 3600
+
+# how long to wait in ms when no data is sent over a connection
+ldcache.so_timeout = 60000
+
+# how long to wait in ms until a connection is established
+ldcache.connection_timeout = 10000
+
+# how many http retrievals to run at most in parallel
+ldcache.max_parallel_requests = 10
+
+# Sample for a cache entry
+ldcache.sample.dbpedia.name = DBPedia Sparql
+ldcache.sample.dbpedia.kind = SPARQL
+ldcache.sample.dbpedia.prefix = http://dbpedia\\.org.*
+ldcache.sample.dbpedia.endpoint = http://dbpedia.org/sparql
+ldcache.sample.dbpedia.mimetype =
+ldcache.sample.dbpedia.expiry = 86400
+
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-common/src/main/resources/config-descriptions.properties
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-common/src/main/resources/config-descriptions.properties b/platform/ldcache/marmotta-ldcache-common/src/main/resources/config-descriptions.properties
new file mode 100644
index 0000000..7d6b4b4
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-common/src/main/resources/config-descriptions.properties
@@ -0,0 +1,41 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+###############################################################################
+# LMF LD caching configuration
+###############################################################################
+
+ldcache.enabled.description = enable/disable automatic caching of remote resources from the Linked Data Cloud; \
+ enabling leads to many HTTP requests when querying and should be considered with care
+ldcache.enabled.type = java.lang.Boolean
+
+ldcache.expiry.description = default expiry time in seconds if not otherwise given (default: 1 day)
+ldcache.expiry.type = java.lang.Integer(3600|0)
+
+ldcache.minexpiry.description = minimum expiry time before which a resource is refreshed from the linked data cloud \
+ (use to avoid too short expiry times returned by servers)
+ldcache.minexpiry.type = java.lang.Integer(60|0)
+
+ldcache.so_timeout.description = how long to wait in ms when no data is sent over a connection
+ldcache.so_timeout.type = java.lang.Integer(1000|1000)
+
+ldcache.connection_timeout.description = how long to wait in ms until a connection is established
+ldcache.connection_timeout.type = java.lang.Integer(1000|1000)
+
+ldcache.max_parallel_requests.description = how many http retrievals to run at most in parallel
+ldcache.max_parallel_requests.type = java.lang.Integer(1|1|100)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-common/src/main/resources/kiwi-module.properties
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-common/src/main/resources/kiwi-module.properties b/platform/ldcache/marmotta-ldcache-common/src/main/resources/kiwi-module.properties
new file mode 100644
index 0000000..3f3dd4e
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-common/src/main/resources/kiwi-module.properties
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name=Linked Data Caching
+subtitle = Endpoints and Caches
+
+icon_small = /admin/img/ld-caching.png
+
+baseurl=/cache
+
+webservices=org.apache.marmotta.platform.ldcache.webservices.LinkedDataCachingWebService
+
+adminpage.0.title=About
+adminpage.0.link=/admin/about.html
+
+adminpage.1.title=Configuration
+adminpage.1.link=/admin/configuration.html
+
+
+
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/about.html
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/about.html b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/about.html
new file mode 100644
index 0000000..39f4955
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/about.html
@@ -0,0 +1,271 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+<head>
+<!--###BEGIN_HEAD###-->
+ <title>Linked Data Caching</title>
+ <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
+ <script type="text/javascript">
+ jQuery(document).ready(function(){
+ jQuery.getJSON(_SERVER_URL + "/cache/info", function(data) {
+ $("#title").html(data.backend);
+ });
+ });
+ </script>
+
+ <!--###END_HEAD###-->
+</head>
+<body>
+ <!--###BEGIN_CONTENT###-->
+ <h1>
+ <a id="Introduction"></a><span id="title">Introduction</span><a class="section_anchor"
+ href="#Introduction"></a>
+ </h1>
+ <p>
+ Apache Marmotta can optionally be extended with a Linked
+ Data Caching Module that transparently retrieves resources from the
+ Linked Data Cloud when they are needed (e.g. when querying a relation
+ to a remote resource) and caches them transparently. Linked Data
+ Caching is integrated at the triple store level and thus available to
+ all services accessing the triple store, including the SPARQL endpoint.
+ </p>
+ <h1>
+ <a id="Functionality"></a>Functionality<a class="section_anchor"
+ href="#Functionality"></a>
+ </h1>
+ <h2>
+ <a id="Transparent_Linked_Data_Access"></a>Transparent Linked Data
+ Access<a class="section_anchor" href="#Transparent_Linked_Data_Access"></a>
+ </h2>
+ <p>The Linked Data Caching module is a powerful component for
+ integrating with other Linked Data servers, either on the public
+ Linked Data Cloud or from local severs deployed in an intranet. It
+ provides transparent access to resources on Linked Data-aware servers.
+ When enabled, it is triggered when the triples of a non-local resource
+ are requested from the triple store. A typical case where this can
+ happen is when a local resource links to a resource in the Linked Data
+ Cloud using a triple and a query to the system requests information
+ about this external resource.</p>
+ <p>For example, the FOAF description of a user in the Marmotta might
+ contain a reference to the FOAF file of a user at some external
+ location:</p>
+ <pre class="prettyprint">
+ <span class="kwd">local</span><span class="pun">:</span><span
+ class="pln">peter foaf</span><span class="pun">:</span><span
+ class="pln">knows </span><span class="pun"><</span><span
+ class="pln">http</span><span class="pun">:</span><span class="com">//example.com/john.rdf></span>
+ </pre>
+ <p>A query could then ask for all the names of persons that peter
+ knows, e.g. in SPARQL:</p>
+ <pre class="prettyprint">
+ <span class="pln">SELECT </span><span class="pun">?</span><span
+ class="pln">name WHERE </span><span class="pun">{</span><span
+ class="pln"> </span><span class="kwd">local</span><span class="pun">:</span><span
+ class="pln">peter foaf</span><span class="pun">:</span><span
+ class="pln">knows </span><span class="pun">?</span><span class="pln">p </span><span
+ class="pun">.</span><span class="pln"> </span><span class="pun">?</span><span
+ class="pln">p foaf</span><span class="pun">:</span><span class="pln">name </span><span
+ class="pun">?</span><span class="pln">name </span><span class="pun">}</span>
+ </pre>
+ <p>
+ When evaluating the query, the Linked Data Caching module would then
+ transparently retrieve the resource <em>http://example.com/john.rdf</em>
+ and try to answer the query using the triples contained therein.
+ </p>
+ <h2>
+ <a id="Local_Caching"></a>Local Caching<a class="section_anchor"
+ href="#Local_Caching"></a>
+ </h2>
+ <p>When the triple data of a remote resource are retrieved, they
+ are cached locally in the Linked Media Framework's triple store in a
+ special named graph called "cache", together with provenance and cache
+ expiry information. The cache graph is special in the sense that
+ resources in this graph are by default not considered for direct
+ indexing in the semantic search (i.e. a foaf:Person retrieved from the
+ Linked Data Cloud will not be returned by the Semantic Search
+ component), and triples and resources in this graph are not included
+ in versioning.</p>
+ <p>A query to a resource is answered from the local cache as long
+ as the entry is not expired, i.e. subsequent queries to a resource
+ will be significantly faster than the first query as long as they are
+ carried out within a certain time frame. The expiry date of a resource
+ in the cache is determined in two ways:</p>
+ <ul>
+ <li>if the Linked Data server providing the original resource
+ sends an "Expires" header, the value of the header defines the expiry
+ date of the local cache entry</li>
+ <li>otherwise, if there is an endpoint configuration for the URI
+ prefix of the resource, the expiry time of the endpoint is used</li>
+ <li>otherwise, the default expiry time configured in the
+ configuration variable ldcache.expiry is used</li>
+ </ul>
+ <p></p>
+ <h2>
+ <a id="Modes_of_Operation"></a>Modes of Operation<a
+ class="section_anchor" href="#Modes_of_Operation"></a>
+ </h2>
+ <p>Since the Linked Data Cloud is distributed over the Web and some
+ services might not provide the reliability or availability necessary,
+ or some servers are not yet Linked Data aware, the Linked Data Caching
+ Module offers different modes of operation for accessing resources:</p>
+ <ul>
+ <li><strong>Linked Data</strong> (direct Linked Data access):
+ makes use of the HTTP content negotiation to directly retrieve a
+ Linked Data resource from the Web as defined in the Linked Data
+ Principles. This is the default behaviour if nothing else has been
+ configured</li>
+ <li><strong>Cache</strong> (access to a resource or entity cache
+ endpoint): retrieves the triples of a resource from a defined server
+ by accessing a cache endpoint. This is e.g. useful if there is a
+ local cache of a public server (e.g. to improve reliability or
+ performance) or if there is a "traditional" RDF server that does not
+ offer Linked Data access</li>
+ <li><strong>SPARQL</strong> (access to a resource via a SPARQL
+ endpoint): retrieves the triples of a resource from a defined SPARQL
+ endpoint by issuing a query for all triples with the resource as
+ subject. This is e.g. useful for traditional RDF servers that are
+ extended by a SPARQL endpoint using e.g. Joseki or other tools.</li>
+ <li><strong>NONE</strong> (block access to the resource): does
+ not try to retrieve the external resource. Useful for blocking access
+ for known "bad" Linked Data servers. For example, many Linked Data
+ sources contain references to Wikipedia, which does not offer its
+ data as Linked Data directly.</li>
+ </ul>
+ <p></p>
+ <p>The different modes of operation can be configured as described
+ below. In addition to the RDF/XML format, the Linked Data Caching
+ Module also supports additional RDF serialisation formats that can be
+ configured for certain Linked Data servers.</p>
+ <h1>
+ <a id="Configuration"></a>Configuration<a class="section_anchor"
+ href="#Configuration"></a>
+ </h1>
+ <p>The Linked Data Caching Module can be configured using Marmotta
+ configuration mechanism. The following section describes the
+ configuration options used.</p>
+ <h2>
+ <a id="Configuration_Options"></a>Configuration Options<a
+ class="section_anchor" href="#Configuration_Options"></a>
+ </h2>
+ <p>The following options affect the general behaviour of the Linked
+ Data Caching Module:</p>
+ <ul>
+ <li>ldcache.enabled (true/false): if set to true, transparent
+ Linked Data Caching is enabled; if set to false, remote resources
+ will never be retrieved</li>
+ <li>ldcache.fallback (true/false): try to retrieve a resource
+ using ordinary Linked Data call if no endpoint is specified; when set
+ to false, this option will not retrieve any remote resources except
+ those defined with endpoints; can be used to provide transparent
+ caching only to some specific Linked Data servers</li>
+ <li>ldcache.expiry (seconds): defines the default expiry time for
+ a resource in the cache if the server does not provide an "Expires"
+ header and the endpoint definition does not have an expiry time
+ (default: 1 day)</li>
+ <li>ldcache.fetchall (true/false): if set to true, even a query
+ for all resources will include the resources that are cached locally;
+ the default is set to false because this might lead to unexpected
+ behaviour and crawling of the whole Linked Data Cloud if not used
+ with care</li>
+ </ul>
+ <h2>
+ <a id="Endpoint_Configuration"></a>Endpoint Configuration<a
+ class="section_anchor" href="#Endpoint_Configuration"></a>
+ </h2>
+ <p>The Linked Data Caching Module allows to define URI prefix to
+ endpoint mappings. These can be used to either redirect Linked Data
+ queries to cache or SPARQL endpoints for improving performance or
+ accessing non-Linked Data resources, or for setting different
+ parameters for certain server. An endpoint definition consists of the
+ following parameters:</p>
+ <ul>
+ <li><strong>name</strong> (string): the public name of the
+ endpoint, used for displaying</li>
+ <li><strong>prefix</strong> (uri): the prefix of URIs that are
+ redirected to the endpoint; if a resource requested from the cache
+ has this prefix, it is handled by this endpoint</li>
+ <li><strong>kind</strong> (SPARQL/LINKEDDATA/CACHE/NONE): the
+ operation mode of the endpoint (see above)</li>
+ <li><strong>endpoint</strong> (uri with parameters): the URI
+ under which the endpoint can be accessed. Depending on the mode,
+ certain parameters will be replaced by actual values in the URI:
+ <ul>
+ <li>CACHE: the parameter {uri} will be replaced by the actual
+ URI of the requested resource, e.g. <span class="tt">http://api.sindice.com/v2/cache?url={uri}</span>
+ </li>
+ <li>SPARQL: the parameter {query} will be replaced by the SPARQL
+ query, the parameter {contenttype} will be replaced by the MIME type
+ to be requested from the server, e.g. <span class="tt">http://sparql.sindice.com/sparql?default-graph-uri=&query={query}&format={contenttype}</span>
+ </li>
+ </ul>
+ </li>
+ <li><strong>mimetype</strong> the MIME type to request/expect
+ from the endpoint; depends on the mode of operation:
+ <ul>
+ <li>CACHE/LINKEDDATA: any RDF serialization supported by the
+ Marmotta, e.g. application/rdf+xml, text/rdf+n3, ...</li>
+ <li>SPARQL: any SPARQL result format, e.g.
+ application/sparql-results+xml</li>
+ </ul>
+ </li>
+ <li><strong>expiry</strong> (seconds): the default expiry time
+ for this endpoint if not provided by the server itself</li>
+ </ul>
+ <h2>
+ <a id="Webservice"></a>Webservice<a class="section_anchor"
+ href="#Webservice"></a>
+ </h2>
+ <p>
+ Endpoints are configured using the Linked Data Caching Webservice
+ available under
+ <span class="tt"><APPDIR>/cache/endpoint</span>
+ ; the Webservice provides the following operations for managing
+ endpoints:
+ </p>
+ <ul>
+ <li><span class="tt">POST
+ <APPDIR>/cache/endpoint?name=...&prefix=...&endpoint=...&kind=...&mimetype=...&expiry=...</span>
+ will create a new endpoint with the given parameters</li>
+ <li><span class="tt">GET <APPDIR>/cache/endpoint/list</span> will return a
+ list of configured endpoints in JSON</li>
+ <li><span class="tt">GET <APPDIR>/cache/endpoint/{id}</span> will return
+ the endpoint configuration for the endpoint with the given internal
+ ID</li>
+ <li><span class="tt">DELETE <APPDIR>/cache/endpoint/{id}</span> will
+ delete the endpoint configuration for the endpoint with the given
+ internal ID</li>
+ </ul>
+ <p></p>
+ <p>In addition to managing endpoints, the webservice also offers
+ two methods for retrieving resources:</p>
+ <ul>
+ <li><span class="tt">GET <APPDIR>/cache/live?uri=...</span> directly
+ retrieves a resource from the endpoints or Linked Data Cloud without
+ caching it locally; used for testing endpoints</li>
+ <li><span class="tt">GET <APPDIR>/cache/cached?uri=...</span> refreshes
+ the resource with the given URI and returns nothing; the resource can
+ then be retrieved using the normal resource access webservices</li>
+ </ul>
+ <p></p>
+ <p>For your convenience, the Marmotta administration interface offers a
+ simple UI for adding, listing and removing endpoint definitions.</p>
+ <!--###END_CONTENT###-->
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/configuration.html
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/configuration.html b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/configuration.html
new file mode 100644
index 0000000..9a53ed3
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/configuration.html
@@ -0,0 +1,83 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<html>
+<head>
+<!--###BEGIN_HEAD###-->
+ <title>Core Module Configuration</title>
+ <script type="text/javascript" src="../../webjars/jquery/1.8.2/jquery.min.js"></script>
+ <script type="text/javascript" src="../../core/public/js/widgets/property_config.js"></script>
+ <script type="text/javascript" src="widgets/lmf_ldcache.js"></script>
+ <script type="text/javascript" src="../../core/public/js/widgets/configurator/configurator.js"></script>
+ <link type="text/css" rel="stylesheet" href="../../core/public/js/widgets/configurator/style.css">
+ <script type="text/javascript">
+ jQuery(document).ready(function(){
+ var options = {
+ url : _SERVER_URL,
+ container : "lmf_configurator",
+ blacklist:['ldcache.endpoint.','ldcache.sample.'],
+ prefix : 'ldcache'
+ }
+ var configurator = new Configurator(options);
+ $('#lmf_ldcache').lmf_ldcache({host:_SERVER_URL});
+ });
+ </script>
+ <style type="text/css">
+
+ .endpoint_status.on {
+ background-color: darkGreen;
+ }
+ .endpoint_status {
+ background-color: red;
+ border-radius: 10px 10px 10px 10px;
+ display: inline-block;
+ float: right;
+ height: 20px;
+ width: 20px;
+ }
+
+ </style>
+<!--###END_HEAD###-->
+</head>
+<body>
+<div id="main">
+<div id="contents">
+<!--###BEGIN_CONTENT###-->
+<h1>Linked Data Cache Configuration</h1>
+ <p>
+ Here you can configure the Marmotta Linked Data Cache mechanism.
+ </p>
+ <p>
+ The configuration contains:
+ </p>
+ <ul>
+ <li><a href="#lmf_configurator">Generic Parameter Configuration</a></li>
+ <li><a href="#lmf_ldcache">LD-Cache Configuration</a></li>
+ </ul>
+ <div id="lmf_configurator">
+ <h4>Loading configurator</h4>
+ </div>
+ <div id="lmf_ldcache">
+ <h4>Loading cache config</h4>
+ </div>
+<!--###END_CONTENT###-->
+</div>
+</div>
+</body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/img/ld-caching.png
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/img/ld-caching.png b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/img/ld-caching.png
new file mode 100755
index 0000000..b358706
Binary files /dev/null and b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/img/ld-caching.png differ
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/widgets/lmf_ldcache.js
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/widgets/lmf_ldcache.js b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/widgets/lmf_ldcache.js
new file mode 100644
index 0000000..ee32b22
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-common/src/main/resources/web/admin/widgets/lmf_ldcache.js
@@ -0,0 +1,360 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Created by . User: Thomas Kurz Date: 18.02.11 Time: 18:46 To change this
+ * template use File | Settings | File Templates.
+ */
+(function($) {
+
+ var contentBox;
+
+ var programs;
+ var buttonset;
+
+ var loadS;
+
+ // new program
+ var name;
+ var kind;
+ var prefix;
+ var endpoint;
+ var mime;
+ var expiry;
+
+ var samples;
+ var samp;
+
+ var loader;
+
+ $.fn.lmf_ldcache = function(options) {
+ var settings = {
+ host : 'http://localhost:8080/LMF/'
+ }
+
+ function addProgram() {
+
+ if (name.val() == '') {
+ alert("name may not be empty!");
+ return;
+ }
+ if (prefix.val() == '') {
+ alert("prefix may not be empty!");
+ return;
+ }
+ /*if (endpoint.val() == '') {
+ alert("endpoint may not be empty!");
+ return;
+ }
+ if (mime.val() == '') {
+ alert("mimetype may not be empty!");
+ return;
+ }*/
+ if (expiry.val() == '') {
+ alert("expiry may not be empty!");
+ return;
+ }
+ var url = settings.host + "cache/endpoint?name=" + encodeURIComponent(name.val()) + '&prefix='
+ + encodeURIComponent(prefix.val()) + '&endpoint=' + encodeURIComponent(endpoint.val()) + '&mimetype='
+ + encodeURIComponent(mime.val()) + '&kind=' + encodeURIComponent(kind.val()) + '&expiry='
+ + encodeURIComponent(expiry.val());
+ loader.html("<span>Save Values</span>");
+ // upload
+ $.ajax({
+ type : "POST",
+ url : url,
+ contentType : "text/plain",
+ success : function() {
+ loader.html("");
+ $.getJSON(settings.host + "cache/endpoint/list", function(data) {
+ writePrograms(data);
+ });
+ alert("success");
+ },
+ error : function(jXHR) {
+ loader.html("");
+ alert("Error: " + jXHR.responseText);
+ }
+ });
+ }
+
+ function removeProgram(b) {
+ var url = settings.host + "cache/endpoint/" + b.attr('data-id');
+ $.ajax({
+ type : "DELETE",
+ url : url,
+ success : function() {
+ $.getJSON(settings.host + "cache/endpoint/list", function(data) {
+ writePrograms(data);
+ });
+ alert("success");
+ },
+ error : function(jXHR, textStatus) {
+ alert("Error: " + jXHR.responseText);
+ }
+ });
+ }
+ function activateProgram(b, active) {
+ var enable = active || (b.attr('data-active') !== "true"),
+ url = settings.host + "cache/endpoint/" + b.attr('data-id') + "/enable?enable=" + enable;
+
+ $.ajax({
+ type : "POST",
+ url : url,
+ success : function() {
+ $.getJSON(settings.host + "cache/endpoint/list", function(data) {
+ writePrograms(data);
+ });
+ },
+ error : function(jXHR, textStatus) {
+ alert("Error: " + jXHR.responseText);
+ }
+ });
+ }
+
+ function writeSample(data) {
+ // contains method
+ var contains = function(array, obj) {
+ var i = array.length;
+ while (i--) {
+ if (array[i] == obj) {
+ return true;
+ }
+ }
+ return false;
+ }
+ var sorted = [];
+ for (property in data) {
+ property = property.substring(15);
+ property = property.substring(0, property.indexOf('.'));
+ if (!contains(sorted, property)) {
+ sorted.push(property);
+ }
+ }
+ sorted.sort();
+ samples = data;
+ samp = $('<select/>').change(function() {
+ loadSample(this);
+ });
+ var d = $("<div></div>");
+ loadS.append(d);
+ d.append('<br>Load Sample: ');
+ d.append(samp);
+ samp.append('<option>---select---</option>');
+ for (property in sorted) {
+ samp.append('<option>' + sorted[property] + '</option>');
+ }
+ }
+
+ function loadSample() {
+ if (samp.val() != '---select---') {
+ var x = samp.val();
+ name.val(samples['ldcache.sample.' + x + '.name'].value);
+ kind.val(samples['ldcache.sample.' + x + '.kind'].value);
+ prefix.val(samples['ldcache.sample.' + x + '.prefix'].value);
+ endpoint.val(samples['ldcache.sample.' + x + '.endpoint'].value);
+ mime.val(samples['ldcache.sample.' + x + '.mimetype'].value);
+ expiry.val(samples['ldcache.sample.' + x + '.expiry'].value);
+ } else {
+ var x = samp.val();
+ name.val('');
+ kind.val('');
+ prefix.val('');
+ endpoint.val('');
+ mime.val('');
+ expiry.val('');
+ }
+ }
+
+ function writePrograms(ps) {
+ if (ps.length == 0) {
+ programs.text("no endpoints defined");
+ return;
+ }
+ var table = $("<table class='simple_table'/>");
+ var tr = $("<tr class='title' valign='top' style='font-weight:bold;color: white;background-color:gray;'/>");
+ tr.append($("<td/>").html(" "));
+ tr.append($("<td/>").text("Name"));
+ tr.append($("<td/>").text("Kind"));
+ tr.append($("<td/>").text("Prefix"));
+ tr.append($("<td/>").text("Endpoint"));
+ tr.append($("<td/>").text("Mimetype"));
+ tr.append($("<td/>").text("Expiry"));
+ tr.append($("<td/>").text("Actions"));
+ table.append(tr);
+
+ function buildIcon(enabled) {
+ var icon = $("<span>", {'class': "endpoint_status"});
+ if (enabled) icon.addClass("on");
+ return icon;
+ }
+
+ function ctToString(obj) {
+ var ret = "";
+ for(var i = 0; i < obj.length; i++) {
+ ret += obj[i].mime;
+ if(i != obj.length-1) ret += ",";
+ }
+ return ret;
+ }
+
+ for ( var i = 0; i < ps.length; i++) {
+ if(!ps[i].volatile) {
+ var delBtn = $("<button/>").text("delete");
+ delBtn.attr('data-id', ps[i].id);
+ delBtn.click(function() {
+ removeProgram($(this));
+ });
+ var modBtn = $("<button>", {text: (ps[i].active?"deactivate":"activate"), 'data-id': ps[i].id, 'data-active':ps[i].active})
+ modBtn.click(function() {
+ activateProgram($(this));
+ });
+ }
+ var col = "";
+ if (i % 2) {
+ col = "even";
+ } else {
+ col = "odd";
+ }
+ var tr = $("<tr class='" + col + "'/>");
+ $("<td/>").append(buildIcon(ps[i].active)).appendTo(tr);
+ $("<td/>").text(ps[i].name || '').appendTo(tr);
+ $("<td/>").text(ps[i].kind || '').appendTo(tr);
+ $("<td/>").text(ps[i].prefix || '').appendTo(tr);
+ $("<td/>").text(ps[i].endpoint || '').appendTo(tr);
+ $("<td/>").text(ps[i].mimetype != undefined ? ctToString(ps[i].mimetype) : '').appendTo(tr);
+ $("<td/>").text(ps[i].expiry || '').appendTo(tr);
+ if(!ps[i].volatile) {
+ $("<td/>").append(modBtn).append(delBtn).appendTo(tr);
+ } else {
+ $("<td>autoregistered</td>").appendTo(tr);
+ }
+ table.append(tr);
+ }
+ programs.empty().append(table);
+ }
+
+ function writeContent() {
+ // set Buttons
+ var button = $("<button/>", {
+ disabled : true
+ }).text("Upload");
+
+ programs = $("<div/>").text('loading');
+ var newprogram = $("<table/>");
+ buttonset = $("<div/>");
+ button.click(function() {
+ addProgram();
+ });
+
+ loader = $("<div/>");
+ buttonset.append(button);
+ buttonset.append(loader);
+
+ loadS = $("<div style='float: right;margin-top: -60px;'></div>");
+
+ contentBox.html("<h2 style='margin-bottom: 10px;'>LD-Cache Endpoints</h2>");
+ contentBox.append(programs);
+ contentBox.append("<h4 style='margin-bottom: 10px;margin-top: 25px'>Add LD-Cache Endpoint</h4>");
+ contentBox.append(loadS);
+ contentBox.append(newprogram);
+ contentBox.append(buttonset);
+
+ $.getJSON(settings.host + "config/list?prefix=ldcache.sample", function(data) {
+ writeSample(data);
+ });
+ $.getJSON(settings.host + "cache/endpoint/list", function(data) {
+ writePrograms(data);
+ });
+
+ // add new program stuff
+ name = $("<input style='width: 100%;' type='text' size='100'>");
+ kind = $("<select>");
+ $.getJSON(settings.host + "cache/provider/list", function(data) {
+ kind.empty();
+ for ( var d in data) {
+ $("<option/>", {
+ value : data[d],
+ text : data[d]
+ }).appendTo(kind);
+ }
+ $("<option/>", {
+ value : "NONE",
+ text : "NONE (Blacklist)"
+ }).appendTo(kind);
+ }).complete(function() {
+ button.removeAttr("disabled");
+ });
+ prefix = $("<input style='width: 100%;' type='text' size='100'>");
+ endpoint = $("<input style='width: 100%;' type='text' size='100'>");
+ mime = $("<input style='width: 100%;' type='text' size='100'>");
+ expiry = $("<input style='width: 100%;' type='text' size='100'>");
+
+ newprogram.append("<tr class='title'><td>Name</td><td>Value</td></tr>")
+
+ var tr1 = $("<tr></tr>");
+ tr1.append("<td>Name</td>");
+ var td1 = $("<td></td>").append(name);
+ tr1.append(td1);
+ newprogram.append(tr1);
+
+ var tr2 = $("<tr></tr>");
+ tr2.append("<td>Kind / Provider</td>");
+ var td2 = $("<td></td>").append(kind);
+ tr2.append(td2);
+ newprogram.append(tr2);
+
+ var tr3 = $("<tr></tr>");
+ tr3.append("<td>Prefix</td>");
+ var td3 = $("<td></td>").append(prefix);
+ tr3.append(td3);
+ newprogram.append(tr3);
+
+ var tr4 = $("<tr></tr>");
+ tr4.append("<td>Enpoint</td>");
+ var td4 = $("<td></td>").append(endpoint);
+ tr4.append(td4);
+ newprogram.append(tr4);
+
+ var tr5 = $("<tr></tr>");
+ tr5.append("<td>Mimetype</td>");
+ var td5 = $("<td></td>").append(mime);
+ tr5.append(td5);
+ newprogram.append(tr5);
+
+ var tr6 = $("<tr></tr>");
+ tr6.append("<td>Expiry Time</td>");
+ var td6 = $("<td></td>").append(expiry);
+ tr6.append(td6);
+ newprogram.append(tr6);
+ }
+
+ return this.each(function() {
+ // merge options
+ if (options) {
+ $.extend(settings, options);
+ }
+ contentBox = $(this);
+ // build skeleton
+
+ writeContent();
+
+ // $.getJSON(settings.host+"import/types",
+ // function(data){write(data);});
+ });
+ };
+})(jQuery);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-file/pom.xml
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-file/pom.xml b/platform/ldcache/marmotta-ldcache-file/pom.xml
new file mode 100644
index 0000000..7bcd070
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-file/pom.xml
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>marmotta-parent</artifactId>
+ <version>3.2.0-incubating-SNAPSHOT</version>
+ <relativePath>../../../parent</relativePath>
+ </parent>
+
+ <artifactId>marmotta-ldcache-file</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Apache Marmotta Platform: Linked Data Caching (File Backend)</name>
+ <description>
+ Provides transparent Linked Data Caching in the LMF triple store. When a resource is queried using e.g. LDPath
+ or SPARQL and it represents an external resource (e.g. on DBPedia or GeoNames), the resource is transparently
+ fetched on demand and cached locally.
+ </description>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin> <!-- generate JRebel Configuration -->
+ <groupId>org.zeroturnaround</groupId>
+ <artifactId>jrebel-maven-plugin</artifactId>
+ <version>1.1.3</version>
+ <executions>
+ <execution>
+ <id>generate-rebel-xml</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <relativePath>../../</relativePath>
+ <rootPath>$${rebel.root}</rootPath>
+ <classpath>
+ <resources>
+ <resource><!-- default resource --></resource>
+ <resource><directory>src/main/resources</directory></resource>
+ </resources>
+ </classpath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>buildinfo-maven-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <systemProperty>user.name</systemProperty>
+ <systemProperty>user.timezone</systemProperty>
+ <systemProperty>java.vm.vendor</systemProperty>
+ <systemProperty>java.vm.version</systemProperty>
+ <systemProperty>java.vm.name</systemProperty>
+ <systemProperty>java.runtime.version</systemProperty>
+ <systemProperty>os.name</systemProperty>
+ <systemProperty>os.version</systemProperty>
+ <systemProperty>os.arch</systemProperty>
+ </systemProperties>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>extract</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <!--
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>site</phase>
+ </execution>
+ -->
+ <execution>
+ <!-- configure how the REST API documentation will be produced -->
+ <id>restapi</id>
+ <configuration>
+ <doclet>com.lunatech.doclets.jax.jaxrs.JAXRSDoclet</doclet>
+
+ <name>REST API</name>
+ <description>REST API for LMF Webservices</description>
+
+ <outputDirectory>${project.build.outputDirectory}/doc</outputDirectory>
+ <reportOutputDirectory>${project.build.outputDirectory}/web/doc</reportOutputDirectory>
+ <destDir>rest</destDir>
+
+ <docletArtifact>
+ <groupId>com.lunatech.jax-doclets</groupId>
+ <artifactId>doclets</artifactId>
+ <version>0.10.0</version>
+ </docletArtifact>
+ <additionalparam>
+ -jaxrscontext {BASE}
+ -charset UTF-8
+ </additionalparam>
+
+ <!--
+ <stylesheetfile>${project.parent.basedir}/config/doc/doclet.css</stylesheetfile>
+ -->
+
+ <header><![CDATA[<!--###BEGIN_CONTENT###--><div class="javadoc">]]></header>
+ <footer><![CDATA[</div><!--###END_CONTENT###-->]]></footer>
+ <encoding>UTF-8</encoding>
+ <detectOfflineLinks>false</detectOfflineLinks>
+
+ <!-- For the project-reports page -->
+ </configuration>
+ <goals>
+ <goal>javadoc</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>marmotta-core</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>marmotta-ldcache-common</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>ldcache-sail-generic</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>ldcache-backend-file</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-file/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/FileLDCacheSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-file/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/FileLDCacheSailProvider.java b/platform/ldcache/marmotta-ldcache-file/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/FileLDCacheSailProvider.java
new file mode 100644
index 0000000..394a4a2
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-file/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/FileLDCacheSailProvider.java
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.marmotta.platform.ldcache.services.kiwi;
+
+import com.google.common.collect.Lists;
+import org.apache.marmotta.commons.sesame.filter.NotFilter;
+import org.apache.marmotta.commons.sesame.filter.OneOfFilter;
+import org.apache.marmotta.commons.sesame.filter.SesameFilter;
+import org.apache.marmotta.ldcache.backend.file.LDCachingFileBackend;
+import org.apache.marmotta.ldcache.sail.GenericLinkedDataSail;
+import org.apache.marmotta.ldcache.services.LDCache;
+import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
+import org.apache.marmotta.platform.core.model.filter.MarmottaLocalFilter;
+import org.apache.marmotta.platform.ldcache.api.ldcache.LDCacheSailProvider;
+import org.openrdf.model.Resource;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.sail.NotifyingSail;
+import org.openrdf.sail.helpers.NotifyingSailWrapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.enterprise.context.ApplicationScoped;
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A sail provider service that allows wrapping a transparent Linked Data caching component around the
+ * main SAIL. This service builds on any triple stores and represents cache entries in a file structure
+ * inside the Marmotta home directory
+ *
+ * <p/>
+ * Author: Sebastian Schaffert (sschaffert@apache.org)
+ */
+@ApplicationScoped
+public class FileLDCacheSailProvider extends LDCacheSailProvider {
+
+ private static Logger log = LoggerFactory.getLogger(FileLDCacheSailProvider.class);
+
+ private LDCachingFileBackend backend;
+
+ private GenericLinkedDataSail sail;
+
+ private File directory;
+
+ /**
+ * Return the name of the provider. Used e.g. for displaying status information or logging.
+ *
+ * @return
+ */
+ @Override
+ public String getName() {
+ return "Linked Data Caching (File Backend)";
+ }
+
+
+ /**
+ * 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) {
+ Set<SesameFilter<Resource>> filters = new HashSet<SesameFilter<Resource>>();
+ filters.add(MarmottaLocalFilter.getInstance());
+ filters.addAll(Lists.newArrayList(ignoreFilters));
+
+ SesameFilter<Resource> cacheFilters = new OneOfFilter<Resource>(filters);
+
+ String cache_context = configurationService.getCacheContext();
+
+ directory = new File(configurationService.getHome() + File.separator + "ldcache");
+
+ try {
+ backend = new LDCachingFileBackend(directory);
+ sail = new GenericLinkedDataSail(parent, backend, new NotFilter<Resource>(cacheFilters), ldclientConfig);
+ return sail;
+ } catch (RepositoryException e) {
+ log.error("could not initialize LDCache file backend",e);
+ return null;
+ }
+ }
+
+
+ /**
+ * Return the Linked Data Client used by the caching system (e.g. for debugging).
+ * @return
+ */
+ public LDClientService getLDClient() {
+ if(sail != null) {
+ return sail.getLDCache().getLDClient();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Return the caching backend used by the caching system (e.g. for debugging)
+ * @return
+ */
+ public LDCache getLDCache() {
+ if(sail != null) {
+ return sail.getLDCache();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Clear the currently configured Linked Data Sail.
+ */
+ @Override
+ public void clearSail() {
+ sail = null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-file/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-file/src/main/resources/META-INF/beans.xml b/platform/ldcache/marmotta-ldcache-file/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..461858e
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-file/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-kiwi/pom.xml
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-kiwi/pom.xml b/platform/ldcache/marmotta-ldcache-kiwi/pom.xml
new file mode 100644
index 0000000..f9b49e1
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-kiwi/pom.xml
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>marmotta-parent</artifactId>
+ <version>3.2.0-incubating-SNAPSHOT</version>
+ <relativePath>../../../parent</relativePath>
+ </parent>
+
+ <artifactId>marmotta-ldcache-kiwi</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Apache Marmotta Platform: Linked Data Caching (KiWi Backend)</name>
+ <description>
+ Provides transparent Linked Data Caching in the LMF triple store. When a resource is queried using e.g. LDPath
+ or SPARQL and it represents an external resource (e.g. on DBPedia or GeoNames), the resource is transparently
+ fetched on demand and cached locally.
+ </description>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin> <!-- generate JRebel Configuration -->
+ <groupId>org.zeroturnaround</groupId>
+ <artifactId>jrebel-maven-plugin</artifactId>
+ <version>1.1.3</version>
+ <executions>
+ <execution>
+ <id>generate-rebel-xml</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <relativePath>../../</relativePath>
+ <rootPath>$${rebel.root}</rootPath>
+ <classpath>
+ <resources>
+ <resource><!-- default resource --></resource>
+ <resource><directory>src/main/resources</directory></resource>
+ </resources>
+ </classpath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>buildinfo-maven-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <systemProperty>user.name</systemProperty>
+ <systemProperty>user.timezone</systemProperty>
+ <systemProperty>java.vm.vendor</systemProperty>
+ <systemProperty>java.vm.version</systemProperty>
+ <systemProperty>java.vm.name</systemProperty>
+ <systemProperty>java.runtime.version</systemProperty>
+ <systemProperty>os.name</systemProperty>
+ <systemProperty>os.version</systemProperty>
+ <systemProperty>os.arch</systemProperty>
+ </systemProperties>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>extract</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <!--
+ <execution>
+ <id>aggregate</id>
+ <goals>
+ <goal>aggregate</goal>
+ </goals>
+ <phase>site</phase>
+ </execution>
+ -->
+ <execution>
+ <!-- configure how the REST API documentation will be produced -->
+ <id>restapi</id>
+ <configuration>
+ <doclet>com.lunatech.doclets.jax.jaxrs.JAXRSDoclet</doclet>
+
+ <name>REST API</name>
+ <description>REST API for LMF Webservices</description>
+
+ <outputDirectory>${project.build.outputDirectory}/doc</outputDirectory>
+ <reportOutputDirectory>${project.build.outputDirectory}/web/doc</reportOutputDirectory>
+ <destDir>rest</destDir>
+
+ <docletArtifact>
+ <groupId>com.lunatech.jax-doclets</groupId>
+ <artifactId>doclets</artifactId>
+ <version>0.10.0</version>
+ </docletArtifact>
+ <additionalparam>
+ -jaxrscontext {BASE}
+ -charset UTF-8
+ </additionalparam>
+
+ <!--
+ <stylesheetfile>${project.parent.basedir}/config/doc/doclet.css</stylesheetfile>
+ -->
+
+ <header><![CDATA[<!--###BEGIN_CONTENT###--><div class="javadoc">]]></header>
+ <footer><![CDATA[</div><!--###END_CONTENT###-->]]></footer>
+ <encoding>UTF-8</encoding>
+ <detectOfflineLinks>false</detectOfflineLinks>
+
+ <!-- For the project-reports page -->
+ </configuration>
+ <goals>
+ <goal>javadoc</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>marmotta-core</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>marmotta-ldcache-common</artifactId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>marmotta-backend-kiwi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>ldcache-sail-kiwi</artifactId>
+ </dependency>
+
+
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-kiwi/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/KiWiLDCacheSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-kiwi/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/KiWiLDCacheSailProvider.java b/platform/ldcache/marmotta-ldcache-kiwi/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/KiWiLDCacheSailProvider.java
new file mode 100644
index 0000000..e97737d
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-kiwi/src/main/java/org/apache/marmotta/platform/ldcache/services/kiwi/KiWiLDCacheSailProvider.java
@@ -0,0 +1,113 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.marmotta.platform.ldcache.services.kiwi;
+
+import com.google.common.collect.Lists;
+import org.apache.marmotta.commons.sesame.filter.NotFilter;
+import org.apache.marmotta.commons.sesame.filter.OneOfFilter;
+import org.apache.marmotta.commons.sesame.filter.SesameFilter;
+import org.apache.marmotta.ldcache.sail.KiWiLinkedDataSail;
+import org.apache.marmotta.ldcache.services.LDCache;
+import org.apache.marmotta.ldclient.api.ldclient.LDClientService;
+import org.apache.marmotta.platform.core.model.filter.MarmottaLocalFilter;
+import org.apache.marmotta.platform.ldcache.api.ldcache.LDCacheSailProvider;
+import org.openrdf.model.Resource;
+import org.openrdf.sail.NotifyingSail;
+import org.openrdf.sail.helpers.NotifyingSailWrapper;
+
+import javax.enterprise.context.ApplicationScoped;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A sail provider service that allows wrapping a transparent Linked Data caching component around the
+ * main SAIL. This service builds on the KiWi triple store and represents cache entries in a separate table
+ * of the database.
+ *
+ * <p/>
+ * Author: Sebastian Schaffert (sschaffert@apache.org)
+ */
+@ApplicationScoped
+public class KiWiLDCacheSailProvider extends LDCacheSailProvider {
+
+
+ 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 (KiWi Backend)";
+ }
+
+
+ /**
+ * 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) {
+ Set<SesameFilter<Resource>> filters = new HashSet<SesameFilter<Resource>>();
+ filters.add(MarmottaLocalFilter.getInstance());
+ filters.addAll(Lists.newArrayList(ignoreFilters));
+
+ SesameFilter<Resource> cacheFilters = new OneOfFilter<Resource>(filters);
+
+ String cache_context = configurationService.getCacheContext();
+ sail = new KiWiLinkedDataSail(parent, new NotFilter<Resource>(cacheFilters), cache_context, ldclientConfig);
+ return sail;
+ }
+
+
+ /**
+ * Return the Linked Data Client used by the caching system (e.g. for debugging).
+ * @return
+ */
+ public LDClientService getLDClient() {
+ if(sail != null) {
+ return sail.getLDCache().getLDClient();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Return the caching backend used by the caching system (e.g. for debugging)
+ * @return
+ */
+ public LDCache getLDCache() {
+ if(sail != null) {
+ return sail.getLDCache();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Clear the currently configured Linked Data Sail.
+ */
+ @Override
+ public void clearSail() {
+ sail = null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/marmotta-ldcache-kiwi/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/platform/ldcache/marmotta-ldcache-kiwi/src/main/resources/META-INF/beans.xml b/platform/ldcache/marmotta-ldcache-kiwi/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..461858e
--- /dev/null
+++ b/platform/ldcache/marmotta-ldcache-kiwi/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<beans
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/47855a4b/platform/ldcache/pom.xml
----------------------------------------------------------------------
diff --git a/platform/ldcache/pom.xml b/platform/ldcache/pom.xml
new file mode 100644
index 0000000..3acda06
--- /dev/null
+++ b/platform/ldcache/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.marmotta</groupId>
+ <artifactId>marmotta-parent</artifactId>
+ <version>3.2.0-incubating-SNAPSHOT</version>
+ <relativePath>../../parent</relativePath>
+ </parent>
+
+ <artifactId>platform-ldcache-reactor</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Apache Marmotta Backends: Reactor</name>
+ <description>Different ldcache backends for the Apache Marmotta Platform</description>
+
+
+ <!-- release management -->
+ <build>
+ <plugins>
+ <!-- do not install / deploy reactor -->
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <modules>
+ <module>marmotta-ldcache-common</module>
+
+ <!-- KiWi backend specific modules -->
+ <module>marmotta-ldcache-kiwi</module>
+
+ <!-- Native/BigData specific modules -->
+ <module>marmotta-ldcache-file</module>
+ </modules>
+
+
+</project>