use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestResultSetFormat1 method resultset_05.
@Test
public void resultset_05() {
ResultSet rs = make($rs);
ByteArrayOutputStream out = new ByteArrayOutputStream();
ResultSetFormatter.outputAsCSV(out, rs);
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestResultSetFormat1 method resultset_02.
@Test
public void resultset_02() {
ResultSet rs = make($rs);
ByteArrayOutputStream out = new ByteArrayOutputStream();
ResultSetFormatter.outputAsXML(out, rs);
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
ResultSet rs2 = ResultSetFactory.fromXML(in);
areIsomorphic(rs, rs2);
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestResultSet method test_RS_union_2.
@Test(expected = ResultSetException.class)
public void test_RS_union_2() {
ResultSet rs1 = make("x", org.apache.jena.graph.NodeFactory.createURI("tag:local"));
ResultSet rs2 = make("y", org.apache.jena.graph.NodeFactory.createURI("tag:local"));
ResultSetUtils.union(rs1, rs2);
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestResultSet method test_RS_peeking_6.
@Test
public void test_RS_peeking_6() {
// Peeking should be able to cope with people moving on the underlying result set independently
ResultSet inner = new ResultSetMem(make("x", NodeFactory.createURI("tag:local")), make("x", NodeFactory.createURI("tag:local")), make("x", NodeFactory.createURI("tag:local")));
ResultSetPeekable rs = ResultSetFactory.makePeekable(inner);
assertTrue(rs.hasNext());
assertNotNull(rs.peek());
// Move on the inner result set independently
inner.next();
// Since we fiddled with the underlying result set we'll be out of sync
// but there should still be further data available
assertTrue(rs.hasNext());
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestResultSet method make.
private ResultSet make(String var1, Node val1, String var2, Node val2) {
BindingMap b = BindingFactory.create();
b.add(Var.alloc(var1), val1);
b.add(Var.alloc(var2), val2);
List<String> vars = new ArrayList<>();
vars.add(var1);
vars.add(var2);
QueryIterator qIter = QueryIterSingleton.create(b, null);
ResultSet rs = new ResultSetStream(vars, null, qIter);
return rs;
}
Aggregations