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 2014/01/10 18:09:21 UTC

[3/4] MARMOTTA-418: removed old LDCache API

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-backend-infinispan/src/test/java/org/apache/marmotta/ldcache/infinispan/test/LDCacheInfinispanTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-infinispan/src/test/java/org/apache/marmotta/ldcache/infinispan/test/LDCacheInfinispanTest.java b/libraries/ldcache/ldcache-backend-infinispan/src/test/java/org/apache/marmotta/ldcache/infinispan/test/LDCacheInfinispanTest.java
index f26abf6..349651a 100644
--- a/libraries/ldcache/ldcache-backend-infinispan/src/test/java/org/apache/marmotta/ldcache/infinispan/test/LDCacheInfinispanTest.java
+++ b/libraries/ldcache/ldcache-backend-infinispan/src/test/java/org/apache/marmotta/ldcache/infinispan/test/LDCacheInfinispanTest.java
@@ -14,122 +14,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.marmotta.ldcache.infinispan.test;
 
-import info.aduna.iteration.CloseableIteration;
+import org.apache.marmotta.ldcache.api.LDCachingBackend;
 import org.apache.marmotta.ldcache.backend.infinispan.LDCachingInfinispanBackend;
-import org.apache.marmotta.ldcache.model.CacheConfiguration;
-import org.apache.marmotta.ldcache.services.LDCache;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.ValueFactoryImpl;
-import org.openrdf.repository.RepositoryConnection;
-import org.openrdf.repository.RepositoryException;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-public class LDCacheInfinispanTest {
-
-
-    private LDCachingInfinispanBackend backend;
-
-    private LDCache ldcache;
-
-    private ValueFactory valueFactory;
-
-    @Before
-    public void initCache() throws RepositoryException {
-        backend = new LDCachingInfinispanBackend();
-        backend.initialize();
+import org.apache.marmotta.ldcache.services.test.ng.BaseLDCacheTest;
 
-        ldcache = new LDCache(new CacheConfiguration(),backend);
-
-        valueFactory = new ValueFactoryImpl();
-    }
-
-    @After
-    public void shutdownCache() throws RepositoryException, SQLException {
-        backend.shutdown();
-    }
-
-
-    /**
-     * Test retrieving and caching some resources (provided by DummyProvider).
-     */
-    @Test
-    public void testCacheResources() throws Exception {
-        String uri1 = "http://localhost/resource1";
-        String uri2 = "http://localhost/resource2";
-        String uri3 = "http://localhost/resource3";
-
-        ldcache.refreshResource(valueFactory.createURI(uri1),false);
-
-        Assert.assertEquals(1, asList(ldcache.listCacheEntries()).size());
-
-        RepositoryConnection con1 = ldcache.getCacheConnection(uri1);
-        try {
-            con1.begin();
-            Assert.assertEquals(3, asList(con1.getStatements(con1.getValueFactory().createURI(uri1), null, null, false)).size());
-            con1.commit();
-        } finally {
-            con1.close();
-        }
-
-        ldcache.refreshResource(valueFactory.createURI(uri2), false);
-
-        Assert.assertEquals(2, asList(ldcache.listCacheEntries()).size());
-
-        RepositoryConnection con2 = ldcache.getCacheConnection(uri2);
-        try {
-            con2.begin();
-            Assert.assertEquals(2, asList(con2.getStatements(con2.getValueFactory().createURI(uri2), null, null, false)).size());
-            con2.commit();
-        } finally {
-            con2.close();
-        }
-
-        ldcache.refreshResource(valueFactory.createURI(uri3), false);
-
-        Assert.assertEquals(3,asList(ldcache.listCacheEntries()).size());
-
-        RepositoryConnection con3 = ldcache.getCacheConnection(uri3);
-        try {
-            con3.begin();
-            Assert.assertEquals(2, asList(con3.getStatements(con3.getValueFactory().createURI(uri3), null, null, false)).size());
-            con3.commit();
-        } finally {
-            con3.close();
-        }
-    }
-
-
-    /*
+/**
+ * Add file description here!
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
+ */
+public class LDCacheInfinispanTest extends BaseLDCacheTest {
 
     /**
-     * Workaround for https://openrdf.atlassian.net/browse/SES-1702 in Sesame 2.7.0-beta1
-     * @param <E>
+     * Needs to be implemented by tests to provide the correct backend. Backend needs to be properly initialised.
+     *
      * @return
      */
-    public static <E,X extends Exception> List<E> asList(CloseableIteration<E,X> result) throws RepositoryException {
-        ArrayList<E> collection = new ArrayList<E>();
-        try {
-            try {
-                while (result.hasNext()) {
-                    collection.add(result.next());
-                }
+    @Override
+    protected LDCachingBackend createBackend() {
+        LDCachingBackend backend = new LDCachingInfinispanBackend();
+        backend.initialize();
 
-                return collection;
-            } finally {
-                result.close();
-            }
-        } catch(Throwable ex) {
-            throw new RepositoryException(ex);
-        }
+        return backend;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/LDCachingKiWiBackend.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/LDCachingKiWiBackend.java b/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/LDCachingKiWiBackend.java
index 0d7870b..1e22f9d 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/LDCachingKiWiBackend.java
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/LDCachingKiWiBackend.java
@@ -1,13 +1,12 @@
-/**
- * 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
+/*
+ * 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
+ *      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,
@@ -15,22 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.marmotta.ldcache.backend.kiwi;
 
 import info.aduna.iteration.CloseableIteration;
-import info.aduna.iteration.ExceptionConvertingIteration;
+import org.apache.marmotta.commons.sesame.model.ModelCommons;
 import org.apache.marmotta.kiwi.sail.KiWiStore;
 import org.apache.marmotta.ldcache.api.LDCachingBackend;
-import org.apache.marmotta.ldcache.api.LDCachingConnection;
+import org.apache.marmotta.ldcache.backend.kiwi.model.KiWiCacheEntry;
 import org.apache.marmotta.ldcache.backend.kiwi.persistence.LDCachingKiWiPersistence;
 import org.apache.marmotta.ldcache.backend.kiwi.persistence.LDCachingKiWiPersistenceConnection;
-import org.apache.marmotta.ldcache.backend.kiwi.repository.LDCachingSailRepositoryConnection;
-import org.apache.marmotta.ldcache.backend.kiwi.sail.LDCachingKiWiSail;
-import org.apache.marmotta.ldcache.backend.kiwi.sail.LDCachingKiWiSailConnection;
 import org.apache.marmotta.ldcache.model.CacheEntry;
-import org.openrdf.repository.RepositoryException;
+import org.openrdf.model.Model;
+import org.openrdf.model.Resource;
+import org.openrdf.model.Statement;
+import org.openrdf.model.URI;
+import org.openrdf.model.impl.TreeModel;
+import org.openrdf.repository.Repository;
+import org.openrdf.repository.base.RepositoryWrapper;
 import org.openrdf.repository.sail.SailRepository;
+import org.openrdf.sail.Sail;
+import org.openrdf.sail.SailConnection;
 import org.openrdf.sail.SailException;
+import org.openrdf.sail.helpers.SailWrapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -38,8 +44,8 @@ import java.sql.SQLException;
 
 /**
  * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert (sschaffert@apache.org)
+ *
+ * @author Sebastian Schaffert (sschaffert@apache.org)
  */
 public class LDCachingKiWiBackend implements LDCachingBackend {
 
@@ -53,155 +59,221 @@ public class LDCachingKiWiBackend implements LDCachingBackend {
     private String cacheContext;
 
 
-    /**
-     * Direct access to the caching SAIL with its caching maintenance functionality.
-     */
-    private LDCachingKiWiSail sail;
-
 
-    private LDCachingKiWiPersistence persistence;
+    protected LDCachingKiWiPersistence persistence;
 
     /**
      * Repository API access to the cache data
      */
-    private SailRepository repository;
+    protected KiWiStore store;
+
 
     /**
      * Create a new LDCache KiWi backend using the given store and context for caching triples and storing cache
      * metadata via JDBC in the database.
      *
-     * @param store
      * @param cacheContext
      */
-    public LDCachingKiWiBackend(KiWiStore store, String cacheContext) {
+    public LDCachingKiWiBackend(Repository repository, String cacheContext) {
         this.cacheContext = cacheContext;
-        this.sail         = new LDCachingKiWiSail(store);
-        this.repository   = new SailRepository(sail);
-        this.persistence  = new LDCachingKiWiPersistence(store.getPersistence());
+        this.store   = getStore(repository);
+        this.persistence  = new LDCachingKiWiPersistence(getStore(repository).getPersistence());
     }
 
     /**
-     * Return a repository connection that can be used for caching. The LDCache will first remove all statements for
-     * the newly cached resources and then add retrieved statements as-is to this connection and properly commit and
-     * close it after use.
-     * <p/>
-     * Note that in case the statements should be rewritten this method must take care of providing the proper
-     * connection, e.g. by using a ContextAwareRepositoryConnection to add a context to all statements when adding them.
-     *
+     * Create a new LDCache KiWi backend using the given store and context for caching triples and storing cache
+     * metadata via JDBC in the database.
      *
-     * @param resource the resource that will be cached
-     * @return a repository connection that can be used for storing retrieved triples for caching
+     * @param cacheContext
      */
-    @Override
-    public LDCachingConnection getCacheConnection(String resource) throws RepositoryException {
-        try {
-            LDCachingKiWiSailConnection sailConnection = sail.getConnection();
+    public LDCachingKiWiBackend(Sail repository, String cacheContext) {
+        this.cacheContext = cacheContext;
+        this.store   = getStore(repository);
+        this.persistence  = new LDCachingKiWiPersistence(getStore(repository).getPersistence());
+    }
 
-            return new LDCachingSailRepositoryConnection(repository,sailConnection,cacheContext);
-        } catch (SailException e) {
-            throw new RepositoryException(e);
+
+    protected KiWiStore getStore(Repository repository) {
+        if(repository instanceof SailRepository) {
+            return getStore(((SailRepository) repository).getSail());
+        } else if(repository instanceof RepositoryWrapper) {
+            return getStore(((RepositoryWrapper) repository).getDelegate());
+        } else {
+            throw new IllegalArgumentException("the repository is not backed by a KiWiStore");
         }
     }
 
+
     /**
-     * Return an iterator over all expired cache entries (can e.g. be used for refreshing).
+     * Get the root sail in the wrapped sail stack
+     * @param sail
+     * @return
+     */
+    protected KiWiStore getStore(Sail sail) {
+        if(sail instanceof KiWiStore) {
+            return (KiWiStore) sail;
+        } else if(sail instanceof SailWrapper) {
+            return getStore(((SailWrapper) sail).getBaseSail());
+        } else {
+            throw new IllegalArgumentException("root sail is not a KiWiStore or could not be found");
+        }
+    }
+
+
+    /**
+     * Return the cache entry for the given resource, or null if this entry does not exist.
+     *
      *
+     * @param resource the resource to retrieve the cache entry for
      * @return
      */
     @Override
-    public CloseableIteration<CacheEntry, RepositoryException> listExpiredEntries()  throws RepositoryException {
+    public CacheEntry getEntry(URI resource) {
         try {
-            final LDCachingKiWiSailConnection sailConnection = sail.getConnection();
-            sailConnection.begin();
+            try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
 
-            return new ExceptionConvertingIteration<CacheEntry, RepositoryException>(sailConnection.listExpired()) {
-                @Override
-                protected RepositoryException convert(Exception e) {
-                    return new RepositoryException(e);
-                }
+                // load cache entry from database
+                CacheEntry ce = dbcon.getCacheEntry(resource.stringValue());
 
-                /**
-                 * Closes this Iteration as well as the wrapped Iteration if it happens to be
-                 * a {@link info.aduna.iteration.CloseableIteration}.
-                 */
-                @Override
-                protected void handleClose() throws RepositoryException {
-                    super.handleClose();
+                // if entry exists, load triples for the resource from the cache context of the repository
+                if(ce != null) {
+                    SailConnection con = store.getConnection();
                     try {
-                        sailConnection.commit();
-                        sailConnection.close();
-                    } catch (SailException ex) {
-                        throw new RepositoryException(ex);
+                        con.begin();
+
+                        Model triples = new TreeModel();
+                        ModelCommons.add(triples,con.getStatements(resource,null,null,true,store.getValueFactory().createURI(cacheContext)));
+                        ce.setTriples(triples);
+
+                        con.commit();
+                    } catch(SailException ex) {
+                        con.rollback();
+                    } finally {
+                        con.close();
                     }
                 }
-            };
-        } catch (SailException e) {
-            throw new RepositoryException(e);
+                return ce;
+
+            }
+
+        } catch (SailException | SQLException e) {
+            log.error("could not retrieve cached triples from repository",e);
         }
+
+        return null;
     }
 
     /**
-     * Return an iterator over all cache entries (can e.g. be used for refreshing or expiring).
+     * Update the cache entry for the given resource with the given entry.
      *
-     * @return
+     * @param resource the resource to update
+     * @param entry    the entry for the resource
      */
     @Override
-    public CloseableIteration<CacheEntry, RepositoryException> listCacheEntries()  throws RepositoryException {
+    public void putEntry(URI resource, CacheEntry entry) {
         try {
-            final LDCachingKiWiSailConnection sailConnection = sail.getConnection();
-            sailConnection.begin();
+            try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
 
-            return new ExceptionConvertingIteration<CacheEntry, RepositoryException>(sailConnection.listAll()) {
-                @Override
-                protected RepositoryException convert(Exception e) {
-                    return new RepositoryException(e);
-                }
+                // store cache entry in database
+                dbcon.removeCacheEntry(resource.stringValue());
 
-                /**
-                 * Closes this Iteration as well as the wrapped Iteration if it happens to be
-                 * a {@link info.aduna.iteration.CloseableIteration}.
-                 */
-                @Override
-                protected void handleClose() throws RepositoryException {
-                    super.handleClose();
-                    try {
-                        sailConnection.commit();
-                        sailConnection.close();
-                    } catch (SailException ex) {
-                        throw new RepositoryException(ex);
+                // update triples in cache
+                SailConnection con = store.getConnection();
+                try {
+                    con.begin();
+
+                    con.removeStatements(resource, null, null, store.getValueFactory().createURI(cacheContext));
+                    for(Statement stmt : entry.getTriples()) {
+                        con.addStatement(stmt.getSubject(), stmt.getPredicate(), stmt.getObject(), store.getValueFactory().createURI(cacheContext));
                     }
+
+                    con.commit();
+
+                    entry.setResource(store.getValueFactory().createURI(resource.stringValue()));
+
+                    dbcon.storeCacheEntry(entry);
+                } catch(SailException ex) {
+                    con.rollback();
+                } finally {
+                    con.close();
                 }
-            };
-        } catch (SailException e) {
-            throw new RepositoryException(e);
+
+            }
+
+        } catch (SailException | SQLException e) {
+            log.error("could not retrieve cached triples from repository",e);
         }
-    }
 
+    }
 
     /**
-     * Return true in case the resource is a cached resource.
+     * Remove the cache entry for the given resource if it exists. Does nothing otherwise.
      *
-     * @param resource the URI of the resource to check
-     * @return true in case the resource is a cached resource
+     * @param resource the resource to remove the entry for
      */
     @Override
-    public boolean isCached(String resource) throws RepositoryException {
+    public void removeEntry(URI resource) {
         try {
-            LDCachingKiWiPersistenceConnection con = persistence.getConnection();
-            try {
-                CacheEntry entry = con.getCacheEntry(resource);
-                return  entry != null && entry.getTripleCount() > 0;
-            } finally {
-                con.commit();
-                con.close();
+            try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
+
+                // store cache entry in database
+                dbcon.removeCacheEntry(resource.stringValue());
+
+                // update triples in cache
+                SailConnection con = store.getConnection();
+                try {
+                    con.begin();
+
+                    con.removeStatements(resource, null, null, store.getValueFactory().createURI(cacheContext));
+
+                    con.commit();
+                } catch(SailException ex) {
+                    con.rollback();
+                } finally {
+                    con.close();
+                }
+
             }
-        } catch (SQLException e) {
-            throw new RepositoryException(e);
+
+        } catch (SailException | SQLException e) {
+            log.error("could not remove cached triples from repository",e);
         }
     }
 
-    public LDCachingKiWiPersistence getPersistence() {
-        return persistence;
+    /**
+     * Clear all entries in the cache backend.
+     */
+    @Override
+    public void clear() {
+        try {
+            try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
+
+                // list all entries and remove them
+                CloseableIteration<KiWiCacheEntry, SQLException> entries = dbcon.listAll();
+                while (entries.hasNext()) {
+                    dbcon.removeCacheEntry(entries.next());
+                }
+
+                // update triples in cache
+                SailConnection con = store.getConnection();
+                try {
+                    con.begin();
+
+                    con.removeStatements((Resource) null, null, null, store.getValueFactory().createURI(cacheContext));
+
+                    con.commit();
+                } catch(SailException ex) {
+                    con.rollback();
+                } finally {
+                    con.close();
+                }
+
+            }
+
+        } catch (SailException | SQLException e) {
+            log.error("could not remove cached triples from repository",e);
+        }
+
     }
 
     /**
@@ -210,19 +282,13 @@ public class LDCachingKiWiBackend implements LDCachingBackend {
     @Override
     public void initialize() {
         try {
-            repository.initialize();
-        } catch (RepositoryException e) {
-            log.error("error initializing secondary repository",e);
-        }
-
-        try {
             persistence.initDatabase();
         } catch (SQLException e) {
             log.error("error initializing LDCache database tables",e);
         }
 
         // register cache context in database
-        repository.getValueFactory().createURI(cacheContext);
+        store.getValueFactory().createURI(cacheContext);
 
     }
 
@@ -231,12 +297,9 @@ public class LDCachingKiWiBackend implements LDCachingBackend {
      */
     @Override
     public void shutdown() {
-        try {
-            repository.shutDown();
-        } catch (RepositoryException e) {
-            log.error("error shutting down secondary repository",e);
-        }
     }
 
-
+    public LDCachingKiWiPersistence getPersistence() {
+        return persistence;
+    }
 }

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/LDCachingKiWiBackendNG.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/LDCachingKiWiBackendNG.java b/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/LDCachingKiWiBackendNG.java
deleted file mode 100644
index dd5082c..0000000
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/LDCachingKiWiBackendNG.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.marmotta.ldcache.backend.kiwi;
-
-import info.aduna.iteration.CloseableIteration;
-import org.apache.marmotta.commons.sesame.model.ModelCommons;
-import org.apache.marmotta.kiwi.sail.KiWiStore;
-import org.apache.marmotta.ldcache.api.LDCachingBackendNG;
-import org.apache.marmotta.ldcache.backend.kiwi.model.KiWiCacheEntry;
-import org.apache.marmotta.ldcache.backend.kiwi.persistence.LDCachingKiWiPersistence;
-import org.apache.marmotta.ldcache.backend.kiwi.persistence.LDCachingKiWiPersistenceConnection;
-import org.apache.marmotta.ldcache.model.CacheEntry;
-import org.openrdf.model.Model;
-import org.openrdf.model.Resource;
-import org.openrdf.model.Statement;
-import org.openrdf.model.URI;
-import org.openrdf.model.impl.TreeModel;
-import org.openrdf.repository.Repository;
-import org.openrdf.repository.base.RepositoryWrapper;
-import org.openrdf.repository.sail.SailRepository;
-import org.openrdf.sail.Sail;
-import org.openrdf.sail.SailConnection;
-import org.openrdf.sail.SailException;
-import org.openrdf.sail.helpers.SailWrapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.SQLException;
-
-/**
- * Add file description here!
- *
- * @author Sebastian Schaffert (sschaffert@apache.org)
- */
-public class LDCachingKiWiBackendNG implements LDCachingBackendNG {
-
-    private static Logger log = LoggerFactory.getLogger(LDCachingKiWiBackendNG.class);
-
-
-
-    /**
-     * URI used as cache context in the central triple store
-     */
-    private String cacheContext;
-
-
-
-    protected LDCachingKiWiPersistence persistence;
-
-    /**
-     * Repository API access to the cache data
-     */
-    protected KiWiStore store;
-
-
-    /**
-     * Create a new LDCache KiWi backend using the given store and context for caching triples and storing cache
-     * metadata via JDBC in the database.
-     *
-     * @param cacheContext
-     */
-    public LDCachingKiWiBackendNG(Repository repository, String cacheContext) {
-        this.cacheContext = cacheContext;
-        this.store   = getStore(repository);
-        this.persistence  = new LDCachingKiWiPersistence(getStore(repository).getPersistence());
-    }
-
-    /**
-     * Create a new LDCache KiWi backend using the given store and context for caching triples and storing cache
-     * metadata via JDBC in the database.
-     *
-     * @param cacheContext
-     */
-    public LDCachingKiWiBackendNG(Sail repository, String cacheContext) {
-        this.cacheContext = cacheContext;
-        this.store   = getStore(repository);
-        this.persistence  = new LDCachingKiWiPersistence(getStore(repository).getPersistence());
-    }
-
-
-    protected KiWiStore getStore(Repository repository) {
-        if(repository instanceof SailRepository) {
-            return getStore(((SailRepository) repository).getSail());
-        } else if(repository instanceof RepositoryWrapper) {
-            return getStore(((RepositoryWrapper) repository).getDelegate());
-        } else {
-            throw new IllegalArgumentException("the repository is not backed by a KiWiStore");
-        }
-    }
-
-
-    /**
-     * Get the root sail in the wrapped sail stack
-     * @param sail
-     * @return
-     */
-    protected KiWiStore getStore(Sail sail) {
-        if(sail instanceof KiWiStore) {
-            return (KiWiStore) sail;
-        } else if(sail instanceof SailWrapper) {
-            return getStore(((SailWrapper) sail).getBaseSail());
-        } else {
-            throw new IllegalArgumentException("root sail is not a KiWiStore or could not be found");
-        }
-    }
-
-
-    /**
-     * Return the cache entry for the given resource, or null if this entry does not exist.
-     *
-     *
-     * @param resource the resource to retrieve the cache entry for
-     * @return
-     */
-    @Override
-    public CacheEntry getEntry(URI resource) {
-        try {
-            try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
-
-                // load cache entry from database
-                CacheEntry ce = dbcon.getCacheEntry(resource.stringValue());
-
-                // if entry exists, load triples for the resource from the cache context of the repository
-                if(ce != null) {
-                    SailConnection con = store.getConnection();
-                    try {
-                        con.begin();
-
-                        Model triples = new TreeModel();
-                        ModelCommons.add(triples,con.getStatements(resource,null,null,true,store.getValueFactory().createURI(cacheContext)));
-                        ce.setTriples(triples);
-
-                        con.commit();
-                    } catch(SailException ex) {
-                        con.rollback();
-                    } finally {
-                        con.close();
-                    }
-                }
-                return ce;
-
-            }
-
-        } catch (SailException | SQLException e) {
-            log.error("could not retrieve cached triples from repository",e);
-        }
-
-        return null;
-    }
-
-    /**
-     * Update the cache entry for the given resource with the given entry.
-     *
-     * @param resource the resource to update
-     * @param entry    the entry for the resource
-     */
-    @Override
-    public void putEntry(URI resource, CacheEntry entry) {
-        try {
-            try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
-
-                // store cache entry in database
-                dbcon.removeCacheEntry(resource.stringValue());
-
-                // update triples in cache
-                SailConnection con = store.getConnection();
-                try {
-                    con.begin();
-
-                    con.removeStatements(resource, null, null, store.getValueFactory().createURI(cacheContext));
-                    for(Statement stmt : entry.getTriples()) {
-                        con.addStatement(stmt.getSubject(), stmt.getPredicate(), stmt.getObject(), store.getValueFactory().createURI(cacheContext));
-                    }
-
-                    con.commit();
-
-                    entry.setResource(store.getValueFactory().createURI(resource.stringValue()));
-
-                    dbcon.storeCacheEntry(entry);
-                } catch(SailException ex) {
-                    con.rollback();
-                } finally {
-                    con.close();
-                }
-
-            }
-
-        } catch (SailException | SQLException e) {
-            log.error("could not retrieve cached triples from repository",e);
-        }
-
-    }
-
-    /**
-     * Remove the cache entry for the given resource if it exists. Does nothing otherwise.
-     *
-     * @param resource the resource to remove the entry for
-     */
-    @Override
-    public void removeEntry(URI resource) {
-        try {
-            try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
-
-                // store cache entry in database
-                dbcon.removeCacheEntry(resource.stringValue());
-
-                // update triples in cache
-                SailConnection con = store.getConnection();
-                try {
-                    con.begin();
-
-                    con.removeStatements(resource, null, null, store.getValueFactory().createURI(cacheContext));
-
-                    con.commit();
-                } catch(SailException ex) {
-                    con.rollback();
-                } finally {
-                    con.close();
-                }
-
-            }
-
-        } catch (SailException | SQLException e) {
-            log.error("could not remove cached triples from repository",e);
-        }
-    }
-
-    /**
-     * Clear all entries in the cache backend.
-     */
-    @Override
-    public void clear() {
-        try {
-            try(LDCachingKiWiPersistenceConnection dbcon = persistence.getConnection()) {
-
-                // list all entries and remove them
-                CloseableIteration<KiWiCacheEntry, SQLException> entries = dbcon.listAll();
-                while (entries.hasNext()) {
-                    dbcon.removeCacheEntry(entries.next());
-                }
-
-                // update triples in cache
-                SailConnection con = store.getConnection();
-                try {
-                    con.begin();
-
-                    con.removeStatements((Resource) null, null, null, store.getValueFactory().createURI(cacheContext));
-
-                    con.commit();
-                } catch(SailException ex) {
-                    con.rollback();
-                } finally {
-                    con.close();
-                }
-
-            }
-
-        } catch (SailException | SQLException e) {
-            log.error("could not remove cached triples from repository",e);
-        }
-
-    }
-
-    /**
-     * Carry out any initialization tasks that might be necessary
-     */
-    @Override
-    public void initialize() {
-        try {
-            persistence.initDatabase();
-        } catch (SQLException e) {
-            log.error("error initializing LDCache database tables",e);
-        }
-
-        // register cache context in database
-        store.getValueFactory().createURI(cacheContext);
-
-    }
-
-    /**
-     * Shutdown the backend and free all runtime resources.
-     */
-    @Override
-    public void shutdown() {
-    }
-
-    public LDCachingKiWiPersistence getPersistence() {
-        return persistence;
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/repository/LDCachingSailRepositoryConnection.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/repository/LDCachingSailRepositoryConnection.java b/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/repository/LDCachingSailRepositoryConnection.java
deleted file mode 100644
index 6907145..0000000
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/repository/LDCachingSailRepositoryConnection.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.marmotta.ldcache.backend.kiwi.repository;
-
-import org.apache.marmotta.commons.sesame.contextaware.ContextAwareSailConnection;
-import org.apache.marmotta.ldcache.api.LDCachingConnection;
-import org.apache.marmotta.ldcache.backend.kiwi.sail.LDCachingKiWiSailConnection;
-import org.apache.marmotta.ldcache.model.CacheEntry;
-import org.apache.marmotta.ldcache.sail.LDCachingSailConnection;
-import org.openrdf.model.URI;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.sail.SailRepository;
-import org.openrdf.repository.sail.SailRepositoryConnection;
-
-/**
- * This is an extension wrapper around sail repository connections that allows delegating the additional cache entry
- * methods to the underlying SAIL repository. Otherwise it behaves like any SailRepositoryConnection.
- * <p/>
- * Author: Sebastian Schaffert (sschaffert@apache.org)
- */
-public class LDCachingSailRepositoryConnection extends SailRepositoryConnection implements LDCachingConnection {
-
-    private LDCachingSailConnection cacheConnection;
-
-    public LDCachingSailRepositoryConnection(SailRepository repository, LDCachingKiWiSailConnection sailConnection, String cacheContext) {
-        super(repository, new ContextAwareSailConnection(sailConnection, sailConnection.getValueFactory().createURI(cacheContext)));
-        cacheConnection = sailConnection;
-    }
-
-    /**
-     * Store a cache entry for the passed resource in the backend. Depending on the backend, this can be a
-     * persistent storage or an in-memory storage.
-     *
-     * @param resource
-     * @param entry
-     */
-    @Override
-    public void addCacheEntry(URI resource, CacheEntry entry) throws RepositoryException {
-        try {
-            cacheConnection.addCacheEntry(resource,entry);
-        } catch (org.openrdf.sail.SailException e) {
-            throw new RepositoryException(e);
-        }
-    }
-
-    /**
-     * Get the cache entry for the passed resource, if any. Returns null in case there is no cache entry.
-     *
-     *
-     * @param resource the resource to look for
-     * @return the cache entry for the resource, or null if the resource has never been cached or is expired
-     */
-    @Override
-    public CacheEntry getCacheEntry(URI resource) throws RepositoryException {
-        try {
-            return cacheConnection.getCacheEntry(resource);
-        } catch (org.openrdf.sail.SailException e) {
-            throw new RepositoryException(e);
-        }
-    }
-
-    /**
-     * Remove the currently stored cache entry for the passed resource from the backend.
-     *
-     * @param resource
-     */
-    @Override
-    public void removeCacheEntry(URI resource) throws RepositoryException {
-        try {
-            cacheConnection.removeCacheEntry(resource);
-        } catch (org.openrdf.sail.SailException e) {
-            throw new RepositoryException(e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/sail/LDCachingKiWiSail.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/sail/LDCachingKiWiSail.java b/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/sail/LDCachingKiWiSail.java
deleted file mode 100644
index a8b1086..0000000
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/sail/LDCachingKiWiSail.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.marmotta.ldcache.backend.kiwi.sail;
-
-import org.apache.marmotta.kiwi.sail.KiWiSailConnection;
-import org.apache.marmotta.kiwi.sail.KiWiStore;
-import org.openrdf.sail.SailException;
-import org.openrdf.sail.helpers.SailWrapper;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert (sschaffert@apache.org)
- */
-public class LDCachingKiWiSail extends SailWrapper {
-
-    private KiWiStore store;
-
-    /**
-     * Creates a new SailWrapper that wraps the supplied Sail.
-     */
-    public LDCachingKiWiSail(KiWiStore baseSail) {
-        super(baseSail);
-
-        this.store = baseSail;
-    }
-
-    @Override
-    public LDCachingKiWiSailConnection getConnection() throws SailException {
-        return new LDCachingKiWiSailConnection((KiWiSailConnection) store.getConnection());
-    }
-
-    @Override
-    public void initialize() throws SailException {
-        // ignore, because we assume that the wrapped store is already initialized
-        if(!store.isInitialized()) {
-            throw new SailException("the LDCachingKiWiSail is a secondary sail and requires an already initialized store!");
-        }
-    }
-
-    @Override
-    public void shutDown() throws SailException {
-        // ignore, because we assume that the wrapped store will be shutdown by another sail
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/sail/LDCachingKiWiSailConnection.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/sail/LDCachingKiWiSailConnection.java b/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/sail/LDCachingKiWiSailConnection.java
deleted file mode 100644
index 5ce66bf..0000000
--- a/libraries/ldcache/ldcache-backend-kiwi/src/main/java/org/apache/marmotta/ldcache/backend/kiwi/sail/LDCachingKiWiSailConnection.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.marmotta.ldcache.backend.kiwi.sail;
-
-import info.aduna.iteration.CloseableIteration;
-import org.apache.marmotta.kiwi.sail.KiWiSailConnection;
-import org.apache.marmotta.kiwi.sail.KiWiValueFactory;
-import org.apache.marmotta.ldcache.backend.kiwi.model.KiWiCacheEntry;
-import org.apache.marmotta.ldcache.backend.kiwi.persistence.LDCachingKiWiPersistenceConnection;
-import org.apache.marmotta.ldcache.model.CacheEntry;
-import org.apache.marmotta.ldcache.sail.LDCachingSailConnection;
-import org.openrdf.model.URI;
-import org.openrdf.sail.SailException;
-import org.openrdf.sail.helpers.SailConnectionWrapper;
-
-import java.sql.SQLException;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert (sschaffert@apache.org)
- */
-public class LDCachingKiWiSailConnection extends SailConnectionWrapper implements LDCachingSailConnection {
-
-    private LDCachingKiWiPersistenceConnection persistence;
-
-    private KiWiSailConnection wrapped;
-
-    public LDCachingKiWiSailConnection(KiWiSailConnection wrappedCon) throws SailException {
-        super(wrappedCon);
-
-        this.wrapped = wrappedCon;
-        try {
-            this.persistence = new LDCachingKiWiPersistenceConnection(wrappedCon.getDatabaseConnection());
-        } catch (SQLException e) {
-            throw new SailException(e);
-        }
-    }
-
-    public KiWiValueFactory getValueFactory() {
-        return wrapped.getValueFactory();
-    }
-
-    /**
-     * Store a cache entry for the passed resource in the backend. Depending on the backend, this can be a
-     * persistent storage or an in-memory storage.
-     *
-     * @param resource
-     * @param entry
-     */
-    @Override
-    public void addCacheEntry(URI resource, CacheEntry entry) throws SailException {
-        try {
-            persistence.storeCacheEntry(entry);
-        } catch (SQLException e) {
-            throw new SailException(e);
-        }
-    }
-
-    /**
-     * Get the cache entry for the passed resource, if any. Returns null in case there is no cache entry.
-     *
-     *
-     * @param resource the resource to look for
-     * @return the cache entry for the resource, or null if the resource has never been cached or is expired
-     */
-    @Override
-    public CacheEntry getCacheEntry(URI resource) throws SailException {
-        try {
-            return persistence.getCacheEntry(resource.stringValue());
-        } catch (SQLException e) {
-            throw new SailException(e);
-        }
-    }
-
-    /**
-     * Remove the currently stored cache entry for the passed resource from the backend.
-     *
-     * @param resource
-     */
-    @Override
-    public void removeCacheEntry(URI resource) throws SailException {
-        try {
-            persistence.removeCacheEntry(resource.stringValue());
-        } catch (SQLException e) {
-            throw new SailException(e);
-        }
-    }
-
-    /**
-     * List all cache entries with an expiry date older than the current time.
-     *
-     * @return a closeable iteration with KiWiCacheEntries; needs to be released by the caller
-     * @throws SQLException
-     */
-    public CloseableIteration<KiWiCacheEntry,SQLException> listExpired() throws SailException {
-        try {
-            return persistence.listExpired();
-        } catch (SQLException e) {
-            throw new SailException(e);
-        }
-    }
-
-
-    /**
-     * List all cache entries in the database, regardless of expiry date.
-     *
-     * @return a closeable iteration with KiWiCacheEntries; needs to be released by the caller
-     * @throws SQLException
-     */
-    public CloseableIteration<KiWiCacheEntry,SQLException> listAll() throws SailException {
-        try {
-            return persistence.listAll();
-        } catch (SQLException e) {
-            throw new SailException(e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCacheBackendTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCacheBackendTest.java b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCacheBackendTest.java
deleted file mode 100644
index e0ab3e8..0000000
--- a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/backend/kiwi/test/LDCacheBackendTest.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.marmotta.ldcache.backend.kiwi.test;
-
-import info.aduna.iteration.CloseableIteration;
-import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.h2.H2Dialect;
-import org.apache.marmotta.kiwi.persistence.mysql.MySQLDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sail.KiWiStore;
-import org.apache.marmotta.ldcache.api.LDCachingConnection;
-import org.apache.marmotta.ldcache.backend.kiwi.LDCachingKiWiBackend;
-import org.apache.marmotta.ldcache.model.CacheEntry;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.openrdf.model.Literal;
-import org.openrdf.model.Statement;
-import org.openrdf.model.URI;
-import org.openrdf.repository.Repository;
-import org.openrdf.repository.RepositoryConnection;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.RepositoryResult;
-import org.openrdf.repository.sail.SailRepository;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * This test checks if the ldcache backend works, i.e. the system properly stores cache entries and cached triples.
- * It will try running over all available databases. Except for in-memory databases like
- * H2 or Derby, database URLs must be passed as system property, or otherwise the test is skipped for this database.
- * Available system properties:
- * <ul>
- *     <li>PostgreSQL:
- *     <ul>
- *         <li>postgresql.url, e.g. jdbc:postgresql://localhost:5433/kiwitest?prepareThreshold=3</li>
- *         <li>postgresql.user (default: lmf)</li>
- *         <li>postgresql.pass (default: lmf)</li>
- *     </ul>
- *     </li>
- *     <li>MySQL:
- *     <ul>
- *         <li>mysql.url, e.g. jdbc:mysql://localhost:3306/kiwitest?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull</li>
- *         <li>mysql.user (default: lmf)</li>
- *         <li>mysql.pass (default: lmf</li>
- *     </ul>
- *     </li>
- *     <li>H2:
- *     <ul>
- *         <li>h2.url, e.g. jdbc:h2:mem;MVCC=true;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=10</li>
- *         <li>h2.user (default: lmf)</li>
- *         <li>h2.pass (default: lmf</li>
- *     </ul>
- *     </li>
- * </ul>
- *
- * <p/>
- * Author: Sebastian Schaffert
- */
-@RunWith(Parameterized.class)
-public class LDCacheBackendTest {
-
-
-    public static final String CACHE_CONTEXT = "http://localhost/context/cache";
-
-    /**
-     * Return database configurations if the appropriate parameters have been set.
-     *
-     * @return an array (database name, url, user, password)
-     */
-    @Parameterized.Parameters(name="Database Test {index}: {0} at {1}")
-    public static Iterable<Object[]> databases() {
-        String[] databases = {"H2", "PostgreSQL", "MySQL"};
-
-        List<Object[]> result = new ArrayList<Object[]>(databases.length);
-        for(String database : databases) {
-            if(System.getProperty(database.toLowerCase()+".url") != null) {
-                result.add(new Object[] {
-                        database,
-                        System.getProperty(database.toLowerCase()+".url"),
-                        System.getProperty(database.toLowerCase()+".user","lmf"),
-                        System.getProperty(database.toLowerCase()+".pass","lmf")
-                });
-            }
-        }
-        return result;
-    }
-
-
-    private KiWiDialect dialect;
-
-    private String jdbcUrl;
-
-    private String jdbcUser;
-
-    private String jdbcPass;
-
-    private KiWiStore store;
-
-    private LDCachingKiWiBackend backend;
-
-    private Repository repository;
-
-    public LDCacheBackendTest(String database, String jdbcUrl, String jdbcUser, String jdbcPass) {
-        this.jdbcPass = jdbcPass;
-        this.jdbcUrl = jdbcUrl;
-        this.jdbcUser = jdbcUser;
-
-        if("H2".equals(database)) {
-            this.dialect = new H2Dialect();
-        } else if("MySQL".equals(database)) {
-            this.dialect = new MySQLDialect();
-        } else if("PostgreSQL".equals(database)) {
-            this.dialect = new PostgreSQLDialect();
-        }
-    }
-
-
-    @Before
-    public void initDatabase() throws RepositoryException {
-        store = new KiWiStore("test",jdbcUrl,jdbcUser,jdbcPass,dialect, "http://localhost/context/default", "http://localhost/context/inferred");
-        repository = new SailRepository(store);
-        repository.initialize();
-
-        backend = new LDCachingKiWiBackend(store, CACHE_CONTEXT);
-        backend.initialize();
-    }
-
-    @After
-    public void dropDatabase() throws RepositoryException, SQLException {
-        backend.getPersistence().dropDatabase();
-        store.getPersistence().dropDatabase();
-        repository.shutDown();
-    }
-
-
-    final Logger logger =
-            LoggerFactory.getLogger(this.getClass());
-
-    @Rule
-    public TestWatcher watchman = new TestWatcher() {
-        /**
-         * Invoked when a test is about to start
-         */
-        @Override
-        protected void starting(Description description) {
-            logger.info("{} being run...", description.getMethodName());
-        }
-    };
-
-    /**
-     * This test verifies if triples are added to the correct context using the repository connection obtained from the backend
-     * @throws Exception
-     */
-    @Test
-    public void testStoreTriples() throws Exception {
-
-        RepositoryConnection con = backend.getCacheConnection("http://localhost/resource/1");
-        try {
-            con.begin();
-
-            URI subject    = con.getValueFactory().createURI("http://localhost/resource/"+ RandomStringUtils.randomAlphanumeric(8));
-            URI predicate  = con.getValueFactory().createURI("http://localhost/resource/"+ RandomStringUtils.randomAlphanumeric(8));
-            Literal object1 = con.getValueFactory().createLiteral(RandomStringUtils.random(64));
-            Literal object2 = con.getValueFactory().createLiteral(RandomStringUtils.random(64));
-            URI context    = con.getValueFactory().createURI("http://localhost/resource/"+ RandomStringUtils.randomAlphanumeric(8));
-
-            Statement stmt1 = con.getValueFactory().createStatement(subject,predicate,object1);
-            Statement stmt2 = con.getValueFactory().createStatement(subject,predicate,object2,context);
-
-            con.add(stmt1);
-            con.add(stmt2);
-
-            con.commit();
-
-            RepositoryResult<Statement> it = con.getStatements(subject,predicate,null,true);
-            try {
-                while(it.hasNext()) {
-                    Statement next =  it.next();
-                    Assert.assertEquals(CACHE_CONTEXT, next.getContext().stringValue());
-                }
-            } finally {
-                it.close();
-            }
-
-            con.commit();
-        } catch(RepositoryException ex) {
-            con.rollback();
-        } finally {
-            con.close();
-        }
-    }
-
-    /**
-     * Test storing and retrieving cache entries
-     *
-     * @throws Exception
-     */
-    @Test
-    public void testStoreEntries() throws Exception {
-        LDCachingConnection con = backend.getCacheConnection("http://localhost/resource/1");
-        try {
-            con.begin();
-
-            URI subject1     = con.getValueFactory().createURI("http://localhost/resource/"+ RandomStringUtils.randomAlphanumeric(8));
-            URI subject2     = con.getValueFactory().createURI("http://localhost/resource/"+ RandomStringUtils.randomAlphanumeric(8));
-            Literal object1  = con.getValueFactory().createLiteral(RandomStringUtils.random(64));
-            Literal object2  = con.getValueFactory().createLiteral(RandomStringUtils.random(64));
-            URI predicate    = con.getValueFactory().createURI("http://localhost/resource/"+ RandomStringUtils.randomAlphanumeric(8));
-
-            Statement stmt1 = con.getValueFactory().createStatement(subject1,predicate,object1);
-            Statement stmt2 = con.getValueFactory().createStatement(subject2,predicate,object2);
-
-            con.add(stmt1);
-            con.add(stmt2);
-
-            con.commit();
-
-            con.begin();
-            CacheEntry entry1 = new CacheEntry();
-            entry1.setExpiryDate(new Date(System.currentTimeMillis()+1000*60));
-            entry1.setLastRetrieved(new Date());
-            entry1.setUpdateCount(1);
-            entry1.setResource(subject1);
-            entry1.setTripleCount(1);
-            con.addCacheEntry(subject1, entry1);
-            con.commit();
-
-            Assert.assertTrue(backend.isCached(subject1.stringValue()));
-            Assert.assertFalse(backend.isCached(subject2.stringValue()));
-            Assert.assertEquals(1,asList(backend.listCacheEntries()).size());
-            Assert.assertEquals(0,asList(backend.listExpiredEntries()).size());
-
-            con.begin();
-            CacheEntry entry2 = new CacheEntry();
-            entry2.setExpiryDate(new Date(System.currentTimeMillis() - 1000 * 60));
-            entry2.setLastRetrieved(new Date());
-            entry2.setUpdateCount(1);
-            entry2.setResource(subject2);
-            entry2.setTripleCount(1);
-            con.addCacheEntry(subject2,entry2);
-
-            con.commit();
-
-            Assert.assertTrue(backend.isCached(subject1.stringValue()));
-            Assert.assertTrue(backend.isCached(subject2.stringValue()));
-            Assert.assertEquals(2,asList(backend.listCacheEntries()).size());
-            Assert.assertEquals(1,asList(backend.listExpiredEntries()).size());
-
-            con.begin();
-            con.removeCacheEntry(subject1);
-            con.commit();
-
-            Assert.assertFalse(backend.isCached(subject1.stringValue()));
-            Assert.assertTrue(backend.isCached(subject2.stringValue()));
-            Assert.assertEquals(1,asList(backend.listCacheEntries()).size());
-            Assert.assertEquals(1,asList(backend.listExpiredEntries()).size());
-        } catch(RepositoryException ex) {
-            con.rollback();
-        } finally {
-            con.close();
-        }
-    }
-
-
-    /**
-     * Workaround for https://openrdf.atlassian.net/browse/SES-1702 in Sesame 2.7.0-beta1
-     * @param <E>
-     * @return
-     */
-    public static <E,X extends Exception> List<E> asList(CloseableIteration<E,X> result) throws RepositoryException {
-        ArrayList<E> collection = new ArrayList<E>();
-        try {
-            try {
-                while (result.hasNext()) {
-                    collection.add(result.next());
-                }
-
-                return collection;
-            } finally {
-                result.close();
-            }
-        } catch(Throwable ex) {
-            throw new RepositoryException(ex);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiNGTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiNGTest.java b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiNGTest.java
deleted file mode 100644
index 4b822bc..0000000
--- a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiNGTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.marmotta.ldcache.services.test;
-
-import org.apache.marmotta.kiwi.persistence.KiWiDialect;
-import org.apache.marmotta.kiwi.persistence.h2.H2Dialect;
-import org.apache.marmotta.kiwi.persistence.mysql.MySQLDialect;
-import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
-import org.apache.marmotta.kiwi.sail.KiWiStore;
-import org.apache.marmotta.ldcache.api.LDCachingBackendNG;
-import org.apache.marmotta.ldcache.backend.kiwi.LDCachingKiWiBackendNG;
-import org.apache.marmotta.ldcache.services.test.ng.BaseLDCacheNGTest;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.openrdf.repository.Repository;
-import org.openrdf.repository.RepositoryException;
-import org.openrdf.repository.sail.SailRepository;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This test checks if the ldcache main class works, i.e. the system properly stores cache entries and cached triples.
- * It will try running over all available databases. Except for in-memory databases like
- * H2 or Derby, database URLs must be passed as system property, or otherwise the test is skipped for this database.
- * Available system properties:
- * <ul>
- *     <li>PostgreSQL:
- *     <ul>
- *         <li>postgresql.url, e.g. jdbc:postgresql://localhost:5433/kiwitest?prepareThreshold=3</li>
- *         <li>postgresql.user (default: lmf)</li>
- *         <li>postgresql.pass (default: lmf)</li>
- *     </ul>
- *     </li>
- *     <li>MySQL:
- *     <ul>
- *         <li>mysql.url, e.g. jdbc:mysql://localhost:3306/kiwitest?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull</li>
- *         <li>mysql.user (default: lmf)</li>
- *         <li>mysql.pass (default: lmf</li>
- *     </ul>
- *     </li>
- *     <li>H2:
- *     <ul>
- *         <li>h2.url, e.g. jdbc:h2:mem;MVCC=true;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=10</li>
- *         <li>h2.user (default: lmf)</li>
- *         <li>h2.pass (default: lmf</li>
- *     </ul>
- *     </li>
- * </ul>
- *
- * <p/>
- * Author: Sebastian Schaffert
- */
-@RunWith(Parameterized.class)
-public class LDCacheKiWiNGTest extends BaseLDCacheNGTest {
-
-    public static final String CACHE_CONTEXT = "http://localhost/context/cache";
-
-    /**
-     * Return database configurations if the appropriate parameters have been set.
-     *
-     * @return an array (database name, url, user, password)
-     */
-    @Parameterized.Parameters(name="Database Test {index}: {0} at {1}")
-    public static Iterable<Object[]> databases() {
-        String[] databases = {"H2", "PostgreSQL", "MySQL"};
-
-        List<Object[]> result = new ArrayList<Object[]>(databases.length);
-        for(String database : databases) {
-            if(System.getProperty(database.toLowerCase()+".url") != null) {
-                result.add(new Object[] {
-                        database,
-                        System.getProperty(database.toLowerCase()+".url"),
-                        System.getProperty(database.toLowerCase()+".user","lmf"),
-                        System.getProperty(database.toLowerCase()+".pass","lmf")
-                });
-            }
-        }
-        return result;
-    }
-
-
-    private KiWiDialect dialect;
-
-    private String jdbcUrl;
-
-    private String jdbcUser;
-
-    private String jdbcPass;
-
-
-    public LDCacheKiWiNGTest(String database, String jdbcUrl, String jdbcUser, String jdbcPass) {
-        this.jdbcPass = jdbcPass;
-        this.jdbcUrl = jdbcUrl;
-        this.jdbcUser = jdbcUser;
-
-        if("H2".equals(database)) {
-            this.dialect = new H2Dialect();
-        } else if("MySQL".equals(database)) {
-            this.dialect = new MySQLDialect();
-        } else if("PostgreSQL".equals(database)) {
-            this.dialect = new PostgreSQLDialect();
-        }
-    }
-
-
-    /**
-     * Needs to be implemented by tests to provide the correct backend. Backend needs to be properly initialised.
-     *
-     * @return
-     */
-    @Override
-    protected LDCachingBackendNG createBackend() {
-        try {
-            KiWiStore store = new KiWiStore("test",jdbcUrl,jdbcUser,jdbcPass,dialect, "http://localhost/context/default", "http://localhost/context/inferred");
-            final Repository repository = new SailRepository(store);
-            repository.initialize();
-
-            LDCachingKiWiBackendNG backend = new LDCachingKiWiBackendNG(repository, CACHE_CONTEXT) {
-                /**
-                 * Shutdown the backend and free all runtime resources.
-                 */
-                @Override
-                public void shutdown() {
-
-                    try {
-                        persistence.dropDatabase();
-                        store.getPersistence().dropDatabase();
-
-                        super.shutdown();
-
-                        repository.shutDown();
-                    } catch (Exception e) { }
-                }
-            };
-            backend.initialize();
-
-
-            return backend;
-        } catch (RepositoryException e) {
-            throw new AssertionError(e);
-        }
-    }
-
-
-
-    @Override
-    @Test
-    @Ignore("does not work due to a bug in Sesame (SES-1993)")
-    public void testGeonames() throws Exception {
-    }
-}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/8941574c/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiTest.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiTest.java b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiTest.java
index b22b600..7d3a297 100644
--- a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiTest.java
+++ b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/LDCacheKiWiTest.java
@@ -1,13 +1,12 @@
-/**
- * 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
+/*
+ * 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
+ *      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,
@@ -17,27 +16,22 @@
  */
 package org.apache.marmotta.ldcache.services.test;
 
-import info.aduna.iteration.CloseableIteration;
 import org.apache.marmotta.kiwi.persistence.KiWiDialect;
 import org.apache.marmotta.kiwi.persistence.h2.H2Dialect;
 import org.apache.marmotta.kiwi.persistence.mysql.MySQLDialect;
 import org.apache.marmotta.kiwi.persistence.pgsql.PostgreSQLDialect;
 import org.apache.marmotta.kiwi.sail.KiWiStore;
+import org.apache.marmotta.ldcache.api.LDCachingBackend;
 import org.apache.marmotta.ldcache.backend.kiwi.LDCachingKiWiBackend;
-import org.apache.marmotta.ldcache.model.CacheConfiguration;
-import org.apache.marmotta.ldcache.services.LDCache;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
+import org.apache.marmotta.ldcache.services.test.ng.BaseLDCacheTest;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.openrdf.repository.Repository;
-import org.openrdf.repository.RepositoryConnection;
 import org.openrdf.repository.RepositoryException;
 import org.openrdf.repository.sail.SailRepository;
 
-import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -74,7 +68,7 @@ import java.util.List;
  * Author: Sebastian Schaffert
  */
 @RunWith(Parameterized.class)
-public class LDCacheKiWiTest {
+public class LDCacheKiWiTest extends BaseLDCacheTest {
 
     public static final String CACHE_CONTEXT = "http://localhost/context/cache";
 
@@ -110,13 +104,6 @@ public class LDCacheKiWiTest {
 
     private String jdbcPass;
 
-    private KiWiStore store;
-
-    private LDCachingKiWiBackend backend;
-
-    private Repository repository;
-
-    private LDCache ldcache;
 
     public LDCacheKiWiTest(String database, String jdbcUrl, String jdbcUser, String jdbcPass) {
         this.jdbcPass = jdbcPass;
@@ -133,175 +120,49 @@ public class LDCacheKiWiTest {
     }
 
 
-    @Before
-    public void initDatabase() throws RepositoryException {
-        store = new KiWiStore("test",jdbcUrl,jdbcUser,jdbcPass,dialect, "http://localhost/context/default", "http://localhost/context/inferred");
-        repository = new SailRepository(store);
-        repository.initialize();
-
-        backend = new LDCachingKiWiBackend(store, CACHE_CONTEXT);
-        backend.initialize();
-
-        ldcache = new LDCache(new CacheConfiguration(),backend);
-    }
-
-    @After
-    public void dropDatabase() throws RepositoryException, SQLException {
-        backend.getPersistence().dropDatabase();
-        store.getPersistence().dropDatabase();
-        backend.shutdown();
-        repository.shutDown();
-    }
-
-
     /**
-     * Test retrieving and caching some resources (provided by DummyProvider).
+     * Needs to be implemented by tests to provide the correct backend. Backend needs to be properly initialised.
+     *
+     * @return
      */
-    @Test
-    public void textCacheResources() throws Exception {
-        String uri1 = "http://localhost/resource1";
-        String uri2 = "http://localhost/resource2";
-        String uri3 = "http://localhost/resource3";
-
-        ldcache.refreshResource(repository.getValueFactory().createURI(uri1),false);
-
-        Assert.assertEquals(1,asList(ldcache.listCacheEntries()).size());
-
-        RepositoryConnection con1 = ldcache.getCacheConnection(uri1);
+    @Override
+    protected LDCachingBackend createBackend() {
         try {
-            con1.begin();
-            Assert.assertEquals(3, asList(con1.getStatements(con1.getValueFactory().createURI(uri1), null, null, false)).size());
-            con1.commit();
-        } finally {
-            con1.close();
-        }
+            KiWiStore store = new KiWiStore("test",jdbcUrl,jdbcUser,jdbcPass,dialect, "http://localhost/context/default", "http://localhost/context/inferred");
+            final Repository repository = new SailRepository(store);
+            repository.initialize();
 
-        ldcache.refreshResource(repository.getValueFactory().createURI(uri2),false);
+            LDCachingKiWiBackend backend = new LDCachingKiWiBackend(repository, CACHE_CONTEXT) {
+                /**
+                 * Shutdown the backend and free all runtime resources.
+                 */
+                @Override
+                public void shutdown() {
 
-        Assert.assertEquals(2,asList(ldcache.listCacheEntries()).size());
+                    try {
+                        persistence.dropDatabase();
+                        store.getPersistence().dropDatabase();
 
-        RepositoryConnection con2 = ldcache.getCacheConnection(uri2);
-        try {
-            con2.begin();
-            Assert.assertEquals(2, asList(con2.getStatements(con2.getValueFactory().createURI(uri2), null, null, false)).size());
-            con2.commit();
-        } finally {
-            con2.close();
-        }
+                        super.shutdown();
 
-        ldcache.refreshResource(repository.getValueFactory().createURI(uri3),false);
+                        repository.shutDown();
+                    } catch (Exception e) { }
+                }
+            };
+            backend.initialize();
 
-        Assert.assertEquals(3,asList(ldcache.listCacheEntries()).size());
 
-        RepositoryConnection con3 = ldcache.getCacheConnection(uri3);
-        try {
-            con3.begin();
-            Assert.assertEquals(2, asList(con3.getStatements(con3.getValueFactory().createURI(uri3), null, null, false)).size());
-            con3.commit();
-        } finally {
-            con3.close();
+            return backend;
+        } catch (RepositoryException e) {
+            throw new AssertionError(e);
         }
     }
 
 
-    /**
-     * Test retrieving and caching some resources (provided by DummyProvider).
-     */
-    @Test
-    public void textExpire() throws Exception {
-        String uri1 = "http://localhost/resource1";
-        String uri2 = "http://localhost/resource2";
-        String uri3 = "http://localhost/resource3";
-
-        ldcache.refreshResource(repository.getValueFactory().createURI(uri1),false);
-        ldcache.refreshResource(repository.getValueFactory().createURI(uri2),false);
-        ldcache.refreshResource(repository.getValueFactory().createURI(uri3),false);
-
-        Assert.assertEquals(3,asList(ldcache.listCacheEntries()).size());
-        Assert.assertEquals(0,asList(ldcache.listExpiredEntries()).size());
-
-        ldcache.expire(repository.getValueFactory().createURI(uri1));
-
-        mysqlSleep();
-
-        Assert.assertEquals(1,asList(ldcache.listExpiredEntries()).size());
-
-        ldcache.refreshExpired();
-
-        mysqlSleep();
 
-        Assert.assertEquals(0,asList(ldcache.listExpiredEntries()).size());
-
-    }
-
-    /**
-     * Test retrieving and caching some resources (provided by DummyProvider).
-     */
+    @Override
     @Test
-    public void textExpireAll() throws Exception {
-        String uri1 = "http://localhost/resource1";
-        String uri2 = "http://localhost/resource2";
-        String uri3 = "http://localhost/resource3";
-
-        ldcache.refreshResource(repository.getValueFactory().createURI(uri1),false);
-        ldcache.refreshResource(repository.getValueFactory().createURI(uri2),false);
-        ldcache.refreshResource(repository.getValueFactory().createURI(uri3),false);
-
-        Assert.assertEquals(3,asList(ldcache.listCacheEntries()).size());
-        Assert.assertEquals(0,asList(ldcache.listExpiredEntries()).size());
-
-        ldcache.expireAll();
-
-        mysqlSleep();
-
-        Assert.assertEquals(3,asList(ldcache.listExpiredEntries()).size());
-
-        ldcache.refreshExpired();
-
-        mysqlSleep();
-
-        Assert.assertEquals(0,asList(ldcache.listExpiredEntries()).size());
-
-    }
-
-
-    /*
-     * MYSQL rounds timestamps to the second, so it is sometimes necessary to sleep before doing a test
-     */
-    private  void mysqlSleep() {
-        if(this.dialect instanceof MySQLDialect) {
-            try {
-                Thread.sleep(1000);
-            } catch (InterruptedException e) {
-            }
-        } else {
-            try {
-                Thread.sleep(100);
-            } catch (InterruptedException e) {
-            }
-        }
-    }
-
-    /**
-     * Workaround for https://openrdf.atlassian.net/browse/SES-1702 in Sesame 2.7.0-beta1
-     * @param <E>
-     * @return
-     */
-    public static <E,X extends Exception> List<E> asList(CloseableIteration<E,X> result) throws RepositoryException {
-        ArrayList<E> collection = new ArrayList<E>();
-        try {
-            try {
-                while (result.hasNext()) {
-                    collection.add(result.next());
-                }
-
-                return collection;
-            } finally {
-                result.close();
-            }
-        } catch(Throwable ex) {
-            throw new RepositoryException(ex);
-        }
+    @Ignore("does not work due to a bug in Sesame (SES-1993)")
+    public void testGeonames() throws Exception {
     }
-
 }