Hi William,

If the CSV is the result of a single SPARQL query, then the best approach would 
be to create a SPIN SelectTemplate, and use the template API to access it as 
CSV.

For an example of this approach, see skostemplate:AllConceptsAndSKOSLabels in 
teamwork.topbraidlive.org/taxonomy/spin/skostemplates.spin.ttl 
<http://teamwork.topbraidlive.org/taxonomy/spin/skostemplates.spin.ttl> . The 
query is in the spin:body property. This query also happens to have an optional 
argument that can be passed in (lang) in case you need that kind of thing.

The template can be invoked like this (assuming a local TBCME and a taxonomy 
“My Taxonomy”):

http://localhost:8083/tbl/template?_template=http%3A%2F%2Ftopbraid.org%2Fspin%2Fskostemplates%23AllConceptsAndSKOSLabels&_base=urn:x-evn-master:my_taxonomy&_format=text/csv
 
<http://localhost:8083/tbl/template?_template=http://topbraid.org/spin/skostemplates#AllConceptsAndSKOSLabels&_base=urn:x-evn-master:my_taxonomy&_format=text/csv>

So, the base URL of the call is:
http://localhost:8083/tbl/template <http://localhost:8083/tbl/template>

And the arguments are:

_template - the URL-encoded version of the full URI of 
skostemplate:AllConceptsAndSKOSLabels
_base - the graph to query
_format - text/csv to get the results in CSV
lang - if you wanted to pass in the optional argument for selecting the 
language of labels

There is more documentation on the template API, and on the templates already 
available out of the box, in the EDG Server Administration area under Available 
Web Services.

Hope that helps,
Richard



> On 7 Mar 2019, at 22:45, William Ramos <[email protected]> wrote:
> 
> Hi, there, I need to generate a spreadsheet report based on queries to some 
> taxonomies. 
> My first thought was to utilize the SWP technology since I already used it to 
> generate HTML (default) and XML output successfully by adding the following 
> parameter: ?_format=xml
> However in this case I need to generate CSV output, is there a proper way to 
> configure the SWP file/service to generate it?, or which feature of topbraid 
> would you recommend to use in order to create it?
> Seems like just writing the output as plain text works, but can we set up the 
> SWP service/file to automatically make it a downloadable CSV file instead of 
> opening it first as a web page?
> 
> Thanks in advance!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to