Search in sources :

Example 61 with Triple

use of org.apache.jena.graph.Triple in project jena by apache.

the class SecuredModelImpl method getBag.

@Override
public SecuredBag getBag(final Resource r) throws ReadDeniedException, AuthenticationRequiredException {
    checkRead();
    checkRead(new Triple(r.asNode(), RDF.type.asNode(), RDF.Bag.asNode()));
    return SecuredBagImpl.getInstance(holder.getSecuredItem(), holder.getBaseItem().getBag(r));
}
Also used : Triple(org.apache.jena.graph.Triple)

Example 62 with Triple

use of org.apache.jena.graph.Triple in project jena by apache.

the class SecuredModelImpl method remove.

@Override
public SecuredModel remove(final Resource s, final Property p, final RDFNode o) throws UpdateDeniedException, DeleteDeniedException, AuthenticationRequiredException {
    checkUpdate();
    checkDelete(new Triple(s.asNode(), p.asNode(), o.asNode()));
    holder.getBaseItem().remove(s, p, o);
    return holder.getSecuredItem();
}
Also used : Triple(org.apache.jena.graph.Triple)

Example 63 with Triple

use of org.apache.jena.graph.Triple in project jena by apache.

the class SecuredModelImpl method createBag.

@Override
public SecuredBag createBag() throws UpdateDeniedException, AddDeniedException, AuthenticationRequiredException {
    checkUpdate();
    checkCreate(new Triple(SecurityEvaluator.FUTURE, RDF.type.asNode(), RDF.Bag.asNode()));
    return SecuredBagImpl.getInstance(holder.getSecuredItem(), holder.getBaseItem().createBag());
}
Also used : Triple(org.apache.jena.graph.Triple)

Example 64 with Triple

use of org.apache.jena.graph.Triple in project jena by apache.

the class SecuredModelImpl method createResource.

@Override
public SecuredResource createResource(final String uri, final Resource type) throws UpdateDeniedException, AddDeniedException, AuthenticationRequiredException {
    final Resource r = ResourceFactory.createResource(uri);
    final Triple t = new Triple(r.asNode(), RDF.type.asNode(), type.asNode());
    if (holder.getBaseItem().contains(r, RDF.type, type)) {
        checkRead();
        checkRead(t);
    } else {
        checkUpdate();
        checkCreate(t);
    }
    return SecuredResourceImpl.getInstance(holder.getSecuredItem(), holder.getBaseItem().createResource(uri, type));
}
Also used : Triple(org.apache.jena.graph.Triple)

Example 65 with Triple

use of org.apache.jena.graph.Triple in project jena by apache.

the class SecuredModelImpl method removeAllReifications.

@Override
public void removeAllReifications(final Statement s) throws UpdateDeniedException, DeleteDeniedException, AuthenticationRequiredException {
    checkUpdate();
    if (canDelete(new Triple(Node.ANY, RDF.subject.asNode(), wildCardNode(s.getSubject()))) && canDelete(new Triple(Node.ANY, RDF.predicate.asNode(), wildCardNode(s.getPredicate()))) && canDelete(new Triple(Node.ANY, RDF.object.asNode(), wildCardNode(s.getObject())))) {
        holder.getBaseItem().removeAllReifications(s);
    } else {
        final RSIterator iter = holder.getBaseItem().listReifiedStatements(s);
        try {
            while (iter.hasNext()) {
                final ReifiedStatement rs = iter.next();
                checkDelete(new Triple(rs.asNode(), RDF.subject.asNode(), wildCardNode(s.getSubject())));
                checkDelete(new Triple(rs.asNode(), RDF.predicate.asNode(), wildCardNode(s.getPredicate())));
                checkDelete(new Triple(rs.asNode(), RDF.object.asNode(), wildCardNode(s.getObject())));
            }
            holder.getBaseItem().removeAllReifications(s);
        } finally {
            iter.close();
        }
    }
}
Also used : Triple(org.apache.jena.graph.Triple)

Aggregations

Triple (org.apache.jena.graph.Triple)407 Test (org.junit.Test)139 Node (org.apache.jena.graph.Node)95 BaseTest (org.apache.jena.atlas.junit.BaseTest)66 Graph (org.apache.jena.graph.Graph)54 Quad (org.apache.jena.sparql.core.Quad)25 TriplePath (org.apache.jena.sparql.core.TriplePath)22 ArrayList (java.util.ArrayList)20 StatsMatcher (org.apache.jena.sparql.engine.optimizer.StatsMatcher)19 Var (org.apache.jena.sparql.core.Var)17 TripleWritable (org.apache.jena.hadoop.rdf.types.TripleWritable)15 Model (org.apache.jena.rdf.model.Model)13 TriplePattern (org.apache.jena.reasoner.TriplePattern)13 Op (org.apache.jena.sparql.algebra.Op)13 BasicPattern (org.apache.jena.sparql.core.BasicPattern)13 TransitiveGraphCache (org.apache.jena.reasoner.transitiveReasoner.TransitiveGraphCache)11 LongWritable (org.apache.hadoop.io.LongWritable)10 InfGraph (org.apache.jena.reasoner.InfGraph)10 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)10 Resource (org.apache.jena.rdf.model.Resource)9