<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head profile="http://internetalchemy.org/2003/02/profile"> <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" /> <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" /> <meta name="dc.title" content="Function: DB.DBA.RDF_LOAD_RDFXML_MT - Virtuoso Functions Guide" /> <meta name="dc.subject" content="Function: DB.DBA.RDF_LOAD_RDFXML_MT - Virtuoso Functions Guide" /> <meta name="dc.creator" content="OpenLink Software Documentation Team ; " /> <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" /> <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" /> <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" /> <link rel="parent" href="functions.html" title="Chapter Contents" /> <link rel="prev" href="appendixa.html" title="Appendix" /> <link rel="next" href="functions.html#.html" title="" /> <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" /> <link rel="stylesheet" type="text/css" href="doc.css" /> <link rel="stylesheet" type="text/css" href="/doc/translation.css" /> <title>Function: DB.DBA.RDF_LOAD_RDFXML_MT - Virtuoso Functions Guide</title> <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" /> <meta name="author" content="OpenLink Software Documentation Team ; " /> <meta name="copyright" content="OpenLink Software, 1999 - 2009" /> <meta name="keywords" content="" /> <meta name="GENERATOR" content="OpenLink XSLT Team" /> </head> <body> <div id="header"> <a name="fn_rdf_load_rdfxml_mt" /> <img src="../images/misc/logo.jpg" alt="" /> <h1>22. Virtuoso Functions Guide - DB.DBA.RDF_LOAD_RDFXML_MT</h1> </div> <div id="navbartop"> <div> <a class="link" href="functions.html">Chapter Contents</a> | <a class="link" href="fn_rdf_restore_metadata.html" title="DB.DBA.RDF_RESTORE_METADATA">Prev</a> | <a class="link" href="fn_rdf_load_rdfxml.html" title="DB.DBA.RDF_LOAD_RDFXML">Next</a> </div> </div> <div id="currenttoc"> <form method="post" action="/doc/adv_search.vspx"> <div class="search">Keyword Search: <br /> <input type="text" name="q" /> <input type="submit" name="go" value="Go" /> </div> </form> <div> <a href="http://www.openlinksw.com/">www.openlinksw.com</a> </div> <div> <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a> </div> <br /> <div> <a href="index.html">Book Home</a> </div> <br /> <div> <a href="contents.html">Contents</a> </div> <div> <a href="preface.html">Preface</a> </div> <br /> <div> <a class="selected" href="functions.html">Virtuoso Functions Guide</a> </div> <br /> <div> <a href="functions.html#admin">Administration</a> </div> <div> <a href="functions.html#aggr">Aggregate Functions</a> </div> <div> <a href="functions.html#array">Array Manipulation</a> </div> <div> <a href="functions.html#bpel">BPEL APIs</a> </div> <div> <a href="functions.html#backup">Backup</a> </div> <div> <a href="functions.html#compression">Compression</a> </div> <div> <a href="functions.html#cursors">Cursor</a> </div> <div> <a href="functions.html#time">Date & Time Manipulation</a> </div> <div> <a href="functions.html#debug">Debug</a> </div> <div> <a href="functions.html#dict">Dictionary Manipulation</a> </div> <div> <a href="functions.html#encoding">Encoding & Decoding</a> </div> <div> <a href="functions.html#file">File Manipulation</a> </div> <div> <a href="functions.html#ft">Free Text</a> </div> <div> <a href="functions.html#hash">Hashing / Cryptographic</a> </div> <div> <a href="functions.html#ldap">LDAP</a> </div> <div> <a href="functions.html#localization">Locale</a> </div> <div> <a href="functions.html#mail">Mail</a> </div> <div> <a href="functions.html#misc">Miscellaneous</a> </div> <div> <a href="functions.html#number">Number</a> </div> <div> <a href="functions.html#phrz">Phrases</a> </div> <div> <a class="selected" href="functions.html#rdf">RDF data</a> </div> <div class="selected"> <div> <a href="fn_rdf_64bit_upgrade.html">db.dba.rdf_64bit_upg...</a> </div> <div> <a href="fn_rdf_audit_metadata.html">db.dba.rdf_audit_met...</a> </div> <div> <a href="fn_rdf_backup_metadata.html">db.dba.rdf_backup_me...</a> </div> <div> <a href="fn_rdf_convert_rdfxml_to_ttl.html">db.dba.rdf_convert_r...</a> </div> <div> <a href="fn_rdf_datatype_of_obj.html">db.dba.rdf_datatype_...</a> </div> <div> <a href="fn_rdf_graph_collect_fp_list.html">db.dba.rdf_graph_col...</a> </div> <div> <a href="fn_rdf_graph_diff.html">db.dba.rdf_graph_dif...</a> </div> <div> <a href="fn_rdf_graph_group_create.html">db.dba.rdf_graph_gro...</a> </div> <div> <a href="fn_rdf_graph_group_ins.html">db.dba.rdf_graph_gro...</a> </div> <div> <a href="fn_rdf_langmatches.html">db.dba.rdf_langmatch...</a> </div> <div> <a href="fn_rdf_load_rdfa.html">db.dba.rdf_load_rdfa</a> </div> <div> <a href="fn_rdf_load_rdfxml.html">db.dba.rdf_load_rdfx...</a> </div> <div> <a class="selected" href="fn_rdf_load_rdfxml_mt.html">db.dba.rdf_load_rdfx...</a> </div> <div> <a href="fn_rdf_quad_uri.html">db.dba.rdf_quad_uri</a> </div> <div> <a href="fn_rdf_quad_uri_l.html">db.dba.rdf_quad_uri_...</a> </div> <div> <a href="fn_rdf_quad_uri_l_typed.html">db.dba.rdf_quad_uri_...</a> </div> <div> <a href="fn_rdf_regex.html">db.dba.rdf_regex</a> </div> <div> <a href="fn_rdf_restore_metadata.html">db.dba.rdf_restore_m...</a> </div> <div> <a href="fn_rdf_suo_apply_patch.html">db.dba.rdf_suo_apply...</a> </div> <div> <a href="fn_rdf_suo_diff_ttl.html">db.dba.rdf_suo_diff_...</a> </div> <div> <a href="fn_rdf_triples_to_rdf_xml_text.html">db.dba.rdf_triples_t...</a> </div> <div> <a href="fn_rdf_triples_to_ttl.html">db.dba.rdf_triples_t...</a> </div> <div> <a href="fn_rdf_ttl2hash.html">db.dba.rdf_ttl2hash</a> </div> <div> <a href="fn_rdf_void_store.html">db.dba.rdf_void_stor...</a> </div> <div> <a href="fn_sparql_eval.html">db.dba.sparql_eval</a> </div> <div> <a href="fn_sparql_eval_to_array.html">db.dba.sparql_eval_t...</a> </div> <div> <a href="fn_sparql_rdb2rdf_codegen.html">db.dba.sparql_rdb2rd...</a> </div> <div> <a href="fn_sparql_rdb2rdf_list_tables.html">db.dba.sparql_rdb2rd...</a> </div> <div> <a href="fn_sparql_rexec.html">db.dba.sparql_rexec</a> </div> <div> <a href="fn_sparql_rexec_to_array.html">db.dba.sparql_rexec_...</a> </div> <div> <a href="fn_sparql_rexec_with_meta.html">db.dba.sparql_rexec_...</a> </div> <div> <a href="fn_sparql_select_known_graphs.html">db.dba.sparql_select...</a> </div> <div> <a href="fn_ttlp.html">db.dba.ttlp</a> </div> <div> <a href="fn_ttlp_mt.html">db.dba.ttlp_mt</a> </div> <div> <a href="fn_ttlp_mt_local_file.html">db.dba.ttlp_mt_local...</a> </div> <div> <a href="fn_GROUP_CONCAT.html">group_concat</a> </div> <div> <a href="fn_isref.html">isref</a> </div> <div> <a href="fn_sample.html">sample</a> </div> <div> <a href="fn___xml_get_ns_prefix.html">__xml_get_ns_prefix</a> </div> <div> <a href="fn___xml_get_ns_uri.html">__xml_get_ns_uri</a> </div> <div> <a href="fn_http_nt_triple.html">http_nt_triple</a> </div> <div> <a href="fn_http_ttl_triple.html">http_ttl_triple</a> </div> <div> <a href="fn_iri_split.html">iri_split</a> </div> <div> <a href="fn_ld_dir.html">ld_dir</a> </div> <div> <a href="fn_rdfs_rule_set.html">rdfs_rule_set</a> </div> <div> <a href="fn_sparql_to_sql_text.html">sparql_to_sql_text</a> </div> </div> <div> <a href="functions.html#rmt">Remote SQL Data Source</a> </div> <div> <a href="functions.html#repl">Replication</a> </div> <div> <a href="functions.html#soap">SOAP</a> </div> <div> <a href="functions.html#sql">SQL</a> </div> <div> <a href="functions.html#string">String</a> </div> <div> <a href="functions.html#txn">Transaction</a> </div> <div> <a href="functions.html#type">Type Mapping</a> </div> <div> <a href="functions.html#uddi">UDDI</a> </div> <div> <a href="functions.html#udt">User Defined Types & The CLR</a> </div> <div> <a href="functions.html#vad">VAD</a> </div> <div> <a href="functions.html#jvmpl">Virtuoso Java PL API</a> </div> <div> <a href="functions.html#bif">Virtuoso Server Extension Interface (VSEI)</a> </div> <div> <a href="functions.html#ws">Web & Internet</a> </div> <div> <a href="functions.html#xml">XML</a> </div> <div> <a href="functions.html#XPATH">XPATH & XQUERY</a> </div> <br /> <div> <a href="functionidx.html">Functions Index</a> </div> <br /> </div> <div id="text"> <h2>DB.DBA.RDF_LOAD_RDFXML_MT</h2> <div class="refpurpose">Parses the content of large RDF/XML text as a sequence of separate RDF triples.</div> <div class="funcsynopsis"> <span class="funcdef"> <span class="function">DB.DBA.RDF_LOAD_RDFXML_MT</span> </span> (<span class="paramdef">in <span class="parameter">strg</span> varchar</span>, <span class="paramdef">in <span class="parameter">base</span> varchar</span>, <span class="paramdef">in <span class="parameter">graph</span> varchar</span>, <span class="paramdefoptional">[in <span class="optional">log_mode</span> integer]</span>, <span class="paramdefoptional">[in <span class="optional">threads</span> integer]</span>); </div> <div class="refsect1"> <div class="refsect1title">Description</div> <p>For loading large resources when transactional integrity is not important (loading of a single resource may take more than one transaction). The function may or may not leave a transaction log, depending on <span class="computeroutput">log_mode</span>. Hence, after successful load, one may need to execute the checkpoint statement to make sure that a server restart does not wipe out the results.</p> </div> <div class="refsect1"> <div class="refsect1title">Parameters</div> <div class="refsect2"> <span class="refsect2title">strg – </span> text of the resource. </div> <div class="refsect2"> <span class="refsect2title">base – </span> base IRI to resolve relative IRIs to absolute. </div> <div class="refsect2"> <span class="refsect2title">graph – </span> target graph IRI, parsed triples will appear in that graph. </div> <div class="refsect2"> <span class="refsect2title">log_mode – </span> detail level of writing the effect of loading to the transaction log. 0 means log nothing, 1 means log only allocations of internal IDs for new IRIs and literals, 2 means log everything. If database crashes when the loading is in progress or after the loading but before checkpoint is made, 0 will means that the database become inconsistent, 1 means that the database is consistent but loaded quads may disappear so the loading should be repeated and log replay may produce wrong results if actions in it depend on the content of quad store, 2 means no danger (so the default is 2). Hence loading with mode 1 and especially mode 0 are faster than usual mode 2 but they require checkpoints after data loadings and mode 0 additionally requires a checkpoint and database backup right before the loading. </div> <div class="refsect2"> <span class="refsect2title">threads – </span> number of threads that insert quads into the database. It should not be less than 1, obviously; it is better to not set it greater than <strong>((N-2)/k)-1</strong> where <strong>N</strong> is the number of available CPU cores and <strong>k</strong> is the number of loadings that happen at the same time. </div> </div> <div class="refsect1"> <div class="refsect1title">Return Types</div> <p>The return value is not specified and may be changed in future versions.</p> </div> <div class="refsect1"> <div class="refsect1title">Examples</div> <a name="ex_rdf_load_rdfxml_mt" /> <div class="example"> <div class="exampletitle" /> <p>The following example demonstrates importing data from the rdf file resource Kingsley_Idehen.rdf which can be downloaded from <a href="http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com/about.rdf">here</a> </p> <div> <pre class="screen"> SQL> DB.DBA.RDF_LOAD_RDFXML_MT (file_to_string_output ('tmp/Kingsley_Idehen.rdf'), '', 'http://mytest.com'); Done. -- 61 msec. SQL>sparql select * from <http://mytest.com> where {?s ?p ?o}; s p o VARCHAR VARCHAR VARCHAR _______________________________________________________________________________ http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#based_near http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2003/01/geo/wgs84_pos#Point http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#based_near http://www.w3.org/2003/01/geo/wgs84_pos#lat 42.485836 http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com#based_near http://www.w3.org/2003/01/geo/wgs84_pos#long -71.214287 http://www.openlinksw.com/dataspace/organization/vdb#this http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://xmlns.com/foaf/0.1/Organization http://www.openlinksw.com/dataspace/organization/vdb#this http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://xmlns.com/foaf/0.1/Person http://www.openlinksw.com/dataspace/organization/vdb#this http://xmlns.com/foaf/0.1/nick vdb http://www.openlinksw.com/dataspace/organization/vdb#this http://xmlns.com/foaf/0.1/name Virtuoso Data Space Bot http://www.openlinksw.com/dataspace/organization/dav#this http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://xmlns.com/foaf/0.1/Organization http://www.openlinksw.com/dataspace/organization/dav#this http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://xmlns.com/foaf/0.1/Person http://www.openlinksw.com/dataspace/organization/dav#this http://xmlns.com/foaf/0.1/nick dav 10 Rows. -- 30 msec. </pre> </div> <p>The following example demonstrates importing data from the rdf resource with URI: http://www.w3.org/People/Berners-Lee/card</p> <div> <pre class="screen"> SQL>create procedure MY_LOAD_FILE (in full_uri varchar, in in_resultset integer := 0) { declare REPORT varchar; declare graph_uri, dattext varchar; declare app_env any; app_env := null; whenever sqlstate '*' goto err_rep; if (not in_resultset) result_names (REPORT); dattext := cast (XML_URI_GET_AND_CACHE (full_uri) as varchar); MY_SPARQL_REPORT (sprintf ('Downloading %s: %d bytes', full_uri, length (dattext) ) ); graph_uri := full_uri; delete from RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_uri); DB.DBA.RDF_LOAD_RDFXML_MT (dattext, full_uri, graph_uri); return graph_uri; err_rep: result (sprintf ('%s: %s', __SQL_STATE, __SQL_MESSAGE)); return graph_uri; } ; Done. -- 0 msec. SQL>create procedure MY_SPARQL_REPORT(in strg varchar) { if (__tag(strg) <> 182) strg := cast (strg as varchar) || sprintf (' -- not a string, tag=%d', __tag(strg)); strg := replace (strg, SPARQL_DAV_DATA_URI(), '\044{SPARQL_DAV_DATA_URI()}'); strg := replace (strg, SPARQL_DAV_DATA_PATH(), '\044{SPARQL_DAV_DATA_PATH()}'); strg := replace (strg, SPARQL_FILE_DATA_ROOT(), '\044{SPARQL_FILE_DATA_ROOT()}'); result (strg); } ; Done. -- 0 msec. SQL> MY_LOAD_FILE('http://www.w3.org/People/Berners-Lee/card'); REPORT VARCHAR _______________________________________________________________________________ Downloading http://www.w3.org/People/Berners-Lee/card: 17773 bytes 1 Rows. -- 4046 msec. SQL>sparql select * from <http://www.w3.org/People/Berners-Lee/card> where {?s ?p ?o} ; s p o VARCHAR VARCHAR VARCHAR __________________________________________________________________________________________________________ http://bblfish.net/people/henry/card#me http://xmlns.com/foaf/0.1/name Henry Story http://www.w3.org/People/Berners-Lee/card#i http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://xmlns.com/foaf/0.1/Person http://www.w3.org/People/Berners-Lee/card#i http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.w3.org/2000/10/swap/pim/contact#Male http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/nick TimBL http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/nick timbl http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/mbox mailto:timbl@w3.org http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/mbox_sha1sum 965c47c5a70db7407210cef6e4e6f5374a525c5c http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/knows http://bblfish.net/people/henry/card#me http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/knows http://hometown.aol.com/chbussler/foaf/chbussler.foaf#me http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/knows http://danbri.org/foaf#danbri http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/knows http://norman.walsh.name/knows/who#norman-walsh http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/knows http://www.aaronsw.com/about.xrdf#aaronsw http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/knows http://www.ivan-herman.net/foaf.rdf#me http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/knows http://www.w3.org/People/Berners-Lee/card#amy http://www.w3.org/People/Berners-Lee/card#i http://xmlns.com/foaf/0.1/knows http://dig.csail.mit.edu/People/RRS .......... </pre> </div> </div> </div> <div class="refsect1"> <div class="refsect1title">See Also</div> <p> <a href="fn_rdf_audit_metadata.html">DB.DBA.RDF_AUDIT_METADATA</a> </p> <p> <a href="fn_rdf_backup_metadata.html">DB.DBA.RDF_BACKUP_METADATA</a> </p> <p> <a href="fn_rdf_load_rdfxml.html">DB.DBA.RDF_LOAD_RDFXML</a> </p> <p> <a href="fn_ttlp.html">DB.DBA.TTLP</a> </p> <p> <a href="fn_ttlp_mt.html">DB.DBA.TTLP_MT</a> </p> </div> </div> <div id="footer"> <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div> <div id="validation"> <a href="http://validator.w3.org/check/referer"> <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /> </a> <a href="http://jigsaw.w3.org/css-validator/"> <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" /> </a> </div> </div> </body> </html>