use of org.eclipse.rdf4j.model.util.GraphUtilException in project rdf4j by eclipse.
the class DAWGTestResultSetParser method endRDF.
@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);
}
}
use of org.eclipse.rdf4j.model.util.GraphUtilException in project rdf4j by eclipse.
the class DAWGTestBooleanParser method endRDF.
@Override
public void endRDF() throws RDFHandlerException {
try {
Resource resultSetNode = GraphUtil.getUniqueSubject(graph, RDF.TYPE, RESULTSET);
Literal booleanLit = GraphUtil.getUniqueObjectLiteral(graph, resultSetNode, BOOLEAN);
if (booleanLit.equals(DAWGTestResultSetSchema.TRUE)) {
value = true;
} else if (booleanLit.equals(DAWGTestResultSetSchema.FALSE)) {
value = false;
} else {
throw new RDFHandlerException("Invalid boolean value: " + booleanLit);
}
} catch (GraphUtilException e) {
throw new RDFHandlerException(e.getMessage(), e);
}
}
Aggregations