use of org.apache.jena.rdf.model.Statement in project jena by apache.
the class TestModelEvents method testDeleteStatementIterator.
public void testDeleteStatementIterator() {
model.register(SL);
final Statement[] sa = ModelHelper.statements(model, "x R y; a P b; x R y");
final StmtIterator it = asIterator(sa);
model.remove(it);
SL.assertHas(new Object[] { "removeIterator", Arrays.asList(sa) });
}
use of org.apache.jena.rdf.model.Statement in project jena by apache.
the class TestModelEvents method testAddStatementIterator.
public void testAddStatementIterator() {
model.register(SL);
final Statement[] sa = ModelHelper.statements(model, "x R y; a P b; x R y");
final StmtIterator it = asIterator(sa);
model.add(it);
SL.assertHas(new Object[] { "addIterator", Arrays.asList(sa) });
}
use of org.apache.jena.rdf.model.Statement in project jena by apache.
the class SecuredContainerTest method testRemove.
@Test
public void testRemove() {
final Set<Action> perms = SecurityEvaluator.Util.asSet(new Action[] { Action.Update, Action.Delete });
final Statement s = baseModel.listStatements().next();
try {
getSecuredContainer().remove(s);
if (!securityEvaluator.evaluate(perms)) {
Assert.fail("Should have thrown AccessDeniedException");
}
} catch (final AccessDeniedException e) {
if (securityEvaluator.evaluate(perms)) {
Assert.fail(String.format("Should not have thrown AccessDeniedException: %s - %s", e, e.getTriple()));
}
}
}
use of org.apache.jena.rdf.model.Statement in project jena by apache.
the class AbstractTestModel method testIsEmpty.
public void testIsEmpty() {
Statement S1 = statement(model, "model rdf:type nonEmpty");
Statement S2 = statement(model, "pinky rdf:type Pig");
assertTrue(model.isEmpty());
model.add(S1);
assertFalse(model.isEmpty());
model.add(S2);
assertFalse(model.isEmpty());
model.remove(S1);
assertFalse(model.isEmpty());
model.remove(S2);
assertTrue(model.isEmpty());
}
use of org.apache.jena.rdf.model.Statement in project jena by apache.
the class AbstractTestModel method testToStatement.
public void testToStatement() {
Triple t = triple("a P b");
Statement s = model.asStatement(t);
assertEquals(node("a"), s.getSubject().asNode());
assertEquals(node("P"), s.getPredicate().asNode());
assertEquals(node("b"), s.getObject().asNode());
}
Aggregations