use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestResultSet method test_RS_union_1.
@Test
public void test_RS_union_1() {
ResultSet rs1 = make("x", org.apache.jena.graph.NodeFactory.createURI("tag:local"));
ResultSet rs2 = make("x", org.apache.jena.graph.NodeFactory.createURI("tag:local"));
ResultSet rs3 = make2("x", org.apache.jena.graph.NodeFactory.createURI("tag:local"));
assertTrue(ResultSetCompare.equalsByTerm(rs3, ResultSetUtils.union(rs1, rs2)));
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestResultSetFormat2 method parseTSV.
private void parseTSV(String x) {
byte[] b = StrUtils.asUTF8bytes(x);
ByteArrayInputStream in = new ByteArrayInputStream(b);
ResultSet rs2 = ResultSetFactory.fromTSV(in);
while (rs2.hasNext()) {
rs2.nextBinding();
}
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestResultSet method test_RS_8.
@Test
public void test_RS_8() {
ResultSet rs = ResultSetFactory.load("testing/ResultSet/output.srx");
test_RS_fmt(rs, ResultsFormat.FMT_RS_JSON, true);
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestResultSet method test_RS_10.
@Test
public void test_RS_10() {
ResultSet rs = ResultSetFactory.load("testing/ResultSet/output.srx");
for (; rs.hasNext(); rs.next()) {
}
// We should be able to call hasNext() as many times as we want!
assertFalse(rs.hasNext());
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestResultSet method make2.
private ResultSet make2(String var, Node val) {
BindingMap b1 = BindingFactory.create();
b1.add(Var.alloc(var), val);
BindingMap b2 = BindingFactory.create();
b2.add(Var.alloc(var), val);
List<String> vars = new ArrayList<>();
vars.add(var);
List<Binding> solutions = new ArrayList<>();
solutions.add(b1);
solutions.add(b2);
QueryIterator qIter = new QueryIterPlainWrapper(solutions.iterator(), null);
ResultSet rs = new ResultSetStream(vars, null, qIter);
return rs;
}
Aggregations