Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 71d40963b505df4524269198e237b3e3 > files > 632

virtuoso-opensource-doc-6.1.4-2.fc14.noarch.rpm

<!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.TTLP_MT_LOCAL_FILE - Virtuoso Functions Guide" />
  <meta name="dc.subject" content="Function: DB.DBA.TTLP_MT_LOCAL_FILE - Virtuoso Functions Guide" />
  <meta name="dc.creator" content="OpenLink Software Documentation Team ;&#10;" />
  <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.TTLP_MT_LOCAL_FILE - Virtuoso Functions Guide</title>
  <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
  <meta name="author" content="OpenLink Software Documentation Team ;&#10;" />
  <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_ttlp_mt_local_file" />
    <img src="../images/misc/logo.jpg" alt="" />
    <h1>22. Virtuoso Functions Guide - DB.DBA.TTLP_MT_LOCAL_FILE</h1>
  </div>
  <div id="navbartop">
   <div>
      <a class="link" href="functions.html">Chapter Contents</a> | <a class="link" href="fn_ttlp_mt.html" title="DB.DBA.TTLP_MT">Prev</a> | <a class="link" href="fn_rdf_datatype_of_obj.html" title="DB.DBA.RDF_DATATYPE_OF_OBJ">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 &amp; 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 &amp; 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 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 class="selected" 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 &amp; 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 &amp; Internet</a>
   </div>
   <div>
      <a href="functions.html#xml">XML</a>
   </div>
   <div>
      <a href="functions.html#XPATH">XPATH &amp; XQUERY</a>
   </div>
    <br />
   <div>
      <a href="functionidx.html">Functions Index</a>
   </div>
    <br />
  </div>
  <div id="text">
    <h2>DB.DBA.TTLP_MT_LOCAL_FILE</h2>
    <div class="refpurpose">parses TTL (TURTLE or N3 resource) and places its triples into DB.DBA.RDF_QUAD on multiple threads.</div>
    <div class="funcsynopsis">
        <span class="funcdef">
     <span class="function">DB.DBA.TTLP_MT_LOCAL_FILE</span>
     </span>
	(<span class="paramdef">in <span class="parameter">path</span> varchar</span>, 
	<span class="paramdef">in <span class="parameter">base</span> varchar</span>, 
	<span class="paramdefoptional">[in <span class="optional">graph</span> varchar]</span>, 
        <span class="paramdefoptional">[in <span class="optional">flags</span> integer]</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>Loads the TTL (TURTLE or N3 resource) file on multiple threads, using parallel I/O and multiprocessing if available. The function commit partial transactions while it runs so the transaction log may contain part of loading. Moreover, 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">path – </span>
      path to the file in the local filesystem
    </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">flags – </span>
      bitmask of parsing flags. Permits some sorts of syntax errors in resource.
Default is 0, meaning no permitted deviations from the spec. Other supported bits are:
<div>
          <pre class="programlisting">
  1 - Single quoted and double quoted strings may with newlines.
  2 - Allows bnode predicates (but SPARQL processor may ignore them!).
  4 - Allows variables, but triples with variables are ignored.
  8 - Allows literal subjects, but triples with them are ignored.
 16 - Allows &#39;/&#39;, &#39;#&#39;, &#39;%&#39; and &#39;+&#39; in local part of QName (&quot;Qname with path&quot;)
 32 - Allows invalid symbols between &#39;&amp;lt;&#39; and &#39;&amp;gt;&#39;, i.e. in relative IRIs.
 64 - Relax TURTLE syntax to include popular violations.
128 - Try to recover from lexical errors as much as it is possible.
256 - Allows Trig syntax, thus loading data in more than one graph.
512 - Allows loading N-quad dataset files with and optional context value to indicate provenance as detailed
&lt;ulink url=&quot;http://sw.deri.org/2008/07/n-quads/&quot;&gt;here&lt;/ulink&gt;.
</pre>
        </div>
    </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_ttlp_mt_local_file" />
      <div class="example">
        <div class="exampletitle" />
<p>
          <strong>Sample Example 1</strong>
        </p>
<div>
          <pre class="screen">
SQL&gt;DB.DBA.TTLP_MT_LOCAL_FILE (&#39;tmp/users.ttl&#39;, &#39;&#39;, &#39;http://mytest.com&#39;);

Done. -- 381 msec.
SQL&gt;sparql
select *
from &lt;http://mytest.com&gt;
where {?s ?p ?o}
limit 10;
s             p                   o
VARCHAR       VARCHAR             VARCHAR
_______________________________________________________________________________

http://www.openlinksw.com/virtrdf-data-formats#SysUsers-GranteeId-format          http://www.w3.org/1999/02/22-rdf-syntax-ns#type            http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat
http://www.openlinksw.com/virtrdf-data-formats#SysUsers-GranteeId-format          http://www.openlinksw.com/schemas/virtrdf#qmfSuperFormats  nodeID://1000272018
http://www.openlinksw.com/virtrdf-data-formats#SysUsers-GranteeId-format          http://www.openlinksw.com/schemas/virtrdf#inheritFrom      http://www.openlinksw.com/virtrdf-data-formats#sql-integer-uri-fn
http://www.openlinksw.com/virtrdf-data-formats#SysUsers-GranteeId-format          http://www.openlinksw.com/schemas/virtrdf#noInherit        http://www.openlinksw.com/schemas/virtrdf#qmfCustomString1
http://www.openlinksw.com/virtrdf-data-formats#SysUsers-GranteeId-format          http://www.openlinksw.com/schemas/virtrdf#qmfCustomString1 DB.DBA.RDF_DF_GRANTEE_ID_URI
http://www.openlinksw.com/virtrdf-data-formats#SysUsers-UserId-format             http://www.w3.org/1999/02/22-rdf-syntax-ns#type            http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat
http://www.openlinksw.com/virtrdf-data-formats#SysUsers-UserId-format             http://www.openlinksw.com/schemas/virtrdf#qmfSuperFormats  nodeID://1000272019
http://www.openlinksw.com/virtrdf-data-formats#SysUsers-UserId-format             http://www.openlinksw.com/schemas/virtrdf#inheritFrom      http://www.openlinksw.com/virtrdf-data-formats#sql-integer-uri
http://www.openlinksw.com/virtrdf-data-formats#SysUsers-UserId-format             http://www.openlinksw.com/schemas/virtrdf#noInherit        http://www.openlinksw.com/schemas/virtrdf#qmfCustomString1
http://www.openlinksw.com/virtrdf-data-formats#SysUsers-UserId-format             http://www.openlinksw.com/schemas/virtrdf#qmfCustomString1 http://localhost/sys/user?id=%d

10 Rows. -- 30 msec.

</pre>
        </div>
<p>
          <strong>Sample Example 2</strong>
        </p>
<div>
          <pre class="screen">
SQL&gt;create procedure SPARQL_DAWG_LOAD_REMOTE_DATFILE (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 &#39;*&#39; goto err_rep;
  if (not in_resultset)
    result_names (REPORT);
  dattext := cast (XML_URI_GET_AND_CACHE (full_uri) as varchar);
  SPARQL_REPORT (sprintf (&#39;Downloading %s: %d bytes&#39;,
      full_uri, length (dattext) ) );
  graph_uri := full_uri;
  delete from RDF_QUAD where G = DB.DBA.RDF_MAKE_IID_OF_QNAME (graph_uri);
  if ((full_uri like &#39;%.ttl&#39;) or (full_uri like &#39;%.nt&#39;) or (full_uri like &#39;%.n3&#39;))
    DB.DBA.TTLP_MT_LOCAL_FILE (dattext, full_uri, graph_uri);
  else -- if (rel_path like &#39;%.rdf&#39;)
    DB.DBA.RDF_LOAD_RDFXML_MT (dattext, full_uri, graph_uri);
  return graph_uri;
err_rep:
  result (sprintf (&#39;%s: %s&#39;, __SQL_STATE, __SQL_MESSAGE));
  return graph_uri;
}
;
Done. -- 891 msec
SQL&gt; select SPARQL_DAWG_LOAD_REMOTE_DATFILE(&#39;http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/sioc.ttl&#39;);
REPORT
VARCHAR
_______________________________________________________________________________

Downloading http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/sioc.ttl: 12768 bytes
http://www.openlinksw.com/dataspace/kidehen@openlinksw.com/weblog/kidehen@openlinksw.com%27s%20BLOG%20%5B127%5D/sioc.ttl

2 Rows. -- 1382 msec.
</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_rdf_load_rdfxml_mt.html">DB.DBA.RDF_LOAD_RDFXML_MT</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>