use of org.eclipse.rdf4j.query.TupleQueryResultHandlerException in project rdf4j by eclipse.
the class AbstractSPARQLXMLWriter method handleSolution.
@Override
public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException {
try {
if (!documentOpen) {
startDocument();
}
if (!headerOpen) {
startHeader();
}
if (!headerComplete) {
endHeader();
}
if (!tupleVariablesFound) {
throw new IllegalStateException("Must call startQueryResult before handleSolution");
}
xmlWriter.startTag(RESULT_TAG);
for (Binding binding : bindingSet) {
xmlWriter.setAttribute(BINDING_NAME_ATT, binding.getName());
xmlWriter.startTag(BINDING_TAG);
writeValue(binding.getValue());
xmlWriter.endTag(BINDING_TAG);
}
xmlWriter.endTag(RESULT_TAG);
} catch (IOException e) {
throw new TupleQueryResultHandlerException(e);
} catch (TupleQueryResultHandlerException e) {
throw e;
} catch (QueryResultHandlerException e) {
throw new TupleQueryResultHandlerException(e);
}
}
use of org.eclipse.rdf4j.query.TupleQueryResultHandlerException in project rdf4j by eclipse.
the class AbstractSPARQLXMLWriter method startQueryResult.
@Override
public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException {
try {
if (!documentOpen) {
startDocument();
}
if (!headerOpen) {
startHeader();
}
tupleVariablesFound = true;
// Write binding names
for (String name : bindingNames) {
xmlWriter.setAttribute(VAR_NAME_ATT, name);
xmlWriter.emptyElement(VAR_TAG);
}
} catch (IOException e) {
throw new TupleQueryResultHandlerException(e);
} catch (TupleQueryResultHandlerException e) {
throw e;
} catch (QueryResultHandlerException e) {
throw new TupleQueryResultHandlerException(e);
}
}
use of org.eclipse.rdf4j.query.TupleQueryResultHandlerException in project rdf4j by eclipse.
the class RDF4JProtocolSession method getNamespaces.
/*---------------------------*
* Get/add/remove namespaces *
*---------------------------*/
public TupleQueryResult getNamespaces() throws IOException, RepositoryException, UnauthorizedException, QueryInterruptedException {
try {
TupleQueryResultBuilder builder = new TupleQueryResultBuilder();
getNamespaces(builder);
return builder.getQueryResult();
} catch (TupleQueryResultHandlerException e) {
// Found a bug in TupleQueryResultBuilder?
throw new RuntimeException(e);
}
}
use of org.eclipse.rdf4j.query.TupleQueryResultHandlerException in project rdf4j by eclipse.
the class RDF4JProtocolSession method getContextIDs.
/*-------------*
* Context IDs *
*-------------*/
public TupleQueryResult getContextIDs() throws IOException, RepositoryException, UnauthorizedException, QueryInterruptedException {
try {
TupleQueryResultBuilder builder = new TupleQueryResultBuilder();
getContextIDs(builder);
return builder.getQueryResult();
} catch (TupleQueryResultHandlerException e) {
// Found a bug in TupleQueryResultBuilder?
throw new RuntimeException(e);
}
}
use of org.eclipse.rdf4j.query.TupleQueryResultHandlerException in project rdf4j by eclipse.
the class RDF4JProtocolSession method getRepositoryList.
/*-----------------*
* Repository list *
*-----------------*/
public TupleQueryResult getRepositoryList() throws IOException, RepositoryException, UnauthorizedException, QueryInterruptedException {
try {
TupleQueryResultBuilder builder = new TupleQueryResultBuilder();
getRepositoryList(builder);
return builder.getQueryResult();
} catch (TupleQueryResultHandlerException e) {
// Found a bug in TupleQueryResultBuilder?
throw new RuntimeException(e);
}
}
Aggregations