<!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>RDFShape: An RDF playground based on Shapes</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Jose Emilio Labra-Gayo</string-name>
          <email>labra@uniovi.es</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Daniel Fernandez-Alvarez</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Herminio Garc a-Gonzalez</string-name>
          <email>herminiogg@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Oviedo</institution>
          <country country="ES">Spain</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The quality of RDF based solutions requires the possibility to describe and validate RDF graphs. In the recent years, two technologies have been proposed for RDF validation: ShEx and SHACL. RDFShape is a web service that can be used as an RDF playground to validate RDF with those technologies, but can also be used as a general RDF playground allowing to parse, convert, visualize and query RDF data. The validation engine supports both ShEx and SHACL, allows the conversion between di erent schema formats, and is able visualize schemas using UML-like class diagrams. The system o ers the possibility to play with di erent RDF technologies in a uni ed setting and has already been used to teach RDF technologies in several courses and tutorials. It has also been employed in industrial RDF work ows that needed a web service for RDF data validation and management.</p>
      </abstract>
      <kwd-group>
        <kwd>RDF</kwd>
        <kwd>ShEx</kwd>
        <kwd>SHACL</kwd>
        <kwd>Validation</kwd>
        <kwd>SPARQL</kwd>
        <kwd>Visualization</kwd>
        <kwd>UML</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        The adoption of any technology depends on the available tools. Although RDF
is not new, there is a lack of integrated tools that can be used for the di erent
aspects of its management, like RDF parsing, conversion, visualization, validation,
querying and inferencing. RDFShape was initially created as an online demo to
play with the recently created Shape Expressions language in 2014[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Once the
W3C Data Shapes Working Group started to develop SHACL [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], RDFShape
added also a SHACL validator as well as other features like SPARQL querying,
RDF visualization, ShEx/SHACL format conversions, endpoint based validation
and querying, UML visualizations of Schemas, etc. We consider that RDFShape
o ers an useful tool for RDF practitioners, both for educational purposes as well
as for more industrial applications.
      </p>
    </sec>
    <sec id="sec-2">
      <title>RDFShape features</title>
      <p>The RDFShape landing page contains several menu options, the most important
of which are:
{ RDF Data. This pane o ers information about RDF data. It has an option
to parse and show information about RDF. For educational purposes, we
added the possibility of visualizing small RDF graphs converting the graphs
to SVG using Graphviz. This url: http://rdfshape.weso.es/links/i1
shows the result of visualizing a simple RDF graph inspired by the one
presented in the RDF 1.1 primer (https://www.w3.org/TR/rdf11-primer/).
RDFShape also allows to convert between di erent RDF formats. It handles
the common RDF formats supported by the underlying RDF library: Turtle,
N-Triples, RDF/XML, JSON-LD, etc. As an example, the result of
converting the previous RDF le to JSON-LD is shown in http://rdfshape.weso.
es/links/i2. The service has a permalink option which allows to generate
permanent URLs that can be copy-pasted and shared.
{ Schema. This option can be used to obtain information about ShEx and
SHACL schema shapes. It allows to convert between the di erent schema
formats available and to visualize them. Both ShEx and SHACL support
the traditional RDF formats Turtle, N-Triples, JSON-LD, etc., while ShEx
also supports a compact syntax. Link http://rdfshape.weso.es/links/i3
shows a ShEx schema converted from ShEx compact syntax to its turtle
serialization. It is also possible to visualize ShEx shapes as UML-like class
diagrams. The system transforms the schema shapes to UML classes using
PlantUML. Those UML class diagrams are later converted to SVG for
visualization. Fig. 2 shows an example of a ShEx Schema and its visualization
(http://rdfshape.weso.es/links/i4)
{ Validation. RDFShape supports both ShEx and SHACL. As an
example, http://rdfshape.weso.es/links/i5 shows the result of validating an
RDF graph using ShEx, while http://rdfshape.weso.es/links/i6 shows
the result of SHACL validation report. In the case of SHACL, it shows
information about the errors and evidences of the di erent results. This
information is useful to distinguish between nodes that are not signalled as
problematic because they have been validated to conform to a shape and
nodes that are not signalled just because the validator does not reach them.
It is also possible to validate against an SPARQL endpoint. For example,
the result of validating a simple Schema against the Wikidata SPARQL
endpoint can be seen at http://rdfshape.weso.es/links/i7. It is also
possible to enable inference over the RDF graphs before querying or
validating them. As an example, the following link shows the results of validating
a ShEx schema over an RDF graph after applying RDFS inference on it:
http://rdfshape.weso.es/links/i8.
{ SPARQL. RDFShape can also be used to run SPARQL queries over RDF
data. Although there are several online SPARQL tools like YASGUI 1, we
consider this feature to be very handy to query the same RDF graphs that
are being validated, specially in the case of SPARQL-based constraints in
SHACL. Link http://rdfshape.weso.es/links/i9 shows the result of a
SPARQL query over the previous RDF graph.
{ API. RDFShape provides a REST API through which it is possible to invoke
the previous actions in a programmatic way.
3</p>
    </sec>
    <sec id="sec-3">
      <title>RDFShape components</title>
      <p>RDFShape is available as open source software using the MIT licence at a github
repository 2. It has been designed with the goal of being exible enough to work
with di erent RDF libraries like Apache Jena or RDf4j. The main components
are depicted in gure 2.
1 http://yasgui.org/
2 https://github.com/labra/rdfshape
{ APIService and WebService provide the external interfaces which o er both
a REST API and an HTML frontend. These two services call di erent
methods from that APIHelper module which is based on http4s3, a simple http
framework using a purely functional programming approach that o ers
support for streaming. For validation, it relies on the Shaclex library, while for
RDF parsing and querying, it relies on SRDF.
{ The Shaclex library has two modules that contain the ShEx and SHACL
implementation. Both implementations use a purely functional approach based
on monad transformers provided by the Scala Cats library4.
{ In order to work with di erent underlying implementations, all RDF
processing is done through a SRDF (Simple RDF, a generic RDF interface which
de ned common methods to manipulate RDF data. It has 3 sub-interfaces:
RDFReader for querying RDF without modifying it, RDFBuilder to update
and modify RDF graphs, and RDFReasoner to add inference capabilities to
RDF graphs.
{ SRDF4Jena is an implementation of SRDF for Apache Jena 5 while SRDF4J
is an implementation of SRDF for RDF4J 6.</p>
      <p>
        RDFShape has already been used in several semantic web courses and
tutorials7, and to test the examples from the Validating RDF data book [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. It
has also been employed in more industrial settings to validate the ShEx schemas
from wikidata (http://rdfshape.weso.es/links/i10) and HL7 FHIR (http:
//rdfshape.weso.es/links/i11). As future work, we are planning to
incorporate the possibility to validate RDF datasets with named graphs and to adapt
the RDF library for RDF Stream processing work ows.
      </p>
      <p>Acknowledgements: This work is partially funded by the Spanish Ministry of
Economy and Competitiveness (Society challenges: TIN2017-88877-R)
3 https://http4s.org/
4 https://typelevel.org/cats/
5 https://jena.apache.org/
6 http://rdf4j.org/
7 http://www.validatingrdf.com/tutorial/iswc2018/</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Prud'hommeaux</surname>
          </string-name>
          , E.,
          <string-name>
            <surname>Labra</surname>
            <given-names>Gayo</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>J.E.</given-names>
            ,
            <surname>Solbrig</surname>
          </string-name>
          , H.:
          <article-title>Shape expressions: an RDF validation and transformation language</article-title>
          .
          <source>In: Proceedings of the 10th International Conference on Semantic Systems, SEMANTICS</source>
          <year>2014</year>
          , ACM (
          <year>2014</year>
          )
          <volume>32</volume>
          {
          <fpage>40</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Knublauch</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kontokostas</surname>
            ,
            <given-names>D.: Shapes</given-names>
          </string-name>
          <string-name>
            <surname>Constraint Language (SHACL). W3C Proposed Recommendation</surname>
          </string-name>
          (
          <year>June 2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Labra</given-names>
            <surname>Gayo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.E.</given-names>
            , Prud'hommeaux, E.,
            <surname>Boneva</surname>
          </string-name>
          ,
          <string-name>
            <given-names>I.</given-names>
            ,
            <surname>Kontokostas</surname>
          </string-name>
          ,
          <string-name>
            <surname>D.</surname>
          </string-name>
          :
          <source>Validating RDF Data. Volume 7 of Synthesis Lectures on the Semantic Web: Theory and Technology</source>
          . Morgan &amp; Claypool Publishers LLC (sep
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>