Alex, CONSTRUCT is definitely not the best way, because it creates in-memory dictionary of created triples, 1.8.Gb dictionary of this sort may abort client connection by 'memory low' alert.
Latest commercial Virtuoso build contains function DB.DBA.RDF_GRAPH_TO_TTL (in graph_iri varchar, inout ses any) that gets a graph IRI and writes the content of the graph into string output object that is passes as second argument (if second argument is NULL then it will output to the current HTTP client connection, if the procedure is called not from an HTTP request then NULL argument will result in error). While the patch that contains this function is on its way to public Virtuoso Open Source repository, you may temporarily clone it. create procedure DB.DBA.RDF_GRAPH_TO_TTL (in graph_iri varchar, inout ses any) { declare tcount integer; declare res varchar; declare prev_s, prev_p IRI_ID; tcount := 0; prev_s := null; prev_p := null; for (select S as subj, P as pred, O as obj from RDF_QUAD where G = iri_to_id (graph_iri)) do { if (prev_s = subj) { if (prev_p = pred) { http (',\n\t\t', ses); goto print_o; } http (';\n\t', ses); goto print_p; } if (prev_s is not null) http ('.\n', ses); if (subj >= #i1000000000) http (sprintf ('_:b%d ', iri_id_num (subj)), ses); else { res := id_to_iri (subj); http ('<', ses); http_escape (res, 12, ses, 1, 1); http ('> ', ses); } prev_s := subj; prev_p := null; print_p: if (pred >= #i1000000000) signal ('RDFXX', 'DB.DBA.RDF_GRAPH_TO_TTL(): blank node as predicate'); else { res := id_to_iri (pred); http ('<', ses); http_escape (res, 12, ses, 1, 1); http ('> ', ses); } prev_p := pred; print_o: DB.DBA.RDF_LONG_TO_TTL (obj, ses); tcount := tcount + 1; } if (0 = tcount) http ('# Empty TURTLE', ses); else http ('.\n', ses); } ; Please rename it to something else to avoid possible conflict when the function with this name will appear in the VOS release; you may also create it without renaming but drop it before the upgrade. You may also replace the condition 'where G = iri_to_id (graph_iri)' with something else. but in that case you may wish to add 'order by 1,2,3' or the result may become not so pretty-printed. Before next major release, Virtuoso will optimize some CONSTRUCT queries so they will avoid in-memory dictionary in some cases, including 'dump graph' case; this will eliminate the complication. Best Regards, IvAn Mikhailov. -----Original Message----- From: Alex Black [mailto:alex.bl...@terapath.net] Sent: Monday, April 30, 2007 10:11 PM To: imikhailov; virtuoso-users@lists.sourceforge.net Subject: RE: [Virtuoso-users] Export RDF to a file Ok, thanks Ivan. Related to this, are there any other options for exporting triples to a file? If I want to export my 1.8gb of data to RDF TTL, is this the most performant method in Virtuoso? - Alex