Reputation: 6654
I am running following query on Virtuoso isql.
SPARQL
CONSTRUCT
{
?infectee ?getInfectedBy ?infector
}
FROM <http://ndssl.bi.vt.edu/chicago/>
WHERE
{
?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://ndssl.bi.vt.edu/chicago/vocab/dendrogram>.
?s <http://ndssl.bi.vt.edu/chicago/vocab/dendrogram_infectee_pid> ?infectee.
?s <http://ndssl.bi.vt.edu/chicago/vocab/dendrogram_infector_pid> ?infector.
?s <http://ndssl.bi.vt.edu/chicago/vocab/dendrogram_iteration> '0'^^xsd:decimal.
BIND (iri('http://ndssl.bi.vt.edu/chicago/vocab/getInfectedBy') as ?getInfectedBy)
};
I want to dump result in "N-Triples" format. How can I do it in isql?
Upvotes: 1
Views: 902
Reputation: 9434
Answered on the Virtuoso Users mailing list where the question was also asked...
Dumping results in various formats can be done by using the
define output:format "{XX}"
pragma, so in your case it would be:
SQL> sparql define output:format "TURTLE" CONSTRUCT ...
Other possible formats are:
NICE_TTL
RDF_XML
When using the ISQL client to fetch long texts, use the set blobs on;
directive to avoid receiving a data truncated
warning.
i.e.:
SQL> set blobs on;
SQL> sparql define output:format ...
For CONSTRUCT
, the supported formats are:
TRIG
, TTL
, JSON
, JSON;TALIS
, SOAP
, RDF/XML
, NT
, RDFA;XHTML
, JSON;RES
, HTML;MICRODATA
, HTML
, JS
, ATOM;XML
, JSON;ODATA
, XML
, CXML;QRCODE
, CXML
, HTML;UL
, HTML;TR
, JSON;LD
, CSV
, TSV
, NICE_TTL
, HTML;NICE_MICRODATA
, HTML;SCRIPT_LD_JSON
, HTML;SCRIPT_TTL
, HTML;NICE_TTL
Documentation links:
To get the result into a local file, the following should work:
XX.ttl
local file:
isql host:port dba pwd exec="set blobs on; sparql define output:format '"TURTLE"' construct {...} from <....> where {....}" > XX.ttl
tail -n +9 XX.ttl > XX_new.ttl
Upvotes: 2