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());
}
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);
}
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();
}
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);
}
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();
}
Aggregations