[ https://issues.apache.org/jira/browse/JENA-626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14962379#comment-14962379 ]
ASF GitHub Bot commented on JENA-626: ------------------------------------- Github user ajs6f commented on a diff in the pull request: https://github.com/apache/jena/pull/95#discussion_r42320957 --- Diff: jena-arq/src/main/java/org/apache/jena/sparql/resultset/CSVOutput.java --- @@ -102,6 +102,62 @@ public void format(OutputStream out, ResultSet resultSet) } } + @Override + public void format(OutputStream out, ResultSet resultSet, StringBuilder cacheBuilder) + { + try { + Writer w = FileUtils.asUTF8(out) ; + NodeToLabelMap bnodes = new NodeToLabelMap() ; + w = new BufferedWriter(w) ; + + String sep = null ; + List<String> varNames = resultSet.getResultVars() ; + List<Var> vars = new ArrayList<>(varNames.size()) ; + + // Convert to Vars and output the header line. + for( String v : varNames ) + { + if ( sep != null ){ + w.write(sep) ; + cacheBuilder.append(sep); + } + else + sep = "," ; + w.write(csvSafe(v)) ; + cacheBuilder.append(csvSafe(v)); + vars.add(Var.alloc(v)) ; + } + w.write(NL) ; + cacheBuilder.append(NL); + + // Data output + for ( ; resultSet.hasNext() ; ) --- End diff -- These two loops could be managed a bit more tightly between `resultSet::forEachRemaining` and `vars.stream()::map`. > SPARQL Query Caching > -------------------- > > Key: JENA-626 > URL: https://issues.apache.org/jira/browse/JENA-626 > Project: Apache Jena > Issue Type: Improvement > Reporter: Andy Seaborne > Labels: java, linked_data, rdf, sparql > > Add a caching layer to Fuseki to cache the results of SPARQL Query requests. > This cache should allow for in-memory and disk-based caching, configuration > and cache management, and coordination with data modification. -- This message was sent by Atlassian JIRA (v6.3.4#6332)