Search in sources :

Example 6 with Graph

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

the class TestGraphUnionRead method gr_union_05.

@Test
public void gr_union_05() {
    List<Node> gnodes = list();
    Graph g = new GraphUnionRead(dsg, gnodes);
    long x = Iter.count(g.find(null, null, null));
    assertEquals(0, x);
}
Also used : GraphUnionRead(org.apache.jena.sparql.graph.GraphUnionRead) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) BuilderGraph(org.apache.jena.sparql.sse.builders.BuilderGraph) Graph(org.apache.jena.graph.Graph) Node(org.apache.jena.graph.Node) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 7 with Graph

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

the class TestGraphUnionRead method gr_union_02.

@Test
public void gr_union_02() {
    List<Node> gnodes = list(gn1, gn2);
    Graph g = new GraphUnionRead(dsg, gnodes);
    Node s = NodeFactory.createURI("http://example/s");
    long x = Iter.count(g.find(s, null, null));
    assertEquals(3, x);
}
Also used : GraphUnionRead(org.apache.jena.sparql.graph.GraphUnionRead) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) BuilderGraph(org.apache.jena.sparql.sse.builders.BuilderGraph) Graph(org.apache.jena.graph.Graph) Node(org.apache.jena.graph.Node) Test(org.junit.Test) BaseTest(org.apache.jena.atlas.junit.BaseTest)

Example 8 with Graph

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

the class AbstractTestUpdateBase method defaultGraphData.

protected void defaultGraphData(DatasetGraph gStore, Graph data) {
    Graph g = gStore.getDefaultGraph();
    g.clear();
    GraphUtil.addInto(g, data);
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Graph(org.apache.jena.graph.Graph)

Example 9 with Graph

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

the class AbstractTestUpdateBase method namedGraphData.

protected void namedGraphData(DatasetGraph gStore, Node uri, Graph data) {
    Graph g = gStore.getGraph(uri);
    if (g == null) {
        gStore.addGraph(uri, GraphFactory.createJenaDefaultGraph());
        g = gStore.getGraph(uri);
    } else
        g.clear();
    GraphUtil.addInto(g, data);
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Graph(org.apache.jena.graph.Graph)

Example 10 with Graph

use of org.apache.jena.graph.Graph 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)

Aggregations

Graph (org.apache.jena.graph.Graph)247 Test (org.junit.Test)90 BaseTest (org.apache.jena.atlas.junit.BaseTest)56 Triple (org.apache.jena.graph.Triple)56 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)54 Node (org.apache.jena.graph.Node)46 AbstractTestGraph (org.apache.jena.graph.test.AbstractTestGraph)16 InfGraph (org.apache.jena.reasoner.InfGraph)16 ContractTest (org.xenei.junit.contract.ContractTest)16 Model (org.apache.jena.rdf.model.Model)14 MultiUnion (org.apache.jena.graph.compose.MultiUnion)9 Delta (org.apache.jena.graph.compose.Delta)8 BuilderGraph (org.apache.jena.sparql.sse.builders.BuilderGraph)8 StreamRDF (org.apache.jena.riot.system.StreamRDF)7 PrefixMapping (org.apache.jena.shared.PrefixMapping)7 GraphUnionRead (org.apache.jena.sparql.graph.GraphUnionRead)7 IOException (java.io.IOException)6 Dataset (org.apache.jena.query.Dataset)6 Rule (org.apache.jena.reasoner.rulesys.Rule)6 ConfigTest (org.apache.jena.tdb.ConfigTest)6