jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sal...@apache.org
Subject svn commit: r1393706 - /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNull.java
Date Wed, 03 Oct 2012 19:21:07 GMT
Author: sallen
Date: Wed Oct  3 19:21:07 2012
New Revision: 1393706

URL: http://svn.apache.org/viewvc?rev=1393706&view=rev
Log:
Add GraphStoreNull, which accepts quads and throws them away.

Added:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNull.java

Added: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNull.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNull.java?rev=1393706&view=auto
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNull.java (added)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/GraphStoreNull.java Wed
Oct  3 19:21:07 2012
@@ -0,0 +1,81 @@
+package com.hp.hpl.jena.sparql.modify;
+
+import java.util.Iterator ;
+
+import org.openjena.atlas.iterator.Iter ;
+
+import com.hp.hpl.jena.graph.Graph ;
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.graph.TripleMatch ;
+import com.hp.hpl.jena.graph.impl.GraphBase ;
+import com.hp.hpl.jena.query.Dataset ;
+import com.hp.hpl.jena.query.DatasetFactory ;
+import com.hp.hpl.jena.sparql.core.DatasetGraphQuad ;
+import com.hp.hpl.jena.sparql.core.Quad ;
+import com.hp.hpl.jena.update.GraphStore ;
+import com.hp.hpl.jena.update.UpdateRequest ;
+import com.hp.hpl.jena.util.iterator.ExtendedIterator ;
+import com.hp.hpl.jena.util.iterator.NullIterator ;
+
+/**
+ * A black hole for Quads, add as many as you want and it will forget them all.  Useful for
testing.
+ */
+public class GraphStoreNull extends DatasetGraphQuad implements GraphStore
+{
+    // The baby brother
+    private static final Graph GRAPH_NULL = new GraphBase()
+    {
+        @Override
+        protected ExtendedIterator<Triple> graphBaseFind(TripleMatch m)
+        {
+            return NullIterator.instance();
+        }
+    };
+
+    @Override
+    public Iterator<Quad> find(Node g, Node s, Node p, Node o)
+    {
+        return Iter.nullIterator();
+    }
+
+    @Override
+    public Iterator<Quad> findNG(Node g, Node s, Node p, Node o)
+    {
+        return Iter.nullIterator();
+    }
+
+    @Override
+    public void add(Quad quad)
+    { }
+
+    @Override
+    public void delete(Quad quad)
+    { }
+
+    @Override
+    public Graph getDefaultGraph()
+    {
+        return GRAPH_NULL ;
+    }
+
+    @Override
+    public Graph getGraph(Node graphNode)
+    {
+        return GRAPH_NULL ;
+    }
+
+    @Override
+    public Dataset toDataset()
+    {
+        return DatasetFactory.create(this);
+    }
+
+    @Override
+    public void startRequest(UpdateRequest request)
+    { }
+
+    @Override
+    public void finishRequest(UpdateRequest request)
+    { }
+}



Mime
View raw message