Search in sources :

Example 1 with StmtIteratorImpl

use of org.apache.jena.rdf.model.impl.StmtIteratorImpl in project jena by apache.

the class SecuredModelImpl method add.

/**
 * @sec.graph Update
 * @sec.triple Create all the statements as triples.
 * @throws UpdateDeniedException
 * @throws AddDeniedException
 * @throws AuthenticationRequiredException if user is not authenticated and is
 *                                         required to be.
 */
@Override
public SecuredModel add(final StmtIterator iter) throws UpdateDeniedException, AddDeniedException, AuthenticationRequiredException {
    checkUpdate();
    StmtIterator updateFrom = iter;
    if (!canCreate(Triple.ANY)) {
        // checkCreate will throw exception on first failure
        List<Statement> stmt = iter.filterKeep(s -> {
            checkCreate(s);
            return true;
        }).toList();
        // now just add the list to the base
        updateFrom = new StmtIteratorImpl(stmt.iterator());
    }
    holder.getBaseItem().add(updateFrom);
    return holder.getSecuredItem();
}
Also used : Arrays(java.util.Arrays) AuthenticationRequiredException(org.apache.jena.shared.AuthenticationRequiredException) Lock(org.apache.jena.shared.Lock) RDF(org.apache.jena.vocabulary.RDF) NodeFactory(org.apache.jena.graph.NodeFactory) URL(java.net.URL) NsIteratorImpl(org.apache.jena.rdf.model.impl.NsIteratorImpl) SecuredGraph(org.apache.jena.permissions.graph.SecuredGraph) RDFNode(org.apache.jena.rdf.model.RDFNode) Model(org.apache.jena.rdf.model.Model) AnonId(org.apache.jena.rdf.model.AnonId) WrappedIterator(org.apache.jena.util.iterator.WrappedIterator) ReifiedStatement(org.apache.jena.rdf.model.ReifiedStatement) AddDeniedException(org.apache.jena.shared.AddDeniedException) Map(java.util.Map) SecuredAlt(org.apache.jena.permissions.model.SecuredAlt) UpdateDeniedException(org.apache.jena.shared.UpdateDeniedException) ModelChangedListener(org.apache.jena.rdf.model.ModelChangedListener) SecuredItem(org.apache.jena.permissions.SecuredItem) SecuredRDFNode(org.apache.jena.permissions.model.SecuredRDFNode) StmtIterator(org.apache.jena.rdf.model.StmtIterator) ResourceF(org.apache.jena.rdf.model.ResourceF) WrappedIOException(org.apache.jena.shared.WrappedIOException) Predicate(java.util.function.Predicate) Triple(org.apache.jena.graph.Triple) RDFWriterI(org.apache.jena.rdf.model.RDFWriterI) Reader(java.io.Reader) NsIterator(org.apache.jena.rdf.model.NsIterator) List(java.util.List) Selector(org.apache.jena.rdf.model.Selector) SecuredBag(org.apache.jena.permissions.model.SecuredBag) CollectionGraph(org.apache.jena.graph.impl.CollectionGraph) Writer(java.io.Writer) DeleteDeniedException(org.apache.jena.shared.DeleteDeniedException) RDFDatatype(org.apache.jena.datatypes.RDFDatatype) SecuredPrefixMapping(org.apache.jena.permissions.graph.SecuredPrefixMapping) ModelFactory(org.apache.jena.rdf.model.ModelFactory) RSIterator(org.apache.jena.rdf.model.RSIterator) SecuredReifiedStatement(org.apache.jena.permissions.model.SecuredReifiedStatement) RDFReaderI(org.apache.jena.rdf.model.RDFReaderI) SecuredRDFList(org.apache.jena.permissions.model.SecuredRDFList) RDFReaderF(org.apache.jena.rdf.model.RDFReaderF) SecuredSeq(org.apache.jena.permissions.model.SecuredSeq) AccessDeniedException(org.apache.jena.shared.AccessDeniedException) HashMap(java.util.HashMap) SecuredItemImpl(org.apache.jena.permissions.impl.SecuredItemImpl) SecuredProperty(org.apache.jena.permissions.model.SecuredProperty) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) Statement(org.apache.jena.rdf.model.Statement) Calendar(java.util.Calendar) NiceIterator(org.apache.jena.util.iterator.NiceIterator) Resource(org.apache.jena.rdf.model.Resource) StmtIteratorImpl(org.apache.jena.rdf.model.impl.StmtIteratorImpl) PropertyNotFoundException(org.apache.jena.shared.PropertyNotFoundException) ResourceFactory(org.apache.jena.rdf.model.ResourceFactory) OutputStream(java.io.OutputStream) SecurityEvaluator(org.apache.jena.permissions.SecurityEvaluator) SecuredResource(org.apache.jena.permissions.model.SecuredResource) Iterator(java.util.Iterator) ReadDeniedException(org.apache.jena.shared.ReadDeniedException) IOException(java.io.IOException) SecuredLiteral(org.apache.jena.permissions.model.SecuredLiteral) PrefixMapping(org.apache.jena.shared.PrefixMapping) SecuredModel(org.apache.jena.permissions.model.SecuredModel) SecuredItemInvoker(org.apache.jena.permissions.impl.SecuredItemInvoker) Node(org.apache.jena.graph.Node) Literal(org.apache.jena.rdf.model.Literal) RDFReaderFImpl(org.apache.jena.rdf.model.impl.RDFReaderFImpl) SecuredStatement(org.apache.jena.permissions.model.SecuredStatement) ItemHolder(org.apache.jena.permissions.impl.ItemHolder) ExtendedIterator(org.apache.jena.util.iterator.ExtendedIterator) Collections(java.util.Collections) Property(org.apache.jena.rdf.model.Property) InputStream(java.io.InputStream) StmtIterator(org.apache.jena.rdf.model.StmtIterator) ReifiedStatement(org.apache.jena.rdf.model.ReifiedStatement) SecuredReifiedStatement(org.apache.jena.permissions.model.SecuredReifiedStatement) Statement(org.apache.jena.rdf.model.Statement) SecuredStatement(org.apache.jena.permissions.model.SecuredStatement) StmtIteratorImpl(org.apache.jena.rdf.model.impl.StmtIteratorImpl)

Aggregations

IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 Reader (java.io.Reader)1 Writer (java.io.Writer)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Calendar (java.util.Calendar)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Predicate (java.util.function.Predicate)1 Supplier (java.util.function.Supplier)1 RDFDatatype (org.apache.jena.datatypes.RDFDatatype)1 Node (org.apache.jena.graph.Node)1 NodeFactory (org.apache.jena.graph.NodeFactory)1 Triple (org.apache.jena.graph.Triple)1