[ https://issues.apache.org/jira/browse/JENA-1594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16594778#comment-16594778 ]
ASF GitHub Bot commented on JENA-1594: -------------------------------------- Github user rvesse commented on a diff in the pull request: https://github.com/apache/jena/pull/465#discussion_r213249005 --- Diff: jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphFilteredView.java --- @@ -0,0 +1,159 @@ +/* + * 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.core; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.function.Predicate; + +import org.apache.jena.atlas.iterator.Iter; +import org.apache.jena.atlas.logging.Log; +import org.apache.jena.graph.Graph; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.graph.GraphReadOnly; +import org.apache.jena.sparql.graph.GraphUnionRead; + +/** + * A read-only {@link DatasetGraph} that applies a filter testing all triples and quads + * returned by accessing the data. Only quads where the filter tests for "true" are exposed. + */ +public class DatasetGraphFilteredView extends DatasetGraphReadOnly implements DatasetGraphWrapperView { + /* + Write operations + add(Quad) + delete(Quad) + add(Node, Node, Node, Node) + delete(Node, Node, Node, Node) + deleteAny(Node, Node, Node, Node) + clear() + + Read operations + listGraphNodes() + isEmpty() + find() + find(Quad) + find(Node, Node, Node, Node) + findNG(Node, Node, Node, Node) + contains(Quad) + contains(Node, Node, Node, Node) + size() + toString() + + Graph operations + listGraphNodes() + getGraph(Node) + getDefaultGraph() + containsGraph(Node) + */ + + private final Predicate<Quad> quadFilter; + private final Collection<Node> visibleGraphs; + + public DatasetGraphFilteredView(DatasetGraph dsg, Predicate<Quad> filter, Collection<Node> visibleGraphs) { + super(dsg); + this.quadFilter = filter; + if ( visibleGraphs.contains(Quad.defaultGraphIRI) || visibleGraphs.contains(Quad.defaultGraphNodeGenerated) ) { + Log.warn(DatasetGraphFilteredView.class, "default graph Node in visibleGraphs colelction - fix up applied"); --- End diff -- Typo -> `colelction` > Provide per-graph access control in Fuseki > ------------------------------------------ > > Key: JENA-1594 > URL: https://issues.apache.org/jira/browse/JENA-1594 > Project: Apache Jena > Issue Type: Task > Components: Fuseki > Affects Versions: Jena 3.8.0 > Reporter: Andy Seaborne > Assignee: Andy Seaborne > Priority: Major > > This will be for TDB1 and TDB2 only. They provide a [filter > mechanism|https://jena.apache.org/documentation/tdb/quadfilter.html] so that > triples and quads are filtered out at the lowest level. > This first version of data security will be for a data-access controlled > read-only service. The expectation is that updates happens via a different > Fuseki service sharing the same database and that service is service-access > controlled (i.e all or nothing access). > The data-access controlled service takes a security configuration of a > collection of graph names. Only those graph are visible through the > data-access controlled service. > For the union default graph, it is the union of visible graph only. -- This message was sent by Atlassian JIRA (v7.6.3#76005)