response.sendError(SC_INTERNAL_SERVER_ERROR, "Serialization error: " + e.getMessage());
private void reportSolution(Resource solutionNode, List<String> bindingNames) throws RDFHandlerException, GraphUtilException { MapBindingSet bindingSet = new MapBindingSet(bindingNames.size()); Iterator<Value> bindingIter = GraphUtil.getObjectIterator(graph, solutionNode, BINDING); while (bindingIter.hasNext()) { Value bindingNode = bindingIter.next(); if (bindingNode instanceof Resource) { Binding binding = getBinding((Resource)bindingNode); bindingSet.addBinding(binding); } else { throw new RDFHandlerException("Value for " + BINDING + " is not a resource: " + bindingNode); } } try { tqrHandler.handleSolution(bindingSet); } catch (TupleQueryResultHandlerException e) { throw new RDFHandlerException(e.getMessage(), e); } }
private void reportSolution(Resource solutionNode, List<String> bindingNames) throws RDFHandlerException, GraphUtilException { MapBindingSet bindingSet = new MapBindingSet(bindingNames.size()); Iterator<Value> bindingIter = GraphUtil.getObjectIterator(graph, solutionNode, BINDING); while (bindingIter.hasNext()) { Value bindingNode = bindingIter.next(); if (bindingNode instanceof Resource) { Binding binding = getBinding((Resource)bindingNode); bindingSet.addBinding(binding); } else { throw new RDFHandlerException("Value for " + BINDING + " is not a resource: " + bindingNode); } } try { tqrHandler.handleSolution(bindingSet); } catch (TupleQueryResultHandlerException e) { throw new RDFHandlerException(e.getMessage(), e); } }
private void reportSolution(Resource solutionNode, List<String> bindingNames) throws RDFHandlerException, GraphUtilException { MapBindingSet bindingSet = new MapBindingSet(bindingNames.size()); Iterator<Value> bindingIter = GraphUtil.getObjectIterator(graph, solutionNode, BINDING); while (bindingIter.hasNext()) { Value bindingNode = bindingIter.next(); if (bindingNode instanceof Resource) { Binding binding = getBinding((Resource)bindingNode); bindingSet.addBinding(binding); } else { throw new RDFHandlerException("Value for " + BINDING + " is not a resource: " + bindingNode); } } try { tqrHandler.handleSolution(bindingSet); } catch (TupleQueryResultHandlerException e) { throw new RDFHandlerException(e.getMessage(), e); } }
@Override public void endRDF() throws RDFHandlerException { try { Resource resultSetNode = GraphUtil.getUniqueSubject(graph, RDF.TYPE, RESULTSET); List<String> bindingNames = getBindingNames(resultSetNode); tqrHandler.startQueryResult(bindingNames); Iterator<Value> solIter = GraphUtil.getObjectIterator(graph, resultSetNode, SOLUTION); while (solIter.hasNext()) { Value solutionNode = solIter.next(); if (solutionNode instanceof Resource) { reportSolution((Resource)solutionNode, bindingNames); } else { throw new RDFHandlerException( "Value for " + SOLUTION + " is not a resource: " + solutionNode); } } tqrHandler.endQueryResult(); } catch (GraphUtilException e) { throw new RDFHandlerException(e.getMessage(), e); } catch (TupleQueryResultHandlerException e) { throw new RDFHandlerException(e.getMessage(), e); } }
@Override public void endRDF() throws RDFHandlerException { try { Resource resultSetNode = GraphUtil.getUniqueSubject(graph, RDF.TYPE, RESULTSET); List<String> bindingNames = getBindingNames(resultSetNode); tqrHandler.startQueryResult(bindingNames); Iterator<Value> solIter = GraphUtil.getObjectIterator(graph, resultSetNode, SOLUTION); while (solIter.hasNext()) { Value solutionNode = solIter.next(); if (solutionNode instanceof Resource) { reportSolution((Resource)solutionNode, bindingNames); } else { throw new RDFHandlerException( "Value for " + SOLUTION + " is not a resource: " + solutionNode); } } tqrHandler.endQueryResult(); } catch (GraphUtilException e) { throw new RDFHandlerException(e.getMessage(), e); } catch (TupleQueryResultHandlerException e) { throw new RDFHandlerException(e.getMessage(), e); } }
@Override public void endRDF() throws RDFHandlerException { try { Resource resultSetNode = GraphUtil.getUniqueSubject(graph, RDF.TYPE, RESULTSET); List<String> bindingNames = getBindingNames(resultSetNode); tqrHandler.startQueryResult(bindingNames); Iterator<Value> solIter = GraphUtil.getObjectIterator(graph, resultSetNode, SOLUTION); while (solIter.hasNext()) { Value solutionNode = solIter.next(); if (solutionNode instanceof Resource) { reportSolution((Resource)solutionNode, bindingNames); } else { throw new RDFHandlerException( "Value for " + SOLUTION + " is not a resource: " + solutionNode); } } tqrHandler.endQueryResult(); } catch (GraphUtilException e) { throw new RDFHandlerException(e.getMessage(), e); } catch (TupleQueryResultHandlerException e) { throw new RDFHandlerException(e.getMessage(), e); } }