Github user ajs6f commented on a diff in the pull request:
https://github.com/apache/jena/pull/337#discussion_r159527929
--- Diff:
jena-arq/src/main/java/org/apache/jena/sparql/util/ViewDatasetGraph.java ---
@@ -0,0 +1,225 @@
+/*
+ * 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.jena.sparql.util;
+
+import static java.util.Objects.requireNonNull;
+import static org.apache.jena.atlas.iterator.Iter.count;
+import static org.apache.jena.atlas.iterator.Iter.map;
+import static
org.apache.jena.ext.com.google.common.collect.Iterators.concat;
+import static org.apache.jena.graph.Node.ANY;
+import static org.apache.jena.query.ReadWrite.READ;
+import static org.apache.jena.sparql.core.Quad.defaultGraphIRI;
+import static org.apache.jena.sparql.util.graph.GraphUtils.triples2quads;
+
+import java.util.Iterator;
+
+import org.apache.jena.atlas.lib.Pair;
+import org.apache.jena.graph.Graph;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.compose.MultiUnion;
+import org.apache.jena.query.ReadWrite;
+import org.apache.jena.shared.Lock;
+import org.apache.jena.sparql.core.DatasetGraph;
+import org.apache.jena.sparql.core.Quad;
+
+public abstract class ViewDatasetGraph extends
Pair.OfSameType<DatasetGraph> implements DatasetGraph {
+
+ private Context context;
+
+ private final Lock lock;
+
+ public ViewDatasetGraph(DatasetGraph left, DatasetGraph right, Context
c) {
+ super(requireNonNull(left), requireNonNull(right));
+ this.context = requireNonNull(c);
+ this.lock = new PairLock(left.getLock(), right.getLock());
+ }
+
+ protected static void throwNoMutationAllowed() {
+ throw new UnsupportedOperationException("This view does not allow
mutation!");
+ }
+
+ @Override
+ public void commit() {
+ throwNoMutationAllowed();
+ }
+
+ @Override
+ public void begin(ReadWrite readWrite) {
+ switch (readWrite) {
+ case WRITE:
+ throwNoMutationAllowed();
+ case READ:
+ forEach(dsg -> dsg.begin(READ));
--- End diff --
Done.
---