File: ttlp.xml

package info (click to toggle)
virtuoso-opensource 7.2.5.1%2Bdfsg1-0.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 285,240 kB
  • sloc: ansic: 641,220; sql: 490,413; xml: 269,570; java: 83,893; javascript: 79,900; cpp: 36,927; sh: 31,653; cs: 25,702; php: 12,690; yacc: 10,227; lex: 7,601; makefile: 7,129; jsp: 4,523; awk: 1,697; perl: 1,013; ruby: 1,003; python: 326
file content (163 lines) | stat: -rw-r--r-- 9,949 bytes parent folder | download | duplicates (2)
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
<?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_ttlp">
  <refmeta>
    <refentrytitle>DB.DBA.TTLP</refentrytitle>
    <refmiscinfo>rdf</refmiscinfo>
  </refmeta>
  <refnamediv>
    <refname>DB.DBA.TTLP</refname>
    <refpurpose>parses TTL (TURTLE or N3 resource) and places its triples into DB.DBA.RDF_QUAD.</refpurpose>
  </refnamediv>
  <refsynopsisdiv>
    <funcsynopsis id="fsyn_ttlp">
      <funcprototype id="fproto_ttlp">
        <funcdef><function>DB.DBA.TTLP</function></funcdef>
	<paramdef>in <parameter>strg</parameter> any</paramdef>
	<paramdef>in <parameter>base</parameter> varchar</paramdef>
	<paramdef>in <parameter>graph</parameter> varchar</paramdef>
        <paramdef>in <parameter>flags </parameter> integer</paramdef>
      </funcprototype>
    </funcsynopsis>
  </refsynopsisdiv>
  <refsect1 id="desc_ttlp">
    <title>Description</title>
    <para>Parses TTL (TURTLE or N3 resource) and places its triples into DB.DBA.RDF_QUAD.</para>
  </refsect1>
  <refsect1 id="params_ttlp">
    <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>flags</title>
      <para>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:</para>
<programlisting><![CDATA[
  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 '/', '#', '%' and '+' in local part of QName ("Qname with path")
 32 - Allows invalid symbols between '<' and '>', 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.
8192 - Enables searching for Turtle within the string.
<ulink url="http://sw.deri.org/2008/07/n-quads/">here</ulink>.
]]></programlisting>
    </refsect2>
  </refsect1>
  <refsect1 id="ret_ttlp"><title>Return Types</title>
    <para>The return value is not specified and may be changed in future versions.</para>
  </refsect1>
<!--  <refsect1 id="errors_ttlp">
    <title>Errors</title>
    <para>This function can generate the following errors:</para>
    <errorcode></errorcode>
  </refsect1>
-->
  <refsect1 id="examples_ttlp">
    <title>Examples</title>
    <example id="ex_ttlp"><title></title>
      <para>For loading a file of any greater length, it is most practical to use the file_to_string_output
function.</para>
      <para>It is important the file to be accessible for the Virtuoso server. You need to have set properly
the DirsAllowed parameter value in section [Parameters] of the Virtuoso database INI file. For example on
Windows it could be:</para>
<screen><![CDATA[
virtuoso.ini file:
[Parameters]
...
DirsAllowed =  .\tmp
...
]]></screen>
      <para>So in the example the file you want to import from, should be in the tmp folder or in its
subfolder. Note that this example folder is a subfolder of the Virtuoso Server working directory.</para>
<para><emphasis>Sample Example 1</emphasis></para>
<screen><![CDATA[
SQL> ttlp (file_to_string_output ('.\tmp\data.ttl'), '', 'http://my_graph', 0);
]]></screen>
    <para>Forth item in record of NQuad format is optional. If present then it is used as a graph.
If missed then the default graph is used. The purpose is to make SPARQL dataset serialization possible in
a "natural" way: the content of default graph is written without any graph name specified whereas the
content of named graphs is written with fouth field in place. Similarly, TriG uses default graph for
triples outside graph blocks. In all these cases, base IRI is used to resolve all relative IRIs of
the document, no matter what is the destination graph. Here is a simple example:</para>
<para><emphasis>Sample Example 2</emphasis></para>
    <para>Suppose we have the simple nquad.nq file:</para>
<programlisting><![CDATA[
<http://www.w3.org/2002/01/tr-automation/tr.rdf> <http://purl.org/dc/elements/1.1/title> "W3C Standards and Technical Reports" <http://www.w3.org/People/Berners-Lee/card> .
<http://www.w3.org/People/Berners-Lee/card> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/PersonalProfileDocument> <http://www.w3.org/People/Berners-Lee/card> .
<http://www.w3.org/People/Berners-Lee/card> <http://creativecommons.org/ns#license> <http://creativecommons.org/licenses/by-nc/3.0/> <http://www.w3.org/People/Berners-Lee/card> .
<http://www.w3.org/People/Berners-Lee/card> <http://purl.org/dc/elements/1.1/title> "Tim Berners-Lee's FOAF file" <http://www.w3.org/People/Berners-Lee/card> .
<http://www.w3.org/People/Berners-Lee/card> <http://xmlns.com/foaf/0.1/maker> <http://www.w3.org/People/Berners-Lee/card#i> <http://www.w3.org/People/Berners-Lee/card> .
<http://www.w3.org/People/Berners-Lee/card> <http://xmlns.com/foaf/0.1/primaryTopic> <http://www.w3.org/People/Berners-Lee/card#i> <http://www.w3.org/People/Berners-Lee/card> .
<http://www.w3.org/People/Berners-Lee/card#cm> <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> .
<http://www.w3.org/People/Berners-Lee/card#cm> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://www.koalie.net/foaf.rdf> <http://www.w3.org/People/Berners-Lee/card> .
<http://www.w3.org/People/Berners-Lee/card#cm> <http://xmlns.com/foaf/0.1/mbox> <mailto:coralie@w3.org> <http://www.w3.org/People/Berners-Lee/card> .
<http://www.w3.org/People/Berners-Lee/card#cm> <http://xmlns.com/foaf/0.1/name> "Coralie Mercier" <http://www.w3.org/People/Berners-Lee/card> .
]]></programlisting>
    <para>Load the file:</para>
<programlisting><![CDATA[
SQL>DB.DBA.TTLP (file_to_string_output ('./nquad.nq'), '', 'http://example.com/DAV/test', 512);
Done. -- 48 msec.
]]></programlisting>
    <para>Select all triples from the graph with URI the fourth provenance URI from the NQuad file i.e.: &lt;http://www.w3.org/People/Berners-Lee/card&gt;:</para>
<programlisting><![CDATA[
 SQL> sparql select * from <http://www.w3.org/People/Berners-Lee/card> where {?s ?p ?o};
 s                                               p                                                  o
 VARCHAR                                         VARCHAR                                            VARCHAR
 ________________________________________________

 http://www.w3.org/2002/01/tr-automation/tr.rdf  http://purl.org/dc/elements/1.1/title              W3C Standards and Technical Reports
 http://www.w3.org/People/Berners-Lee/card       http://www.w3.org/1999/02/22-rdf-syntax-ns#type    http://xmlns.com/foaf/0.1/PersonalProfileDocument
 http://www.w3.org/People/Berners-Lee/card       http://xmlns.com/foaf/0.1/primaryTopic             http://www.w3.org/People/Berners-Lee/card#i
 http://www.w3.org/People/Berners-Lee/card       http://purl.org/dc/elements/1.1/title              Tim Berners-Lee's FOAF file
 http://www.w3.org/People/Berners-Lee/card       http://xmlns.com/foaf/0.1/maker                    http://www.w3.org/People/Berners-Lee/card#i
 http://www.w3.org/People/Berners-Lee/card       http://creativecommons.org/ns#license              http://creativecommons.org/licenses/by-nc/3.0/
 http://www.w3.org/People/Berners-Lee/card#cm    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#cm    http://xmlns.com/foaf/0.1/mbox                     mailto:coralie@w3.org
 http://www.w3.org/People/Berners-Lee/card#cm    http://xmlns.com/foaf/0.1/name                     Coralie Mercier
 http://www.w3.org/People/Berners-Lee/card#cm    http://www.w3.org/2000/01/rdf-schema#seeAlso       http://www.koalie.net/foaf.rdf

 10 Rows. -- 7 msec.
]]></programlisting>
    </example>
  </refsect1>
  <refsect1 id="seealso_ttlp">
    <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_rdf_load_rdfxml_mt"><function>DB.DBA.RDF_LOAD_RDFXML_MT()</function></link></para>
    <para><link linkend="fn_ttlp_mt"><function>DB.DBA.TTLP_MT()</function></link></para>
    <para><link linkend="fn_ttlp_mt_local_file"><function>DB.DBA.TTLP_MT_LOCAL_FILE()</function></link></para>
  </refsect1>
</refentry>