Thanks very much Ivan, that helps a lot! 

> -----Original Message-----
> From: imikhailov [mailto:imikhai...@openlinksw.com] 
> Sent: Saturday, April 28, 2007 3:19 PM
> To: Alex Black
> Cc: virtuoso-users-boun...@lists.sourceforge.net
> Subject: RE: [Virtuoso-users] Export RDF to a file
> 
> Hello Alex,
> 
> The output stream may be created by string_output() 
> 'constructor' function.
> The returned value is an object that can grow basically 
> infinitely (it supports even flushing to disk when it become 
> really huge). It is a valid input for variety of functions 
> including http(), http_value() etc;
> DB.DBA.RDF_TRIPLES_TO_TTL() serialize data using http_* 
> family of functions so the serialisation can be sent to HTTP 
> client (if the second parameter is
> NULL) or written to file (by string_to_file()) or converted 
> to a string by string_output_string().
> 
> A simple use case:
> 
> create procedure DB.DBA.CONSTRUCT_AND_SAVE_TO_TTL_FILE (in 
> construct_query varchar, in dflt_graph varchar, in filename varchar) {
>   declare ses, res, triples any;
>   res := DB.DBA.SPARQL_EVAL_TO_ARRAY (construct_query, dflt_graph, 1);
>   triples := dict_list_keys (res[0][0], 1);
>   ses := string_output ();
>   DB.DBA.RDF_TRIPLES_TO_TTL (triples, ses);
>   string_to_file (filename, ses, -2);
> }
> ;
> 
> DB.DBA.CONSTRUCT_AND_SAVE_TO_TTL_FILE (
>   'construct { ?s ?p ?o } where { ?s ?p ?o }',
>   DB.DBA.JSO_SYS_GRAPH(),
>   'system_metadata.ttl' );
> 
> 
> Best Regards,
> IvAn Mikhailov.
> 
> -----Original Message-----
> From: virtuoso-users-boun...@lists.sourceforge.net
> [mailto:virtuoso-users-boun...@lists.sourceforge.net] On 
> Behalf Of Alex Black
> Sent: Saturday, April 28, 2007 3:32 AM
> To: virtuoso-users@lists.sourceforge.net
> Subject: [Virtuoso-users] Export RDF to a file
> 
> Can anyone point me in the right direction to export RDF to a 
> file (say TTL, or RDF/XML)?
> 
> It looks to me like DB.DBA.RDF_TRIPLES_TO_TTL() would work, 
> but I can't figure out what to pass in to the second 
> parameter (the output stream)?
> 
> 

Reply via email to