Updated Branches: refs/heads/develop 9fc4a5eb4 -> aaf499a1c
add a function to LDCache that allows to retrieve a resource into a model Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/5276f0db Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/5276f0db Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/5276f0db Branch: refs/heads/develop Commit: 5276f0db98b6b3650484c3498566daa8dd44051e Parents: 33262e0 Author: Sebastian Schaffert <[email protected]> Authored: Thu Jan 9 17:33:54 2014 +0100 Committer: Sebastian Schaffert <[email protected]> Committed: Thu Jan 9 17:33:54 2014 +0100 ---------------------------------------------------------------------- .../marmotta/kiwi/caching/KiWiCacheManager.java | 2 + .../marmotta/ldcache/services/LDCache.java | 34 +++++++++++++++++ parent/pom.xml | 39 ++++++++++++++++++++ .../core/services/cache/CachingServiceImpl.java | 2 + 4 files changed, 77 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/5276f0db/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java index 84ca5db..43cd331 100644 --- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java +++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/KiWiCacheManager.java @@ -110,6 +110,8 @@ public class KiWiCacheManager { .numOwners(2) .numSegments(40) .consistentHashFactory(new SyncConsistentHashFactory()) + .stateTransfer() + .fetchInMemoryState(false) .eviction() .strategy(EvictionStrategy.LIRS) .maxEntries(100000) http://git-wip-us.apache.org/repos/asf/marmotta/blob/5276f0db/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 d28a571..a01842f 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 @@ -28,8 +28,10 @@ import org.apache.marmotta.ldclient.api.ldclient.LDClientService; import org.apache.marmotta.ldclient.exception.DataRetrievalException; import org.apache.marmotta.ldclient.model.ClientResponse; import org.apache.marmotta.ldclient.services.ldclient.LDClient; +import org.openrdf.model.Model; import org.openrdf.model.Statement; import org.openrdf.model.URI; +import org.openrdf.model.impl.TreeModel; import org.openrdf.repository.RepositoryConnection; import org.openrdf.repository.RepositoryException; import org.openrdf.repository.RepositoryResult; @@ -185,6 +187,38 @@ public class LDCache implements LDCachingService { } + + /** + * Return the triples for the linked data resource given as argument. Will transparently retrieve triples from + * remote servers if needed or retrieve them from the cache. + * + * @param resource + * @return + * @throws RepositoryException + */ + public Model get(URI resource) throws RepositoryException { + refreshResource(resource,false); + + Model m = new TreeModel(); + + LDCachingConnection c = getCacheConnection(resource.stringValue()); + try { + c.begin(); + RepositoryResult<Statement> triples = c.getStatements(resource,null,null,false); + try { + while(triples.hasNext()) { + m.add(triples.next()); + } + } finally { + triples.close(); + } + } finally { + c.close(); + } + return m; + + } + /** * Refresh the cached resource passed as argument. The method will do nothing for local * resources. http://git-wip-us.apache.org/repos/asf/marmotta/blob/5276f0db/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index 1f2f4e7..44480c9 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -989,6 +989,45 @@ <version>6.0.1.Final</version> </dependency> + <!-- use stable versions for some dependencies --> + <dependency> + <groupId>org.jboss.spec.javax.annotation</groupId> + <artifactId>jboss-annotations-api_1.2_spec</artifactId> + <version>1.0.0.Final</version> + </dependency> + <dependency> + <groupId>org.jboss.spec.javax.annotation</groupId> + <artifactId>jboss-annotations-api_1.1_spec</artifactId> + <version>1.0.1.Final</version> + </dependency> + <dependency> + <groupId>org.jboss.spec.javax.interceptor</groupId> + <artifactId>jboss-interceptors-api_1.2_spec</artifactId> + <version>1.0.0.Final</version> + </dependency> + <dependency> + <groupId>org.jboss.spec.javax.interceptor</groupId> + <artifactId>jboss-interceptors-api_1.1_spec</artifactId> + <version>1.0.1.Final</version> + </dependency> + <dependency> + <groupId>org.jboss.marshalling</groupId> + <artifactId>jboss-marshalling</artifactId> + <version>1.4.3.Final</version> + </dependency> + <dependency> + <groupId>org.jboss.marshalling</groupId> + <artifactId>jboss-marshalling-river</artifactId> + <version>1.4.3.Final</version> + </dependency> + <!-- + <dependency> + <groupId>org.jboss.netty</groupId> + <artifactId>netty</artifactId> + <version>3.2.10.Final</version> + </dependency> + --> + <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> http://git-wip-us.apache.org/repos/asf/marmotta/blob/5276f0db/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java ---------------------------------------------------------------------- diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java index feceaa0..67f14cc 100644 --- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java +++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java @@ -103,6 +103,8 @@ public class CachingServiceImpl implements CachingService { .numOwners(2) .numSegments(40) .consistentHashFactory(new SyncConsistentHashFactory()) + .stateTransfer() + .fetchInMemoryState(false) .eviction() .strategy(EvictionStrategy.LIRS) .maxEntries(10000)
