You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3240 lines
148 KiB
3240 lines
148 KiB
<?xml version="1.0" encoding="utf-8"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN" xml:lang="EN">
|
|
<head>
|
|
<title>R2RML: RDB to RDF Mapping Language</title>
|
|
<meta name="RCS-Id" content=
|
|
"$Id: Overview.html,v 1.3 2011/09/20 13:14:52 denis Exp $" />
|
|
<link rel="stylesheet" type="text/css" href=
|
|
"http://www.w3.org/StyleSheets/TR/W3C-WD.css" />
|
|
<style type="text/css">
|
|
/*<![CDATA[*/
|
|
dfn { color: navy; font-weight: bold; }
|
|
pre { margin-left: 0; padding: 0 2em; }
|
|
dt { margin-top: 0.8em; }
|
|
th, td { padding: 0.3em 0.5em; }
|
|
cite { font-style: normal }
|
|
th { text-align: left; }
|
|
h2, h3 { margin-top: 2em; }
|
|
em.rfc2119 { text-transform: lowercase; font-variant: small-caps; font-style: normal; }
|
|
.figure { margin: 2em 0; text-align: center; }
|
|
.figure .caption { margin-top: 1.6em; }
|
|
table.term-index th code { font-weight: normal; }
|
|
table.term-index th, table.term-index td { padding: 0.1em 0.5em; }
|
|
.issue { background-color: #fdd; border: 1px solid #800; margin: 1em 0em; padding: 1em; page-break-inside: avoid ; font-style: italic; }
|
|
.issue a.tracker { font-style: normal; font-weight: bold; }
|
|
.note { background: #e2fff0; border: 2px solid #cff6d9; margin: 1em 0em 0em; padding: 1em; }
|
|
.note:before { background: #fff; border: 1px solid #cff6d9; content: "Note"; display: block; font-weight: bold; margin: -1.5em 0 0.5em 0; padding: 0.2em 0.8em; width: 2.5em; }
|
|
.ex-data, table.ex-data th, table.ex-data td { background: #cee; border: 1px solid #acc; }
|
|
table.ex-data { border-collapse: collapse; margin-bottom: 1.5em; }
|
|
table.ex-data caption, table.ex-data th, table.ex-data td { font-family: monospace; }
|
|
table.ex-data caption, table.ex-data th { font-size: 125%; }
|
|
table.ex-data caption { font-weight: bold; }
|
|
table.ex-data th small, table.ex-data caption small { display: block; font-size: 65%; font-weight: normal; }
|
|
pre.vocab, pre.ex-mapping, pre.ex-output, pre.ex-sql { margin-top: 1.5em; padding: 1em; }
|
|
pre.vocab:before, pre.ex-mapping:before, pre.ex-output:before, pre.ex-sql:before { background: white; display: block; font-family: sans-serif; font-size: 90%; margin: -1.7em 0 0.5em 0; padding: 0.2em 0.4em; }
|
|
pre.vocab { background: #d4dddd; }
|
|
pre.vocab, pre.vocab:before { border: 1px solid #bbb; }
|
|
pre.vocab:before { color: #888; content: "R2RML vocabulary definition"; width: 13em; }
|
|
pre.ex-mapping, pre.ex-sql { background: #eeb; }
|
|
pre.ex-mapping, pre.ex-mapping:before, pre.ex-sql, pre.ex-sql:before { border: 1px solid #cc9; }
|
|
pre.ex-mapping:before { color: #996; content: "Example R2RML mapping"; width: 12em; }
|
|
pre.ex-sql:before { color: #996; content: "Example SQL query"; width: 9em; }
|
|
.ex-output { background: #cfc; }
|
|
.ex-output, .ex-output:before, .ex-output th, .ex-output td { border: 1px solid #aca; }
|
|
pre.ex-output:before { color: #797; content: "Example output data"; width: 9.5em; }
|
|
.toc ul { list-style-type: none; }
|
|
.toc > li { font-weight: bold; margin-bottom: 0.8em; }
|
|
.toc li li { font-weight: normal; }
|
|
/*]]>*/
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="head">
|
|
<p><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C"
|
|
height="48" width="72" /></a></p>
|
|
|
|
<h1><a name="title" id="title"></a>R2RML: RDB to RDF Mapping Language</h1>
|
|
|
|
<h2><a name="w3c-doctype" id="w3c-doctype"></a><em>W3C Working Draft 20 September 2011</em></h2>
|
|
|
|
<dl>
|
|
<dt>This version:</dt>
|
|
|
|
<dd><a href="http://www.w3.org/TR/2011/WD-r2rml-20110920/">http://www.w3.org/TR/2011/WD-r2rml-20110920/</a></dd>
|
|
|
|
<dt>Latest Editor's Draft:</dt>
|
|
|
|
<dd><a href=
|
|
"http://www.w3.org/2001/sw/rdb2rdf/r2rml/">http://www.w3.org/2001/sw/rdb2rdf/r2rml/</a></dd>
|
|
|
|
<dt>Latest published version:</dt>
|
|
|
|
<dd><a href="http://www.w3.org/TR/r2rml/">http://www.w3.org/TR/r2rml/</a></dd>
|
|
|
|
<dt>Previous version:</dt>
|
|
|
|
<dd><a href=
|
|
"http://www.w3.org/TR/2011/WD-r2rml-20110324/">http://www.w3.org/TR/2011/WD-r2rml-20110324/</a></dd>
|
|
|
|
<dt>Editors:</dt>
|
|
|
|
<dd>Souripriya Das, Oracle</dd>
|
|
|
|
<dd>Seema Sundara, Oracle</dd>
|
|
|
|
<dd>Richard Cyganiak, DERI, National University of Ireland, Galway</dd>
|
|
</dl>
|
|
|
|
<p class="copyright"><a href=
|
|
"http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
|
|
2011 <a href="http://www.w3.org/"><acronym title=
|
|
"World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href=
|
|
"http://www.csail.mit.edu/"><acronym title=
|
|
"Massachusetts Institute of Technology">MIT</acronym></a>, <a href=
|
|
"http://www.ercim.eu/"><acronym title=
|
|
"European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
|
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href=
|
|
"http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
|
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
|
|
and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
|
|
rules apply.</p>
|
|
</div>
|
|
<hr />
|
|
|
|
<h2><a name="abstract" id="abstract"></a>Abstract</h2>
|
|
|
|
<p>This document describes R2RML, a language for expressing customized mappings from
|
|
relational databases to RDF datasets. Such mappings provide the ability to view
|
|
existing relational data in the RDF data model, expressed in a structure and target
|
|
vocabulary of the mapping author's choice. R2RML mappings are themselves RDF graphs and
|
|
written down in Turtle syntax. R2RML enables different types of mapping
|
|
implementations. Processors could, for example, offer a virtual SPARQL endpoint over
|
|
the mapped relational data, or generate RDF dumps, or offer a Linked Data
|
|
interface.</p>
|
|
|
|
<div>
|
|
<h2><a name="status" id="status"></a>Status of this Document</h2>
|
|
|
|
<p><em>This section describes the status of this document at the time of its
|
|
publication. Other documents may supersede this document. A list of current W3C
|
|
publications and the latest revision of this technical report can be found in the
|
|
<a href="http://www.w3.org/TR/">W3C technical reports index</a> at
|
|
http://www.w3.org/TR/.</em></p>
|
|
|
|
<p>This document is a <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#last-call">Last Call Working Draft</a> of the "R2RML: RDB to RDF Mapping Language". Publication as a Last Call Working Draft indicates that the <a href="http://www.w3.org/2001/sw/rdb2rdf/">RDB2RDF Working Group</a> believes it has addressed all substantive issues and that the document is stable. The Working Group expects to advance this specification to <a href="http://www.w3.org/2004/02/Process-20040205/tr.html#RecsW3C">Recommendation Status</a>.</p><p>Comments on this document should be sent to <a href="mailto:public-rdb2rdf-comments@w3.org">public-rdb2rdf-comments@w3.org</a>, a mailing list with
|
|
a <a href="http://lists.w3.org/Archives/Public/public-rdb2rdf-comments/">public archive</a>. Comments on this working draft are due on or before <strong>1 November 2011</strong>. </p>
|
|
|
|
<p>Publication as a Working Draft does not imply endorsement by the W3C Membership.
|
|
This is a draft document and may be updated, replaced or obsoleted by other documents
|
|
at any time. It is inappropriate to cite this document as other than work in
|
|
progress.</p>
|
|
|
|
<p>This document was produced by the
|
|
<a href="http://www.w3.org/2001/sw/rdb2rdf/">W3C RDB2RDF Working Group</a>.
|
|
R2RML has changed significantly since the previous Working Draft. Much of the
|
|
document has been rewritten, many terms were renamed and other design details
|
|
have changed. New language features include
|
|
a detailed
|
|
account of the <a href="#datatype-conversions">conversion of SQL datatypes
|
|
to RDF</a>. The <a href="#generated-rdf">triples in the output dataset</a>
|
|
are now more accurately specified. One major open question remains, and the
|
|
working group seeks feedback on it: should
|
|
R2RML processors be <a href="#syntax">required to support the Turtle
|
|
syntax</a>? Apart from this, the working group anticipates no major further
|
|
changes.</p>
|
|
|
|
<p>This document was produced by a group operating under the <a href=
|
|
"http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
|
|
Policy</a>. W3C maintains a <a rel="disclosure" href=
|
|
"http://www.w3.org/2004/01/pp-impl/43889/status">public list of any patent
|
|
disclosures</a> made in connection with the deliverables of the group; that page also
|
|
includes instructions for disclosing a patent. An individual who has actual knowledge
|
|
of a patent which the individual believes contains <a href=
|
|
"http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
|
|
Claim(s)</a> must disclose the information in accordance with <a href=
|
|
"http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of
|
|
the W3C Patent Policy</a>.</p>
|
|
</div>
|
|
|
|
<div class="toc">
|
|
<h2><a name="contents" id="contents"></a>Table of Contents</h2>
|
|
|
|
<ul class="toc">
|
|
<li><a href="#introduction">1 Introduction</a>
|
|
<ul>
|
|
<li><a href="#conventions">1.1 Document Conventions</a></li>
|
|
</ul></li>
|
|
<li><a href="#overview">2 R2RML Overview and Example (Informative)</a>
|
|
<ul>
|
|
<li><a href="#example-input-database">2.1 Example Input Database</a></li>
|
|
<li><a href="#desired-rdf">2.2 Desired RDF Output</a></li>
|
|
<li><a href="#example-simple">2.3 Example: Mapping a Simple Table</a></li>
|
|
<li><a href="#example-r2rml-view">2.4 Example: Computing a Property with an R2RML View</a></li>
|
|
<li><a href="#example-fk">2.5 Example: Linking Two Tables</a></li>
|
|
<li><a href="#example-m2m">2.6 Example: Many-to-Many Tables</a></li>
|
|
</ul></li>
|
|
<li><a href="#conformance">3 Conformance</a></li>
|
|
<li><a href="#definitions">4 R2RML Processors and Mapping Documents</a>
|
|
<ul>
|
|
<li><a href="#vocabulary">4.1 Mapping Graphs and the R2RML Vocabulary</a></li>
|
|
<li><a href="#syntax">4.2 RDF-based Turtle Syntax; Media Type</a></li>
|
|
<li><a href="#data-errors">4.3 Data Errors</a></li>
|
|
</ul></li>
|
|
<li><a href="#logical-tables">5 Defining Logical Tables</a>
|
|
<ul>
|
|
<li><a href="#physical-tables">5.1 Base Tables and SQL Views (<code>rr:tableName</code>)</a></li>
|
|
<li><a href="#r2rml-views">5.2 R2RML Views (<code>rr:sqlQuery</code>)</a></li>
|
|
</ul></li>
|
|
<li><a href="#triples-map">6 Mapping Logical Tables to RDF with Triples Maps</a>
|
|
<ul>
|
|
<li><a href="#subject-map">6.1 Creating Resources with Subject Maps</a></li>
|
|
<li><a href="#typing">6.2 Typing Resources (<code>rr:class</code>)</a></li>
|
|
<li><a href="#predicate-object-map">6.3 Creating Properties and Values with Predicate-Object Maps</a></li>
|
|
</ul></li>
|
|
<li><a href="#term-map">7 Creating RDF Terms with Term Maps</a>
|
|
<ul>
|
|
<li><a href="#constant">7.1 Constant RDF Terms (<code>rr:constant</code>)</a></li>
|
|
<li><a href="#from-column">7.2 From a Column (<code>rr:column</code>)</a></li>
|
|
<li><a href="#from-template">7.3 From a Template (<code>rr:template</code>)</a></li>
|
|
<li><a href="#termtype">7.4 IRIs, Literal, Blank Nodes (<code>rr:termType</code>)</a></li>
|
|
<li><a href="#language-tags">7.5 Language Tags (<code>rr:language</code>)</a></li>
|
|
<li><a href="#typed-literals">7.6 Typed Literals (<code>rr:datatype</code>)</a></li>
|
|
<li><a href="#inverse">7.7 Inverse Expressions (<code>rr:inverseExpression</code>)</a></li>
|
|
</ul></li>
|
|
<li><a href="#foreign-key">8 Foreign Key Relationships among Logical Tables (<code>rr:parentTriplesMap</code>, <code>rr:joinCondition</code>, <code>rr:child</code> and <code>rr:parent</code>)</a></li>
|
|
<li><a href="#named-graphs">9 Assigning Triples to Named Graphs</a>
|
|
<ul>
|
|
<li><a href="#blank-nodes">9.1 Scope of Blank Nodes</a></li>
|
|
</ul></li>
|
|
<li><a href="#datatype-conversions">10 Datatype Conversions</a>
|
|
<ul>
|
|
<li><a href="#datatype-table">10.1 Table of Corresponding Datatypes</a></li>
|
|
<li><a href="#to-string">10.2 Conversion to String</a></li>
|
|
<li><a href="#to-boolean">10.3 Conversion to <code>xsd:boolean</code></a></li>
|
|
<li><a href="#datetime">10.4 Conversion to Datetime</a></li>
|
|
<li><a href="#binary">10.5 Conversion to <code>xsd:base64Binary</code></a></li>
|
|
</ul></li>
|
|
<li><a href="#generated-rdf">11 The Output Dataset</a>
|
|
<ul>
|
|
<li><a href="#generated-triples">11.1 The Generated RDF Triples of a Triples Map</a></li>
|
|
<li><a href="#generated-rdf-terms">11.2 The Generated RDF Terms of a Term Map</a></li>
|
|
</ul></li>
|
|
<li><a href="#terminology">A. RDF Terminology (Informative)</a></li>
|
|
<li><a href="#index">B. Index of R2RML Vocabulary Terms (Informative)</a>
|
|
<ul>
|
|
<li><a href="#class-index">B.1 Classes</a></li>
|
|
<li><a href="#property-index">B.2 Properties</a></li>
|
|
<li><a href="#other-index">B.3 Other Terms</a></li>
|
|
</ul></li>
|
|
<li><a href="#references">C. References</a>
|
|
<ul>
|
|
<li><a href="#normative-refs">C.1 Normative References</a></li>
|
|
<li><a href="#non-normative-refs">C.2 Other References</a></li>
|
|
</ul></li>
|
|
<li><a href="#acknowledgements">D. Acknowledgements (Informative)</a></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<hr />
|
|
|
|
<div class="body">
|
|
<h2><a name="introduction" id="introduction"></a>1 Introduction</h2>
|
|
|
|
<p>This specification describes R2RML, a language for expressing customized mappings
|
|
from relational databases to RDF datasets. Such mappings provide the ability to view
|
|
existing relational data in the RDF data model, expressed in a structure and target
|
|
vocabulary of the mapping author's choice.</p>
|
|
|
|
<p>This specification has a companion that defines <cite><a class="inform"
|
|
href="http://www.w3.org/TR/2011/WD-rdb-direct-mapping-20110920/">a direct mapping
|
|
from relational databases to RDF</a></cite> [<cite><a href="#DM">DM</a></cite>].
|
|
In the direct mapping of a database, the
|
|
structure of the resulting RDF graph directly reflects the structure of the database,
|
|
the target RDF vocabulary directly reflects the names of database schema elements,
|
|
and neither structure nor target vocabulary can be changed. With R2RML on the other
|
|
hand, a mapping author can define highly customized views over the relational
|
|
data.</p>
|
|
|
|
<p>Every R2RML mapping is tailored to a specific database schema and target
|
|
vocabulary. The input to an R2RML mapping is a relational database that conforms to
|
|
that schema. The output is an <cite><a class="norm" href=
|
|
"http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#rdfDataset">RDF
|
|
dataset</a></cite> [<cite><a href="#SPARQL">SPARQL</a></cite>], as defined in SPARQL,
|
|
that uses predicates and types from the target vocabulary. The mapping is conceptual;
|
|
R2RML processors are free to materialize the output data, or to offer virtual access
|
|
through an interface that queries the underlying database, or to offer any other
|
|
means of providing access to the output RDF dataset.</p>
|
|
|
|
<p>R2RML mappings are themselves expressed as RDF graphs and written down in
|
|
<cite><a class="norm" href=
|
|
"http://www.w3.org/TeamSubmission/2008/SUBM-turtle-20080114/">Turtle
|
|
syntax</a></cite> [<cite><a href="#TURTLE">TURTLE</a></cite>].</p>
|
|
|
|
<p>The intended audience of this specification is implementors of software
|
|
that
|
|
generates or processes R2RML mapping documents, as well as mapping authors looking
|
|
for a reference to the R2RML language constructs. The document uses concepts from
|
|
<cite><em><a class="norm" href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/">RDF Concepts and Abstract
|
|
Syntax</a></em></cite> [<cite><a href="#RDF">RDF</a></cite>] and from the <cite>SQL
|
|
language specifications</cite> [<cite><a href="#SQL1">SQL1</a></cite>][<cite><a href=
|
|
"#SQL2">SQL2</a></cite>]. A reader's familiarity with the contents of these
|
|
documents, as well as with the Turtle syntax, is assumed.</p>
|
|
|
|
<p>The R2RML language is designed to meet the use cases and requirements identified
|
|
in <cite><em><a class="inform" href=
|
|
"http://www.w3.org/TR/2010/WD-rdb2rdf-ucr-20100608/">Use Cases and Requirements for
|
|
Mapping Relational Databases to RDF</a></em></cite> [<cite><a href=
|
|
"#UCNR">UCNR</a></cite>].</p>
|
|
|
|
|
|
<h3 id="conventions">1.1 Document Conventions</h3>
|
|
|
|
<p>In this document, examples assume the following namespace prefix bindings unless
|
|
otherwise stated:</p>
|
|
|
|
<table rules="all" summary="list of prefixes used in the document">
|
|
<tr>
|
|
<th>Prefix</th>
|
|
|
|
<th>IRI</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><code>rr:</code></td>
|
|
|
|
<td><code>http://www.w3.org/ns/r2rml#</code></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><code>rdf:</code></td>
|
|
|
|
<td><code>http://www.w3.org/1999/02/22-rdf-syntax-ns#</code></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><code>rdfs:</code></td>
|
|
|
|
<td><code>http://www.w3.org/2000/01/rdf-schema#</code></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><code>xsd:</code></td>
|
|
|
|
<td><code>http://www.w3.org/2001/XMLSchema#</code></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td><code>ex:</code></td>
|
|
|
|
<td><code>http://example.com/ns#</code></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>Throughout the document, boxes containing Turtle markup and SQL data will appear.
|
|
These boxes are color-coded. Gray boxes contain RDFS definitions of R2RML vocabulary
|
|
terms:</p>
|
|
<pre class="vocab">
|
|
# This box contains RDFS definitions of R2RML vocabulary terms
|
|
</pre>
|
|
|
|
<p>Yellow boxes contain example fragments of R2RML mappings in Turtle syntax:</p>
|
|
<pre class="ex-mapping">
|
|
# This box contains example R2RML mappings
|
|
</pre>
|
|
|
|
<p>Blue tables contain example input into an R2RML mapping:</p>
|
|
<table class="ex-data">
|
|
<caption>EXAMPLE</caption>
|
|
<tr><th>ID <small>INTEGER PRIMARY KEY</small></th><th>DESC <small>VARCHAR(100)</small></th></tr>
|
|
<tr><td>1</td><td>This is an example input table.</td></tr>
|
|
<tr><td>2</td><td>The table name is EXAMPLE.</td></tr>
|
|
<tr><td>3</td><td>It has six rows.</td></tr>
|
|
<tr><td>4</td><td>It has two columns, ID and DESC.</td></tr>
|
|
<tr><td>5</td><td>ID is the table's primary key and of type INTEGER.</td></tr>
|
|
<tr><td>6</td><td>DESC is of type VARCHAR(100)</td></tr>
|
|
</table>
|
|
|
|
<p>Green boxes contain example output:</p>
|
|
|
|
<pre class="ex-output">
|
|
# This box contains example output RDF triples or fragments
|
|
</pre>
|
|
|
|
|
|
<h2 id="overview">2 R2RML Overview and Example (Informative)</h2>
|
|
|
|
<p>This section gives a brief overview of the R2RML mapping language,
|
|
followed by a simple example relational database with an
|
|
R2RML mapping document and its output RDF. Further R2RML examples can
|
|
be found in the
|
|
<cite><em><a class="inform" href="http://www.w3.org/2001/sw/rdb2rdf/test-cases/">R2RML and Direct Mapping Test Cases</a></em></cite>
|
|
[<cite><a href="#TC">TC</a></cite>].</p>
|
|
|
|
<p>An <a href="#dfn-r2rml-mapping">R2RML mapping</a> refers to
|
|
<a href="#dfn-logical-table">logical tables</a> to retrieve
|
|
data from the <a href="#dfn-input-database">input database</a>.
|
|
A logical table can be one of the following:</p>
|
|
|
|
<ol>
|
|
<li>A base table,</li>
|
|
<li>a view, or</li>
|
|
<li>a valid SQL query (called an
|
|
“<a href="#dfn-r2rml-view">R2RML view</a>” because it
|
|
emulates a SQL view without modifying the database).</li>
|
|
</ol>
|
|
|
|
<p>Each logical table is mapped to RDF using a
|
|
<a href="#dfn-triples-map">triples map</a>. The triples map is
|
|
a rule that maps each <a href="#dfn-logical-table-row">row in the
|
|
logical table</a> to a number of <a href="#dfn-rdf-triple">RDF triples</a>.
|
|
The rule has two main parts:</p>
|
|
|
|
<ol>
|
|
<li>A <a href="#dfn-subject-map">subject map</a> that generates the subject
|
|
of all RDF triples that will be generated from a logical table row.</li>
|
|
<li>Multiple <a href="#dfn-predicate-object-map">predicate-object maps</a>
|
|
that in turn consist of <a href="#dfn-predicate-map">predicate maps</a> and
|
|
<a href="#dfn-object-map">object maps</a>
|
|
(or <a href="#dfn-referencing-object-map">referencing object maps</a>).
|
|
</li>
|
|
</ol>
|
|
|
|
<p>Triples are produced by combining the subject map with a predicate
|
|
map and object map, and applying these three to each
|
|
<a href="#dfn-logical-table-row">logical table row</a>. For example, the
|
|
complete rule for generating a set of triples might be:</p>
|
|
|
|
<ul>
|
|
<li><strong>Subjects:</strong> A template <code>http://data.example.com/employee/{empno}</code> is used to generate subject <a href="#dfn-iri">IRIs</a> from the <code>empno</code> column.</li>
|
|
<li><strong>Predicates:</strong> The constant vocabulary <a href="#dfn-iri">IRI</a> <code>ex:name</code> is used.</li>
|
|
<li><strong>Objects:</strong> The value of the <code>ename</code> column is used to produce an <a href="#dfn-literal">RDF literal</a>.</li>
|
|
</ul>
|
|
|
|
<p>By default, all <a href="#dfn-rdf-triple">RDF triples</a> are in the
|
|
<a href="#dfn-default-graph">default graph</a> of the
|
|
<a href="#dfn-output-dataset">output dataset</a>.
|
|
A triples map can contain
|
|
<a href="#dfn-graph-map">graph maps</a>
|
|
that place some or all of the triples into
|
|
<a href="#dfn-named-graph">named graphs</a> instead.</p>
|
|
|
|
<div class="figure">
|
|
<img src="images/uml-overview.png" alt="UML overview diagram of R2RML"/>
|
|
<br /><br />
|
|
Figure 1: An overview of R2RML
|
|
</div>
|
|
|
|
|
|
<h3 id="example-input-database">2.1 Example Input Database</h3>
|
|
|
|
<p>The following example database consists of two tables,
|
|
<code>EMP</code> and <code>DEPT</code>, with one row each:</p>
|
|
|
|
<table class="ex-data" summary="EMP table: sample data" id="ex_EMP">
|
|
<caption>EMP</caption>
|
|
<tr>
|
|
<th>EMPNO <small>INTEGER PRIMARY KEY</small></th>
|
|
<th>ENAME <small>VARCHAR(100)</small></th>
|
|
<th>JOB <small>VARCHAR(20)</small></th>
|
|
<th>DEPTNO <small>INTEGER REFERENCES DEPT (DEPTNO)</small></th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>7369</code></td>
|
|
<td><code>SMITH</code></td>
|
|
<td><code>CLERK</code></td>
|
|
<td><code>10</code></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<table class="ex-data" summary="DEPT table: sample data" id="ex_DEPT">
|
|
<caption>DEPT</caption>
|
|
<tr>
|
|
<th>DEPTNO <small>INTEGER PRIMARY KEY</small></th>
|
|
<th>DNAME <small>VARCHAR(30)</small></th>
|
|
<th>LOC <small>VARCHAR(100)</small></th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>10</code></td>
|
|
<td><code>APPSERVER</code></td>
|
|
<td><code>NEW YORK</code></td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
<h3 id="desired-rdf">2.2 Desired RDF Output</h3>
|
|
|
|
<p>The desired RDF triples to be produced from this database are
|
|
as follows:</p>
|
|
|
|
<pre class="ex-output">
|
|
<http://data.example.com/employee/7369> rdf:type ex:Employee.
|
|
<http://data.example.com/employee/7369> ex:name "SMITH".
|
|
<http://data.example.com/employee/7369> ex:department <http://data.example.com/department/10>.
|
|
|
|
<http://data.example.com/department/10> rdf:type ex:Department.
|
|
<http://data.example.com/department/10> ex:name "APPSERVER".
|
|
<http://data.example.com/department/10> ex:location "NEW YORK".
|
|
<http://data.example.com/department/10> ex:staff 1.</pre>
|
|
|
|
<p>Note in particular:</p>
|
|
|
|
<ul>
|
|
<li>Construction of custom IRI identifiers for departments and employees;</li>
|
|
<li>use of a custom target vocabulary (<code>ex:Employee</code>, <code>ex:location</code> etc.);</li>
|
|
<li>the <code>ex:staff</code> property has the total number of staff of a department; this value is not stored directly in the database but has to be computed.</li>
|
|
<li>the <code>ex:department</code> property relates an employee to their department, using the identifiers of both entities;</li>
|
|
</ul>
|
|
|
|
|
|
<h3 id="example-simple">2.3 Example: Mapping a Simple Table</h3>
|
|
|
|
<p>The following partial R2RML mapping document will produce
|
|
the desired triples from the <a href="#ex_EMP"><code>EMP</code> table</a>
|
|
(except the
|
|
<code>ex:department</code> triple, which will be added later):</p>
|
|
|
|
<pre class="ex-mapping">
|
|
@prefix rr: <http://www.w3.org/ns/r2rml#>.
|
|
|
|
<#TriplesMap1>
|
|
rr:logicalTable [ rr:tableName "EMP" ];
|
|
rr:subjectMap [
|
|
rr:template "http://data.example.com/employee/{EMPNO}";
|
|
rr:class ex:Employee;
|
|
];
|
|
rr:predicateObjectMap [
|
|
rr:predicate ex:name;
|
|
rr:objectMap [ rr:column "ENAME" ];
|
|
].</pre>
|
|
|
|
<pre class="ex-output">
|
|
<http://data.example.com/employee/7369> rdf:type ex:Employee.
|
|
<http://data.example.com/employee/7369> ex:name "SMITH".</pre>
|
|
|
|
|
|
<h3 id="example-r2rml-view">2.4 Example: Computing a Property with an R2RML View</h3>
|
|
|
|
<p>Next, the <a href="#ex_DEPT"><code>DEPT</code> table</a> needs
|
|
to be mapped. Instead of using the table directly as the basis
|
|
for that mapping, an “<a href="#dfn-r2rml-view">R2RML view</a>”
|
|
will be defined based on a SQL query.
|
|
This allows computation of the staff number.
|
|
(Alternatively, one could define this view directly in the database.)</p>
|
|
|
|
<pre class="ex-sql">
|
|
<#DeptTableView> rr:sqlQuery """
|
|
SELECT DEPTNO,
|
|
DNAME,
|
|
LOC,
|
|
(SELECT COUNT(*) FROM EMP WHERE EMP.DEPTNO=DEPT.DEPTNO) AS STAFF
|
|
FROM DEPT;
|
|
""".
|
|
</pre>
|
|
|
|
<p>The definition of a triples map that generates the desired
|
|
<code>DEPT</code> triples based on this R2RML view follows.</p>
|
|
|
|
<pre class="ex-mapping">
|
|
<#TriplesMap2>
|
|
rr:logicalTable <#DeptTableView>;
|
|
rr:subjectMap [
|
|
rr:template "http://data.example.com/department/{DEPTNO}";
|
|
rr:class ex:Department;
|
|
];
|
|
rr:predicateObjectMap [
|
|
rr:predicate ex:name;
|
|
rr:objectMap [ rr:column "DNAME" ];
|
|
];
|
|
rr:predicateObjectMap [
|
|
rr:predicate ex:location;
|
|
rr:objectMap [ rr:column "LOC" ];
|
|
];
|
|
rr:predicateObjectMap [
|
|
rr:predicate ex:staff;
|
|
rr:objectMap [ rr:column "STAFF" ];
|
|
].</pre>
|
|
|
|
<pre class="ex-output">
|
|
<http://data.example.com/department/10> rdf:type ex:Department.
|
|
<http://data.example.com/department/10> ex:name "APPSERVER".
|
|
<http://data.example.com/department/10> ex:location "NEW YORK".
|
|
<http://data.example.com/department/10> ex:staff 1.</pre>
|
|
|
|
|
|
<h3 id="example-fk">2.5 Example: Linking Two Tables</h3>
|
|
|
|
<p>To complete the mapping document, the <code>ex:department</code>
|
|
triples need to be generated. Their subjects come from
|
|
the first triples map (<code><#TriplesMap1></code>),
|
|
the objects come from the second triples map
|
|
(<code><#TriplesMap2></code>).</p>
|
|
|
|
<p>This can be achieved by adding another <code>rr:predicateObjectMap</code>
|
|
to <code><#TriplesMap1></code>. This one uses the other triples map,
|
|
<code><#TriplesMap2></code>, as a <a href="#foreign-key">parent
|
|
triples map</a>:</p>
|
|
|
|
<pre class="ex-mapping"><#TriplesMap1>
|
|
rr:predicateObjectMap [
|
|
rr:predicate ex:department;
|
|
rr:objectMap [
|
|
rr:parentTriplesMap <#TriplesMap2>;
|
|
rr:joinCondition [
|
|
rr:child "DEPTNO";
|
|
rr:parent "DEPTNO";
|
|
];
|
|
];
|
|
].</pre>
|
|
|
|
<p>This performs a join between the <code>EMP</code> table and the
|
|
R2RML view, on the
|
|
<code>DEPTNO</code> columns. The objects will be generated from
|
|
the subject map of the parent triples map, yielding the desired
|
|
triple:</p>
|
|
|
|
<pre class="ex-output">
|
|
<http://data.example.com/employee/7369> ex:department <http://data.example.com/department/10>.</pre>
|
|
|
|
<p>This completes the R2RML mapping document. An R2RML processor will
|
|
generate the triples listed above from this mapping document.</p>
|
|
|
|
|
|
<h3 id="example-m2m">2.6 Example: Many-to-Many Tables</h3>
|
|
|
|
<p>A final example will assume that a many-to-many relationship exists between
|
|
the extended versions of <a href="#ex_EMP_m2m"><code>EMP</code> table</a> and the <a
|
|
href="#ex_DEPT_m2m"><code>DEPT</code> table</a> shown below. This
|
|
many-to-many relationship is captured by the content of
|
|
the <a href="#ex_EMP2DEPT"><code>EMP2DEPT</code> table</a>. The database consisting of
|
|
the <code>EMP</code>, <code>DEPT</code>, and <code>EMP2DEPT</code> tables are shown below:</p>
|
|
|
|
<table class="ex-data" summary="EMP table: sample data" id="ex_EMP_m2m">
|
|
<caption>EMP</caption>
|
|
<tr>
|
|
<th>EMPNO <small>INTEGER PRIMARY KEY</small></th>
|
|
<th>ENAME <small>VARCHAR(100)</small></th>
|
|
<th>JOB <small>VARCHAR(20)</small></th>
|
|
<th>DEPTNO <small>INTEGER REFERENCES DEPT (DEPTNO)</small></th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>7369</code></td>
|
|
<td><code>SMITH</code></td>
|
|
<td><code>CLERK</code></td>
|
|
<td><code>10</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>7369</code></td>
|
|
<td><code>SMITH</code></td>
|
|
<td><code>NIGHTGUARD</code></td>
|
|
<td><code>20</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>7400</code></td>
|
|
<td><code>JONES</code></td>
|
|
<td><code>ENGINEER</code></td>
|
|
<td><code>10</code></td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<table class="ex-data" summary="DEPT table: sample data" id="ex_DEPT_m2m">
|
|
<caption>DEPT</caption>
|
|
<tr>
|
|
<th>DEPTNO <small>INTEGER PRIMARY KEY</small></th>
|
|
<th>DNAME <small>VARCHAR(30)</small></th>
|
|
<th>LOC <small>VARCHAR(100)</small></th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>10</code></td>
|
|
<td><code>APPSERVER</code></td>
|
|
<td><code>NEW YORK</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>20</code></td>
|
|
<td><code>RESEARCH</code></td>
|
|
<td><code>BOSTON</code></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<table class="ex-data" summary="EMP2DEPT table: sample data" id="ex_EMP2DEPT">
|
|
<caption>EMP2DEPT <small>PRIMARY KEY (EMPNO, DEPTNO)</small></caption>
|
|
<tr>
|
|
<th>EMPNO <small>INTEGER REFERENCES EMP (EMPNO)</small></th>
|
|
<th>DEPTNO <small>INTEGER REFERENCES DEPT (DEPTNO)</small></th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>7369</code></td>
|
|
<td><code>10</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>7369</code></td>
|
|
<td><code>20</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>7400</code></td>
|
|
<td><code>10</code></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<pre class="ex-output">
|
|
<http://data.example.com/employee=7369/department=10>
|
|
ex:employee <http://data.example.com/employee/7369> ;
|
|
ex:department <http://data.example.com/department/10> .
|
|
|
|
<http://data.example.com/employee=7369/department=20>
|
|
ex:employee <http://data.example.com/employee/7369> ;
|
|
ex:department <http://data.example.com/department/20> .
|
|
|
|
<http://data.example.com/employee=7400/department=10>
|
|
ex:employee <http://data.example.com/employee/7400> ;
|
|
ex:department <http://data.example.com/department/10> .
|
|
</pre>
|
|
|
|
<p>The following R2RML mapping will produce the desired triples listed above:</p>
|
|
|
|
<pre class="ex-mapping"><#TriplesMap3>
|
|
rr:tableName "EMP2DEPT";
|
|
rr:subjectMap [ rr:template "http://data.example.com/employee={EMPNO}/department={DEPTNO}" ];
|
|
rr:predicateObjectMap [
|
|
rr:predicate ex:employee;
|
|
rr:objectMap [ rr:template "http://data.example.com/employee/{EMPNO}" ; rr:termType rr:IRI ]
|
|
];
|
|
rr:predicateObjectMap [
|
|
rr:predicate ex:department;
|
|
rr:objectMap [ rr:template "http://data.example.com/department/{DEPTNO}" ; rr:termType rr:IRI ]
|
|
].
|
|
</pre>
|
|
|
|
|
|
<p>However, if one does <em>not</em> require that the subjects in
|
|
the desired output uniquely identify the rows in the <a
|
|
href="#ex_EMP2DEPT"><code>EMP2DEPT</code> table</a>, the desired output
|
|
may look as follows: </p>
|
|
|
|
<pre class="ex-output">
|
|
<http://data.example.com/employee/7369>
|
|
ex:department <http://data.example.com/department/10> ;
|
|
ex:department <http://data.example.com/department/20> .
|
|
|
|
<http://data.example.com/employee/7400>
|
|
ex:department <http://data.example.com/department/10>.
|
|
</pre>
|
|
|
|
<p>The following R2RML mapping will produce the desired triples:</p>
|
|
|
|
<pre class="ex-mapping"><#TriplesMap3>
|
|
rr:tableName "EMP2DEPT";
|
|
rr:subjectMap [
|
|
rr:template "http://data.example.com/employee/{EMPNO}";
|
|
];
|
|
rr:predicateObjectMap [
|
|
rr:predicate ex:department;
|
|
rr:objectMap [ rr:template "http://data.example.com/department/{DEPTNO}"; rr:termType rr:IRI ]
|
|
].</pre>
|
|
|
|
|
|
<h2 id="conformance">3 Conformance</h2>
|
|
|
|
<p>As well as sections marked as non-normative in the section heading,
|
|
all diagrams, examples, and notes in this specification are
|
|
non-normative. Everything else in this specification is normative.</p>
|
|
|
|
<p>The key words <em class="rfc2119">must</em>,
|
|
<em class="rfc2119">must not</em>, <em class="rfc2119">required</em>,
|
|
<em class="rfc2119">should</em>, <em class="rfc2119">should not</em>,
|
|
<em class="rfc2119">recommended</em>, <em class="rfc2119">may</em>,
|
|
and <em class="rfc2119">optional</em> in this specification are to be
|
|
interpreted as described in
|
|
<cite><a href="http://tools.ietf.org/html/rfc2119">RFC 2119</a></cite>
|
|
[<cite><a href="#RFC2119">RFC2119</a></cite>].</p>
|
|
|
|
<p>This specification describes conformance criteria for:</p>
|
|
|
|
<ul>
|
|
<li><a href="#dfn-r2rml-mapping-document">R2RML mapping documents</a></li>
|
|
<li><a href="#dfn-r2rml-mapping-graph">R2RML mapping graphs</a></li>
|
|
<li><a href="#dfn-r2rml-processor">R2RML processors</a></li>
|
|
<li><a href="#dfn-r2rml-data-validator">R2RML data validators</a></li>
|
|
</ul>
|
|
|
|
<p>A collection of test cases for R2RML processors and
|
|
R2RML data validators is available in the
|
|
<cite><em><a class="inform" href="http://www.w3.org/2001/sw/rdb2rdf/test-cases/">R2RML and Direct Mapping Test Cases</a></em></cite> [<cite><a href="#TC">TC</a></cite>].</p>
|
|
|
|
<p>This specification defines R2RML for databases that conform to
|
|
<em>Core SQL 2008</em>, as defined in
|
|
<cite><em>ISO/IEC 9075-1:2008</em></cite>
|
|
[<cite><a href="#SQL1">SQL1</a></cite>] and
|
|
<cite><em>ISO/IEC 9075-2:2008</em></cite>
|
|
[<cite><a href="#SQL2">SQL2</a></cite>].
|
|
Processors and mappings may have
|
|
to deviate from the R2RML specification in order to support databases
|
|
that do not conform to this version of SQL.</p>
|
|
|
|
<p>Where SQL queries are embedded into R2RML mappings,
|
|
<a href="#dfn-sql-version-identifier">SQL version identifiers</a>
|
|
can be used to indicate the specific version of SQL that is being used.</p>
|
|
|
|
|
|
<h2 id="definitions">4 R2RML Processors and Mapping Documents</h2>
|
|
|
|
<p>An <dfn id="dfn-r2rml-mapping">R2RML mapping</dfn> defines a mapping
|
|
from a relational database to RDF. It is a structure that consists of
|
|
one or more <a href="#dfn-triples-map">triples maps</a>.</p>
|
|
|
|
<p>The input to an R2RML mapping is called the
|
|
<dfn id="dfn-input-database">input database</dfn>.</p>
|
|
|
|
<p>An <dfn id="dfn-r2rml-processor">R2RML processor</dfn> is a system
|
|
that, given an <a href="#dfn-r2rml-mapping">R2RML mapping</a> and an
|
|
<a href="#dfn-input-database">input database</a>, provides access to
|
|
the <a href="#dfn-output-dataset">output dataset</a>.</p>
|
|
|
|
<p>There are no constraints on the method of access to the output
|
|
dataset provided by a conforming R2RML processor. An R2RML processor
|
|
<em class="rfc2119">MAY</em>
|
|
materialize the output dataset into a file, or offer virtual access
|
|
through an interface that queries the input database, or offer any
|
|
other means of providing access to the output dataset.</p>
|
|
|
|
<p>An <a href="#dfn-r2rml-processor">R2RML processor</a> also has access
|
|
to an execution environment consisting of:</p>
|
|
|
|
<ul>
|
|
<li>A <dfn id="dfn-sql-connection">SQL connection</dfn>
|
|
to the <a href="#dfn-input-database">input database</a>,</li>
|
|
<li>a <dfn id="dfn-base-iri">base IRI</dfn> used in resolving
|
|
relative IRIs produced by the R2RML mapping.</li>
|
|
</ul>
|
|
|
|
<p>The <a href="#dfn-sql-connection">SQL connection</a>
|
|
is used by the R2RML processor to evaluate SQL queries against the input
|
|
database. It <em class="rfc2119">MUST</em> be established
|
|
with sufficient privileges for read access to all base tables and views that are
|
|
referenced in the R2RML mapping. It <em class="rfc2119">MUST</em> be
|
|
configured with a <dfn id="dfn-default-catalog">default catalog</dfn>
|
|
and <dfn id="dfn-default-schema">default schema</dfn> that will be
|
|
used when tables and views are accessed without an explicit
|
|
catalog or schema reference.</p>
|
|
|
|
<p>How the SQL connection is established, or how users
|
|
are authenticated against the database, is outside of the scope of this document.</p>
|
|
|
|
<p>The <a href="#dfn-base-iri">base IRI</a> <em class="rfc2119">MUST</em>
|
|
be a valid <a href="#dfn-iri">IRI</a>. It <em class="rfc2119">SHOULD</em>
|
|
end in a slash (“<code>/</code>”) character.</p>
|
|
|
|
<p class="note">Resolution of relative IRIs in R2RML uses simple
|
|
string concatenation instead of the more complex algorithm defined in
|
|
RFC 3986. This ensures that the original database value can be
|
|
reconstructed from the generated IRI.</p>
|
|
|
|
<p>An <dfn id="dfn-r2rml-data-validator">R2RML data validator</dfn>
|
|
is a system that takes as its input an
|
|
<a href="#dfn-r2rml-mapping">R2RML mapping</a>, a
|
|
<a href="#dfn-base-iri">base IRI</a>, and a
|
|
<a href="#dfn-sql-connection">SQL connection</a> to an
|
|
<a href="#dfn-input-database">input database</a>, and checks for
|
|
the presence of <a href="#dfn-data-error">data errors</a>.
|
|
When checking the input database, a data validator
|
|
<em class="rfc2119">MUST</em> report any data errors that are raised
|
|
in the process of generating the output dataset.</p>
|
|
|
|
<p>An <a href="#dfn-r2rml-processor">R2RML processor</a>
|
|
<em class="rfc2119">MAY</em> include an
|
|
<a href="#dfn-r2rml-data-validator">R2RML data validator</a>, but this
|
|
is not required.</p>
|
|
|
|
|
|
<h3 id="vocabulary">4.1 Mapping Graphs and the R2RML Vocabulary</h3>
|
|
|
|
<p>An <a href="#dfn-r2rml-mapping">R2RML mapping</a> is represented
|
|
as an <a href="#dfn-rdf-graph">RDF graph</a>. In other words,
|
|
RDF is used not just as the target data model of the mapping, but also
|
|
as a formalism for representing the R2RML mapping itself.</p>
|
|
|
|
<p>An <a href="#dfn-rdf-graph">RDF graph</a> that represents an
|
|
<a href="#dfn-r2rml-mapping">R2RML mapping</a> is called an
|
|
<dfn id="dfn-r2rml-mapping-graph">R2RML mapping graph</dfn>.</p>
|
|
|
|
<p>The <dfn id="dfn-r2rml-vocabulary">R2RML vocabulary</dfn> is the
|
|
set of <a href="#dfn-iri">IRIs</a> defined in this specification
|
|
that start with the <code>rr:</code> namespace IRI:</p>
|
|
|
|
<pre><strong><a href="http://www.w3.org/ns/r2rml#">http://www.w3.org/ns/r2rml#</a></strong></pre>
|
|
|
|
<p>An <a href="#dfn-r2rml-mapping-graph">R2RML mapping graph</a>:</p>
|
|
|
|
<ul>
|
|
<li><em class="rfc2119">SHOULD NOT</em> include any
|
|
<a href="#dfn-iri">IRIs</a> that start with the <code>rr:</code>
|
|
namespace IRI, but are not defined in the
|
|
<a href="#dfn-r2rml-vocabulary">R2RML vocabulary</a>.</li>
|
|
|
|
<li><em class="rfc2119">SHOULD NOT</em> include
|
|
<a href="#dfn-iri">IRIs</a> from the
|
|
<a href="#dfn-r2rml-vocabulary">R2RML vocabulary</a> where
|
|
such use is not explicitly allowed or required by a clause in this
|
|
specification.</li>
|
|
|
|
<li><em class="rfc2119">SHOULD NOT</em> contain any
|
|
mapping components (<a href="#dfn-logical-table">logical tables</a>,
|
|
<a href="#dfn-term-map">term maps</a>,
|
|
<a href="#dfn-predicate-object-map">predicate-object maps</a>)
|
|
that are not referenced by a <a href="#dfn-triples-map">triples map</a>
|
|
(in other words, are “unused”).</li>
|
|
|
|
<li><em class="rfc2119">MAY</em> contain arbitrary additional
|
|
<a href="#dfn-rdf-triple">triples</a> whose terms are not
|
|
from the <a href="#dfn-r2rml-vocabulary">R2RML vocabulary</a>.
|
|
In particular, a valid mapping graph <em class="rfc2119">MAY</em>
|
|
contain documentation in the form of <code>rdfs:label</code>,
|
|
<code>rdfs:comment</code> and similar properties.</li>
|
|
|
|
<li><em class="rfc2119">MAY</em> assign <a href="#dfn-iri">IRIs</a>
|
|
or <a href="#dfn-blank-node-identifier">blank node identifiers</a>
|
|
to any mapping component in order to enable re-use of mapping components
|
|
within the mapping graph.
|
|
For example, an IRI that represents
|
|
a <a href="#dfn-subject-map">subject map</a> may be used as the subject
|
|
map of multiple <a href="#dfn-triples-map">triples maps</a>; and may
|
|
even be used as an <a href="#dfn-object-map">object map</a> of another
|
|
triples map if it has the right properties.</li>
|
|
</ul>
|
|
|
|
<p>The <a href="#dfn-r2rml-vocabulary">R2RML vocabulary</a> also
|
|
includes the following <dfn id="dfn-R2RML-classes">R2RML classes</dfn>,
|
|
which represent various R2RML mapping constructs. Using these
|
|
classes is <em class="rfc2119">OPTIONAL</em> in a mapping graph.
|
|
The applicable class of a resource can always be inferred from its
|
|
properties.</p>
|
|
|
|
<ul>
|
|
<li><code>rr:TriplesMap</code> is the class of
|
|
<a href="#dfn-triples-map">triples maps</a>.</li>
|
|
<li><code>rr:LogicalTable</code> is the class of
|
|
<a href="#dfn-logical-table">logical tables</a>.</li>
|
|
<li><code>rr:SubjectMap</code> is the class of
|
|
<a href="#dfn-subject-map">subject maps</a>.</li>
|
|
<li><code>rr:PredicateMap</code> is the class of
|
|
<a href="#dfn-predicate-map">predicate maps</a>.</li>
|
|
<li><code>rr:ObjectMap</code> is the class of
|
|
<a href="#dfn-object-map">object maps</a>.</li>
|
|
<li><code>rr:GraphMap</code> is the class of
|
|
<a href="#dfn-graph-map">graph maps</a>.</li>
|
|
<li><code>rr:PredicateObjectMap</code> is the class of
|
|
<a href="#dfn-predicate-object-map">predicate-object maps</a>.</li>
|
|
<li><code>rr:RefObjectMap</code> is the class of
|
|
<a href="#dfn-referencing-object-map">referencing object maps</a>.</li>
|
|
<li><code>rr:Join</code> is the class of
|
|
<a href="#dfn-join-condition">join conditions</a>.</li>
|
|
</ul>
|
|
|
|
<p class="note">Many of these classes differ only in capitalization from
|
|
properties in the <a href="#dfn-r2rml-vocabulary">R2RML vocabulary</a>.</p>
|
|
|
|
|
|
<h3 id="syntax">4.2 RDF-based Turtle Syntax; Media Type</h3>
|
|
|
|
<div class="issue">
|
|
<p><a class="tracker" href="http://www.w3.org/2001/sw/rdb2rdf/track/issues/57">ISSUE-57</a>:
|
|
<strong>Should R2RML require a specific syntax?</strong></p>
|
|
|
|
<p>The working group has proposed two alternate proposals for this issue:</p>
|
|
|
|
<ol>
|
|
<li>The R2RML mapping document specifies both the vocabulary and
|
|
the syntax. The R2RML document <em class="rfc2119">MUST</em> be a Turtle document and
|
|
R2RML processors <em class="rfc2119">MUST</em> support Turtle to be able to read such
|
|
documents. Conformance criteria requires support of R2RML
|
|
vocabulary written in Turtle.</li>
|
|
|
|
<li>The R2RML mapping document specifies only the
|
|
vocabulary. There is no syntax specified. There can be an
|
|
accompanying "R2RML mapping document in Turtle" that specifies the
|
|
Turtle syntax. Conformance criteria for the R2RML mapping
|
|
document requires supporting the vocabulary in any language
|
|
(Turtle, N-Triple, RDF/XML etc.) Additionally, if an
|
|
implementation supports the Turtle syntax, it can claim
|
|
conformance to the "R2RML mapping document in Turtle".</li>
|
|
</ol>
|
|
|
|
<p>The advantage of the first approach is that it promotes
|
|
interoperability between different producers and consumers of
|
|
R2RML files by requiring all to support at least one shared
|
|
syntax. Without such a shared syntax, an R2RML file created in one
|
|
tool may be rejected by another tool because both assume different
|
|
RDF syntaxes. R2RML examples found in educational material may not
|
|
work in actual implementations due to different syntaxes. This is
|
|
seen as an impediment to the uptake of R2RML.
|
|
</p>
|
|
|
|
<p>The second approach distinguishes between the R2RML vocabulary
|
|
and the syntax and wants to keep them separate. The advantage of
|
|
the second approach is that the R2RML mapping document remains
|
|
independent of any exchange format. This gives flexibility as
|
|
different syntax flavours of R2RML could be easily defined. It is
|
|
in the spirit of RDF as an abstract format. Users may have to
|
|
convert between different RDF syntaxes in order to use R2RML
|
|
files, but such conversion is not difficult and therefore not seen
|
|
as an impediment. Thereby, it allows conformance with the R2RML
|
|
mapping document using any of the standard exchange formats.
|
|
</p>
|
|
|
|
<p>There is consensus that Turtle should be used for the examples in
|
|
this document, as well as for the test cases.</p>
|
|
|
|
<p>The working group seeks comments and opinions on this question
|
|
and encourages reports to <a href="http://lists.w3.org/Archives/Public/public-rdb2rdf-comments/">public-rdb2rdf-comments mailing list</a>.</p>
|
|
</div>
|
|
|
|
<p>An <dfn id="dfn-r2rml-mapping-document">R2RML mapping document</dfn> is any document
|
|
written in the <cite><a class="norm" href=
|
|
"http://www.w3.org/TeamSubmission/2008/SUBM-turtle-20080114/">Turtle</a></cite>
|
|
[<cite><a href="#TURTLE">TURTLE</a></cite>] RDF syntax that encodes an
|
|
<a href="#dfn-r2rml-mapping-graph">R2RML mapping graph</a>.</p>
|
|
|
|
<p>The media type for <a href="#dfn-r2rml-mapping-document">R2RML mapping
|
|
documents</a> is the same as for Turtle
|
|
documents in general: <code>text/turtle</code>. The content encoding of
|
|
Turtle content is always UTF-8 and the <code>charset</code> parameter
|
|
on the media type <em class="rfc2119">SHOULD</em> always be used:
|
|
<code>text/turtle;charset=utf-8</code>. The preferred file extension is
|
|
<code>.ttl</code>.</p>
|
|
|
|
<p>A conforming <a href="#dfn-r2rml-processor">R2RML processor</a>
|
|
<em class="rfc2119">MUST</em> accept <a href="#dfn-r2rml-mapping-document">
|
|
R2RML mapping documents</a> in Turtle syntax.
|
|
It <em class="rfc2119">MAY</em> accept
|
|
<a href="#dfn-r2rml-mapping-graph">R2RML mapping graphs</a> encoded in
|
|
other RDF syntaxes.</p>
|
|
|
|
<div class="note">
|
|
<p>It is common to use document-local IRIs in mapping documents by
|
|
defining the default prefix in the beginning of the document, and
|
|
using it for creating IRIs for mapping components such as triples maps:</p>
|
|
<pre>@prefix : <#>
|
|
…
|
|
:EmpQuery rr:sqlQuery """SELECT * FROM EMP WHERE …""".
|
|
…
|
|
:EmpTriples rr:logicalTable :EmpQuery.</pre>
|
|
</div>
|
|
|
|
|
|
<h3 id="data-errors">4.3 Data Errors</h3>
|
|
|
|
<p>A <dfn id="dfn-data-error">data error</dfn> is a condition
|
|
of the data in the <a href="#dfn-input-database">input database</a>
|
|
that would lead to the generation of an invalid
|
|
<a href="#dfn-rdf-term">RDF term</a>, such as an invalid
|
|
<a href="#dfn-iri">IRI</a> or an ill-typed
|
|
<a href="#dfn-literal">literal</a>.</p>
|
|
|
|
<p>When providing access to the
|
|
<a href="#dfn-output-dataset">output dataset</a>, an
|
|
<a href="#dfn-r2rml-processor">R2RML processor</a>
|
|
<em class="rfc2119">MUST</em> abort any operation that
|
|
requires inspecting or returning an <a href="#dfn-rdf-term">RDF term</a>
|
|
whose generation would give rise to a
|
|
<a href="#dfn-data-error">data error</a>, and report an error
|
|
to the agent invoking the operation. A conforming
|
|
<a href="#dfn-r2rml-processor">R2RML processor</a>
|
|
<em class="rfc2119">MAY</em>, however, allow other operations
|
|
that do not require inspecting or returning these
|
|
<a href="#dfn-rdf-term">RDF terms</a>,
|
|
and thus <em class="rfc2119">MAY</em> provide partial access to an
|
|
<a href="#dfn-output-dataset">output dataset</a> that contains
|
|
data errors. Nevertheless, an
|
|
<a href="#dfn-r2rml-processor">R2RML processor</a>
|
|
<em class="rfc2119">SHOULD</em> report data errors as early as possible.</p>
|
|
|
|
<p>The following conditions give rise to data errors:</p>
|
|
|
|
<ol>
|
|
<li>A <a href="#dfn-term-map">term map</a> with
|
|
<a href="#dfn-term-type">term type</a> <code>rr:IRI</code>
|
|
results in the <a href="#dfn-generated-rdf-terms">generation</a>
|
|
of an invalid <a href="#dfn-iri">IRI</a>.</li>
|
|
<li>A <a href="#dfn-term-map">term map</a> with a
|
|
<a href="#dfn-datatype-override">datatype override</a>
|
|
produces an <a href="#dfn-ill-typed">ill-typed</a> literal
|
|
of a <a href="#dfn-supported-rdf-datatype">supported RDF datatype</a>.</li>
|
|
</ol>
|
|
|
|
<p>The presence of <a href="#dfn-data-error">data errors</a>
|
|
does not make an <a href="#dfn-r2rml-mapping">R2RML mapping</a>
|
|
non-conforming.</p>
|
|
|
|
<div class="note">
|
|
<p><a href="#dfn-data-error">Data errors</a> cannot
|
|
generally be detected by analyzing the table schema of the database,
|
|
but only by scanning the data in the tables. For large and rapidly
|
|
changing databases, this can be impractical. Therefore,
|
|
<a href="#dfn-r2rml-processor">R2RML processors</a> are allowed to
|
|
answer queries that do not “touch” a data error, and the behavior
|
|
of such operations is well-defined. For the same reason,
|
|
the conformance of <a href="#dfn-r2rml-mapping">R2RML mappings</a>
|
|
is defined without regard for the presence of data errors.</p>
|
|
|
|
<p><a href="#dfn-r2rml-data-validator">R2RML data validators</a>
|
|
can be used to explicitly scan a database for data errors.</p>
|
|
</div>
|
|
|
|
|
|
<h2 id="logical-tables">5 Defining Logical Tables</h2>
|
|
|
|
<div class="figure">
|
|
<img src="images/logical-table.png" alt="Diagram: The properties of logical tables"/>
|
|
<br /><br />
|
|
Figure 2: The properties of logical tables
|
|
</div>
|
|
|
|
<p>A <dfn id="dfn-logical-table">logical table</dfn> is a
|
|
possibly virtual database table that is to be mapped to
|
|
<a href="#dfn-rdf-triple">RDF triples</a>. A logical table is either</p>
|
|
|
|
<ul>
|
|
<li>a <a href="#dfn-sql-base-table-or-view">SQL base table or view</a>,
|
|
or</li>
|
|
<li>a <a href="#dfn-r2rml-view">R2RML view</a>.</li>
|
|
</ul>
|
|
|
|
<p>Every logical table has an
|
|
<dfn id="dfn-effective-sql-query">effective SQL query</dfn> that,
|
|
if executed over the <a href="#dfn-sql-connection">SQL connection</a>,
|
|
produces as its result the contents of the logical table.</p>
|
|
|
|
<p>A <dfn id="dfn-logical-table-row">logical table row</dfn> is a row
|
|
in a <a href="#dfn-logical-table">logical table</a>.</p>
|
|
|
|
<p>A <dfn id="dfn-column-name">column name</dfn> is the name of a
|
|
column of a <a href="#dfn-logical-table">logical table</a>. A column name
|
|
<em class="rfc2119">MUST</em> be a valid
|
|
<a href="#dfn-sql-identifier">SQL identifier</a>. Column names
|
|
do not include any qualifying table, view or schema names.</p>
|
|
|
|
<p>A <dfn id="dfn-sql-identifier">SQL identifier</dfn> is the name of
|
|
a SQL object, such as a column, table, view, schema, or catalog.
|
|
A SQL identifier
|
|
<em class="rfc2119">MUST</em> match the <code><identifier></code>
|
|
production in [<cite><a href="#SQL2">SQL2</a></cite>]. When
|
|
comparing identifiers for equality, the comparison rules
|
|
of [<cite><a href="#SQL2">SQL2</a></cite>] <em class="rfc2119">MUST</em>
|
|
be used.</p>
|
|
|
|
<div class="note">
|
|
An informative summary of SQL identifier syntax rules:
|
|
<ol>
|
|
<li>SQL identifiers can be delimited identifiers (with double quotes),
|
|
or regular identifiers.</li>
|
|
<li>Regular identifiers must start with a Unicode character from
|
|
any of the following character classes: upper-case letter,
|
|
lower-case letter, title-case letter, modifier letter, other letter,
|
|
or letter number. Subsequent characters may be any of these, or
|
|
a nonspacing mark, spacing combining mark, decimal number,
|
|
connector punctuation, and formatting code.</li>
|
|
<li>Regular identifiers are case-insensitive.</li>
|
|
<li>Delimited identifiers can contain any character.</li>
|
|
<li>Double quotes inside delimited identifiers must be immediately
|
|
followed by another double quote.</li>
|
|
<li>Delimited identifiers are case-sensitive.</li>
|
|
<li><code>deptno</code> and <code>"deptno"</code> are not equivalent
|
|
(delimited identifiers that are not in all-upper-case are
|
|
not equivalent to any undelimited identifiers).</li>
|
|
<li><code>DEPTNO</code> and <code>"DEPTNO"</code> are equivalent
|
|
(all-upper-case delimited and undelimited identifiers are equivalent).</li>
|
|
<li>Five examples of valid column names:
|
|
<code>deptno</code>, <code>dept_no</code>, <code>"dept_no"</code>,
|
|
<code>"Department Number"</code>,
|
|
<code>"Identifier ""with quotes"""</code>.</li>
|
|
</ol>
|
|
|
|
Note that in R2RML, column name specified as an RDF <a
|
|
href="#dfn-plain-literal">plain literal</a> or within curly
|
|
braces, is considered a delimited SQL identifier. Thus the SQL column
|
|
name identifiers <code>deptno</code>, <code>dept_no</code>,
|
|
<code>"dept_no"</code>, <code>"Department Number"</code> can be
|
|
used as (part of) object value for the various relevant R2RML properties
|
|
as follows:
|
|
|
|
<pre>
|
|
[] rr:column "DEPTNO".
|
|
[] rr:parent "DEPT_NO".
|
|
[] rr:child "dept_no".
|
|
[] rr:template "http://data.example.com/department/{Department Number}".
|
|
</pre>
|
|
|
|
Note that Turtle string syntax requires escaping of double quotes with
|
|
a backslash, so the identifier <code>"Identifier ""with quotes"""</code> can be
|
|
used as (part of) value for the various relevant R2RML properties as follows:
|
|
<pre>
|
|
[] rr:column "Identifier \"\"with quotes\"\"".
|
|
[] rr:template "http://data.example.com/department/{Identifier \"\"with quotes\"\"}".
|
|
</pre>
|
|
These rules are for <em>Core SQL 2008</em>. See
|
|
<a href="#conformance">Section 3,
|
|
<em>Conformance</em></a> regarding databases that do not conform to this
|
|
version of SQL.
|
|
</div>
|
|
|
|
|
|
<h3 id="physical-tables">5.1 Base Tables and SQL Views (<code>rr:tableName</code>)</h3>
|
|
|
|
<p>A <dfn id="dfn-sql-base-table-or-view">SQL base table or view</dfn> is a
|
|
<a href="#dfn-logical-table">logical table</a> containing
|
|
SQL data from a base table or view in the
|
|
<a href="#dfn-input-database">input database</a>.
|
|
A SQL base tables or views is represented by a resource that
|
|
has exactly one <code>rr:tableName</code> property.</p>
|
|
|
|
<p>The value of <code>rr:tableName</code> specifies the
|
|
<dfn id="dfn-table-or-view-name">table or view name</dfn> of the base table or view.
|
|
Its value <em class="rfc2119">MUST</em>
|
|
be a valid <a href="#dfn-schema-qualified-name">schema-qualified name</a>
|
|
that names an existing base table or view in the
|
|
<a href="#dfn-input-database">input database</a>.</p>
|
|
|
|
<p>A <dfn id="dfn-schema-qualified-name">schema-qualified name</dfn>
|
|
is a sequence of one, two or three valid
|
|
<a href="#dfn-sql-identifier">SQL identifiers</a>, separated
|
|
by the dot character (“<code>.</code>”). The three identifiers
|
|
name, respectively, a catalog, a schema, and a table or view.
|
|
If no catalog or schema are specified, then the
|
|
<a href="#dfn-default-catalog">default catalog</a> and
|
|
<a href="#dfn-default-schema">default schema</a> of the
|
|
<a href="#dfn-sql-connection">SQL connection</a> are assumed.</p>
|
|
|
|
<p>The <a href="#dfn-effective-sql-query">effective SQL query</a>
|
|
of a <a href="#dfn-sql-base-table-or-view">SQL base table or view</a> is:</p>
|
|
|
|
<pre>SELECT * FROM <em>{table}</em></pre>
|
|
<p>with <code><em>{table}</em></code>
|
|
replaced with the
|
|
<a href="#dfn-table-or-view-name">table or view name</a>.</p>
|
|
|
|
<p>The following example shows a logical table specified using
|
|
a schema-qualified table name.</p>
|
|
<pre class="ex-mapping">
|
|
[] rr:tableName "SCOTT.DEPT".
|
|
</pre>
|
|
|
|
<p>The following example shows a logical table specified using
|
|
an unqualified table name. The SQL connection's default
|
|
schema will be used.</p>
|
|
<pre class="ex-mapping">
|
|
[] rr:tableName "DEPT".
|
|
</pre>
|
|
|
|
|
|
<h3 id="r2rml-views">5.2 R2RML Views (<code>rr:sqlQuery</code>, <code>rr:sqlVersion</code>)</h3>
|
|
|
|
<p>An <dfn id="dfn-r2rml-view">R2RML view</dfn>
|
|
is a <a href="#dfn-logical-table">logical table</a> whose contents
|
|
are the result of executing a SQL query against the
|
|
<a href="#dfn-input-database">input database</a>. It is represented
|
|
by a resource that has exactly one <code>rr:sqlQuery</code> property,
|
|
whose value <em class="rfc2119">MUST</em> be a valid
|
|
<a href="#dfn-sql-query">SQL query</a>.</p>
|
|
|
|
<p class="note">
|
|
R2RML mappings sometimes require data transformation, computation,
|
|
or filtering before
|
|
generating triples from the database. This can be achieved by defining
|
|
a SQL view in the <a href="#dfn-input-database">input database</a>
|
|
and referring to it with
|
|
<a href="#dfn-sql-base-table-or-view">rr:tableName</a>. However, this
|
|
approach may not be practical for lack of database privileges or other
|
|
reasons. <a href="#dfn-r2rml-view">R2RML views</a>
|
|
achieve the same effect without requiring changes to the
|
|
input database.</p>
|
|
|
|
<p class="note">
|
|
Note that unlike “real” SQL views, an R2RML view can not be
|
|
used as an input table in further SQL queries.
|
|
</p>
|
|
|
|
<p>A <dfn id="dfn-sql-query">SQL query</dfn> is a <code>SELECT</code>
|
|
query in the SQL language that can be executed over the
|
|
<a href="#dfn-input-database">input database</a>.
|
|
The value of <code>rr:sqlQuery</code> <em class="rfc2119">MUST</em>
|
|
conform to the production
|
|
<code><direct select statement: multiple rows></code>
|
|
in [<cite><a href="#SQL2">SQL2</a></cite>] with an
|
|
<em class="rfc2119">OPTIONAL</em> trailing semicolon character and
|
|
<em class="rfc2119">OPTIONAL</em> surrounding white space (excluding
|
|
comments) as defined in [<cite><a href="#TURTLE">TURTLE</a></cite>].
|
|
It <em class="rfc2119">MUST</em> be a valid SQL query if executed over
|
|
the <a href="#dfn-sql-connection">SQL connection</a>. It
|
|
<em class="rfc2119">MUST NOT</em> have duplicate column names
|
|
or unnamed derived columns in the <code>SELECT</code> list. For any
|
|
database objects referenced without an explicit catalog name
|
|
or schema name, the <a href="#dfn-default-catalog">default catalog</a>
|
|
and <a href="#dfn-default-schema">default schema</a> of the
|
|
<a href="#dfn-sql-connection">SQL connection</a> are used.</p>
|
|
|
|
<p>An <a href="#dfn-r2rml-view">R2RML view</a>
|
|
<em class="rfc2119">MAY</em> have one or more
|
|
<dfn id="dfn-sql-version-identifier">SQL version identifiers</dfn>.
|
|
They <em class="rfc2119">MUST</em> be valid <a href="#dfn-iri">IRIs</a>
|
|
and are represented as values of the <code>rr:sqlVersion</code>
|
|
property. The following <a href="#dfn-sql-version-identifier">SQL version
|
|
identifier</a> indicates that the SQL query conforms to
|
|
Core SQL 2008:</p>
|
|
|
|
<pre>http://www.w3.org/ns/r2rml#SQL2008</pre>
|
|
|
|
<p>The absence of a <a href="#dfn-sql-version-identifier">SQL version
|
|
identifier</a> indicates that no claim to Core SQL 2008 conformance
|
|
is made.</p>
|
|
|
|
<p class="note">No further identifiers besides <code>rr:SQL2008</code>
|
|
are defined in this specification.
|
|
The RDB2RDF Working Group intends to maintain a non-normative
|
|
<cite><a href="http://www.w3.org/2001/sw/rdb2rdf/wiki/SQL_Version_IRIs">list
|
|
of identifiers for other SQL versions</a></cite>
|
|
[<cite><a href="#SQLIRIS">SQLIRIS</a></cite>].</p>
|
|
|
|
<p>The <a href="#dfn-effective-sql-query">effective SQL query</a>
|
|
of an <a href="#dfn-r2rml-view">R2RML view</a> is the value of its
|
|
<code>rr:sqlQuery</code> property.</p>
|
|
|
|
<p>The following example shows a logical table specified as an R2RML view
|
|
conforming to Core SQL 2008.</p>
|
|
<pre class="ex-mapping">
|
|
[] rr:sqlQuery """
|
|
Select ('Department' || DEPTNO) AS DEPTID
|
|
, DEPTNO
|
|
, DNAME
|
|
, LOC
|
|
from SCOTT.DEPT
|
|
""";
|
|
rr:sqlVersion rr:SQL2008.</pre>
|
|
|
|
|
|
<h2 id="triples-map">6 Mapping Logical Tables to RDF with Triples Maps</h2>
|
|
|
|
<div class="figure">
|
|
<img src="images/triples-map.png" alt="Diagram: The properties of triples maps"/>
|
|
<br /><br />
|
|
Figure 3: The properties of triples maps
|
|
</div>
|
|
|
|
<p>A <dfn id="dfn-triples-map">triples map</dfn> specifies a rule
|
|
for translating each row of a <a href="#dfn-logical-table">logical table</a>
|
|
to zero or more <a href="#dfn-rdf-triple">RDF triples</a>.</p>
|
|
|
|
<p>The RDF triples generated from one row in the logical table
|
|
all share the same subject.</p>
|
|
|
|
<p>A triples map is represented by a resource that references the
|
|
following other resources:</p>
|
|
|
|
<ul>
|
|
<li>It <em class="rfc2119">MUST</em> have exactly one
|
|
<a href="#dfn-logical-table">logical table</a>,
|
|
which specifies a SQL query result to be mapped to triples.
|
|
The logical table may be specified in one of two ways:
|
|
<ol>
|
|
<li>The <a href="#dfn-triples-map">triples map</a>
|
|
<em class="rfc2119">MAY</em> have a <code>rr:logicalTable</code>
|
|
property, whose value <em class="rfc2119">MUST</em> be
|
|
the <a href="#dfn-logical-table">logical table</a>.</li>
|
|
<li>The resource representing the
|
|
<a href="#dfn-triples-map">triples map</a>
|
|
<em class="rfc2119">MAY</em> itself also represent
|
|
the <a href="#dfn-logical-table">logical table</a>
|
|
(that is, have the required properties such as
|
|
<code>rr:tableName</code> or <code>rr:sqlQuery</code>).</li>
|
|
</ol>
|
|
</li>
|
|
|
|
<li>It <em class="rfc2119">MUST</em> have exactly one
|
|
<a href="#dfn-subject-map">subject map</a>
|
|
that specifies how to generate the subjects for each row of the
|
|
logical table. It may be specified in two ways:
|
|
<ol>
|
|
<li>using the <code>rr:subjectMap</code> property,
|
|
whose value <em class="rfc2119">MUST</em> be
|
|
the subject map, or</li>
|
|
<li>using the <a href="#dfn-constant-shortcut-property">constant
|
|
shortcut property</a> <code>rr:subject</code>.</li>
|
|
</ol>
|
|
</li>
|
|
|
|
<li>It <em class="rfc2119">MAY</em> have zero or more
|
|
<code>rr:predicateObjectMap</code> properties,
|
|
whose values <em class="rfc2119">MUST</em> be
|
|
<a href="#dfn-predicate-object-map">predicate-object maps</a>.
|
|
Each specifies a predicate-object pair that, together with the
|
|
subjects generated by the subject map, may form one
|
|
<a href="#dfn-rdf-triple">RDF triple</a> for each row.</li>
|
|
</ul>
|
|
|
|
<p>The <a href="#dfn-referenced-columns">referenced columns</a> of
|
|
all <a href="#dfn-term-map">term maps</a> of a triples map
|
|
(subject map, predicate maps, object maps, graph maps)
|
|
<em class="rfc2119">MUST</em>
|
|
be <a href="#dfn-column-name">column names</a> that exist
|
|
in the term map's <a href="#dfn-logical-table">logical table</a>.
|
|
Furthermore, the columns carrying these names in the
|
|
logical table <em class="rfc2119">MUST</em> be of a SQL datatype
|
|
for which <a href="#dfn-conversion-to-string">conversion to string</a>
|
|
is defined.</p>
|
|
|
|
<p class="note"><a href="#dfn-conversion-to-string">Conversion
|
|
to string</a> is undefined in SQL 2008 for row types, array types,
|
|
user-defined datatypes that do not have a user-defined string
|
|
<code>CAST</code>, and a few other exotic types.</p>
|
|
|
|
<p>The following example shows a <a href="#dfn-triples-map">triples map</a>
|
|
including its logical table, subject map, and two predicate-object maps.</p>
|
|
|
|
<pre class="ex-mapping">
|
|
[]
|
|
rr:logicalTable [ rr:tableName "DEPT" ];
|
|
rr:subjectMap [ rr:template "http://data.example.com/department/{DEPTNO}" ];
|
|
rr:predicateObjectMap [
|
|
rr:predicate ex:name;
|
|
rr:objectMap [ rr:column "DNAME" ];
|
|
].
|
|
rr:predicateObjectMap [
|
|
rr:predicate ex:location;
|
|
rr:objectMap [ rr:column "LOC" ];
|
|
].</pre>
|
|
|
|
<p>The logical table may also be specified directly on the same
|
|
resource, without introducing an intermediate resource:</p>
|
|
|
|
<pre class="ex-mapping">
|
|
[]
|
|
rr:tableName "DEPT";
|
|
rr:subjectMap [ rr:template "http://data.example.com/department/{DEPTNO}" ];
|
|
# …
|
|
.</pre>
|
|
|
|
<h3 id="subject-map">6.1 Creating Resources with Subject Maps</h3>
|
|
|
|
<p>A <dfn id="dfn-subject-map">subject map</dfn> is a
|
|
<a href="#dfn-term-map">term map</a>. It specifies a rule
|
|
for generating the subjects of the
|
|
<a href="#dfn-rdf-triple">RDF triples</a> generated by a
|
|
<a href="#dfn-triples-map">triples map</a>.</p>
|
|
|
|
|
|
<h3 id="typing">6.2 Typing Resources (<code>rr:class</code>)</h3>
|
|
|
|
<p>A <a href="#dfn-subject-map">subject map</a> <em class="rfc2119">MAY</em>
|
|
have one or more <dfn id="dfn-class-iri">class IRIs</dfn>. They are
|
|
represented by the <code>rr:class</code> property. The values
|
|
of the <code>rr:class</code> property
|
|
<em class="rfc2119">MUST</em> be <a href="#dfn-iri">IRIs</a>.
|
|
For each <a href="#dfn-rdf-term">RDF term</a> generated by the subject map,
|
|
<a href="#dfn-rdf-triple">RDF triples</a> with predicate
|
|
<code>rdf:type</code> and the class IRI as object will be generated.</p>
|
|
|
|
<p class="note">This property is merely a shortcut for specifying an
|
|
<code>rr:predicateObjectMap</code> with predicate <code>rdf:type</code>
|
|
and the <code>rr:class</code> IRI as a constant object.
|
|
Mappings where the class IRI is not constant, but needs to be computed
|
|
based on the contents of the database, can be achieved by defining
|
|
such a <code>rr:predicateObjectMap</code> with a non-constant object.</p>
|
|
|
|
<p>In the following example, the generated subject will be asserted
|
|
as an instance of the <code>ex:Employee</code> class.</p>
|
|
<pre class="ex-mapping">
|
|
[] rr:template "http://data.example.com/employee/{EMPNO}";
|
|
rr:class ex:Employee.
|
|
</pre>
|
|
|
|
<p>Using the example <a href="#ex_EMP"><code>EMP</code> table</a>,
|
|
the following RDF triple will be generated:</p>
|
|
<pre class="ex-output">
|
|
<http://data.example.com/emp/7369> rdf:type ex:Employee.
|
|
</pre>
|
|
|
|
|
|
<h3 id="predicate-object-map">6.3 Creating Properties and Values with Predicate-Object Maps</h3>
|
|
|
|
<p>A <dfn id="dfn-predicate-object-map">predicate-object map</dfn> is
|
|
a function that creates predicate-object pairs from
|
|
<a href="#dfn-logical-table-row">logical table rows</a>. It is
|
|
used in conjunction with a <a href="#dfn-subject-map">subject map</a>
|
|
to generate <a href="#dfn-rdf-triple">RDF triples</a> in a
|
|
<a href="#dfn-triples-map">triples map</a>.</p>
|
|
|
|
<p>A <a href="#dfn-predicate-object-map">predicate-object map</a>
|
|
is represented by a resource that references the following
|
|
other resources:</p>
|
|
|
|
<ul>
|
|
<li>Exactly one <a href="#dfn-predicate-map">predicate map</a>. It may be
|
|
specified in two ways:
|
|
<ol>
|
|
<li>using the <code>rr:predicateMap</code> property, whose value
|
|
<em class="rfc2119">MUST</em> be a
|
|
<a href="#dfn-predicate-map">predicate map</a>, or</li>
|
|
<li>using the <a href="#dfn-constant-shortcut-property">constant
|
|
shortcut property</a> <code>rr:predicate</code>.</li>
|
|
</ol>
|
|
</li>
|
|
<li>Exactly one <a href="#dfn-object-map">object map</a>. It may be
|
|
specified in one of two ways:
|
|
<ol>
|
|
<li>using the <code>rr:objectMap</code> property, whose value
|
|
<em class="rfc2119">MUST</em> be either an
|
|
<a href="#dfn-object-map">object map</a>, or a
|
|
<a href="#dfn-referencing-object-map">referencing object map</a>.</li>
|
|
<li>using the <a href="#dfn-constant-shortcut-property">constant
|
|
shortcut property</a> <code>rr:object</code>.</li>
|
|
</ol>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>A <dfn id="dfn-predicate-map">predicate map</dfn> is a
|
|
<a href="#dfn-term-map">term map</a>.</p>
|
|
|
|
<p>An <dfn id="dfn-object-map">object map</dfn>
|
|
is a <a href="#dfn-term-map">term map</a>.</p>
|
|
|
|
|
|
<h2 id="term-map">7 Creating RDF Terms with Term Maps</h2>
|
|
|
|
<div class="figure">
|
|
<img src="images/term-map.png" alt="Diagram: The properties of term maps"/>
|
|
<br /><br />
|
|
Figure 4: The properties of term maps
|
|
</div>
|
|
|
|
<p>An <dfn id="dfn-rdf-term">RDF term</dfn> is either an
|
|
<a href="#dfn-iri">IRI</a>, or a <a href="#dfn-blank-node">blank node</a>,
|
|
or a <a href="#dfn-literal">literal</a>.</p>
|
|
|
|
<p>A <dfn id="dfn-term-map">term map</dfn> is a function that generates
|
|
an <a href="#dfn-rdf-term">RDF term</a> from a
|
|
<a href="#dfn-logical-table-row">logical table row</a>. The result of
|
|
that function is known as the term map's
|
|
<a href="#dfn-generated-rdf-terms">generated RDF term</a>.</p>
|
|
|
|
<p>Term maps
|
|
are used to generate the subjects, predicates and objects of the
|
|
<a href="#dfn-rdf-triple">RDF triples</a> that are generated by
|
|
a <a href="#dfn-triples-map">triples map</a>. Consequently, there
|
|
are several kinds of <a href="#dfn-term-map">term maps</a>,
|
|
depending on where in the mapping they occur:
|
|
<a href="#dfn-subject-map">subject maps</a>,
|
|
<a href="#dfn-predicate-map">predicate maps</a>,
|
|
<a href="#dfn-object-map">object maps</a> and
|
|
<a href="#dfn-graph-map">graph maps</a>.</p>
|
|
|
|
<p>A <a href="#dfn-term-map">term map</a> <em class="rfc2119">MUST</em>
|
|
be exactly one of the following:</p>
|
|
|
|
<ul>
|
|
<li>a <a href="#dfn-constant-valued-term-map">constant-valued term map</a>,</li>
|
|
<li>a <a href="#dfn-column-valued-term-map">column-valued term map</a>,</li>
|
|
<li>a <a href="#dfn-template-valued-term-map">template-valued term map</a>.</li>
|
|
</ul>
|
|
|
|
<p>The <dfn id="dfn-referenced-columns">referenced columns</dfn> of a
|
|
<a href="#dfn-term-map">term map</a> are the set of
|
|
<a href="#dfn-column-name">column names</a> referenced
|
|
in the term map and depend on the type of term map.</p>
|
|
|
|
|
|
<h3 id="constant">7.1 Constant RDF Terms (<code>rr:constant</code>)</h3>
|
|
|
|
<p>A <dfn id="dfn-constant-valued-term-map">constant-valued term map</dfn>
|
|
is a <a href="#dfn-term-map">term map</a> that ignores the
|
|
<a href="#dfn-logical-table-row">logical table row</a> and always generates
|
|
the same RDF term. A constant-valued term map is represented by a
|
|
resource that has exactly one <code>rr:constant</code>
|
|
property.</p>
|
|
|
|
<p>The <dfn id="dfn-constant-value">constant value</dfn> of a
|
|
<a href="#dfn-constant-valued-term-map">constant-valued term map</a>
|
|
is the RDF term that is the value of its <code>rr:constant</code>
|
|
property.</p>
|
|
|
|
<p>If the
|
|
<a href="#dfn-constant-valued-term-map">constant-valued term map</a>
|
|
is a <a href="#dfn-subject-map">subject map</a>,
|
|
<a href="#dfn-predicate-map">predicate map</a> or
|
|
<a href="#dfn-graph-map">graph map</a>, then its
|
|
<a href="#dfn-constant-value">constant value</a>
|
|
<em class="rfc2119">MUST</em> be an <a href="#dfn-iri">IRI</a>.</p>
|
|
|
|
<p>If the
|
|
<a href="#dfn-constant-valued-term-map">constant-valued term map</a>
|
|
is an <a href="#dfn-object-map">object map</a>, then its
|
|
<a href="#dfn-constant-value">constant value</a>
|
|
<em class="rfc2119">MUST</em> be an
|
|
<a href="#dfn-iri">IRI</a> or <a href="#dfn-literal">literal</a>.</p>
|
|
|
|
<p>The <a href="#dfn-referenced-columns">referenced columns</a> of
|
|
a <a href="#dfn-constant-valued-term-map">constant-valued term map</a>
|
|
is the empty set.</p>
|
|
|
|
<p>Constant-valued term maps can be expressed more concisely using the
|
|
<dfn id="dfn-constant-shortcut-property">constant shortcut properties</dfn>
|
|
<code>rr:subject</code>, <code>rr:predicate</code>,
|
|
<code>rr:object</code> and <code>rr:graph</code>.
|
|
Occurrances of these properties <em class="rfc2119">MUST</em> be
|
|
treated exactly as if the following triples were present in the
|
|
mapping graph instead:</p>
|
|
|
|
<table rules="all" summary="Constant shortcut properties and their replacements">
|
|
<tr>
|
|
<th>Triple involving constant shortcut property</th>
|
|
<th>Replacement triples</th>
|
|
</tr>
|
|
<tr>
|
|
<td><code><em>aaa</em> rr:subject <em>bbb</em>.</code></td>
|
|
<td><code><em>aaa</em> rr:subjectMap [ rr:constant <em>bbb</em> ].</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code><em>aaa</em> rr:predicate <em>bbb</em>.</code></td>
|
|
<td><code><em>aaa</em> rr:predicateMap [ rr:constant <em>bbb</em> ].</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code><em>aaa</em> rr:object <em>bbb</em>.</code></td>
|
|
<td><code><em>aaa</em> rr:objectMap [ rr:constant <em>bbb</em> ].</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code><em>aaa</em> rr:graph <em>bbb</em>.</code></td>
|
|
<td><code><em>aaa</em> rr:graphMap [ rr:constant <em>bbb</em> ].</code></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>The following example shows a
|
|
<a href="#dfn-predicate-object-map">predicate-object map</a> that
|
|
uses a constant-valued term map both for its predicate and for its
|
|
object.</p>
|
|
<pre class="ex-mapping">
|
|
[] rr:predicateMap [ rr:constant rdf:type ];
|
|
rr:objectMap [ rr:constant ex:Employee ].</pre>
|
|
|
|
<p>If added to a <a href="#dfn-triples-map">triples map</a>,
|
|
this predicate-object map would add the following triple to
|
|
all resources <code>?x</code> generated by the triples map:</p>
|
|
<pre class="ex-output">
|
|
?x rdf:type ex:Employee.</pre>
|
|
|
|
<p>The following example uses
|
|
<a href="#dfn-constant-shortcut-property">constant shortcut properties</a>
|
|
and is equivalent to the example above:</p>
|
|
|
|
<pre class="ex-mapping">
|
|
[] rr:predicate rdf:type;
|
|
rr:object ex:Employee.</pre>
|
|
|
|
|
|
<h3 id="from-column">7.2 From a Column (<code>rr:column</code>)</h3>
|
|
|
|
<p>A <dfn id="dfn-column-valued-term-map">column-valued term map</dfn>
|
|
is a <a href="#dfn-term-map">term map</a> that is represented by
|
|
a resource that has exactly one <code>rr:column</code> property.</p>
|
|
|
|
<p>The value of the <code>rr:column</code> property
|
|
<em class="rfc2119">MUST</em> be a valid
|
|
<a href="#dfn-column-name">column name</a>. The
|
|
<dfn id="dfn-column-value">column value</dfn> of the term map
|
|
is the data value of that column in a given
|
|
<a href="#dfn-logical-table-row">logical table row</a>.</p>
|
|
|
|
<p>The <a href="#dfn-referenced-columns">referenced columns</a> of
|
|
a <a href="#dfn-column-valued-term-map">column-valued term map</a>
|
|
is the singleton set containing the value of <code>rr:column</code>.</p>
|
|
|
|
<p>The following example defines an <a href="#dfn-object-map">object map</a>
|
|
that generates <a href="#dfn-literal">literals</a> from the
|
|
<code>DNAME</code> column of some logical table.</p>
|
|
<pre class="ex-mapping">
|
|
[] rr:objectMap [ rr:column "DNAME" ].</pre>
|
|
|
|
<p>Using the sample row from the
|
|
<a href="#ex_DEPT"><code>DEPT</code> table</a> as a logical table
|
|
row, the <a href="#dfn-column-value">column value</a> of the object map
|
|
would be “<code>APPSERVER</code>”.</p>
|
|
|
|
|
|
<h3 id="from-template">7.3 From a Template (<code>rr:template</code>)</h3>
|
|
|
|
<p>A <dfn id="dfn-template-valued-term-map">template-valued term map</dfn>
|
|
is a <a href="#dfn-term-map">term map</a> that is represented by
|
|
a resource that has exactly one <code>rr:template</code> property.
|
|
The value of the <code>rr:template</code> property
|
|
<em class="rfc2119">MUST</em> be a valid
|
|
<a href="#dfn-string-template">string template</a>.</p>
|
|
|
|
<p>A <dfn id="dfn-string-template">string template</dfn> is a
|
|
format string that can be used to build strings from multiple
|
|
components. It can reference
|
|
<a href="#dfn-column-name">column names</a> by enclosing
|
|
them in curly braces. The following syntax rules apply to valid
|
|
string templates:</p>
|
|
|
|
<ul>
|
|
<li>Pairs of unescaped curly braces <em class="rfc2119">MUST</em> enclose
|
|
valid <a href="#dfn-column-name">column names</a>.</li>
|
|
<li>Curly braces that do not enclose column names
|
|
<em class="rfc2119">MUST</em> be escaped by a backslash character.
|
|
This includes curly braces within column names.</li>
|
|
<li>Backslash characters <em class="rfc2119">MUST</em> be escaped by
|
|
doubling them with another backslash character. This includes
|
|
backslashes within column names.</li>
|
|
<li>If a template contains multiple pairs of unescaped curly braces,
|
|
then adjacent pairs <em class="rfc2119">SHOULD</em> be separated by
|
|
a character or string that does not occur anywhere in the data values
|
|
of either column.</li>
|
|
</ul>
|
|
|
|
<p>The <dfn id="dfn-template-value">template value</dfn> of the term map
|
|
for a given <a href="#dfn-logical-table-row">logical table row</a>
|
|
is determined as follows:</p>
|
|
|
|
<ol>
|
|
<li>Let <code><em>result</em></code> be the
|
|
<a href="#dfn-string-template">template string</a></li>
|
|
<li>For each pair of unescaped curly braces in
|
|
<code><em>result</em></code>:
|
|
<ol>
|
|
<li>Let <code><em>value</em></code> be the data value of the
|
|
column whose name is enclosed in the curly braces</li>
|
|
<li>If <code><em>value</em></code> is <code>NULL</code>,
|
|
then return <code>NULL</code></li>
|
|
<li>Apply <a href="#dfn-conversion-to-string">conversion to string</a>
|
|
to <code><em>value</em></code></li>
|
|
<li>If the <a href="#dfn-term-type">term type</a> is
|
|
<code>rr:IRI</code>, then replace the pair of curly braces
|
|
with an <a href="#dfn-iri-safe">IRI-safe</a> version of
|
|
<code><em>value</em></code>; otherwise, replace the pair
|
|
of curly braces with <code><em>value</em></code></li>
|
|
</ol>
|
|
</li>
|
|
<li>Return <code><em>result</em></code></li>
|
|
</ol>
|
|
|
|
<p>The <dfn id="dfn-iri-safe">IRI-safe version</dfn> of a string
|
|
is obtained by applying the following transformation to any character
|
|
that is not in the
|
|
<cite><a class="norm" href="http://tools.ietf.org/html/rfc3987#section-2.2">
|
|
<code>iunreserved</code> production</a></cite> in
|
|
[<cite><a href="#RFC3987">RFC3987</a></cite>]:</p>
|
|
|
|
<ol>
|
|
<li>Convert the character to a sequence of one or more octets
|
|
using <cite><a class="norm" href="http://tools.ietf.org/html/rfc3629">UTF-8</a></cite>
|
|
[<cite><a href="#RFC3629">RFC3629</a></cite>]</li>
|
|
<li><cite><a class="norm" href="http://tools.ietf.org/html/rfc3986#section-2.1">Percent-encode</a></cite>
|
|
each octet [<cite><a href="#RFC3986">RFC3986</a></cite>]</li>
|
|
</ol>
|
|
|
|
<p>The <a href="#dfn-referenced-columns">referenced columns</a> of
|
|
a <a href="#dfn-template-valued-term-map">template-valued term map</a>
|
|
is the set of <a href="#dfn-column-name">column names</a> enclosed
|
|
in unescaped curly braces in the
|
|
<a href="#dfn-string-template">template string</a>.</p>
|
|
|
|
<p>The following example defines a
|
|
<a href="#dfn-subject-map">subject map</a> that generates
|
|
<a href="#dfn-iri">IRIs</a> from the
|
|
<code>DEPTNO</code> column of a logical table.</p>
|
|
<pre class="ex-mapping">
|
|
[] rr:subjectMap [ rr:template "http://data.example.com/department/{DEPTNO}" ].</pre>
|
|
|
|
<p>Using the sample row from the
|
|
<a href="#ex_DEPT"><code>DEPT</code> table</a> as a logical table
|
|
row, the <a href="#dfn-template-value">template value</a> of the subject map
|
|
would be:</p>
|
|
|
|
<pre class="ex-output">http://data.example.com/department/10</pre>
|
|
|
|
<p>The following example shows how an <a href="#dfn-iri-safe">IRI-safe</a>
|
|
template value is created:</p>
|
|
<pre class="ex-mapping">
|
|
[] rr:subjectMap [ rr:template "http://data.example.com/site/{LOC}" ].</pre>
|
|
|
|
<p>Using the sample row from the
|
|
<a href="#ex_DEPT"><code>DEPT</code> table</a> as a logical table
|
|
row, the <a href="#dfn-template-value">template value</a> of the subject map
|
|
would be:</p>
|
|
|
|
<pre class="ex-output">http://data.example.com/site/NEW%20YORK</pre>
|
|
|
|
<p>The space character is not in the <code>iunreserved</code> set,
|
|
and therefore percent-encoding is applied to the character, yielding
|
|
“<code>%20</code>”.</p>
|
|
|
|
<p>The following example shows the use of backslash escapes in string
|
|
templates. The template will generate a fancy title such as</p>
|
|
<pre>{{{ Hello World! }}}</pre>
|
|
<p>from a string “<code>Hello World!</code>” in the <code>TITLE</code> column.</p>
|
|
<pre class="ex-mapping">
|
|
[] rr:objectMap [ rr:template "\\{\\{\\{ {TITLE} \\}\\}\\}" ].</pre>
|
|
<p>Note that because <a class="norm" href=
|
|
"http://www.w3.org/TeamSubmission/2008/SUBM-turtle-20080114/#sec-strings">
|
|
backslashes need to be escaped by a second backslash
|
|
in the Turtle syntax</a>
|
|
[<cite><a href="#TURTLE">TURTLE</a></cite>],
|
|
a double backslash is needed to escape each curly brace.</p>
|
|
|
|
|
|
<h3 id="termtype">7.4 IRIs, Literal, Blank Nodes (<code>rr:termType</code>)</h3>
|
|
|
|
<p>The <dfn id="dfn-term-type">term type</dfn> of a
|
|
<a href="#dfn-column-valued-term-map">column-valued term map</a> or
|
|
<a href="#dfn-template-valued-term-map">template-valued term map</a>
|
|
determines the kind of
|
|
<a href="#dfn-generated-rdf-terms">generated RDF term</a>
|
|
(<a href="#dfn-iri">IRIs</a>, <a href="#dfn-blank-node">blank nodes</a> or
|
|
<a href="#dfn-literal">literals</a>).</p>
|
|
|
|
<p>If the term map has an optional <code>rr:termType</code> property,
|
|
then its <a href="#dfn-term-type">term type</a>
|
|
is the value of that property. The value <em class="rfc2119">MUST</em>
|
|
be an IRI and <em class="rfc2119">MUST</em> be
|
|
one of the following options:</p>
|
|
|
|
<ul>
|
|
<li>If the term map is a <a href="#dfn-subject-map">subject map</a>:
|
|
<code>rr:IRI</code> or <code>rr:BlankNode</code></li>
|
|
<li>If the term map is a <a href="#dfn-predicate-map">predicate map</a>:
|
|
<code>rr:IRI</code></li>
|
|
<li>If the term map is an <a href="#dfn-object-map">object map</a>:
|
|
<code>rr:IRI</code>, <code>rr:BlankNode</code>, or <code>rr:Literal</code></li>
|
|
<li>If the term map is a <a href="#dfn-graph-map">graph map</a>:
|
|
<code>rr:IRI</code></li>
|
|
</ul>
|
|
|
|
<p>If the term map does not have a <code>rr:termType</code> property,
|
|
then its <a href="#dfn-term-type">term type</a> is:</p>
|
|
|
|
<ul>
|
|
<li>If the term map is an <a href="#dfn-object-map">object map</a>
|
|
and a <a href="#dfn-column-valued-term-map">column-based term map</a>:
|
|
<code>rr:Literal</code></li>
|
|
<li>Otherwise: <code>rr:IRI</code></li>
|
|
</ul>
|
|
|
|
<p class="note">Term maps with term type <code>rr:IRI</code>
|
|
cause <a href="#dfn-data-error">data errors</a> if the value is not a
|
|
valid <a href="#dfn-iri">IRI</a>
|
|
(see <a href="#dfn-generated-rdf-terms">generated RDF term</a> for details).
|
|
Data values from the input database may require percent-encoding before
|
|
they can be used in IRIs.
|
|
<a href="#dfn-template-valued-term-map">Template-valued term maps</a>
|
|
are a convenient way of percent-encoding data values.</p>
|
|
|
|
|
|
<h3 id="language-tags">7.5 Language Tags (<code>rr:language</code>)</h3>
|
|
|
|
<p>A <a href="#dfn-term-map">term map</a> with a
|
|
<a href="#dfn-term-type">term type</a> of <code>rr:Literal</code>
|
|
<em class="rfc2119">MAY</em> have a
|
|
<dfn id="dfn-specified-language-tag">specified language tag</dfn>.
|
|
It is represented by the <code>rr:language</code> property on a term map.
|
|
If present, its value <em class="rfc2119">MUST</em> be
|
|
a valid <a href="#dfn-language-tag">language tag</a>.</p>
|
|
|
|
<p>A specified language tag causes generated literals to be
|
|
language-tagged plain literals. In the following example, plain
|
|
literals with language tag “<code>en-us</code>” (U.S. English)
|
|
will be generated for the data values in the <code>DNAME</code>
|
|
column.</p>
|
|
|
|
<pre class="ex-mapping">
|
|
[] rr:objectMap [ rr:column "DNAME"; rr:language "en-us" ].
|
|
</pre>
|
|
|
|
|
|
<h3 id="typed-literals">7.6 Typed Literals (<code>rr:datatype</code>)</h3>
|
|
|
|
<p>A <dfn id="dfn-typeable-term-map">typeable term map</dfn> is a
|
|
<a href="#dfn-term-map">term map</a> with a
|
|
<a href="#dfn-term-type">term type</a> of <code>rr:Literal</code>
|
|
that does not have a
|
|
<a href="#dfn-specified-language-tag">specified langauge tag</a>.</p>
|
|
|
|
<p>Typeable term maps may generate
|
|
<a href="#dfn-typed-literal">typed literals</a>. The datatype
|
|
of these literals can be explicitly specified using
|
|
<code>rr:datatype</code>, or
|
|
<a href="#dfn-corresponding-rdf-datatype">automatically determined</a>
|
|
based on the SQL datatype of the underlying logical table column.</p>
|
|
|
|
<p>A <a href="#dfn-typeable-term-map">typeable term map</a>
|
|
<em class="rfc2119">MAY</em> have a <code>rr:datatype</code> property.
|
|
Its value <em class="rfc2119">MUST</em> be an <a href="#dfn-iri">IRI</a>.
|
|
This IRI is the <dfn id="dfn-specified-datatype">specified datatype</dfn>
|
|
of the term map.</p>
|
|
|
|
<p>A term map <em class="rfc2119">MUST NOT</em> have more than one
|
|
<code>rr:datatype</code> value.</p>
|
|
|
|
<p>A term map that is not a
|
|
<a href="#dfn-typeable-term-map">typeable term map</a>
|
|
<em class="rfc2119">MUST NOT</em> have an <code>rr:datatype</code>
|
|
property.</p>
|
|
|
|
<p>A <a href="#dfn-typeable-term-map">typeable term map</a>
|
|
has an <dfn id="dfn-implicit-datatype">implicit datatype</dfn>
|
|
and an <dfn id="dfn-implicit-transform">implicit transform</dfn>.
|
|
They are determined as follows:</p>
|
|
|
|
<ul>
|
|
<li>If the term map is a
|
|
<a href="#dfn-column-valued-term-map">column-valued term map</a>,
|
|
then the implicit datatype is the
|
|
<a href="#dfn-corresponding-rdf-datatype">corresponding RDF datatype</a>
|
|
of the respective column in
|
|
the <a href="#dfn-logical-table-row">logical table row</a>, and
|
|
the implicit transform is the <a href="#dfn-rdf-transformation">RDF
|
|
transformation</a> of the column.</li>
|
|
|
|
<li>Otherwise, the term map must be a
|
|
<a href="#dfn-template-valued-term-map">template-valued term map</a>
|
|
and its implicit datatype is <code>empty</code>, and
|
|
its implicit transform is the identity transform.</li>
|
|
</ul>
|
|
|
|
<p>A <dfn id="dfn-datatype-override">datatype override</dfn>
|
|
is in effect on a <a href="#dfn-typeable-term-map">typeable term map</a>
|
|
if it has a <a href="#dfn-specified-datatype">specified datatype</a>,
|
|
and the specified datatype is different from its
|
|
<a href="#dfn-implicit-datatype">implicit datatype</a>.</p>
|
|
|
|
<p>See <a href="#dfn-generated-rdf-terms">generated RDF term</a>
|
|
for further details.</p>
|
|
|
|
<p class="note">R2RML does not allow generating
|
|
<a href="#dfn-plain-literal">plain literals</a> without
|
|
<a href="#dfn-language-tag">language tag</a> from non-string
|
|
columns. One can use a derived column that uses a SQL
|
|
<code>CAST</code> expression instead.</p>
|
|
|
|
<p>The following example shows an <a href="#dfn-object-map">object map</a>
|
|
that overrides the default datatype of the logical table with
|
|
an explicitly specified <code>xsd:positiveInteger</code> type.
|
|
Whatever is in the <code>EMPNO</code> column will be subjected
|
|
to <a href="#dfn-conversion-to-string">conversion to string</a>,
|
|
and turned into a literal of that type.</p>
|
|
|
|
<pre class="ex-mapping">
|
|
[] rr:objectMap [ rr:column "EMPNO"; rr:datatype xsd:positiveInteger ].
|
|
</pre>
|
|
|
|
|
|
<h3 id="inverse">7.7 Inverse Expressions (<code>rr:inverseExpression</code>)</h3>
|
|
|
|
<p>An <dfn id="dfn-inverse-expression">inverse expression</dfn> is a
|
|
<a href="#dfn-string-template">string template</a> associated with
|
|
a <a href="#dfn-column-valued-term-map">column-valued term map</a> or
|
|
<a href="#dfn-template-valued-term-map">template-value term map</a>.
|
|
It is represented by the value of the <code>rr:inverseExpression</code>
|
|
property. This property is <em class="rfc2119">OPTIONAL</em> and there
|
|
<em class="rfc2119">MUST NOT</em> be more than one for a term map.</p>
|
|
|
|
<p>Inverse expressions are useful for optimizing
|
|
<a href="#dfn-term-map">term maps</a>
|
|
that reference derived columns in
|
|
<a href="#dfn-r2rml-view">R2RML views</a>.
|
|
An inverse expression specifies an expression that
|
|
allows “reversing” of a <a href="#dfn-generated-rdf-terms">generated RDF term</a>
|
|
and the construction of a SQL query that efficiently retrieves the
|
|
<a href="#dfn-logical-table-row">logical table row</a> from which the
|
|
term was generated. In particular, it allows the use of indexes
|
|
on the underlying relational tables.</p>
|
|
|
|
<p>Every pair of unescaped curly braces in the inverse expression is a
|
|
<dfn id="dfn-column-reference">column reference in an inverse expression</dfn>.
|
|
The string between the braces <em class="rfc2119">MUST</em> be a valid
|
|
<a href="#dfn-column-name">column name</a>.</p>
|
|
|
|
<p>An <a href="#dfn-inverse-expression">inverse expression</a>
|
|
<em class="rfc2119">MUST</em> satisfy the following condition:</p>
|
|
|
|
<ul>
|
|
<li>Let <em>t</em> be the <a href="#dfn-logical-table">logical table</a>
|
|
associated with this <a href="#dfn-term-map">term map</a></li>
|
|
<li>Every <a href="#dfn-column-reference">column reference</a> in the
|
|
inverse expression <em class="rfc2119">MUST</em> be an existing column
|
|
in <em>t</em></li>
|
|
<li>Given a <a href="#dfn-logical-table-row">logical table row</a>
|
|
<em>r</em> in <em>t</em>, let <em>instantiation(r)</em> be the result of
|
|
replacing each <a href="#dfn-column-reference">column reference</a>
|
|
<em>c</em> in the inverse expression with:
|
|
<ul>
|
|
<li>the <a href="#dfn-quoted-data-value">quoted and escaped data value</a>
|
|
of column
|
|
<em>c</em> in <em>r</em>, if <em>c</em> is a
|
|
<a href="#dfn-referenced-columns">referenced column</a>
|
|
in the <a href="#dfn-term-map">term map</a></li>
|
|
<li>the <a href="#dfn-column-name">column name</a>
|
|
of column <em>c</em>, otherwise</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li>Given a <a href="#dfn-logical-table-row">logical table row</a>
|
|
<em>r</em> in <em>t</em>, let <em>same-term(r)</em>
|
|
be the set of logical table rows in <em>t</em> that are the
|
|
result of executing the following SQL query over the
|
|
<a href="#dfn-sql-connection">SQL connection</a>:
|
|
|
|
<pre>SELECT * FROM (<em>{query}</em>) AS tmp WHERE <em>{expr}</em></pre>
|
|
|
|
where <code><em>{query}</em></code> is the
|
|
<a href="#dfn-effective-sql-query">effective SQL query</a>
|
|
of <em>t</em>, and <code><em>{expr}</em></code> is
|
|
<em>instantiation(r)</em></li>
|
|
|
|
<li>For every <a href="#dfn-logical-table-row">logical table row</a>
|
|
<em>r</em> in <em>t</em> whose
|
|
<a href="#dfn-generated-rdf-terms">generated RDF term</a> <em>g</em>
|
|
is not <code>NULL</code>, <em>same-term(r)</em>
|
|
<em class="rfc2119">MUST</em> be exactly the set of logical table rows
|
|
in <em>t</em> whose
|
|
<a href="#dfn-generated-rdf-terms">generated RDF term</a> is
|
|
also <em>g</em>.</li>
|
|
</ul>
|
|
|
|
<p>For example, for the <code>DEPTID</code> column in the
|
|
<a href="#dfn-logical-table">logical table</a> used for
|
|
mapping the <code>DEPT</code> table in
|
|
<a href="#example-r2rml-view">this example mapping</a>,
|
|
an inverse expression could be defined as follows:</p>
|
|
|
|
<pre class="ex-mapping">
|
|
[] rr:column "DEPTID";
|
|
rr:inverseExpression "{DEPTNO} = substr({DEPTID},length('Department')+1)";
|
|
</pre>
|
|
|
|
<p>This facilitates the use of an existing index on the <code>DEPTNO</code>
|
|
column of the <a href="#ex_DEPT">DEPT table</a>.</p>
|
|
|
|
<p>A <dfn id="dfn-quoted-data-value">quoted and escaped data value</dfn>
|
|
is a SQL literal that can be used in a SQL query, such as:</p>
|
|
|
|
<ul>
|
|
<li><code>27</code></li>
|
|
<li><code>'foo'</code></li>
|
|
<li><code>'foo''bar'</code></li>
|
|
</ul>
|
|
|
|
|
|
<h2 id="foreign-key">8 Foreign Key Relationships among Logical Tables (<code>rr:parentTriplesMap</code>, <code>rr:joinCondition</code>, <code>rr:child</code> and <code>rr:parent</code>)</h2>
|
|
|
|
<div class="figure">
|
|
<img src="images/ref-object-map.png" alt="Diagram: The properties of referencing object maps"/>
|
|
<br /><br />
|
|
Figure 5: The properties of referencing object maps
|
|
</div>
|
|
|
|
<p>A <dfn id="dfn-referencing-object-map">referencing object map</dfn>
|
|
allows using the subjects of another
|
|
<a href="#dfn-triples-map">triples map</a> as the objects generated
|
|
by a <a href="#dfn-predicate-object-map">predicate-object map</a>.
|
|
Since both triples maps may be based on different
|
|
<a href="#dfn-logical-table">logical tables</a>, this may require
|
|
a join between the logical tables. A referencing object map is represented
|
|
by a resource that:</p>
|
|
|
|
<ul>
|
|
<li>has exactly one <code>rr:parentTriplesMap</code> property, whose value
|
|
<em class="rfc2119">MUST</em> be a
|
|
<a href="#dfn-triples-map">triples map</a>, known as the
|
|
referencing object map's <dfn id="dfn-parent-triples-map">parent
|
|
triples map</dfn>.</li>
|
|
|
|
<li><em class="rfc2119">MAY</em> have one or more
|
|
<code>rr:joinCondition</code> properties, whose values
|
|
<em class="rfc2119">MUST</em> be
|
|
<a href="#dfn-join-condition">join conditions</a>.</li>
|
|
</ul>
|
|
|
|
<p>A <dfn id="dfn-join-condition">join condition</dfn> is a resource that
|
|
has exactly two properties:</p>
|
|
|
|
<ul>
|
|
<li><code>rr:child</code>, whose value is known as the join condition's
|
|
<dfn id="dfn-child-column">child column</dfn> and
|
|
<em class="rfc2119">MUST</em> be a
|
|
<a href="#dfn-column-name">column name</a> that exists in the
|
|
<a href="#dfn-logical-table">logical table</a> of the
|
|
<a href="#dfn-triples-map">triples map</a> that contains the
|
|
referencing object map</li>
|
|
<li><code>rr:parent</code>, whose value is known as the join condition's
|
|
<dfn id="dfn-parent-column">parent column</dfn> and
|
|
<em class="rfc2119">MUST</em> be a
|
|
<a href="#dfn-column-name">column name</a> that exists in the
|
|
<a href="#dfn-logical-table">logical table</a> of the
|
|
referencing object map's
|
|
<a href="#dfn-parent-triples-map">parent triples map</a>.</li>
|
|
</ul>
|
|
|
|
<p>The <dfn id="dfn-child-query">child query</dfn> of a
|
|
<a href="#dfn-referencing-object-map">referencing object map</a>
|
|
is the <a href="#dfn-effective-sql-query">effective SQL query</a>
|
|
of the <a href="#dfn-logical-table">logical table</a> containing
|
|
the referencing object map.</p>
|
|
|
|
<p>The <dfn id="dfn-parent-query">parent query</dfn> of a
|
|
<a href="#dfn-referencing-object-map">referencing object map</a>
|
|
is the <a href="#dfn-effective-sql-query">effective SQL query</a>
|
|
of the <a href="#dfn-logical-table">logical table</a> of its
|
|
<a href="#dfn-parent-triples-map">parent triples map</a>.</p>
|
|
|
|
<p>If the <a href="#dfn-child-query">child query</a> and
|
|
<a href="#dfn-parent-query">parent query</a> of a
|
|
<a href="#dfn-referencing-object-map">referencing object map</a>
|
|
are not identical, then the referencing object map
|
|
<em class="rfc2119">MUST</em> have at least one
|
|
<a href="#dfn-join-condition">join condition</a>.</p>
|
|
|
|
<p>The <dfn id="dfn-joint-sql-query">joint SQL query</dfn> of a
|
|
<a href="#dfn-referencing-object-map">referencing object map</a>
|
|
is:</p>
|
|
|
|
<ul>
|
|
<li>If the referencing object map has no
|
|
<a href="#dfn-join-condition">join condition</a>:
|
|
<pre>SELECT * FROM (<em>{child-query}</em>) AS tmp</pre></li>
|
|
<li>If the referencing object map has at least one join condition:
|
|
<pre>
|
|
SELECT * FROM (<em>{child-query}</em>) AS child,
|
|
(<em>{parent-query}</em>) AS parent
|
|
WHERE child.<em>{child-column1}</em>=parent.<em>{parent-column1}</em>
|
|
AND child.<em>{child-column2}</em>=parent.<em>{parent-column2}</em>
|
|
AND ...</pre>
|
|
where <code><em>{child-query}</em></code> is the referencing object map's
|
|
<a href="#dfn-child-query">child query</a>,
|
|
<code><em>{parent-query}</em></code> is its
|
|
<a href="#dfn-parent-query">parent query</a>,
|
|
<code><em>{child-column1}</em></code> and
|
|
<code><em>{parent-column1}</em></code> are the
|
|
<a href="#dfn-child-column">child column</a> and
|
|
<a href="#dfn-parent-column">parent column</a> of its first
|
|
<a href="#dfn-join-condition">join condition</a>, and so on.
|
|
The order of the join conditions is chosen arbitrarily.</li>
|
|
</ul>
|
|
|
|
<p>The following example shows a referencing object map as
|
|
part of a <a href="#dfn-predicate-object-map">predicate-object map</a>:</p>
|
|
<pre class="ex-mapping" id="ex-mapping">
|
|
[] rr:predicateObjectMap [
|
|
rr:predicate ex:department;
|
|
rr:refObjectMap [
|
|
rr:parentTriplesMap <#TriplesMap2>;
|
|
rr:joinCondition [
|
|
rr:child "DEPTNO";
|
|
rr:parent "DEPTNO";
|
|
];
|
|
];
|
|
].</pre>
|
|
<p>If the logical table of the surrounding
|
|
triples map is <code>EMP</code>, and the logical table
|
|
of <code><#TriplesMap2></code> is <code>DEPT</code>,
|
|
this would result in a join between these two tables
|
|
with the condition</p>
|
|
<pre>EMP.DEPTNO = DEPT.DEPTNO</pre>
|
|
<p>and the objects of the triples would be generated using
|
|
the subject map of <code><#TriplesMap2></code>.</p>
|
|
|
|
<p>Given the two <a href="#example-input-database">example
|
|
tables</a>, and subject maps as defined in the
|
|
<a href="#ex-mapping">example mapping</a>, this would
|
|
result in a triple:</p>
|
|
|
|
<pre class="ex-output"><http://data.example.com/employee/7369> ex:department <http://data.example.com/department/10>.</pre>
|
|
|
|
|
|
<h2 id="named-graphs">9 Assigning Triples to Named Graphs</h2>
|
|
|
|
<div class="figure">
|
|
<img src="images/graph-map.png" alt="Diagram: The properties of graph maps"/>
|
|
<br /><br />
|
|
Figure 6: The properties of graph maps
|
|
</div>
|
|
|
|
<p>Each triple generated from an <a href="#dfn-r2rml-mapping">R2RML
|
|
mapping</a> is placed into one or
|
|
more graphs of the <a href="#dfn-output-dataset">output dataset</a>.
|
|
Possible target graphs are the unnamed
|
|
<a href="#dfn-default-graph">default graph</a>, and the
|
|
<a href="#dfn-iri">IRI</a>-named <a href="#dfn-named-graph">named
|
|
graphs</a>.</p>
|
|
|
|
<p>Any <a href="#dfn-subject-map">subject map</a>
|
|
or <a href="#dfn-predicate-object-map">predicate-object map</a> <em class="rfc2119">MAY</em>
|
|
have one or more associated <dfn id="dfn-graph-map">graph maps</dfn>.
|
|
They are specified in one of two ways:</p>
|
|
|
|
<ol>
|
|
<li>using the <code>rr:graphMap</code> property, whose value
|
|
<em class="rfc2119">MUST</em> be a
|
|
<a href="#dfn-graph-map">graph map</a>,</li>
|
|
<li>using the <a href="#dfn-constant-shortcut-property">constant
|
|
shortcut property</a> <code>rr:graph</code>.</li>
|
|
</ol>
|
|
|
|
<p>Graph maps are themselves <a href="#dfn-term-map">term maps</a>.
|
|
When <a href="#dfn-generating-rdf-triples">RDF
|
|
triples are generated</a>, the set of target graphs is determined by
|
|
taking into account any graph maps associated with the subject map
|
|
or predicate-object map.</p>
|
|
<p>If a <a href="#dfn-graph-map">graph map</a> generates the special
|
|
IRI <code>rr:defaultGraph</code>, then the target graph is the
|
|
<a href="#dfn-default-graph">default graph</a> of the
|
|
<a href="#dfn-output-dataset">output dataset</a>.</p>
|
|
|
|
<p>In the following <a href="#dfn-subject-map">subject map</a> example,
|
|
all generated RDF triples will be stored in the named graph
|
|
<code>ex:DepartmentGraph</code>.</p>
|
|
<pre class="ex-mapping">
|
|
[] rr:subjectMap [
|
|
rr:template "http://data.example.com/department/{DEPTNO}";
|
|
rr:graphMap [ rr:graph ex:DepartmentGraph ];
|
|
].</pre>
|
|
|
|
<p>This is equivalent to the following example, which uses a
|
|
<a href="#dfn-constant-shortcut-property">constant shortcut property</a>:</p>
|
|
|
|
<pre class="ex-mapping">
|
|
[] rr:subjectMap [
|
|
rr:template "http://data.example.com/department/{DEPTNO}";
|
|
rr:graph ex:DepartmentGraph;
|
|
].</pre>
|
|
|
|
<p>In the following example, RDF triples are placed into named graphs
|
|
according to the job title of employees:</p>
|
|
|
|
<pre class="ex-mapping">
|
|
[] rr:subjectMap [
|
|
rr:template "http://data.example.com/employee/{EMPNO}";
|
|
rr:graphMap [ rr:template "http://data.example.com/jobgraph/{JOB}" ];
|
|
].</pre>
|
|
|
|
<p>The triples generated from the <a href="#ex_EMP"><code>EMP</code>
|
|
table</a> would be placed in the named graph with the following IRI:</p>
|
|
|
|
<pre class="ex-output">
|
|
<http://data.example.com/jobgraph/CLERK></pre>
|
|
|
|
|
|
<h3 id="blank-nodes">9.1 Scope of Blank Nodes</h3>
|
|
|
|
<p><a href="#dfn-blank-node">Blank nodes</a> in the
|
|
<a href="#dfn-output-dataset">output dataset</a> are
|
|
scoped to a single <a href="#dfn-rdf-graph">RDF graph</a>.
|
|
If the same <a href="#dfn-blank-node-identifier">blank node identifier</a>
|
|
occurs in multiple <a href="#dfn-rdf-triple">RDF triples</a>
|
|
that are in the same graph, then the triples will share the
|
|
same single blank node.
|
|
If, however, the same blank node identifier occurs in multiple graphs,
|
|
then a distinct blank node is created for each graph. An R2RML-generated
|
|
blank node can never be shared by two triples in two different graphs.</p>
|
|
|
|
<p>This implies that triples generated from a single logical table row
|
|
will have different subjects if the subjects are blank nodes and the
|
|
triples are placed into different graphs.</p>
|
|
|
|
|
|
<h2 id="datatype-conversions">10 Datatype Conversions</h2>
|
|
|
|
<p>This section defines various conversion rules applicable
|
|
to data values. The rules are invoked in various places
|
|
throughout this specification, in particular around
|
|
<a href="#typed-literals"><code>rr:datatype</code></a>
|
|
and in hte <a href="#dfn-term-generation-rules">term generation rules</a>.</p>
|
|
|
|
<p>A <a href="#dfn-typed-literal">typed literal</a> of a
|
|
<a href="#dfn-supported-rdf-datatype">supported RDF datatype</a> is
|
|
<dfn id="dfn-ill-typed">ill-typed</dfn> if its
|
|
<a href="#dfn-lexical-form">lexical form</a> is not in the
|
|
<a href="#dfn-lexical-space">lexical space</a> of the RDF datatype
|
|
identified by its <a href="#dfn-datatype-iri">datatype IRI</a>.</p>
|
|
|
|
<p>For example, <code>"X"^^xsd:boolean</code> is ill-typed because
|
|
“<code>X</code>” is not in the
|
|
<a href="http://www.w3.org/TR/xmlschema-2/#boolean">lexical space of
|
|
<code>xsd:boolean</code></a>
|
|
[<cite><a href="#XMLSCHEMA2">XMLSCHEMA2</a></cite>].</p>
|
|
|
|
|
|
<h3 id="datatype-table">10.1 Table of Corresponding Datatypes</h3>
|
|
|
|
<p>The <dfn id="dfn-corresponding-rdf-datatype">corresponding RDF
|
|
datatype</dfn> of a SQL datatype is given in the table below, or
|
|
<code>empty</code> if the SQL datatype does not occur in the table.</p>
|
|
|
|
<p>The <dfn id="dfn-rdf-transformation">RDF transformation</dfn> of a
|
|
SQL datatype is a transformation rule given in the table below, or
|
|
<em><a href="#dfn-conversion-to-string">conversion to string</a></em>
|
|
if the SQL datatype does not occur in the table.</p>
|
|
|
|
<p>The <dfn id="dfn-supported-rdf-datatype">supported RDF datatypes</dfn>
|
|
are the datatypes for which an implementation can detect
|
|
<a href="#dfn-ill-typed">ill-typed</a> literals. This set
|
|
<em class="rfc2119">MUST</em> include all datatypes mentioned
|
|
in the table below in the column “Corresponding RDF datatype”,
|
|
according to their definitions in
|
|
[<cite><a href="#XMLSCHEMA2">XMLSCHEMA2</a></cite>].
|
|
This set <em class="rfc2119">MAY</em> include arbitrary further
|
|
datatypes.</p>
|
|
|
|
<table rules="all" summary="The RDF datatypes and transformations corresponding to SQL datatypes">
|
|
<tr>
|
|
<th>SQL datatype</th>
|
|
<th>Corresponding RDF datatype</th>
|
|
<th>Transformation</th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>BINARY</code>, <code>BINARY VARYING</code>, <code>BINARY LARGE OBJECT</code></td>
|
|
<td><code>xsd:base64Binary</code></td>
|
|
<td><a href="#dfn-base64-encoding">base64 encoding</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>NUMERIC</code>, <code>DECIMAL</code></td>
|
|
<td><code>xsd:decimal</code></td>
|
|
<td><a href="#dfn-conversion-to-string">conversion to string</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code></td>
|
|
<td><code>xsd:integer</code></td>
|
|
<td><a href="#dfn-conversion-to-string">conversion to string</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>FLOAT</code>, <code>REAL</code>, <code>DOUBLE PRECISION</code></td>
|
|
<td><code>xsd:double</code></td>
|
|
<td><a href="#dfn-conversion-to-string">conversion to string</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>BOOLEAN</code></td>
|
|
<td><code>xsd:boolean</code></td>
|
|
<td><a href="#dfn-conversion-to-boolean">conversion to boolean</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>DATE</code></td>
|
|
<td><code>xsd:date</code></td>
|
|
<td><a href="#dfn-conversion-to-datetime">conversion to datetime</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>TIME</code></td>
|
|
<td><code>xsd:time</code></td>
|
|
<td><a href="#dfn-conversion-to-datetime">conversion to datetime</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>TIMESTAMP</code></td>
|
|
<td><code>xsd:dateTime</code></td>
|
|
<td><a href="#dfn-conversion-to-datetime">conversion to datetime</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>INTERVAL</code></td>
|
|
<td>undefined</td>
|
|
<td>undefined</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<div class="note">
|
|
<p>Any types not appearing in the table, including all character
|
|
string types and vendor-specific types, will default to producing RDF
|
|
<a href="#dfn-plain-literal">plain literals</a> by using
|
|
<a href="#dfn-conversion-to-string">conversion to string</a>.</p>
|
|
|
|
<p><a href="#dfn-r2rml-processor">R2RML processor</a> implementations
|
|
are expected to augment the table with additional rows for mapping
|
|
vendor-specific datatypes to appropriate XSD types.</p>
|
|
</div>
|
|
|
|
<p class="note">The translation of <code>INTERVAL</code> is left
|
|
undefined due to the complexity of the translation.
|
|
[<cite><a href="#SQL14">SQL14</a></cite>] describes a translation of
|
|
<code>INTERVAL</code> to <code>xdt:yearMonthDuration</code> and
|
|
<code>xdt:dayTimeDuration</code>.</p>
|
|
|
|
<p id="datatype-examples">The following table shows examples
|
|
of various SQL data values after
|
|
<a href="#dfn-conversion-to-string">conversion to string</a>, and a
|
|
<a href="#dfn-typed-literal">typed literal</a> of the
|
|
<a href="#dfn-corresponding-rdf-datatype">corresponding RDF datatype</a>,
|
|
derived by applying the SQL datatype's
|
|
<a href="#dfn-rdf-transformation">RDF transformation</a>:</p>
|
|
|
|
<table rules="all" summary="Examples of SQL data values converted to string and to typed literals">
|
|
<tr>
|
|
<th>SQL datatype</th>
|
|
<th>Conversion to string example</th>
|
|
<th>Typed literal example</th>
|
|
</tr>
|
|
<tr>
|
|
<td><code>DECIMAL</code></td>
|
|
<td><code>2000000000005.9</code></td>
|
|
<td><code>"2000000000005.9"^^xsd:decimal</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>DECIMAL</code></td>
|
|
<td><code>2000000000000</code></td>
|
|
<td><code>"2000000000000"^^xsd:decimal</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>INTEGER</code></td>
|
|
<td><code>-1</code></td>
|
|
<td><code>"-1"^^xsd:integer</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>REAL</code></td>
|
|
<td><code>5.0E-1</code></td>
|
|
<td><code>"5.0E-1"^^xsd:double</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>REAL</code></td>
|
|
<td><code>0E0</code></td>
|
|
<td><code>"0E0"^^xsd:double</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>DATE</code></td>
|
|
<td><code>DATE 2011-08-23</code></td>
|
|
<td><code>"2011-08-23"^^xsd:date</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>TIME</code></td>
|
|
<td><code>TIME 22:17:00</code></td>
|
|
<td><code>"22:17:00"^^xsd:time</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>TIME</code></td>
|
|
<td><code>TIME 22:17:00.0000</code></td>
|
|
<td><code>"22:17:00.0000"^^xsd:time</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>TIME</code></td>
|
|
<td><code>TIME 22:17:00+01:00</code></td>
|
|
<td><code>"22:17:00+01:00"^^xsd:time</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>TIMESTAMP</code></td>
|
|
<td><code>TIMESTAMP 2011-08-23 22:17:00</code></td>
|
|
<td><code>"2011-08-23T22:17:00"^^xsd:dateTime</code></td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
<h3 id="to-string">10.2 Conversion to string</h3>
|
|
|
|
<p><dfn id="dfn-conversion-to-string">Conversion to string</dfn> is the process
|
|
of transforming a SQL data value to a Unicode string. Its result
|
|
<em class="rfc2119">MUST</em> be the same as evaluating the following
|
|
SQL expression, as defined in [<cite><a href="#SQL2">SQL2</a></cite>]:</p>
|
|
|
|
<pre>CAST(<em>value</em> AS CHARACTER VARYING(<em>max</em>))</pre>
|
|
|
|
<p>where <code><em>value</em></code> is the
|
|
<a href="#dfn-quoted-data-value">quoted and escaped form</a> of the
|
|
SQL data value, and <code><em>max</em></code> is the
|
|
implementation-dependent maximum length of a
|
|
variable-length character string.</p>
|
|
|
|
<div class="note">
|
|
<p>An informative summary of the rules for casting standard SQL 2008
|
|
datatypes to string follows. The right column of the table contains a
|
|
<a href="http://www.w3.org/TR/xmlschema-2/#regexs">regular expression</a>
|
|
that is matched by the string-converted form of all SQL data values of
|
|
the types in the left column:</p>
|
|
|
|
<table rules="all" summary="">
|
|
<tr><th>Type</th><th>Pattern</th></tr>
|
|
<tr><td><code>DECIMAL</code>, <code>NUMERIC</code></td><td><code>-?(\.\d+|\d+(\.\d+)?)</code></td></tr>
|
|
<tr><td><code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code></td><td><code>-?\d+</code></td></tr>
|
|
<tr><td><code>FLOAT</code>, <code>REAL</code>, <code>DOUBLE PRECISION</code></td><td><code>0E0|-?[1-9]\.\d+</code></td></tr>
|
|
<tr><td><code>DATE</code></td><td><code>\d\d\d\d-\d\d-\d\d</code></td></tr>
|
|
<tr><td><code>TIME</code></td><td><code>\d\d:\d\d:\d\d(.\d+)?([+-]\d\d:\d\d)?</code></td></tr>
|
|
<tr><td><code>TIMESTAMP</code></td><td><code>\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d(.\d+)?([+-]\d\d:\d\d)?</code></td></tr>
|
|
<tr><td><code>BOOLEAN</code></td><td><code>TRUE|FALSE</code></td></tr>
|
|
</table>
|
|
|
|
<p>The result of conversion to string is always the shortest possible
|
|
string that, if interpreted as a SQL literal of the original SQL datatype,
|
|
has the same value as the original SQL data value. For example,
|
|
converting the <code>DECIMAL</code> value 1 to string yields <code>1</code>,
|
|
not the longer equal-valued strings <code>01</code> or <code>1.0</code>.</p>
|
|
</div>
|
|
|
|
|
|
<h3 id="to-boolean">10.3 Conversion to <code>xsd:boolean</code></h3>
|
|
|
|
<p><dfn id="dfn-conversion-to-boolean">Conversion to boolean</dfn>
|
|
is the process of transforming a SQL data value of datatype
|
|
<code>BOOLEAN</code> to a string that is compatible with the
|
|
<code>xsd:boolean</code> datatype. It consists of the following
|
|
steps:</p>
|
|
|
|
<ol>
|
|
<li>Apply <a href="#dfn-conversion-to-string">conversion to string</a>
|
|
to the SQL data value,</li>
|
|
<li>convert the resulting string to lowercase.</li>
|
|
</ol>
|
|
|
|
<p>Example: The result of converting a <code>BOOLEAN</code>
|
|
SQL data value to string is either <code>TRUE</code> or <code>FALSE</code>.
|
|
The resulting typed literal is either <code>"true"^^xsd:boolean</code> or
|
|
<code>"false"^^xsd:boolean</code>.</p>
|
|
|
|
|
|
<h3 id="datetime">10.4 Conversion to Datetime</h3>
|
|
|
|
<p><dfn id="dfn-conversion-to-datetime">Conversion to datetime</dfn>
|
|
is the process of transforming a SQL data value of datatype
|
|
<code>DATE</code>, <code>TIME</code> or <code>TIMESTAMP</code>
|
|
to a string that is compatible with the corresponding XSD datatype.
|
|
It consists of the following steps:</p>
|
|
|
|
<ol>
|
|
<li>Apply <a href="#dfn-conversion-to-string">conversion to string</a>
|
|
to the SQL data value.</li>
|
|
<li>Remove any initial string “<code>DATE</code>”,
|
|
“<code>TIME</code>” or “<code>TIMESTAMP</code>” and any leading spaces
|
|
from the resulting string.</li>
|
|
<li>If the SQL data value is of datatype <code>TIMESTAMP</code>,
|
|
then replace the 11th character of the string (a space) with an
|
|
upper-case “<code>T</code>”.</li>
|
|
</ol>
|
|
|
|
<p>Any fractional seconds and/or time zone interval present after
|
|
conversion to string is included in the resulting string.</p>
|
|
|
|
<p><a href="#datatype-examples">Examples for conversion to datetime</a>
|
|
can be found in the table above.</p>
|
|
|
|
|
|
<h3 id="binary">10.5 Conversion to <code>xsd:base64Binary</code></h3>
|
|
|
|
<p><dfn id="dfn-base64-encoding">Base64 encoding</dfn> is the process
|
|
of transforming a binary SQL data value to a string that is compatible with
|
|
the <code>xsd:base64Binary</code> datatype, by applying
|
|
<a href="http://www.w3.org/TR/xmlschema-2/#base64Binary">base64
|
|
encoding as restricted for <code>xsd:base64Binary</code></a>
|
|
[<cite><a href="#XMLSCHEMA2">XMLSCHEMA2</a></cite>] on the binary
|
|
value.</p>
|
|
|
|
|
|
<h2 id="generated-rdf">11 The Output Dataset</h2>
|
|
|
|
<p>The <dfn id="dfn-output-dataset">output dataset</dfn> of an
|
|
R2RML mapping is an <a href="#dfn-rdf-dataset">RDF dataset</a>
|
|
that contains the
|
|
<a href="#dfn-generating-rdf-triples">generated RDF triples</a>
|
|
for each of the <a href="#dfn-triples-map">triples maps</a> of
|
|
the R2RML mapping. The output dataset <em class="rfc2119">MUST NOT</em>
|
|
contain any other <a href="#dfn-rdf-triple">RDF triples</a> or
|
|
<a href="#dfn-named-graph">named graphs</a> besides these.</p>
|
|
|
|
<p>If a table or column is not explicitly referenced in a
|
|
<a href="#dfn-triples-map">triples map</a>,
|
|
then no <a href="#dfn-rdf-triple">RDF triples</a>
|
|
will be generated for that table or column.</p>
|
|
|
|
<p>Conforming <a href="#dfn-r2rml-processor">R2RML processors</a>
|
|
<em class="rfc2119">MAY</em> rename
|
|
<a href="#dfn-blank-node">blank nodes</a> when providing
|
|
access to the <a href="#dfn-output-dataset">output dataset</a>.
|
|
This means that client applications may see actual
|
|
<a href="#dfn-blank-node-identifier">blank node identifiers</a>
|
|
that differ from those produced by the
|
|
<a href="#dfn-r2rml-mapping">R2RML mapping</a>. Client applications
|
|
<em class="rfc2119">SHOULD NOT</em>
|
|
rely on the specific text of the blank node identifier for any purpose.</p>
|
|
|
|
<p class="note"><a href="#dfn-rdf-dataset">RDF datasets</a> may
|
|
contain empty <a href="#dfn-named-graph">named graphs</a>.
|
|
R2RML cannot generate such output datasets.</p>
|
|
|
|
|
|
<h3 id="generated-triples">11.1 The Generated RDF Triples of a Triples Map</h3>
|
|
|
|
<p>This subsection describes the process of
|
|
<dfn id="dfn-generating-rdf-triples">generating RDF triples</dfn>
|
|
from a <a href="#dfn-triples-map">triples map</a>. This process adds
|
|
<a href="#dfn-rdf-triple">RDF triples</a> to the
|
|
<a href="#dfn-output-dataset">output dataset</a>. Each generated triple
|
|
is placed into one or more particular graphs of the output dataset.</p>
|
|
|
|
<p>The generated RDF triples are determined by the following algorithm.
|
|
R2RML processors <em class="rfc2119">MAY</em> use other means than
|
|
implementing this algorithm to compute the generated RDF triples,
|
|
as long as the result is the same.</p>
|
|
|
|
<ol>
|
|
<li>Let <code><em>sm</em></code> be the
|
|
<a href="#dfn-subject-map">subject map</a> of the triples map</li>
|
|
<li>Let <code><em>rows</em></code> be the result of evaluating the
|
|
<a href="#dfn-effective-sql-query">effective SQL query</a>
|
|
of the <a href="#dfn-triples-map">triples map</a>'s
|
|
<a href="#dfn-logical-table">logical table</a> using the
|
|
<a href="#dfn-sql-connection">SQL connection</a></li>
|
|
<li>Let <code><em>classes</em></code> be the
|
|
<a href="#dfn-class-iri">class IRIs</a> of <code><em>sm</em></code></li>
|
|
<li>Let <code><em>sgm</em></code> be the set of
|
|
<a href="#dfn-graph-map">graph maps</a> of <code><em>sm</em></code></li>
|
|
|
|
<li>For each <a href="#dfn-logical-table-row">logical table row</a>
|
|
<code><em>row</em></code> in <code><em>rows</em></code>,
|
|
apply the following steps:
|
|
<ol>
|
|
<li>Let <code><em>subject</em></code> be the
|
|
<a href="#dfn-generated-rdf-terms">generated RDF term</a> that results
|
|
from applying <code><em>sm</em></code> to
|
|
<code><em>row</em></code></li>
|
|
<li>Let <code><em>subject_graphs</em></code> be the union of
|
|
the <a href="#dfn-generated-rdf-terms">generated RDF terms</a>
|
|
that result from applying any term maps in <code><em>sgm</em></code>
|
|
to <code><em>row</em></code></li>
|
|
<li>If <code><em>classes</em></code> is not empty, then for each
|
|
<a href="#dfn-iri">IRI</a> in <code><em>classes</em></code>,
|
|
<a href="#dfn-adding-triples">add the following triples</a> to the
|
|
output dataset:
|
|
<p>
|
|
<strong>Subject:</strong> <code><em>subject</em></code><br />
|
|
<strong>Predicate:</strong> <code>rdf:type</code><br />
|
|
<strong>Object:</strong> <code><em>classes</em></code><br />
|
|
<strong>Target graphs:</strong> If <code><em>sgm</em></code> is empty:
|
|
<code>rr:defaultgraph</code>;
|
|
otherwise: <code><em>subject_graphs</em></code>
|
|
</p>
|
|
</li>
|
|
<li>For each <a href="#dfn-predicate-object-map">predicate-object map</a>
|
|
of the <a href="#dfn-triples-map">triples map</a>, apply the following
|
|
steps:
|
|
<ol>
|
|
<li>If the predicate-object map has no
|
|
<a href="#dfn-object-map">object map</a> (but a
|
|
<a href="#dfn-referencing-object-map">referencing object map</a>), then
|
|
skip these substeps for this predicate-object map</li>
|
|
<li>Let <code><em>predicate</em></code> be the
|
|
<a href="#dfn-generated-rdf-terms">generated RDF term</a> that results
|
|
from applying the predicate-object map's
|
|
<a href="#dfn-predicate-map">predicate map</a>
|
|
to <code><em>row</em></code></li>
|
|
<li>Let <code><em>object</em></code> be the
|
|
<a href="#dfn-generated-rdf-terms">generated RDF term</a> that results
|
|
from applying the predicate-object map's
|
|
<a href="#dfn-object-map">object map</a>
|
|
to <code><em>row</em></code></li>
|
|
<li>Let <code><em>pogm</em></code> be the set of
|
|
<a href="#dfn-graph-map">graph maps</a> of the predicate-object map</li>
|
|
<li>Let <code><em>predicate-object_graphs</em></code> be the union of
|
|
the <a href="#dfn-generated-rdf-terms">generated RDF terms</a>
|
|
that result from applying any <a href="#dfn-graph-map">graph maps</a> in <code><em>pogm</em></code>
|
|
to <code><em>row</em></code></li>
|
|
<li><a href="#dfn-adding-triples">Add the following triples</a>
|
|
to the output dataset:
|
|
<p>
|
|
<strong>Subject:</strong> <code><em>subject</em></code><br />
|
|
<strong>Predicate:</strong> <code><em>predicate</em></code><br />
|
|
<strong>Object:</strong> <code><em>object</em></code><br />
|
|
<strong>Target graphs:</strong> If <code><em>sgm</em></code> and
|
|
<code><em>pogm</em></code> are empty: <code>rr:defaultGraph</code>;
|
|
otherwise: union of <code><em>subject_graphs</em></code>
|
|
and <code><em>predicate-object_graphs</em></code>
|
|
</p>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li>For each <a href="#dfn-predicate-object-map">predicate-object map</a>
|
|
of the <a href="#dfn-triples-map">triples map</a>, apply the following
|
|
steps:
|
|
<ol>
|
|
<li>If the predicate-object map has no
|
|
<a href="#dfn-referencing-object-map">referencing object map</a> (but a
|
|
normal <a href="#dfn-object-map">object map</a>), then
|
|
skip these substeps for this predicate-object map</li>
|
|
<li>Let <code><em>psm</em></code> be the
|
|
<a href="#dfn-subject-map">subject map</a> of the
|
|
<a href="#dfn-parent-triples-map">parent triples map</a> of the
|
|
referencing object map</li>
|
|
<li>Let <code><em>pogm</em></code> be the set of
|
|
<a href="#dfn-graph-map">graph maps</a> of the predicate-object map</li>
|
|
<li>Let <code><em>rows</em></code> be the result of evaluating the
|
|
<a href="#dfn-joint-sql-query">joint SQL query</a>
|
|
of the referencing object map</li>
|
|
<li>For each <code><em>row</em></code> in <code><em>rows</em></code>,
|
|
apply the following steps:
|
|
<ol>
|
|
<li>Let <code><em>child_row</em></code> be the subset of
|
|
<code><em>row</em></code> whose columns are present in
|
|
the referencing object map's
|
|
<a href="#dfn-child-query">child query</a></li>
|
|
<li>Let <code><em>parent_row</em></code> be the subset of
|
|
<code><em>row</em></code> whose columns are present in
|
|
the referencing object map's
|
|
<a href="#dfn-parent-query">parent query</a></li>
|
|
<li>Let <code><em>subject</em></code> be the
|
|
<a href="#dfn-generated-rdf-terms">generated RDF term</a> that results
|
|
from applying <code><em>sm</em></code> to
|
|
<code><em>child_row</em></code></li>
|
|
<li>Let <code><em>predicate</em></code> be the
|
|
<a href="#dfn-generated-rdf-terms">generated RDF term</a> that results
|
|
from applying the predicate-object map's
|
|
<a href="#dfn-predicate-map">predicate map</a>
|
|
to <code><em>child_row</em></code></li>
|
|
<li>Let <code><em>object</em></code> be the
|
|
<a href="#dfn-generated-rdf-terms">generated RDF term</a> that results
|
|
from applying <code><em>psm</em></code> to
|
|
<code><em>parent_row</em></code></li>
|
|
<li>Let <code><em>subject_graphs</em></code> be the union of the
|
|
<a href="#dfn-generated-rdf-terms">generated RDF terms</a>
|
|
that result from applying any
|
|
<a href="#dfn-graph-map">graph maps</a> of <code><em>sgm</em></code>
|
|
to <code><em>child_row</em></code></li>
|
|
<li>Let <code><em>predicate-object_graphs</em></code> be the union of the
|
|
<a href="#dfn-generated-rdf-terms">generated RDF terms</a>
|
|
that result from applying any
|
|
<a href="#dfn-graph-map">graph maps</a> in <code><em>pogm</em></code>
|
|
to <code><em>child_row</em></code></li>
|
|
<li><a href="#dfn-adding-triples">Add the following triples</a>
|
|
to the output dataset:
|
|
<p>
|
|
<strong>Subject:</strong> <code><em>subject</em></code><br />
|
|
<strong>Predicate:</strong> <code><em>predicate</em></code><br />
|
|
<strong>Object:</strong> <code><em>object</em></code><br />
|
|
<strong>Target graphs:</strong> If neither <code><em>sgm</em></code>
|
|
nor <code><em>pogm</em></code> has any <a href="#dfn-graph-map">graph
|
|
maps</a>: <code>rr:defaultGraph</code>; otherwise: union of
|
|
<code><em>subject_graphs</em></code>
|
|
and <code><em>predicate-object_graphs</em></code>
|
|
</p>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
|
|
<p>The process of <dfn id="dfn-adding-triples">adding triples
|
|
to the output dataset</dfn> takes as its input:</p>
|
|
|
|
<ul>
|
|
<li><strong>Subjects</strong>, a set of zero or more
|
|
<a href="#dfn-iri">IRIs</a> or
|
|
<a href="#dfn-blank-node">blank nodes</a></li>
|
|
<li><strong>Predicates</strong>, a set of zero or more
|
|
<a href="#dfn-iri">IRIs</a></li>
|
|
<li><strong>Objects</strong>, a set of zero or more
|
|
<a href="#dfn-rdf-term">RDF terms</a></li>
|
|
<li><strong>Target graphs</strong>, a set of zero or more
|
|
<a href="#dfn-iri">IRIs</a></li>
|
|
</ul>
|
|
|
|
<p>For each possible combination <<em>s</em>, <em>p</em>, <em>o</em>>,
|
|
where <em>s</em> is a member of <em>Subjects</em>, <em>p</em> a member
|
|
of <em>Predicates</em> and <em>o</em> a member of <em>Objects</em>:</p>
|
|
|
|
<ol>
|
|
<li>Generate an <a href="#dfn-rdf-triple">RDF triple</a> <<em>s</em>, <em>p</em>,
|
|
<em>o</em>></li>
|
|
<li>If the set of target graphs includes <code>rr:defaultGraph</code>,
|
|
add the triple to the <a href="#dfn-default-graph">default graph</a>
|
|
of the <a href="#dfn-output-dataset">output dataset</a>.</li>
|
|
<li>For each <a href="#dfn-iri">IRI</a> in the set of target
|
|
graphs that is not equal to <code>rr:defaultGraph</code>,
|
|
add the triple to a <a href="#dfn-default-graph">named graph</a>
|
|
of that name in the <a href="#dfn-output-dataset">output dataset</a>.
|
|
If the output dataset does not contain a named graph with that IRI,
|
|
create it first.</li>
|
|
</ol>
|
|
|
|
<p><a href="#dfn-rdf-graph">RDF graphs</a> cannot contain duplicate
|
|
<a href="#dfn-rdf-triple">RDF triples</a>. Placing multiple equal
|
|
triples into the same graph has the same effect as placing it into
|
|
the graph only once.</p>
|
|
|
|
|
|
<h3 id="generated-rdf-terms">11.2 The Generated RDF Terms of a Term Map</h3>
|
|
|
|
<p>A <a href="#dfn-term-map">term map</a> is a function that generates
|
|
a set of <a href="#dfn-rdf-term">RDF terms</a> from a
|
|
<a href="#dfn-logical-table-row">logical table row</a>. The result of that
|
|
function can be:</p>
|
|
|
|
<ul>
|
|
<li>The empty set – if the term map references a <code>NULL</code> value,</li>
|
|
<li>A singleton set of one RDF term – the common case,</li>
|
|
<li>A <a href="#dfn-data-error">data error</a>.</li>
|
|
</ul>
|
|
|
|
<p>The <dfn id="dfn-generated-rdf-terms">generated RDF terms</dfn>
|
|
of a term map for a given logical table row are determined as follows:</p>
|
|
|
|
<ul>
|
|
<li>If the term map is a
|
|
<a href="#dfn-constant-valued-term-map">constant-valued term map</a>,
|
|
then the generated RDF terms are a singleton set containing
|
|
the term map's <a href="#dfn-constant-value">constant value</a>.</li>
|
|
|
|
<li>If the term map is a
|
|
<a href="#dfn-column-valued-term-map">column-valued term map</a>, then
|
|
the generated RDF terms are determined by applying the
|
|
<a href="#dfn-term-generation-rules">term generation rules</a> to its
|
|
<a href="#dfn-column-value">column value</a>.</li>
|
|
|
|
<li>If the term map is a
|
|
<a href="#dfn-template-valued-term-map">template-valued term map</a>, then
|
|
the generated RDF terms are determined by applying the
|
|
<a href="#dfn-term-generation-rules">term generation rules</a> to its
|
|
<a href="#dfn-template-value">template value</a>.</li>
|
|
</ul>
|
|
|
|
<p>The <dfn id="dfn-term-generation-rules">term generation rules</dfn>
|
|
are as follows:</p>
|
|
|
|
<ol>
|
|
<li>If the value is <code>NULL</code>, then no RDF term is generated.</li>
|
|
<li>Otherwise, if the <a href="#dfn-term-map">term map</a>'s
|
|
<a href="#dfn-term-type">term type</a> is <code>rr:IRI</code>:
|
|
<ol>
|
|
<li>Apply <a href="#dfn-conversion-to-string">conversion to string</a>
|
|
to the value.</li>
|
|
<li>If the value is a valid
|
|
<cite><a href="http://tools.ietf.org/html/rfc3987#section-2.2">
|
|
absolute IRI</a></cite> [<cite><a href="#RFC3987">RFC3987</a></cite>],
|
|
then generate an <a href="#dfn-iri">IRI</a>.</li>
|
|
<li>Otherwise, prepend the value with the
|
|
<a href="#dfn-base-iri">base IRI</a>. If the result is a valid
|
|
<cite><a href="http://tools.ietf.org/html/rfc3987#section-2.2">
|
|
absolute IRI</a></cite> [<cite><a href="#RFC3987">RFC3987</a></cite>],
|
|
then generate an <a href="#dfn-iri">IRI</a> from the result.</li>
|
|
<li>Otherwise, raise a <a href="#dfn-data-error">data error</a>.</li>
|
|
</ol>
|
|
</li>
|
|
<li>Otherwise, if the term type is <code>rr:BlankNode</code>:
|
|
<ol>
|
|
<li>Apply <a href="#dfn-conversion-to-string">conversion to string</a>
|
|
to the value.</li>
|
|
<li>Generate
|
|
a <a href="#dfn-blank-node-identifier">blank node</a> whose
|
|
<a href="#dfn-blank-node-identifier">blank node identifier</a>
|
|
is the value.</li>
|
|
</ol>
|
|
</li>
|
|
<li>Otherwise, if the term type is <code>rr:Literal</code>:
|
|
<ol>
|
|
<li>If the term map has a <a href="#dfn-specified-language-tag">specified
|
|
language tag</a>, then apply
|
|
<a href="#dfn-conversion-to-string">conversion to string</a>
|
|
to the value, and generate a
|
|
<a href="#dfn-plain-literal">plain literal</a> with that
|
|
language tag.</li>
|
|
<li>Otherwise, if a <a href="#dfn-datatype-override">datatype override</a>
|
|
is in effect on the term map:
|
|
<ol>
|
|
<li>Apply <a href="#dfn-conversion-to-string">conversion to string</a>
|
|
to the value.</li>
|
|
<li>Generate a <a href="#dfn-typed-literal">typed literal</a> whose
|
|
<a href="#dfn-datatype-iri">datatype IRI</a> is the
|
|
<a href="#dfn-specified-datatype">specified datatype</a>.</li>
|
|
<li>If the specified datatype is a
|
|
<a href="#dfn-supported-rdf-datatype">supported RDF datatype</a>
|
|
and the generated typed literal is
|
|
<a href="#dfn-ill-typed">ill-typed</a>, then raise a
|
|
<a href="#dfn-data-error">data error</a>.</li>
|
|
</ol>
|
|
</li>
|
|
<li>Otherwise, if the term map's
|
|
<a href="#dfn-implicit-datatype">implicit datatype</a> is
|
|
<code>empty</code>, then apply
|
|
<a href="#dfn-conversion-to-string">conversion to string</a>
|
|
to the value, and generate a
|
|
<a href="#dfn-plain-literal">plain literal</a> without
|
|
language tag.</li>
|
|
<li>Otherwise, apply the term map's
|
|
<a href="#dfn-implicit-transform">implicit transform</a>
|
|
to the value, and generate a
|
|
<a href="#dfn-typed-literal">typed literal</a> whose
|
|
<a href="#dfn-datatype-iri">datatype IRI</a> is the
|
|
<a href="#dfn-implicit-datatype">implicit datatype</a>.</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
|
|
<p class="note">The algorithm uses simple string concatenation for
|
|
obtaining an absolute IRI from a relative IRI, rather than the more complex
|
|
algorithm defined in RFC 3986. This ensures that the original database
|
|
value can be reconstructed from the generated IRI.</p>
|
|
|
|
|
|
<h2 id="terminology">A. RDF Terminology (Informative)</h2>
|
|
|
|
<p>This section lists some terms normatively defined in other specifications.</p>
|
|
|
|
<p>The following terms are defined in <cite><em><a class="norm" href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/">RDF Concepts and Abstract
|
|
Syntax</a></em></cite> [<cite><a href="#RDF">RDF</a></cite>] and used in R2RML:</p>
|
|
|
|
<ul>
|
|
<li><dfn id="dfn-rdf-graph"><a class="type rdfGraph" href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-rdf-graph">RDF
|
|
graph</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-rdf-triple"><a href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-rdf-triple">RDF
|
|
triple</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-iri"><a class="type IRI" href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#section-rdf-graph">IRI</a></dfn>
|
|
(corresponds to the Concepts and Abstract Syntax term <em>RDF URI
|
|
reference</em>)</li>
|
|
|
|
<li><dfn id="dfn-literal"><a class="type literal" href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-literal">literal</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-plain-literal"><a class="type plainLiteral" href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-plain-literal">plain
|
|
literal</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-typed-literal"><a class="type typedLiteral" href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-typed-literal">typed
|
|
literal</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-language-tag"><a class="type langTag" href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-language-identifier">language
|
|
tag</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-lexical-form"><a class="type lexicalForm" href=
|
|
"http://www.w3.org/TR/rdf-concepts/#dfn-lexical-form">lexical form</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-datatype-iri"><a class="type datatypeIRI" href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-datatype-URI">datatype
|
|
IRI</a></dfn> (corresponds to the Concepts and Abstract Syntax term <em>datatype
|
|
URI</em>)</li>
|
|
|
|
<li><dfn id="dfn-lexical-space"><a class="type lexicalSpace" href=
|
|
"http://www.w3.org/TR/rdf-concepts/#dfn-lexical-space">lexical space</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-blank-node"><a class="type bNode" href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-blank-node">blank
|
|
node</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-blank-node-identifier"><a href=
|
|
"http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-blank-node-id">
|
|
blank node identifier</a></dfn></li>
|
|
</ul>
|
|
|
|
<p>The following terms are defined in <cite><em><a class="norm" href=
|
|
"http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/">SPARQL Query Language for
|
|
RDF</a></em></cite> [<cite><a href="#SPARQL">SPARQL</a></cite>] and used in
|
|
R2RML:</p>
|
|
|
|
<ul>
|
|
<li><dfn id="dfn-rdf-dataset"><a href=
|
|
"http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#rdfDataset">RDF
|
|
dataset</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-default-graph"><a href=
|
|
"http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#rdfDataset">default
|
|
graph</a></dfn></li>
|
|
|
|
<li><dfn id="dfn-named-graph"><a href=
|
|
"http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/#rdfDataset">named
|
|
graph</a></dfn></li>
|
|
</ul>
|
|
|
|
|
|
<h2 id="index">B. Index of R2RML Vocabulary Terms (Informative)</h2>
|
|
|
|
<p>This appendix lists all the classes, properties and other terms
|
|
defined by this specification within the
|
|
<a href="#dfn-r2rml-vocabulary">R2RML vocabulary</a>.</p>
|
|
|
|
<p>An RDFS representation of the vocabulary is available from
|
|
the <a href="http://www.w3.org/ns/r2rml#">namespace IRI</a>.</p>
|
|
|
|
|
|
<h3 id="class-index">B.1 Classes</h3>
|
|
|
|
<table class="term-index">
|
|
<tr><th>Class</th><th>Represents</th></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#GraphMap"><code>rr:GraphMap</code></a></th>
|
|
<td><a href="#dfn-graph-map">graph map</a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#Join"><code>rr:Join</code></a></th>
|
|
<td><a href="#dfn-join-condition">join condition</a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#LogicalTable"><code>rr:LogicalTable</code></a></th>
|
|
<td><a href="#dfn-logical-table">logical table</a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#ObjectMap"><code>rr:ObjectMap</code></a></th>
|
|
<td><a href="#dfn-object-map">object map</a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#PredicateMap"><code>rr:PredicateMap</code></a></th>
|
|
<td><a href="#dfn-predicate-map">predicate map</a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#PredicateObjectMap"><code>rr:PredicateObjectMap</code></a></th>
|
|
<td><a href="#dfn-predicate-object-map">predicate-object map</a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#RefObjectMap"><code>rr:RefObjectMap</code></a></th>
|
|
<td><a href="#dfn-referencing-object-map">referencing object map</a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#SubjectMap"><code>rr:SubjectMap</code></a></th>
|
|
<td><a href="#dfn-subject-map">subject map</a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#TriplesMap"><code>rr:TriplesMap</code></a></th>
|
|
<td><a href="#dfn-triples-map">triples map</a></td></tr>
|
|
</table>
|
|
|
|
<h3 id="property-index">B.2 Properties</h3>
|
|
|
|
<p>The cardinality column indicates how often this property
|
|
occurs within its context. Note that additional constraints
|
|
not stated in this table might apply, and making a property
|
|
forbidden or required in certain situations.</p>
|
|
|
|
<table class="term-index">
|
|
<tr><th>Property</th><th>Represents</th><th>Context</th><th>Cardinality</th></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#child"><code>rr:child</code></a></th>
|
|
<td><a href="#dfn-child-column">child column</a></td>
|
|
<td><a href="#dfn-join-condition">join condition</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#class"><code>rr:class</code></a></th>
|
|
<td><a href="#dfn-class-iri">class IRI</a></td>
|
|
<td><a href="#dfn-subject-map">subject map</a></td>
|
|
<td>0…∞</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#column"><code>rr:column</code></a></th>
|
|
<td><a href="#dfn-column-valued-term-map">column name</a></td>
|
|
<td><a href="#dfn-column-valued-term-map">column-valued term map</a></td><td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#datatype"><code>rr:datatype</code></a></th>
|
|
<td><a href="#dfn-specified-datatype">specified datatype</a></td>
|
|
<td><a href="#dfn-term-map">term map</a></td>
|
|
<td>0…1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#constant"><code>rr:constant</code></a></th>
|
|
<td><a href="#dfn-constant-value">constant value</a></td>
|
|
<td><a href="#dfn-constant-valued-term-map">constant-valued term map</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#graph"><code>rr:graph</code></a></th>
|
|
<td><a href="#dfn-constant-shortcut-property">constant shortcut property</a></td>
|
|
<td><a href="#dfn-subject-map">subject map</a>, <a href="#dfn-predicate-object-map">predicate-object map</a></td>
|
|
<td>0…∞</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#graphMap"><code>rr:graphMap</code></a></th>
|
|
<td><a href="#dfn-graph-map">graph map</a></td>
|
|
<td><a href="#dfn-subject-map">subject map</a>, <a href="#dfn-predicate-object-map">predicate-object map</a></td>
|
|
<td>0…∞</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#inverseExpression"><code>rr:inverseExpression</code></a></th>
|
|
<td><a href="#dfn-inverse-expression">inverse-expression</a></td>
|
|
<td><a href="#dfn-term-map">term map</a></td>
|
|
<td>0…1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#joinCondition"><code>rr:joinCondition</code></a></th>
|
|
<td><a href="#dfn-join-condition">join condition</a></td>
|
|
<td><a href="#dfn-referencing-object-map">referencing object map</a></td>
|
|
<td>0…∞</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#language"><code>rr:language</code></a></th>
|
|
<td><a href="#dfn-specified-language-tag">specified language tag</a></td>
|
|
<td><a href="#dfn-term-map">term map</a></td>
|
|
<td>0…1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#logicalTable"><code>rr:logicalTable</code></a></th>
|
|
<td><a href="#dfn-triples-map">logical table</a></td>
|
|
<td><a href="#dfn-triples-map">triples map</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#object"><code>rr:object</code></a></th>
|
|
<td><a href="#dfn-constant-shortcut-property">constant shortcut property</a></td>
|
|
<td><a href="#dfn-predicate-object-map">predicate-object map</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#objectMap"><code>rr:objectMap</code></a></th>
|
|
<td><a href="#dfn-object-map">object map</a></td>
|
|
<td><a href="#dfn-predicate-object-map">predicate-object map</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#parent"><code>rr:parent</code></a></th>
|
|
<td><a href="#dfn-parent-column">parent column</a></td>
|
|
<td><a href="#dfn-join-condition">join condition</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#parentTriplesMap"><code>rr:parentTriplesMap</code></a></th>
|
|
<td><a href="#dfn-parent-triples-map">parent triples map</a></td>
|
|
<td><a href="#dfn-referencing-object-map">referencing object map</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#predicate"><code>rr:predicate</code></a></th>
|
|
<td><a href="#dfn-constant-shortcut-property">constant shortcut property</a></td>
|
|
<td><a href="#dfn-predicate-object-map">predicate-object map</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#predicateMap"><code>rr:predicateMap</code></a></th>
|
|
<td><a href="#dfn-predicate-map">predicate map</a></td>
|
|
<td><a href="#dfn-predicate-object-map">predicate-object map</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#predicateObjectMap"><code>rr:predicateObjectMap</code></a></th>
|
|
<td><a href="#dfn-triples-map">predicate-object map</a></td>
|
|
<td><a href="#dfn-triples-map">triples map</a></td>
|
|
<td>0…∞</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#sqlQuery"><code>rr:sqlQuery</code></a></th>
|
|
<td><a href="#dfn-sql-query">SQL query</a></td>
|
|
<td><a href="#dfn-r2rml-view">R2RML view</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#sqlVersion"><code>rr:sqlVersion</code></a></th>
|
|
<td><a href="#dfn-sql-version-identifier">SQL version identifier</a></td>
|
|
<td><a href="#dfn-r2rml-view">R2RML view</a></td>
|
|
<td>0…∞</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#subject"><code>rr:subject</code></a></th>
|
|
<td><a href="#dfn-constant-shortcut-property">constant shortcut property</a></td>
|
|
<td><a href="#dfn-triples-map">triples map</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#subjectMap"><code>rr:subjectMap</code></a></th>
|
|
<td><a href="#dfn-triples-map">subject map</a></td>
|
|
<td><a href="#dfn-triples-map">triples map</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#tableName"><code>rr:tableName</code></a></th>
|
|
<td><a href="#dfn-table-or-view-name">table or view name</a></td>
|
|
<td><a href="#dfn-sql-base-table-or-view">SQL base table or view</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#template"><code>rr:template</code></a></th>
|
|
<td><a href="#dfn-string-template">string template</a></td>
|
|
<td><a href="#dfn-template-valued-term-map">template-valued term map</a></td>
|
|
<td>1</td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#termType"><code>rr:termType</code></a></th>
|
|
<td><a href="#dfn-term-type">term type</a></td>
|
|
<td><a href="#dfn-term-map">term map</a></td>
|
|
<td>0…1</td></tr>
|
|
</table>
|
|
|
|
|
|
<h3 id="other-index">B.3 Other Terms</h3>
|
|
|
|
<table class="term-index">
|
|
<tr><th>Term</th><th>Denotes</th><th>Used with property</th></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#defaultGraph"><code>rr:defaultGraph</code></a></th>
|
|
<td><a href="#dfn-default-graph">default graph</a></td>
|
|
<td><a href="#named-graphs"><code>rr:graph</code></a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#SQL2008"><code>rr:SQL2008</code></a></th>
|
|
<td><a href="#conformance">Core SQL 2008</a></td>
|
|
<td><a href="#dfn-sql-version-identifier"><code>rr:sqlVersion</code></a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#IRI"><code>rr:IRI</code></a></th>
|
|
<td><a href="#dfn-iri">IRI</a></td>
|
|
<td><a href="#dfn-term-type"><code>rr:termType</code></a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#BlankNode"><code>rr:BlankNode</code></a></th>
|
|
<td><a href="#dfn-blank-node">blank node</a></td>
|
|
<td><a href="#dfn-term-type"><code>rr:termType</code></a></td></tr>
|
|
<tr><th><a href="http://www.w3.org/ns/r2rml#Literal"><code>rr:Literal</code></a></th>
|
|
<td><a href="#dfn-literal">literal</a></td>
|
|
<td><a href="#dfn-term-type"><code>rr:termType</code></a></td></tr>
|
|
</table>
|
|
|
|
|
|
<h2 id="references">C. References</h2>
|
|
|
|
<h3 id="normative-refs">C.1 Normative References</h3>
|
|
|
|
<dl>
|
|
<dt><a id="RDF" name="RDF">[RDF]</a></dt>
|
|
|
|
<dd><cite><a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/">Resource
|
|
Description Framework (RDF): Concepts and Abstract Syntax</a></cite>, Graham Klyne,
|
|
Jermey J. Carroll, Editors. World Wide Web Consortium, 10 February 2004. This
|
|
version is http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/. The latest version
|
|
is http://www.w3.org/TR/rdf-concepts/.</dd>
|
|
|
|
<dt><a id="RFC2119" name="RFC2119">[RFC2119]</a></dt>
|
|
|
|
<dd><cite><a href="http://tools.ietf.org/html/rfc2119">Key words
|
|
for use in RFCs to Indicate Requirement Levels</a></cite>, S. Bradner,
|
|
March 1997.
|
|
Internet RFC 2119, http://tools.ietf.org/html/rfc2119.</dd>
|
|
|
|
<dt><a id="RFC3629" name="RFC3629">[RFC3629]</a></dt>
|
|
|
|
<dd><cite><a href="http://tools.ietf.org/html/rfc3629">UTF-8, a
|
|
transformation format of ISO 10646</a></cite>, F. Yergeau. November 2003.
|
|
Internet RFC 3629, http://tools.ietf.org/html/rfc3629.</dd>
|
|
|
|
<dt><a id="RFC3986" name="RFC3986">[RFC3986]</a></dt>
|
|
|
|
<dd><cite><a href="http://tools.ietf.org/html/rfc3986">Uniform Resource
|
|
Identifier (URI): Generic Syntax</a></cite>, T. Berners-Lee, R. Fielding,
|
|
L. Masinter. January 2005.
|
|
Internet RFC 3986, http://tools.ietf.org/html/rfc3986.</dd>
|
|
|
|
<dt><a id="RFC3987" name="RFC3987">[RFC3987]</a></dt>
|
|
|
|
<dd><cite><a href="http://tools.ietf.org/html/rfc3987">Internationalized
|
|
Resource Identifiers (IRIs)</a></cite>, M. Duerst, M. Suignard. January 2005.
|
|
Internet RFC 3987, http://tools.ietf.org/html/rfc3987.</dd>
|
|
|
|
<dt><a id="SPARQL" name="SPARQL">[SPARQL]</a></dt>
|
|
|
|
<dd><cite><a href="http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/">SPARQL
|
|
Query Language for RDF</a></cite>, Eric Prud'hommeaux, Andy Seaborne, Editors.
|
|
World Wide Web Consortium, 15 January 2008. This version is
|
|
http://www.w3.org/TR/2008/REC-rdf-sparql-query-20080115/. The latest version is
|
|
http://www.w3.org/TR/rdf-sparql-query/.</dd>
|
|
|
|
<dt><a id="SQL1" name="SQL1">[SQL1]</a></dt>
|
|
|
|
<dd><cite>ISO/IEC 9075-1:2008 SQL - Part 1: Framework (SQL/Framework)</cite>.
|
|
International Organization for
|
|
Standardization, 27 January 2009.</dd>
|
|
|
|
<dt><a id="SQL2" name="SQL2">[SQL2]</a></dt>
|
|
|
|
<dd><cite>ISO/IEC 9075-2:2008 SQL - Part 2: Foundation (SQL/Foundation)</cite>.
|
|
International Organization for
|
|
Standardization, 27 January 2009.</dd>
|
|
|
|
<dt><a id="TURTLE" name="TURTLE">[TURTLE]</a></dt>
|
|
|
|
<dd><cite><a href=
|
|
"http://www.w3.org/TeamSubmission/2008/SUBM-turtle-20080114/">Turtle - Terse RDF
|
|
Triple Language</a></cite>, Dave Beckett, Tim Berners-Lee. World Wide Web
|
|
Consortium, 14 January 2008. This version is
|
|
http://www.w3.org/TeamSubmission/2008/SUBM-turtle-20080114/. The latest version is
|
|
http://www.w3.org/TeamSubmission/turtle/.</dd>
|
|
|
|
<dt><a id="XMLSCHEMA2" name="XMLSCHEMA2">[XMLSCHEMA2]</a></dt>
|
|
|
|
<dd><cite><a href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/">XML
|
|
Schema Part 2: Datatypes Second Edition</a></cite>,
|
|
Paul V. Biron, Ashok Malhotra. World Wide Web Consortium,
|
|
28 October 2004. This version is
|
|
http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/.
|
|
The latest version is http://www.w3.org/TR/xmlschema-2/.</dd>
|
|
</dl>
|
|
|
|
|
|
<h3 id="non-normative-refs">C.2 Other References</h3>
|
|
|
|
<dl>
|
|
<dt><a id="DM" name="DM">[DM]</a></dt>
|
|
|
|
<dd><cite><a href="http://www.w3.org/TR/2011/WD-rdb-direct-mapping-20110920/">A
|
|
Direct Mapping of Relational Data to RDF</a></cite>, Alexandre Bertails, Marcelo Arenas,
|
|
Eric Prud'hommeaux, Juan Sequeda, Editors. World Wide Web Consortium, 20 September 2011.
|
|
This version is http://www.w3.org/TR/2011/WD-rdb-direct-mapping-20110920/. The latest
|
|
version is http://www.w3.org/TR/rdb-direct-mapping/. This document is work in
|
|
progress.</dd>
|
|
|
|
<dt><a id="SQL14" name="SQL14">[SQL14]</a></dt>
|
|
|
|
<dd><cite>ISO/IEC 9075-14:2008 SQL - Part 14: XML-Related Specifications (SQL/XML)</cite>.
|
|
International Organization for Standardization, 27 January 2009.</dd>
|
|
|
|
<dt><a id="SQLIRIS" name="SQLIRIS">[SQLIRIS]</a></dt>
|
|
|
|
<dd><cite><a href="http://www.w3.org/2001/sw/rdb2rdf/wiki/SQL_Version_IRIs">SQL
|
|
Version IRIs</a></cite>, Members of the W3C RDB2RDF Working Group.
|
|
The latest version is http://www.w3.org/2001/sw/rdb2rdf/wiki/SQL_Version_IRIs.
|
|
This is a public wiki page.</dd>
|
|
|
|
<dt><a id="TC" name="TC">[TC]</a></dt>
|
|
|
|
<dd><cite><a href="http://www.w3.org/2001/sw/rdb2rdf/test-cases/">R2RML and Direct Mapping Test Cases (Editor's Draft)</a></cite>, Boris Villazón-Terrazas, Michael Hausenblas, Alexander de Leon, Editors. World Wide Web Consortium, 31 August 2011. The latest version is http://www.w3.org/2001/sw/rdb2rdf/test-cases/. This document is work in progress.</dd>
|
|
|
|
<dt><a id="UCNR" name="UCNR">[UCNR]</a></dt>
|
|
|
|
<dd><cite><a href="http://www.w3.org/TR/2010/WD-rdb2rdf-ucr-20100608/">Use Cases
|
|
and Requirements for Mapping Relational Databases to RDF</a></cite>, Eric
|
|
Prud'hommeaux, Michael Hausenblas, Editors. World Wide Web Consortium, 8 June 2010.
|
|
This version is http://www.w3.org/TR/2010/WD-rdb2rdf-ucr-20100608/. The latest
|
|
version is http://www.w3.org/TR/rdb2rdf-ucr/. This document is work in
|
|
progress.</dd>
|
|
</dl>
|
|
|
|
|
|
<h2 id="acknowledgements">D. Acknowledgements (Informative)</h2>
|
|
|
|
<p>The Editors would like to give special thanks to the following members: Nuno Lopes for help in designing the datatyping related text, David McNeil for raising many of the issues that needed addressing, Eric Prud'hommeaux for designing the SQL compatibility text, and Boris Villazón-Terrazas for drawing all the diagrams.
|
|
</p>
|
|
<p>In addition, the Editors gratefully acknowledge contributions from: Marcelo Arenas, Sören Auer, Samir Batla, Alexander de Leon, Orri Erling, Lee Feigenbaum, Enrico Franconi, Howard Greenblatt, Wolfgang Halb, Harry Halpin, Michael Hausenblas, Patrick Hayes, Ivan Herman, Nophadol Jekjantuk, Li Ma, Nan Ma, Ashok Malhotra, Ivan Mikhailov, Percy Enrique Rivera Salas, Juan Sequeda, Ben Szekely, Ted Thibodeau, and Edward Thomas.
|
|
</p>
|
|
</div>
|
|
</body>
|
|
</html>
|