use of org.apache.jena.graph.Graph in project jena by apache.
the class AbstractTestGraphMaker method testListThreeGraphs.
/**
Test that a maker with three graphs inserted lists those three grapsh; we don't
mind what order they appear in. We also use funny names to ensure that the spelling
that goes in is the one that comes out [should really be in a separate test].
*/
public void testListThreeGraphs() {
String x = "x", y = "y/sub", z = "z:boo";
Graph X = gf.createGraph(x);
Graph Y = gf.createGraph(y);
Graph Z = gf.createGraph(z);
Set<String> wanted = setOfStrings(x + " " + y + " " + z);
assertEquals(wanted, iteratorToSet(gf.listGraphs()));
X.close();
Y.close();
Z.close();
}
use of org.apache.jena.graph.Graph in project jena by apache.
the class TestContains method testModelComContainsSPcallsContainsSPO.
public void testModelComContainsSPcallsContainsSPO() {
final Graph g = Factory.createDefaultGraph();
final boolean[] wasCalled = { false };
// FIXME change to dynamic proxy
final Model m = new ModelCom(g) {
@Override
public boolean contains(final Resource s, final Property p, final RDFNode o) {
wasCalled[0] = true;
return super.contains(s, p, o);
}
};
Assert.assertFalse(m.contains(ModelHelper.resource("r"), ModelHelper.property("p")));
Assert.assertTrue("contains(S,P) should call contains(S,P,O)", wasCalled[0]);
}
use of org.apache.jena.graph.Graph in project jena by apache.
the class TestModelPrefixMapping method doOnlyFreshPrefixes.
/**
* Test that existing prefixes are not over-ridden by the default ones.
*/
private void doOnlyFreshPrefixes() {
final String newURI = "abc:def/";
final Graph g = Factory.createDefaultGraph();
final PrefixMapping pm = g.getPrefixMapping();
pm.setNsPrefix(TestModelPrefixMapping.alphaPrefix, newURI);
final Model m = ModelFactory.createModelForGraph(g);
Assert.assertEquals(newURI, m.getNsPrefixURI(TestModelPrefixMapping.alphaPrefix));
Assert.assertEquals(TestModelPrefixMapping.betaURI, m.getNsPrefixURI(TestModelPrefixMapping.betaPrefix));
}
use of org.apache.jena.graph.Graph in project jena by apache.
the class SecuredPrefixMappingTest method setup.
@Before
public void setup() {
final Graph g = GraphFactory.createDefaultGraph();
final SecuredGraph sg = Factory.getInstance(securityEvaluator, "http://example.com/testGraph", g);
this.securedMapping = sg.getPrefixMapping();
}
use of org.apache.jena.graph.Graph in project jena by apache.
the class SecuredGraphListenerTest method getGraph.
@Override
public Graph getGraph() {
final Graph graph = org.apache.jena.permissions.Factory.getInstance(eval, getName(), Factory.createDefaultGraph());
graph.getEventManager().register(new CheckChanges("simple tracking", graph));
return graph;
}
Aggregations