public void handleSolution(BindingSet bindingSet)
throws TupleQueryResultHandlerException
{
try {
BNode solutionNode = vf.createBNode();
reportStatement(resultSetNode, SOLUTION, solutionNode);
for (Binding binding : bindingSet) {
BNode bindingNode = vf.createBNode();
reportStatement(solutionNode, BINDING, bindingNode);
reportStatement(bindingNode, VARIABLE, vf.createLiteral(binding.getName()));
Value value = binding.getValue();
// Map bnodes to new bnodes to prevent collisions with the bnodes
// generated for the result format
if (value instanceof BNode) {
BNode mappedBNode = bnodeMap.get(value);
if (mappedBNode == null) {
mappedBNode = vf.createBNode();
bnodeMap.put((BNode)value, mappedBNode);
}