Search in sources :

Example 1 with TripleBoundary

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

the class ModelExtract method extractInto.

/**
         Answer <code>model</code> after updating it with the sub-graph of
         <code>s</code> rooted at <code>r</code>, bounded by this instances
         <code>boundary</code>.
    */
public Model extractInto(Model model, Resource r, Model s) {
    TripleBoundary tb = boundary.asTripleBoundary(s);
    Graph g = getGraphExtract(tb).extractInto(model.getGraph(), r.asNode(), s.getGraph());
    return ModelFactory.createModelForGraph(g);
}
Also used : TripleBoundary(org.apache.jena.graph.TripleBoundary) Graph(org.apache.jena.graph.Graph)

Example 2 with TripleBoundary

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

the class TestModelExtract method testStatementTripleBoundaryAnon.

public void testStatementTripleBoundaryAnon() {
    final TripleBoundary anon = TripleBoundary.stopAtAnonObject;
    Assert.assertSame(anon, new StatementTripleBoundary(anon).asTripleBoundary(null));
    Assert.assertFalse(new StatementTripleBoundary(anon).stopAt(ModelHelper.statement("s P o")));
    Assert.assertTrue(new StatementTripleBoundary(anon).stopAt(ModelHelper.statement("s P _o")));
}
Also used : TripleBoundary(org.apache.jena.graph.TripleBoundary)

Example 3 with TripleBoundary

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

the class TestModelExtract method testStatementTripleBoundaryNowhere.

public void testStatementTripleBoundaryNowhere() {
    final TripleBoundary nowhere = TripleBoundary.stopNowhere;
    Assert.assertSame(nowhere, new StatementTripleBoundary(nowhere).asTripleBoundary(null));
    Assert.assertFalse(new StatementTripleBoundary(nowhere).stopAt(ModelHelper.statement("s P _o")));
    Assert.assertFalse(new StatementTripleBoundary(nowhere).stopAt(ModelHelper.statement("s P o")));
}
Also used : TripleBoundary(org.apache.jena.graph.TripleBoundary)

Aggregations

TripleBoundary (org.apache.jena.graph.TripleBoundary)3 Graph (org.apache.jena.graph.Graph)1