GitHub user hartig opened a pull request:
https://github.com/apache/jena/pull/473
Extendable versions of classes for printing result sets
This PR modifies the classes `CSVOutput` and `TSVOutput` to make it
possible to extend them and override their behavior in subclasses. I want to
implement such subclasses for my SPARQL* extension of Jena.
A related question: Is there a reason why the mapping from `ResultsFormat`
objects to `ResultSetLang`object (i.e., the [`mapResultsFormatToLang` in
`ResultsFormat.java`](https://github.com/apache/jena/blob/aef35ee50eef9e0820d23d5ba184906b177a5c15/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java#L190))
does not map `ResultsFormat.FMT_TEXT` to `ResultSetLang.SPARQLResultSetText`?
Without this, the command line program `arq.query` falls back to the old
`ResultSetWriter` and there is no elegant way for my SPARQL* extension of this
program to use my SPARQL*-aware version of `ResultSetWriter` for text output.
Hence, it would be great to add the following line into code that sets up
`mapResultsFormatToLang`.
```
mapResultsFormatToLang.put(ResultsFormat.FMT_TEXT,
ResultSetLang.SPARQLResultSetText) ;
```
Alternatively, the could be a method that can be used for adding something
to `mapResultsFormatToLang`.
If you are fine with any of these two options, I would like to add it to
this PR.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/hartig/jena master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/jena/pull/473.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #473
commit ce453fe9a930ce060c662360dfb4e17a8c6e03fc
Author: Olaf Hartig
Date: 2018-09-30T09:32:35Z
Merge pull request #1 from apache/master
update this fork to reflect the latest version of the original
commit 3ea4a230610fea61ff288dc15e5ce8f4ae36924e
Author: Olaf Hartig
Date: 2018-09-30T18:53:08Z
changed the access modifier of both 'output' and 'csvSafe' to be protected
commit a8550192ed39c899687764fd9beda410a2560542
Author: Olaf Hartig
Date: 2018-09-30T18:59:09Z
added method createNodeFormatter() which can be overridden in subclasses
commit ea7b430b825636595e92aebe7366d27b8ddcf47c
Author: Olaf Hartig
Date: 2018-09-30T19:00:09Z
removed irrelevant comment
---