=Paper= {{Paper |id=Vol-1361/paper2 |storemode=property |title=RSLT: RDF Stylesheet Language Transformations |pdfUrl=https://ceur-ws.org/Vol-1361/paper2.pdf |volume=Vol-1361 |dblpUrl=https://dblp.org/rec/conf/esws/PeroniV15 }} ==RSLT: RDF Stylesheet Language Transformations== https://ceur-ws.org/Vol-1361/paper2.pdf
                   Proceedings of the ESWC2015 Developers Workshop                                 7




                             RSLT:
            RDF Stylesheet Language Transformations

                                Silvio Peroni and Fabio Vitali

         Department of Computer Science and Engineering, University of Bologna (Italy)
                       silvio.peroni@unibo.it, fabio@cs.unibo.it




         Abstract. In this paper we introduce RSLT, a simple transformation language for
         RDF data. RSLT organizes the rendering of RDF statements as transformation
         templates associated to properties or resource types and producing HTML. A
         prototype based on AngularJs is presented and we also discuss some implementation
         details and examples.

         Keywords: RDF dataset visualization, RSLT, templates


1     Introduction

The visualization of RDF data is a hot topic for the Semantic Web community. Even if
works have been presented in the past (e.g., [2, 3, 5–7]), and some visualisation interfaces
(usually in tabular form) are supported by existing triplestores such as Virtuoso1,
visualisation tools for RDF triplestores in general are still far from the sophistication of
reporting tools for traditional databases. In particular, most of such tools display triplestore
content as tabular data where identificative, descriptive and secondary properties are
shown in exactly the same way, where the order in which properties are displayed is
totally arbitrary, where related entities are described by their plain IRI rather than textual
descriptions, and where readability is completely absent.
    This drove us to investigate the best tools to provide readable representations of RDF
datasets for the general public, and to propose basic guidelines:

    – the tool should be easy to integrate in a web-based application;
    – it should be as easy to represent individual RDF statements as convoluted OWL
      entities;
    – IRIs of entities should be rendered with readable and meaningful text or other
      representations – but they should still be available for special rendering needs (e.g.,
      as destinations for links and HTML anchors);
    – complex representations of main resources should be built by combining simpler
      representations of lesser resources and properties.

    Reporting software tools have limitations, such as the complexity to integrate them
in web-based architectures or the variety and complexity of approaches in generating
and delivering the reports. Yet, we found XSLT [4] a fairly natural and sophisticated
 1 http://virtuoso.openlinksw.com/




                            Copyright held by the paper authors
                  Proceedings of the ESWC2015 Developers Workshop                                        8




approach to provide presentation support to XML documents, and sought to provide
something similar for OWL and RDF data.
    In this paper we introduce RSLT (RDF Stylesheet Language Transformations, pro-
nounced result), a simple transformation language for RDF data. RSLT organizes
rendering as transformation templates associated to resources, properties or resource
types, produces HTML and can recursively call other templates. A browser-based
prototype based on the AngularJs library has been created that allows client-based
presentations of SPARQL constructs, and soon of Turtle datasets as well. The rest of the
paper is organized as follows: in Section 2 we introduce the main constructs of RSLT. In
Section 3 we introduce some implementation details of RSLT and few examples, and in
Section 4 we conclude the paper by sketching out some future works.


2    RSLT

RDF Stylesheet Language Transformations (RSLT)2, pronounced result, is a direct and
trivial translation of (some parts of) the XSLT language into the RDF domain. Similarly
to its noble ancestor, an RSLT document contains a number of templates that create
fragments of output in some displayable format (e.g., HTML) when navigating through a
graph of RDF statements. The fact that RDF graphs, differently than XML documents,
lack a natural hierarchy in its internal organization. and that no obvious selector language
for RDF exists3 provide for some interesting complications of the original design, though.
    Thus, while XSLT always starts transforming the root of an XML document, no such
concept exists for RDF graphs, which therefore require a starting template such as the
following one:


    The above template will be fired at the beginning of the process and will create
an HTML div element, and will first select all entities whose foaf:familyNa me is
“Horrocks”, and then look for a reasonable template for each of them.
    The lack of a correspondence for XPath forced us to invent a new syntax for
 selectors, liberally derived from the SPARQL query syntax, that
allow templates to distinguish statements from entities. Thus, the selector “?person
foaf:familyName 'Horrocks'.” with a single question mark (SQM) in the variable
selects all RDF statements whose predicate is foaf:familyName and whose object
 2 RSLT is available on its GitHub repository: https://github.com/fvitali/rslt. The tool
   as well as all the additional scripts are distributed under an ISC License, while the other related
   files such as HTML documents are distributed under a Creative Commons Attribution 4.0
   International License.
 3 SPARQL cannot be considered as a pure selector language for RDF as XPath, used by XSLT, is.
   Rather, it is a full-featured query language, similar to XQuery for XML.




                            Copyright held by the paper authors
                 Proceedings of the ESWC2015 Developers Workshop                               9




equals “Horrocks”. On the other hand, the selector “??person foaf:familyName
'Horrocks'.” with double question marks (DQM) selects a list of RSLT entities, where
each RSLT entity is defined as the set of available statements that share the same subject.
The DQM selector above can be converted as follows in SPARQL 1.1:
SELECT DISTINCT ?s ?p ?o WHERE {
  ?person foaf:familyName "Horrocks".
  { BIND(?person as ?s) ?s ?p ?o. }
}

    RSLT templates can be either associated to RDF statements (by matching a triple
with one or more unbound SQM variables), to a specific resource (by matching the IRI of
the resource) or to resources of a particular type (by using a special syntax), as described
in the following excerpts:








    Within a template all unbound variables are bounded to the relevant RLST entities
and all associated properties are available for presentation. Any markup or content can
be placed inside templates, and RSLT constructs can be specified to refer to literals or
other resources associated to the bounded entities. Values in literal statements can be
rendered immediately through  elements, while values of resource statements
are additional RSLT entities, and therefore are rendered through additional templates.
For instance, the following is a complete template of a class:


   Whenever the rendering engine comes across an entity of type foaf:Person, this
template is triggered, creating an HTML fragment with a 

element containing text and the values of data properties foaf:givenName and foaf:family Name, then an

    element containing the rendering recursively produced by selecting all entities Copyright held by the paper authors Proceedings of the ESWC2015 Developers Workshop 10 ??work related to ?person through the chain of properties pro:holdsRoleInTime / pro:relatedToDocument. This rendering is generated by looking for and executing the templates that match the ??work entities just selected. In order to avoid circularity in the selection of templates, a simple approach is taken to consider the template as spent when applied in a recursion, so it cannot be chosen and applied again inside itself. Once all relevant templates have been spent, if a template for a specific entity is needed again, a default one is applied that does not recurse, thus halting any potential circularity. Given the strong dependance of the current implementation of RSLT to the AngularJS framework, a shorter syntax exists that uses the classical double brackets of the framework. Additionally, since all entities are in fact Javascript objects and the colon “:” is a forbidden character in Javascript variables, Java-script’s dot notation is used and the underscore is used instead: In addition to