1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
-
- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- project.
-
- Copyright (C) 1998-2018 OpenLink Software
-
- This project is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; only version 2 of the License, dated June 1991.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-->
<refentry id="fn_rdf_load_rdfxml_mt">
<refmeta>
<refentrytitle>DB.DBA.RDF_LOAD_RDFXML_MT</refentrytitle>
<refmiscinfo>rdf</refmiscinfo>
</refmeta>
<refnamediv>
<refname>DB.DBA.RDF_LOAD_RDFXML_MT</refname>
<refpurpose>Parses the content of large RDF/XML text as a sequence of separate RDF triples.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="fsyn_rdf_load_rdfxml_mt">
<funcprototype id="fproto_rdf_load_rdfxml_mt">
<funcdef><function>DB.DBA.RDF_LOAD_RDFXML_MT</function></funcdef>
<paramdef>in <parameter>strg</parameter> varchar</paramdef>
<paramdef>in <parameter>base</parameter> varchar</paramdef>
<paramdef>in <parameter>graph</parameter> varchar</paramdef>
<paramdef><optional>in <parameter>log_mode</parameter> integer</optional></paramdef>
<paramdef><optional>in <parameter>threads</parameter> integer</optional></paramdef>
<paramdef><optional>in <parameter>transactional </parameter> integer</optional></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="desc_rdf_load_rdfxml_mt">
<title>Description</title>
<para>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 <parameter>log_mode</parameter>. 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.</para>
</refsect1>
<refsect1 id="params_rdf_load_rdfxml_mt">
<title>Parameters</title>
<refsect2><title>strg</title>
<para>text of the resource.</para>
</refsect2>
<refsect2><title>base</title>
<para>base IRI to resolve relative IRIs to absolute.</para>
</refsect2>
<refsect2><title>graph</title>
<para>target graph IRI, parsed triples will appear in that graph.</para>
</refsect2>
<refsect2><title>log_mode</title>
<para>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.</para>
</refsect2>
<refsect2><title>threads</title>
<para>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 <emphasis>((N-2)/k)-1</emphasis> where <emphasis>N</emphasis> is the number of available CPU cores and <emphasis>k</emphasis> is the number of loadings that happen at the same time.</para>
</refsect2>
<refsect2><title>transactional</title>
<para>controls the transaction mode which is "0" by default i.e. off and can be turned on by setting it to "1".</para>
</refsect2>
</refsect1>
<refsect1 id="ret_rdf_load_rdfxml_mt"><title>Return Types</title>
<para>The return value is not specified and may be changed in future versions.</para>
</refsect1>
<refsect1 id="examples_rdf_load_rdfxml_mt">
<title>Examples</title>
<example id="ex_rdf_load_rdfxml_mt"><title>Usage Example</title>
<para>The following example demonstrates importing data from the rdf file resource Kingsley_Idehen.rdf which can be downloaded from <ulink url="http://www.openlinksw.com/dataspace/person/kidehen@openlinksw.com/about.rdf">here</ulink></para>
<screen><![CDATA[
SQL> DB.DBA.RDF_LOAD_RDFXML_MT (file_to_string_output ('tmp/Kingsley_Idehen.rdf'), '', 'http://example.com');
Done. -- 61 msec.
SQL>sparql
select *
from <http://example.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.
]]></screen>
<para>The following example demonstrates importing data from the rdf resource with URI: http://www.w3.org/People/Berners-Lee/card</para>
<screen><![CDATA[
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
..........
]]>
</screen>
</example>
</refsect1>
<refsect1 id="seealso_rdf_load_rdfxml_mt">
<title>See Also</title>
<para><link linkend="fn_rdf_audit_metadata"><function>DB.DBA.RDF_AUDIT_METADATA()</function></link></para>
<para><link linkend="fn_rdf_backup_metadata"><function>DB.DBA.RDF_BACKUP_METADATA()</function></link></para>
<para><link linkend="fn_rdf_load_rdfxml"><function>DB.DBA.RDF_LOAD_RDFXML()</function></link></para>
<para><link linkend="fn_ttlp"><function>DB.DBA.TTLP()</function></link></para>
<para><link linkend="fn_ttlp_mt"><function>DB.DBA.TTLP_MT()</function></link></para>
</refsect1>
</refentry>
|