con.addStatement(picasso, RDF.TYPE, painter);
con.addStatement(guernica, RDF.TYPE, painting);
con.addStatement(picasso, paints, guernica);
con.commit();
ParsedTupleQuery tupleQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SERQL,
"SELECT C FROM {} rdf:type {C}", null);
CloseableIteration<? extends BindingSet, QueryEvaluationException> iter;
iter = con.evaluate(tupleQuery.getTupleExpr(), null, EmptyBindingSet.getInstance(), false);
while (iter.hasNext()) {
BindingSet bindings = iter.next();
Value c = bindings.getValue("C");
if (c instanceof Resource) {
con.addStatement((Resource)c, RDF.TYPE, RDFS.CLASS);
}
}
con.commit();
// Simulate auto-commit
assertEquals(3, countElements(con.getStatements(null, RDF.TYPE, RDFS.CLASS, false)));
tupleQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SERQL, "SELECT P FROM {} P {}", null);
iter = con.evaluate(tupleQuery.getTupleExpr(), null, EmptyBindingSet.getInstance(), false);
while (iter.hasNext()) {
BindingSet bindings = iter.next();
Value p = bindings.getValue("P");
if (p instanceof URI) {