. "e00a3987becdce496d8ec2e95a2d0c6e" . . . "VirtRDFDumpNQuad" . "VirtRDFDumpNQuad" . . . "%META:TOPICPARENT{name=\"VOSIndex\"}%\n\n---+Producing NQuad dumps of Virtuoso Quad-store hosted RDF model data\n\n%TOC%\n\n---++What?\n\nHow to export RDF model data from Virtuoso's Quad Store in NQuad format.\n\n---++Why?\n\nWhen exporting RDF model data from Virtuoso's Quad Store, having the \nability to retain and reflect Named Graph IRI based data partitioning \nprovides significant value to a variety of application profiles.\n\n---++How?\n\nWe have created stored procedures for the task. The dump procedure dump_nquads \nleverages SPARQL to facilitate data dump(s) for all graphs excluding the internal \npredefined \"virtrdf:\".\n\n---+++ Procedure Parameters\n\nThe procedure dump_nquads has the following parameters: \n\n * IN dir VARCHAR -- folder where the dumps will be stored. \nNote: The dump directory must be included in the DirsAllowed \nparameter of the Virtuoso configuration file (e.g., virtuoso.ini), or the Virtuoso \nserver will not be able to create or access the data files.\n * IN outstart_fromfile INTEGER -- output start from number n\n * IN file_length_limit INTEGER -- maximum length of dump files \n * IN comp INTEGER -- when set to 0, then no gzip will be done. By default is set to 1.\n\n\n---+++ Procedure Source\n\nThe procedure dump_nquads has the following source:\n\n\nCREATE PROCEDURE dump_nquads \n ( IN dir VARCHAR := 'dumps'\n , IN start_from INT := 1\n , IN file_length_limit INTEGER := 100000000\n , IN comp INT := 1\n )\n {\n DECLARE inx, ses_len INT\n ; DECLARE file_name VARCHAR\n ; DECLARE env, ses ANY\n ;\n\n inx := start_from;\n SET isolation = 'uncommitted';\n env := vector (0,0,0);\n ses := string_output (10000000);\n FOR (SELECT * FROM (sparql define input:storage \"\" SELECT ?s ?p ?o ?g { GRAPH ?g { ?s ?p ?o } . FILTER ( ?g != virtrdf: ) } ) AS sub OPTION (loop)) DO\n {\n DECLARE EXIT HANDLER FOR SQLSTATE '22023' \n\t{\n\t GOTO next;\n\t};\n http_nquad (env, \"s\", \"p\", \"o\", \"g\", ses);\n ses_len := LENGTH (ses);\n IF (ses_len >= file_length_limit)\n\t{\n\t file_name := sprintf ('%s/output%06d.nq', dir, inx);\n\t string_to_file (file_name, ses, -2);\n\t IF (comp)\n\t {\n\t gz_compress_file (file_name, file_name||'.gz');\n\t file_delete (file_name);\n\t }\n\t inx := inx + 1;\n\t env := vector (0,0,0);\n\t ses := string_output (10000000);\n\t}\n next:;\n }\n IF (length (ses))\n {\n file_name := sprintf ('%s/output%06d.nq', dir, inx);\n string_to_file (file_name, ses, -2);\n IF (comp)\n\t{\n\t gz_compress_file (file_name, file_name||'.gz');\n\t file_delete (file_name);\n\t}\n inx := inx + 1;\n env := vector (0,0,0);\n }\n}\n;\n\n\n\n---+++Example\n\nThis example demonstrates calling the dump_nquads procedure to dump all graphs to \na series of compressed NQuad dumps, each with uncompressed length of 10Mb (./dumps/output000001.nq.gz):\n\nSQL> dump_nquads ('dumps', 1, 10000000, 1);\n\n\n\n\n---++ Related\n\n * [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]]\n * [[VirtRDFDatasetDump][RDF dumps from Virtuoso Quad store hosted data]]\n * [[VirtBulkRDFLoader][Virtuoso RDF Bulk Loader]]\n * [[http://docs.openlinksw.com/virtuoso/rdfperformancetuning.html#rdfperfdumpintonquads][Virtuoso Documentation]]\n\n" . . "2017-06-13T05:44:21Z" . "2017-06-13T05:44:21.014705"^^ . "2017-06-13T05:44:21.014705"^^ . . . . . "VirtRDFDumpNQuad" . . "2017-06-13T05:44:21Z" . . . . . . .