. . "2017-06-13T05:41:56Z" . . "VirtRdfGraphDumpInfRule" . "VirtRdfGraphDumpInfRule" . . "32f95300ba5175930fda9bcdd6a344c1" . . . . . "VirtRdfGraphDumpInfRule" . "2017-06-13T05:41:56.315653"^^ . . "2017-06-13T05:41:56.315653"^^ . . . . . "2017-06-13T05:41:56Z" . . . "---++Virtuoso RDF Graph Dump based on Inference Rule Utility\n\nThe graph_dump procedure below can be used to export triples from Named RDF Graphs in N3 triple format to file, filtering based on the specified Inference rule and predicate/property URI:\n\nParams:\n\n * in srcgraph varchar - source graph\n * in format varchar - output format N3 is supported for now \n * in inf varchar - inference name \n * in pred varchar - predicate to filter \n * in out_file varchar - output file prefix \n * in file_llength_llimit := 1000000000 - maximum size of files data is dumped in\n\n\n\ncreate procedure graph_dump (in srcgraph varchar, in format varchar := 'N3', in inf varchar := null, in pred varchar := null,\n\t\t\t in out_file varchar, in file_length_limit integer := 1000000000)\n{\n declare qr, file_name varchar;\n declare env, ses, meta, data, h any;\n declare ses_len, max_ses_len, file_len, file_idx integer;\n set isolation = 'uncommitted';\n max_ses_len := 10000000;\n file_len := 0;\n file_idx := 1;\n if (format <> 'N3')\n signal ('22023', 'The output format is not supported');\n file_name := sprintf ('%s%06d.ttl', out_file, file_idx);\n string_to_file (file_name || '.graph', srcgraph, -2);\n string_to_file (file_name, sprintf ('# Dump of graph <%s>, as of %s\\n', srcgraph, cast (now() as varchar)), -2);\n --env := vector (dict_new (16000), 0, '', '', '', 0, 0);\n env := vector (dict_new (16000), 0, '', '', '', 0, 0, 0, 0);\n ses := string_output ();\n if (inf is not null)\n inf := sprintf ('define input:inference \"%s\"', inf);\n else \n inf := '';\n if (pred is not null)\n pred := sprintf ('<%s>', pred); \n else \n pred := '?p';\n qr := sprintf ('select * from (sparql define input:storage \"\" %s select ?s %s as ?p ?o { graph <%S> { ?s %s ?o } } ) as sub option (loop)',\n \t\tinf, pred, srcgraph, pred);\n exec (qr, null, null, vector (), 0, null, null, h);\n while (0 = exec_next (h, null, null, data))\n {\n declare \"s\", \"p\", \"o\" any;\n \"s\" := data[0];\n \"p\" := data[1];\n \"o\" := data[2];\n http_ttl_triple (env, \"s\", \"p\", \"o\", ses);\n ses_len := length (ses);\n if (ses_len > max_ses_len)\n {\n file_len := file_len + ses_len;\n if (file_len > file_length_limit)\n {\n http (' .\\n', ses);\n string_to_file (file_name, ses, -1);\n file_len := 0;\n file_idx := file_idx + 1;\n file_name := sprintf ('%s%06d.ttl', out_file, file_idx);\n string_to_file (file_name, sprintf ('# Dump of graph <%s>, as of %s (part %d)\\n', srcgraph, cast (now() as varchar), file_idx), -2);\n env := vector (dict_new (16000), 0, '', '', '', 0, 0);\n }\n else\n string_to_file (file_name, ses, -1);\n ses := string_output ();\n }\n }\n exec_close (h);\n if (length (ses))\n {\n http (' .\\n', ses);\n string_to_file (file_name, ses, -1);\n }\n}\n;\n\n\n---+++Example\n\n[[http://www.ontologyportal.org/][SUMO ontology]] was recently mapped to DBpedia by its creators using RDF/XML and loaded into the [[http://dbpedia.org/sparql][DBpedia SPARQL Endpoint]].\n\nIssues:\n\n * To add to DBpedia data sets, N3 is preferred format.\n * Cross Links needed i.e. mapping <#dbpediaURI> owl:sameAs <#SumoURI> in addition to the authors links which are solely, <#SumoURI> owl:sameAs <#DBpediaURI>\n\nSolution:\n\n * Make an inference rules graph where owl:sameAs is explicitly asserted to be an owl:SymmetricalProperty type.\n\nttlp('owl:sameAs a owl:SymmetricalProperty .', '', 'rule_graph');\n\n * Make a Named Rule that's associated the the Named Graph in step above.\n\nrdfs_rule_set ('sas', 'rule_graph');\n\n * Run the graph_dump export procedure with the inference rule parameter and predicate/property filter option to export the data to file, in N3 format and with necessary owl:sameas cross links.\n\ngraph_dump ('http://www.ontologyportal.org/SUMO#', 'N3', 'sas', 'http://www.w3.org/2002/07/owl#sameAs', 'sumo_');\n" .