You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by en...@apache.org on 2014/02/07 00:04:02 UTC
git commit: CLEREZZA-873 Added in memory mgraphs to the list of
available graphs. This allows to have empty graphs in these lists even if
they do not exist in the storage.
Updated Branches:
refs/heads/master 40de7d4f5 -> 26bffb67e
CLEREZZA-873 Added in memory mgraphs to the list of available graphs. This allows to have empty graphs in these lists even if they do not exist in the storage.
Project: http://git-wip-us.apache.org/repos/asf/clerezza/repo
Commit: http://git-wip-us.apache.org/repos/asf/clerezza/commit/26bffb67
Tree: http://git-wip-us.apache.org/repos/asf/clerezza/tree/26bffb67
Diff: http://git-wip-us.apache.org/repos/asf/clerezza/diff/26bffb67
Branch: refs/heads/master
Commit: 26bffb67e2517f428211a9a1a013395f4f08136b
Parents: 40de7d4
Author: enridaga <en...@apache.org>
Authored: Thu Feb 6 23:03:54 2014 +0000
Committer: enridaga <en...@apache.org>
Committed: Thu Feb 6 23:03:54 2014 +0000
----------------------------------------------------------------------
.../access/VirtuosoWeightedProvider.java | 2 ++
.../access/VirtuosoWeightedProviderTest.java | 26 ++++++++++++++++++++
2 files changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/clerezza/blob/26bffb67/clerezza-virtuoso/rdf.virtuoso.storage/src/main/java/rdf/virtuoso/storage/access/VirtuosoWeightedProvider.java
----------------------------------------------------------------------
diff --git a/clerezza-virtuoso/rdf.virtuoso.storage/src/main/java/rdf/virtuoso/storage/access/VirtuosoWeightedProvider.java b/clerezza-virtuoso/rdf.virtuoso.storage/src/main/java/rdf/virtuoso/storage/access/VirtuosoWeightedProvider.java
index d97556a..626c561 100644
--- a/clerezza-virtuoso/rdf.virtuoso.storage/src/main/java/rdf/virtuoso/storage/access/VirtuosoWeightedProvider.java
+++ b/clerezza-virtuoso/rdf.virtuoso.storage/src/main/java/rdf/virtuoso/storage/access/VirtuosoWeightedProvider.java
@@ -422,6 +422,8 @@ public class VirtuosoWeightedProvider implements WeightedTcProvider {
public Set<UriRef> listGraphs() {
logger.debug("listGraphs()");
Set<UriRef> graphs = new HashSet<UriRef>();
+ // XXX Add the active (possibly empty) mgraphs
+ graphs.addAll(this.graphs.keySet());
// Returns the list of graphs in the virtuoso quad store
String SQL = "SPARQL SELECT DISTINCT ?G WHERE {GRAPH ?G {?S ?P ?O} }";
VirtuosoConnection connection = null;
http://git-wip-us.apache.org/repos/asf/clerezza/blob/26bffb67/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/VirtuosoWeightedProviderTest.java
----------------------------------------------------------------------
diff --git a/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/VirtuosoWeightedProviderTest.java b/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/VirtuosoWeightedProviderTest.java
index 5757049..e5dfc8e 100644
--- a/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/VirtuosoWeightedProviderTest.java
+++ b/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/VirtuosoWeightedProviderTest.java
@@ -32,11 +32,13 @@ import org.apache.clerezza.rdf.core.NonLiteral;
import org.apache.clerezza.rdf.core.PlainLiteral;
import org.apache.clerezza.rdf.core.Resource;
import org.apache.clerezza.rdf.core.Triple;
+import org.apache.clerezza.rdf.core.TripleCollection;
import org.apache.clerezza.rdf.core.UriRef;
import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
import org.junit.After;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
@@ -257,4 +259,28 @@ public class VirtuosoWeightedProviderTest {
// Nothing to do
}
}
+
+ @Test
+ public void testCreateEmptyMGraph(){
+ log.info("testCreateEmptyMGraph()");
+ if (TestUtils.SKIP) {
+ log.warn("SKIPPED");
+ return;
+ }
+ try {
+ UriRef ur = new UriRef("urn:my-empty-graph");
+ Assert.assertFalse(wp.listGraphs().contains(ur));
+ Assert.assertFalse(wp.listMGraphs().contains(ur));
+ wp.createMGraph(ur);
+ Assert.assertTrue(wp.canRead(ur));
+ Assert.assertTrue(wp.canModify(ur));
+ Assert.assertTrue(wp.listGraphs().contains(ur));
+ Assert.assertTrue(wp.listMGraphs().contains(ur));
+ wp.deleteTripleCollection(ur);
+ Assert.assertFalse(wp.listGraphs().contains(ur));
+ Assert.assertFalse(wp.listMGraphs().contains(ur));
+ } catch (NoSuchEntityException nsee) {
+ // Nothing to do
+ }
+ }
}