Search in sources :

Example 91 with Graph

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

the class TestFindLiterals method testProgrammaticValues.

public void testProgrammaticValues() {
    Node ab = NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral((byte) 42));
    Node as = NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral((short) 42));
    Node ai = NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral(42));
    Node al = NodeFactory.createLiteral(LiteralLabelFactory.createTypedLiteral((long) 42));
    Graph g = graphWith("");
    Node SB = NodeCreateUtils.create("SB");
    Node SS = NodeCreateUtils.create("SS");
    Node SI = NodeCreateUtils.create("SI");
    Node SL = NodeCreateUtils.create("SL");
    Node P = NodeCreateUtils.create("P");
    g.add(Triple.create(SB, P, ab));
    g.add(Triple.create(SS, P, as));
    g.add(Triple.create(SI, P, ai));
    g.add(Triple.create(SL, P, al));
    assertEquals(4, iteratorToSet(g.find(Node.ANY, P, NodeCreateUtils.create("42"))).size());
}
Also used : Graph(org.apache.jena.graph.Graph) Node(org.apache.jena.graph.Node)

Example 92 with Graph

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

the class TestGraphPrefixMapping method testGraphPrefixMapping.

public void testGraphPrefixMapping() {
    Graph g = Factory.createDefaultGraph();
    AbstractTestPrefixMapping.testUseEasyPrefix("from Graph", g.getPrefixMapping());
    testSameMapping(g);
}
Also used : Graph(org.apache.jena.graph.Graph)

Example 93 with Graph

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

the class AbstractTestGraphMaker method testListAfterDelete.

/**
        Test that a maker with some things put in and then some removed gets the right
        things listed. 
    */
public void testListAfterDelete() {
    String x = "x_y", y = "y//zub", z = "a:b/c";
    Graph X = gf.createGraph(x);
    Graph Y = gf.createGraph(y);
    Graph Z = gf.createGraph(z);
    gf.removeGraph(x);
    Set<String> s = iteratorToSet(gf.listGraphs());
    assertEquals(setOfStrings(y + " " + z), s);
    X.close();
    Y.close();
    Z.close();
}
Also used : Graph(org.apache.jena.graph.Graph)

Example 94 with Graph

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

the class AbstractTestGraphMaker method testCanOpenUncreated.

/**
        Test that we *can* open a graph that hasn't been created
    */
public void testCanOpenUncreated() {
    String name = jName("willBeCreated");
    Graph g1 = gf.openGraph(name);
    g1.close();
    gf.openGraph(name, true);
}
Also used : Graph(org.apache.jena.graph.Graph)

Example 95 with Graph

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

the class AbstractTestGraphMaker method testCarefulClose.

public void testCarefulClose() {
    Graph x = gf.createGraph("x");
    Graph y = gf.openGraph("x");
    x.add(triple("a BB c"));
    x.close();
    y.add(triple("p RR q"));
    y.close();
}
Also used : 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