use of org.apache.jena.query.ResultSet in project jena by apache.
the class TableBase method toResultSet.
@Override
public ResultSet toResultSet() {
QueryIterator qIter = iterator(null);
ResultSet rs = new ResultSetStream(getVarNames(), null, qIter);
rs = ResultSetFactory.makeRewindable(rs);
qIter.close();
return rs;
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class JSONInput method process.
// TODO Streaming version of JSON Result set processing
private SPARQLResult process(InputStream in, Model model) {
parse(in);
if (model == null)
model = GraphFactory.makeJenaDefaultModel();
if (rows != null) {
QueryIterator qIter = new QueryIterPlainWrapper(rows.iterator());
ResultSet rs = new ResultSetStream(Var.varNames(vars), model, qIter);
super.set(rs);
} else
super.set(booleanResult);
return this;
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestSolverTDB method solve_05.
@Test
public void solve_05() {
ResultSet rs1 = exec("(project (?s ?y) (bgp (?s :p ?z) (?z :q ?y)))", graph);
ResultSet rs2 = results("(row (?s :s) (?y :y))");
equals(rs1, rs2);
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestSolverTDB method solve_01.
@Test
public void solve_01() {
ResultSet rs1 = exec("(bgp (:s :p :o))", graph);
ResultSet rs2 = results("unit");
equals(rs1, rs2);
}
use of org.apache.jena.query.ResultSet in project jena by apache.
the class TestDatasetWithLuceneStoredLiterals method doTestSearchWithLiteralsMultiple.
protected List<Node> doTestSearchWithLiteralsMultiple(String turtle, String queryString, String expectedEntityURI) {
List<Node> literals = new LinkedList<>();
Model model = dataset.getDefaultModel();
Reader reader = new StringReader(turtle);
dataset.begin(ReadWrite.WRITE);
model.read(reader, "", "TURTLE");
dataset.commit();
Query query = QueryFactory.create(queryString);
dataset.begin(ReadWrite.READ);
try (QueryExecution qexec = QueryExecutionFactory.create(query, dataset)) {
ResultSet results = qexec.execSelect();
int count;
for (count = 0; results.hasNext(); count++) {
QuerySolution soln = results.nextSolution();
String entityURI = soln.getResource("s").getURI();
assertEquals(expectedEntityURI, entityURI);
Literal literal = soln.getLiteral("literal");
assertNotNull(literal);
literals.add(literal.asNode());
}
} finally {
dataset.end();
}
return literals;
}
Aggregations