Skip to content

2. Basic RDB RDF Mapping

Josef Hardi edited this page Aug 7, 2015 · 3 revisions
<?xml version="1.0" encoding="utf-8"?>
<program xmlns="http://www.obidea.com/ns/termal#"
   xmlns:tml="http://www.obidea.com/ns/termal#"
   xmlns:rr="http://www.w3.org/ns/r2rml#">
   <prefix tml:name="" tml:ns="http://obidea.com/ex/ontology/work/" />

   <uri-template tml:name="Department" tml:value="http://obidea.com/ex/ontology/work/department/{1}/" />
   <uri-template tml:name="Employee" tml:value="http://obidea.com/ex/ontology/work/employee/{1}/" />

   <mapping tml:id="TriplesMap1">
      <logical-table rr:tableName="employees"/>
      <subject-map rr:template="Employee(emp_no)"/>
      <predicate-object-map rr:predicate="firstName" rr:column="first_name"/>
      <predicate-object-map rr:predicate="lastName" rr:column="last_name"/>
      <predicate-object-map rr:predicate="hireDate" rr:column="hire_date"/>
   </mapping>
   <mapping tml:id="TriplesMap2">
      <logical-table>
      <![CDATA[
        SELECT dept_manager.emp_no as employeeID
        FROM dept_manager
        JOIN titles on dept_manager.emp_no = titles.emp_no]]>
      </logical-table>
      <subject-map rr:class="Manager" rr:template="Employee(employeeID)"/>
   </mapping>
   <mapping tml:id="TriplesMap3">
      <logical-table rr:tableName="dept_emp"/>
      <subject-map rr:template="Employee(emp_no)"/>
      <predicate-object-map rr:predicate="worksIn" rr:template="Department(dept_no)"/>
   </mapping>
</program>

The RDB/RDF mappings in Semantika are defined in XML document. The mapping document is designed to be readable and easy to edit manually. Most of popular text editors already have a built-in XML processor for fast editing (e.g., auto-completion, syntax highlight, etc.)

Starting from Semantika 1.5, the system offers R2RML syntax support for writing the RDB/RDF mappings. The section below describes the native TERMAL/XML syntax. Both syntaxes are adaptable to each other (See the corresponding example above in R2RML syntax)

Structure of the Mapping File

All the elements that can appear in the mapping file are listed below in alphabetical order. Each element, along with all of its attributes is documented in a separate page. To view detailed information about any element, click on the element name in the list.

Clone this wiki locally