@Test public void Ask() throws IOException { JSONResultProducer producer = new JSONResultProducer(); SPARQLQuery query = connection.createQuery(QueryLanguage.SPARQL, "ASK { ?s ?p ?o }"); StringWriter writer = new StringWriter(); producer.stream(query, writer); assertEquals("{\"head\":null,\"boolean\":true}", writer.toString()); }
@Override public void stream(SPARQLQuery query, Writer writer) throws IOException { JsonGenerator generator = jsonFactory.createJsonGenerator(writer); if (query.getResultType().equals(SPARQLQuery.ResultType.BOOLEAN)) { streamBoolean(query, generator); } else { streamTuple(query, generator); } generator.flush(); }
JSONResultProducer extends AbstractResultProducer { @Override public void stream(SPARQLQuery query, Writer writer) throws IOException { JsonGenerator generator = jsonFactory.createJsonGenerator(writer); if (query.getResultType().equals(SPARQLQuery.ResultType.BOOLEAN)) { streamBoolean(query, generator); } else { streamTuple(query, generator); } generator.flush(); } }
JSONResultProducer extends AbstractResultProducer { @Override public void stream(SPARQLQuery query, Writer writer) throws IOException { JsonGenerator generator = jsonFactory.createJsonGenerator(writer); if (query.getResultType().equals(SPARQLQuery.ResultType.BOOLEAN)) { streamBoolean(query, generator); } else { streamTuple(query, generator); } generator.flush(); }  }
JSONResultProducer extends AbstractResultProducer { @Override public void stream(SPARQLQuery query, Writer writer) throws IOException { JsonGenerator generator = jsonFactory.createJsonGenerator(writer); if (query.getResultType().equals(SPARQLQuery.ResultType.BOOLEAN)) { streamBoolean(query, generator); } else { streamTuple(query, generator); } generator.flush(); }  @Override void stream(SPARQLQuery query, Writer writer); }
JSONResultProducer extends AbstractResultProducer { @Override public void stream(SPARQLQuery query, Writer writer) throws IOException { JsonGenerator generator = jsonFactory.createJsonGenerator(writer); if (query.getResultType().equals(SPARQLQuery.ResultType.BOOLEAN)) { streamBoolean(query, generator); } else { streamTuple(query, generator); } generator.flush(); }  @Override void stream(SPARQLQuery query, Writer writer);  }