<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>ShERML: Mapping Relational Data to RDF</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Iovka Boneva</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Jose Lozano</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Slawek Staworko</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Univ. Lille, CNRS, Centrale Lille, Inria, UMR 9189 - CRIStAL - Centre de Recherche en Informatique Signal et Automatique de Lille</institution>
          ,
          <addr-line>F-59000 Lille</addr-line>
          ,
          <country country="FR">France</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>We present ShERML, a tool for facilitating the data exchange from relational data to RDF. The main feature of the tool is a graphical user interface for designing a relational-to-RDF mapping by drawing arrows between schematic representations of the relational schema on the one hand, and a SHACL or ShEx schema on the other hand. The mapping thus constructed can be used directly by the tool for materializing the RDF graph, or be exported as an R2RML mapping.</p>
      </abstract>
      <kwd-group>
        <kwd>RDF</kwd>
        <kwd>ShEx</kwd>
        <kwd>SHACL</kwd>
        <kwd>Graphical Mapping Language</kwd>
        <kwd>R2RML</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        RDF and Semantic Web data often originate from pre-existing relational
databases. The problem to export relational data to RDF is known as relational to
RDF data exchange, and can be solved either by writing ad-hoc export scripts,
or more recently by using dedicated declarative languages such as the W3C
standard R2RML. The latter allows to de ne mappings that use logical tables
(typically SQL queries) and how each row of such table is used to construct a
number of RDF triples. There exist a number of mapping editors to facilitate
the creation of R2RML mappings [
        <xref ref-type="bibr" rid="ref1 ref3 ref4 ref5">5,3,4,1</xref>
        ].
      </p>
      <p>
        ShERML is inspired by the well known relational-to-relational data exchange
tool Clio[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], in which mappings are de ned by drawing arrows between the source
and the target schema, as shown in Fig. 1. In ShERML we use Shape Constraint
Languge (SHACL) or Shape Expressions Language (ShEx) as target schemas.
Both languages were speci cally designed to describe the vocabulary and the
desired structure of an RDF graph. They use shapes to describe how a particular
piece of information should be structured. Collections of shapes with references
to each other are called shapes schemas. Using a shapes schema for relational to
RDF mappings presents several advantages. On the one hand, xing the target
vocabulary prior to the design of the mapping allows to separate concerns. On
the other hand, compared to ontologies, shapes schemas are more exible as they
allow to de ne (1) a target vocabulary mixing terms from di erent ontologies,
and (2) structural requirements on the graph tted for a particular existing
application. Additionally, ShERML checks whether the mapping de ned by the
user would generate an RDF graph compliant with the given shapes schema.
      </p>
      <p>Copyright c 2019 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0).</p>
    </sec>
    <sec id="sec-2">
      <title>Architecture and Implementation</title>
      <p>The architecture of ShERML is presented in Fig. 2. The core element of ShERML
is the Graphical Mapping Language (GML), which allows to de ne mappings
from relational databases to RDF while specifying how the results of SQL queries
should be organized to t the shapes of a shapes schema. ShERML provides a
Graphical Mapping Language Editor that allows to de ne GML mappings while
allowing a high degree of customization of the de ned mapping. A GML mapping
can be fed into the Materializer that executes it by running SQL queries on the
relational database and constructing the desired RDF graph. Additionally, the
GML script can be translated to a corresponding R2RML script with the help of
the Converter. The online video demo, source code and installation instructions
are available on this repository https://github.com/josemachino/ShERML.</p>
    </sec>
    <sec id="sec-3">
      <title>Demo Scenario</title>
      <p>We demonstrate the principal functionality of ShERML with the following use
case. We shall export the contents of a relational database with products and
their suppliers as seen on the left side in Fig. 1. The database consists of three
tables: Product with the information on products, Supplier with the information
on suppliers, and ProdSupp with information on what supplier provides which
product. The data is to be exported to RDF whose structure is de ned with the
schema present on the right side in Fig. 1. In essence, it de nes two types of RDF
nodes: TProduct for products and TSupplier for suppliers. The type TProduct
requires a node to have a single name, a single price, and an optional origin
information. Additionally, a product node must have one or more suppliers. A
supplier node must have a name, a phone number, and an arbitrary number of
email addresses. During the demonstration, we shall construct the desired GML
mapping, in Fig. 1, with the following steps:</p>
      <p>Loading schema. Before de ning the mapping, both schemas need to be
loaded from their source les. Each table and each shape are represented with a
single box, each containing the list of attributes/property names. Each element
of the list has a dedicated circular anchor, for creating connections later on.
Anchors use two colors: orange anchors identify elements that reference other
elements i.e., foreign keys in the relational schema and shape references in shapes
schema; green anchors identify remaining elements that store values.</p>
      <p>De ning mapping. The mapping is de ned with the convenience of drawing
arrows from the elements of relational schema to the elements of the shape
schema. There are three kinds of arrows:
IRI arrow connects relation to the corresponding shape (it does not use
anchors). It de nes how rows from a table are to be mapped to IRI nodes
satisfying a given shape constraint. For instance, table Product is mapped
to the shape TProduct and for every row in Product a corresponding IRI is
created in the output RDF using a speci ed IRI constructor TPr2iri applied
to the key attribute PID (more details on IRI constructors below).
Property arrow connects relation attributes to literal properties of the shapes;
it can only connect two green anchors. It de nes how table rows are mapped
to triples. A property arrow is dependent on an IRI arrow that de nes the
IRI nodes for which the property values are generated. For instance, the
arrow from Product :Name to TProduct:name maps every row in Product to a
triple whose subject is TPr2iri(PID ), the predicate is name, and the object
is the value of the Name attribute in the row.</p>
      <p>Reference arrow connects a foreign key of a table to a reference property
in the shape schema; it can only connect two orange anchors. Similarly to a
property arrow, a reference arrow is dependent on an IRI arrow and yields
RDF triples, but this time the object is also an IRI rather than a literal. For
instance, the arrow from ProdSupp:SID to TProduct:suppliedBy generates
the triples that connect every product with each of its suppliers.</p>
      <p>Both property and reference arrows are dependent on an IRI arrow that speci es
the subject of the generated triples. The IRI arrow does not need to originate
from the same table, and those arrows are annotated with the join expressions
needed to reach the relevant IRI arrow cf., the expression ProdSupp on Product
on the arrow from ProdSupp:SID to TProduct:suppliedBy.</p>
      <p>Both IRI and reference arrows are annotated with IRI constructors that
specify how the IRI nodes are to be obtained. By default when loading a shape
schema, the system constructs default IRI constructors for every shape in a
manner consistent with how IRIs are constructed in R2RML. For instance, for
the TProduct shape, whose full IRI is http:==inria:fr=TProduct, the default
IRI constructor TPr2iri basically appends the given value to this IRI e.g.,
TPr2iri(P1) returns http:==inria:fr=TProduct=P1.</p>
      <p>Re ning GML mapping. The mapping can then be closely inspected and
rened further. For this purpose ShERML o ers a visual inspector that reorganizes
the GML by grouping the arrows by the target shapes. It allows adding lter
conditions and, in our demonstration we shall add a condition to the TProduct
IRI arrow to export only products whose stock is lower than 1000.</p>
      <p>RDF materialization and R2RML export. Once the GML mapping is de ned,
ShERML can export the contents of the relational database to RDF in a
chosen format (Turtle, N-triples, or RDF/JSON). Finally, the system allows us to
convert the GML mapping to an R2RML mapping that can then be used by
third-party applications.</p>
      <p>During the demonstration we shall also present static and runtime
consistency checking and property value transformations.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Conclusions</title>
      <p>We have presented a demo of ShERML, a versatile system for de ning mappings
from relational databases to RDF with target shape schema using an intuitive
and powerful graphical mapping language. As next step we plan to use the
tool for expressing existing relational to RDF data exchange scenarios currently
written as python programs. This will allow to prioritise the future extensions
of ShERML such as extending its mapping language or its GUI.
Acknowledgments This work was partially supported by a grant from CPER
Nord-Pas de Calais/FEDER DATA Advanced data science and technologies
2015-2020 and by the ANR project DataCert ANR-15-CE39-0009.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Crotti</given-names>
            <surname>Junior</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Debruyne</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            ,
            <surname>O'Sullivan</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.</surname>
          </string-name>
          :
          <article-title>Juma: An editor that uses a block metaphor to facilitate the creation and editing of R2RML mappings</article-title>
          . In: ESWC 2017
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Fagin</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Haas</surname>
            ,
            <given-names>L.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hernandez</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Miller</surname>
            ,
            <given-names>R.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Popa</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Velegrakis</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          :
          <source>Clio: Schema Mapping Creation and Data Exchange</source>
          , pp.
          <volume>198</volume>
          {
          <fpage>236</fpage>
          . Springer Berlin Heidelberg (
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Heyvaert</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dimou</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Herregodts</surname>
            ,
            <given-names>A.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Verborgh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schuurman</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mannens</surname>
          </string-name>
          , E., Van de Walle, R.:
          <article-title>RMLEditor: a graph-based mapping editor for Linked Data mappings</article-title>
          .
          <source>In: ESWC 2016</source>
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>4. Rml.x visual editor. http://pebbie.org/mashup/rml</mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Sengupta</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Haase</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schmidt</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hitzler</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Editing R2RML mappings made easy</article-title>
          .
          <source>In: ISWC 2013</source>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>