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/05/23 10:55:59 UTC
[1/2] git commit: added local filter to not cached filter - local
resources are never cached
Updated Branches:
refs/heads/develop 2222cc2b5 -> c7cb76dfc
added local filter to not cached filter - local resources are never cached
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/f2513c23
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/f2513c23
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/f2513c23
Branch: refs/heads/develop
Commit: f2513c238d2a0db91225339b5cac575ebbe8022f
Parents: 2222cc2
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Thu May 23 10:44:41 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Thu May 23 10:44:41 2013 +0200
----------------------------------------------------------------------
.../model/filter/MarmottaNotCachedFilter.java | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/f2513c23/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/model/filter/MarmottaNotCachedFilter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/model/filter/MarmottaNotCachedFilter.java b/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/model/filter/MarmottaNotCachedFilter.java
index 072da16..cd6ae95 100644
--- a/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/model/filter/MarmottaNotCachedFilter.java
+++ b/platform/marmotta-ldcache/src/main/java/org/apache/marmotta/platform/ldcache/model/filter/MarmottaNotCachedFilter.java
@@ -18,6 +18,7 @@
package org.apache.marmotta.platform.ldcache.model.filter;
import org.apache.marmotta.commons.sesame.filter.resource.ResourceFilter;
+import org.apache.marmotta.platform.core.model.filter.MarmottaLocalFilter;
import org.apache.marmotta.platform.core.util.CDIContext;
import org.apache.marmotta.platform.ldcache.services.ldcache.LDCacheSailProvider;
import org.openrdf.model.BNode;
@@ -33,9 +34,11 @@ import org.openrdf.repository.RepositoryException;
public class MarmottaNotCachedFilter implements ResourceFilter {
private LDCacheSailProvider cacheSailProvider;
+ private MarmottaLocalFilter marmottaLocalFilter;
public MarmottaNotCachedFilter() {
cacheSailProvider = CDIContext.getInstance(LDCacheSailProvider.class);
+ marmottaLocalFilter = CDIContext.getInstance(MarmottaLocalFilter.class);
}
@@ -65,6 +68,10 @@ public class MarmottaNotCachedFilter implements ResourceFilter {
return true;
}
+ if(marmottaLocalFilter.accept(resource)) {
+ return true;
+ }
+
URI uri = (URI)resource;
try {
[2/2] git commit: fixed a misbehaviour in isCached in LDCache: it
will now also return false in case there are no cached triples
Posted by ss...@apache.org.
fixed a misbehaviour in isCached in LDCache: it will now also return false in case there are no cached triples
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/c7cb76df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/c7cb76df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/c7cb76df
Branch: refs/heads/develop
Commit: c7cb76dfce4395e1afe09e5e3fbab57155f20bdb
Parents: f2513c2
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Thu May 23 10:55:48 2013 +0200
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Thu May 23 10:55:48 2013 +0200
----------------------------------------------------------------------
.../apache/marmotta/ldcache/services/LDCache.java | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/c7cb76df/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
----------------------------------------------------------------------
diff --git a/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java b/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
index c137f2a..8d78aa6 100644
--- a/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
+++ b/libraries/ldcache/ldcache-core/src/main/java/org/apache/marmotta/ldcache/services/LDCache.java
@@ -136,7 +136,20 @@ public class LDCache implements LDCachingService {
* @throws RepositoryException
*/
public boolean isCached(String resourceUri) throws RepositoryException {
- return backend.isCached(resourceUri);
+ // if there is no cache entry, then return false in any case
+ if(!backend.isCached(resourceUri)) {
+ return false;
+ } else {
+ // else list all cached triples - if there are none, the resource is not cached (e.g. blacklist or no LD resource)
+ RepositoryConnection con = backend.getCacheConnection(resourceUri);
+ try {
+ con.begin();
+ return con.hasStatement(con.getValueFactory().createURI(resourceUri), null, null, false);
+ } finally {
+ con.commit();
+ con.close();
+ }
+ }
}
/**