Github user ejwhite922 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/275#discussion_r170336478
--- Diff:
extras/rya.streams/client/src/main/java/org/apache/rya/streams/client/command/StreamResultsCommand.java
---
@@ -167,17 +182,38 @@ public void run() {
throw new ExecutionException("Could not parse the SPARQL for
the query: " + sparql, e);
}
- // Iterate through the results and print them to the console until
the program or the stream ends.
- try (final QueryResultStream<?> stream =
getQueryResultStream.fromStart(queryId)) {
- while(!finished.get()) {
- for(final Object result : stream.poll(1000)) {
- System.out.println(result);
+ // Iterate through the results and print them to the configured
output mechanism.
+ try (final QueryResultStream<?> resultsStream =
getQueryResultStream.fromStart(queryId)) {
+ final TupleExpr tupleExpr = new
SPARQLParser().parseQuery(sparql, null).getTupleExpr();
+ if(params.outputPath != null) {
+ final Path file = Paths.get(params.outputPath);
+ try(OutputStream out = Files.newOutputStream(file)) {
--- End diff --
try(final OutputStream out ...
---