qr.add(new BindingsCollection());
} else if (result instanceof TupleQueryResult) {
qr = QueryResult.createInstance();
while (((TupleQueryResult) result).hasNext()) {
final BindingSet bs = ((TupleQueryResult) result).next();
final Bindings binding = new BindingsMap();
for (final Binding b : bs) {
// Bindings bb = Bindings.createNewInstance();
final Value v = b.getValue();
if (v instanceof org.openrdf.model.Literal) {
final org.openrdf.model.Literal lit = (org.openrdf.model.Literal) v;
if (lit.getDatatype() != null) {
binding.add(new Variable(b.getName()),
TypedLiteralOriginalContent
.createTypedLiteral("\""
+ lit.getLabel() + "\"",
"<" + lit.getDatatype()
+ ">"));
} else {
binding.add(new Variable(b.getName()),
LiteralFactory.createLiteral("\""
+ lit.getLabel() + "\""));
}
} else if (v instanceof BNode) {
binding.add(new Variable(b.getName()),
new AnonymousLiteral(((BNode) v).toString()));
} else if (v instanceof URI) {
binding.add(new Variable(b.getName()), LiteralFactory
.createURILiteral("<" + (v) + ">"));
}
}
qr.add(binding);
}