use of org.eclipse.rdf4j.query.resultio.TupleQueryResultFormat in project rdf4j by eclipse.
the class SPARQLCSVTupleBackgroundTest method testEmptyResults.
@Test
public void testEmptyResults() throws Exception {
TupleQueryResultFormat format = getTupleFormat();
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out);
writer.startDocument();
writer.startHeader();
writer.handleLinks(Arrays.<String>asList());
QueryResults.report(createTupleNoBindingSets(), writer);
assertRegex("a,b,c(\r\n)?", out.toString("UTF-8"));
}
use of org.eclipse.rdf4j.query.resultio.TupleQueryResultFormat in project rdf4j by eclipse.
the class SPARQLTSVTupleBackgroundTest method toString.
private String toString(TupleQueryResult results) throws QueryResultHandlerException, TupleQueryResultHandlerException, QueryEvaluationException, UnsupportedEncodingException {
TupleQueryResultFormat format = getTupleFormat();
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out);
writer.startDocument();
writer.startHeader();
writer.handleLinks(Arrays.<String>asList());
QueryResults.report(results, writer);
return out.toString("UTF-8");
}
use of org.eclipse.rdf4j.query.resultio.TupleQueryResultFormat in project rdf4j by eclipse.
the class SPARQLCSVTupleBackgroundTest method testEndOfLine.
@Test
public void testEndOfLine() throws Exception {
TupleQueryResultFormat format = getTupleFormat();
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out);
writer.startDocument();
writer.startHeader();
writer.handleLinks(Arrays.<String>asList());
QueryResults.report(createTupleNoBindingSets(), writer);
assertEquals("\r\n", out.toString("UTF-8").replaceAll("\\S+", ""));
}
use of org.eclipse.rdf4j.query.resultio.TupleQueryResultFormat in project rdf4j by eclipse.
the class SPARQLCSVTupleBackgroundTest method testmultipleVarResults.
@Test
public void testmultipleVarResults() throws Exception {
TupleQueryResultFormat format = getTupleFormat();
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out);
writer.startDocument();
writer.startHeader();
writer.handleLinks(Arrays.<String>asList());
QueryResults.report(createTupleMultipleBindingSets(), writer);
assertRegex("a,b,c\r\n" + "foo:bar,_:bnode,baz\r\n" + "1,,Hello World!\r\n" + "http://example.org/test/ns/bindingA,http://example.com/other/ns/bindingB,\"http://example.com/other/ns/binding,C\"\r\n" + "\"string with newline at the end \n\",string with space at the end , \r\n" + "''single-quoted string,\"\"\"\"\"double-quoted string\",\t\tunencoded tab characters followed by encoded \t\t(\r\n)?", out.toString("UTF-8"));
}
use of org.eclipse.rdf4j.query.resultio.TupleQueryResultFormat in project rdf4j by eclipse.
the class SPARQLTSVTupleTest method toString.
private String toString(TupleQueryResult results) throws QueryResultHandlerException, TupleQueryResultHandlerException, QueryEvaluationException, UnsupportedEncodingException {
TupleQueryResultFormat format = getTupleFormat();
ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
TupleQueryResultWriter writer = QueryResultIO.createTupleWriter(format, out);
writer.startDocument();
writer.startHeader();
writer.handleLinks(Arrays.<String>asList());
QueryResults.report(results, writer);
return out.toString("UTF-8");
}
Aggregations