Java Code Examples for org.openrdf.query.resultio.BooleanQueryResultWriter

The following examples show how to use org.openrdf.query.resultio.BooleanQueryResultWriter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: database   Source File: BigdataRDFContext.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void doQuery(final BigdataSailRepositoryConnection cxn,
        final OutputStream os) throws Exception {

    final BigdataSailBooleanQuery query = (BigdataSailBooleanQuery) setupQuery(cxn);

    // Note: getQueryTask() verifies that format will be non-null.
    final BooleanQueryResultFormat format = BooleanQueryResultWriterRegistry
            .getInstance().getFileFormatForMIMEType(mimeType);

    final BooleanQueryResultWriter w = BooleanQueryResultWriterRegistry
            .getInstance().get(format).getWriter(os);

    final boolean result = query.evaluate();

    w.write(result);

}