<!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>Using JavaScript RDFa Widgets for Model/View Separation inside Read/Write Websites</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Sebastian Dietzold</string-name>
          <email>dietzold@informatik.uni-leipzig.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Sebastian Hellmann</string-name>
          <email>hellmann@informatik.uni-leipzig.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Martin Peklo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Universitt Leipzig, Department of Computer Science Johannisgasse 26</institution>
          ,
          <addr-line>D-04103 Leipzig</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>As more and more websites start to embed RDFa content in their web application view, the need arises to provide a more extensive way for viewing and editing this semantic content independently from the remainder of the application. We present a JavaScript API that allows the independent creation of editing widgets for embedded RDFa, which adds a new edge to Web development in the context of the Semantic Web. As an addition, the API also provides sound update methods that allow on-the-spot model synchronization between client and server.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>1 rdfapi-js is available at http://powl.svn.sf.net/viewvc/powl/trunk/rdfapi-js/
implication we would also like to mention is the redundancy of creating
separate views for editing, because updating can often be solved with the proposed
widgets.
2</p>
    </sec>
    <sec id="sec-2">
      <title>API Overview</title>
      <p>The RDF-API for JavaScript implements the RDF JSON specication proposal
from the Talis n2 Wiki 2 for data representation and allows for RDF manipulation
methods. The RDF model is extracted by a modied version of the parser from
the RDFa Javascript implementation 3 provided by the W3C.</p>
      <p>The added methods can be grouped as follows:
Statement modication: These methods are used to modify the content of the
model. We have implemented methods for adding one or more statements to a
model and for deleting one or more statements from the model.</p>
      <p>Namespace management: Since RDFa incorporates the use of namespaces,
methods on in-memory models for adding, deleting and applying namespaces are
needed. The Talis RDF JSON specication proposal does not include
namespace declarations, so we have added this to our object notication. We have
implemented methods for adding and deleting namespaces as well as for
converting models from qualied names to full URIs (and back) according to the
current namespace declarations.</p>
      <p>
        Model comparison and check: These methods are used to check the consistency
of a given model and to compare two models and produce a statement di for
the update service. At this time, we do not care about bnodes in the di, e.g.
by using blank node enrichment [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] or minimum self-contained graphs [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. This
could be added in the future.
      </p>
      <p>We complete the rdfapi-js by adding a small set of administration methods
for counting, (X)HTML output and debugging.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Usage in a Semantic Wiki</title>
      <p>
        We use rdfapi-js in our semantic wiki application OntoWiki [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. OntoWiki is able
to handle plugins for the visualization of resources from specic RDF schema
(e.g. a FOAF person). These plugins are simple templates which have access to
the attributes of the resource that is to be rendered. Without rdfapi-js, plugin
developers have the choice to develop either a special edit template or let users
edit the attributes with the generic table-edit view. With rdfapi-js, a new option
is to enable view templates for inline editing just by adding RDFa markup.
2 http://n2.talis.com/wiki/RDF_JSON_Specification
3 http://www.w3.org/2006/07/SWD/RDFa/impl/js/
      </p>
      <p>The following steps describe an examplary editing process:
1. The complete page with RDFa markup and the link to the rdfapi-js and a
control script are created on the server and transferred to the client.
2. The client receives the page and loads the rdfapi-js as well as the application
control script through a script-link.
3. rdfapi-js parses the page and creates an in-memory model from the RDFa
markup.
4. An onclick handler is added next to every RDFa Literal found in the page.
5. By clicking on the event handler, an editing widget is displayed as an overlay
to the existing page (see Fig.1).
6. The user submits the new value to the widget. The widget modies the
inmemory model by using statement modication methods of rdfapi-js. These
API methods apply the changes to the in-memory model as well as modify
the (X)HTML view.
7. The modied in-memory model triggers a new submit button which enables
the user to submit the change request to the server. If pressed by the user, a
statement dierence is calculated and transferred to the server via an
asynchronous HTTP request to an update service. The current implementation
sends two JSON models to the server, one with the statements which have
to be deleted, another with the statements which have to be created on the
server. The execution of these atomic add / delete actions is left to the server
update interface.</p>
      <p>Widgets are not limited to the editing of plain literals. According to the
inmemory model, dierent widgets can be loaded (e.g. for dates or geo locations).
The idea of such widgets is to achieve independence from the page template so
that a growing widget library can enhance every application which uses rdfapi-js.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Conclusion and Future Work</title>
      <p>The presented API includes methods for customized client-side edit widgets to
modify embedded RDFa. It tackles the synchronization of a locally changed
RDF model with the model on the server. The main advantage is the
separation of edit functions from the data view. Widgets can be created for dierent
datatypes and properties. These widgets add new possibilities for exible user
interaction. The API is included in OntoWiki, but can be used in other
Semantic Web applications as well. Without making a promising statement, we have
already considered to propose the API as a full alternative to an editing view.
However, the problems that have to be overcome are numerous such as
multiuser synchronization, security and user validation. Although solutions for these
problems have to be provided, they are clearly out of the scope of this API, since
these problems have to be solved on the server side.</p>
      <p>
        Future work includes the improvement of the di computation algorithm
to support bnodes and the enhancement of the widget library with a set of
widgets for common attributes. The (X)HTML rollout of in-memory changes is
currently limited to plain literals and resource relations. This limitation has to
be resolved in order to support more complex RDFa markup. To generalize the
editing process, future work should include support for SPARUL [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] queries in
addition to transferring JSON model objects for change requests.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>Ben</given-names>
            <surname>Adida</surname>
          </string-name>
          , Mark Birbeck,
          <string-name>
            <surname>Shane McCarron</surname>
            ,
            <given-names>and Steven</given-names>
          </string-name>
          <string-name>
            <surname>Pemberton</surname>
          </string-name>
          .
          <source>RDFa in XHTML: Syntax and Processing. W3C Working Draft, W3C</source>
          ,
          <year>2008</year>
          . http://www. w3.org/TR/rdfa-syntax/.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Sren</given-names>
            <surname>Auer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Sebastian</given-names>
            <surname>Dietzold</surname>
          </string-name>
          , and Thomas Riechert.
          <article-title>OntoWiki - A Tool for Social, Semantic Collaboration</article-title>
          . In Isabel F. Cruz, Stefan Decker,
          <string-name>
            <surname>Dean Allemang</surname>
            , Chris Preist, Daniel Schwabe,
            <given-names>Peter</given-names>
          </string-name>
          <string-name>
            <surname>Mika</surname>
            ,
            <given-names>Michael</given-names>
          </string-name>
          <string-name>
            <surname>Uschold</surname>
          </string-name>
          , and Lora Aroyo, editors,
          <source>The Semantic Web - ISWC</source>
          <year>2006</year>
          , 5th International Semantic Web Conference,
          <string-name>
            <surname>ISWC</surname>
          </string-name>
          <year>2006</year>
          , Athens, GA, USA, November 5-
          <issue>9</issue>
          ,
          <year>2006</year>
          , Proceedings , volume
          <volume>4273</volume>
          of Lecture Notes in Computer Science , pages
          <fpage>736749</fpage>
          . Springer,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Rohit</given-names>
            <surname>Khare</surname>
          </string-name>
          and
          <article-title>Tantek ˙elik. Microformats: a pragmatic path to the semantic web</article-title>
          .
          <source>In Les Carr</source>
          , David De Roure, Arun Iyengar, Carole A.
          <string-name>
            <surname>Goble</surname>
          </string-name>
          , and Michael Dahlin, editors,
          <source>Proceedings of the 15th international conference on World Wide Web, WWW</source>
          <year>2006</year>
          , Edinburgh, Scotland, UK, May
          <volume>23</volume>
          -26,
          <year>2006</year>
          , pages
          <fpage>865866</fpage>
          . ACM,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Andy</given-names>
            <surname>Seaborne</surname>
          </string-name>
          and
          <string-name>
            <given-names>Geetha</given-names>
            <surname>Manjunath</surname>
          </string-name>
          .
          <article-title>SPARQL/Update A language for updating RDF graphs</article-title>
          .
          <source>Technical report</source>
          , Hewlett-Packard,
          <year>January 2008</year>
          . V4.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Giovanni</given-names>
            <surname>Tummarello</surname>
          </string-name>
          , Christian Morbidoni,
          <article-title>Reto Bachmann-Gmr, and Orri Erling</article-title>
          .
          <article-title>RDFSync: Ecient Remote Synchronization of RDF Models</article-title>
          . In Karl Aberer,
          <string-name>
            <surname>Key-Sun</surname>
            <given-names>Choi</given-names>
          </string-name>
          , Natasha Fridman Noy,
          <string-name>
            <surname>Dean Allemang</surname>
          </string-name>
          ,
          <string-name>
            <surname>Kyung-Il</surname>
            <given-names>Lee</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lyndon J. B. Nixon</surname>
            , Jennifer Golbeck,
            <given-names>Peter</given-names>
          </string-name>
          <string-name>
            <surname>Mika</surname>
          </string-name>
          , Diana Maynard, Riichiro Mizoguchi, Guus Schreiber, and
          <string-name>
            <surname>Philippe</surname>
          </string-name>
          CudrØ-Mauroux, editors,
          <source>The Semantic Web, 6th International Semantic Web Conference, 2nd Asian Semantic Web Conference</source>
          ,
          <string-name>
            <surname>ISWC</surname>
          </string-name>
          <year>2007</year>
          +
          <article-title>ASWC 2007, Busan</article-title>
          , Korea,
          <source>November 11-15</source>
          ,
          <year>2007</year>
          , volume
          <volume>4825</volume>
          of Lecture Notes in Computer Science, pages
          <fpage>537551</fpage>
          . Springer,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>Max</given-names>
            <surname>Vlkel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Carlos F.</given-names>
            <surname>Enguix</surname>
          </string-name>
          , Sebastian Ryszard Kruk,
          <string-name>
            <surname>Anna</surname>
            <given-names>V.</given-names>
          </string-name>
          <string-name>
            <surname>Zhdanova</surname>
          </string-name>
          , Robert Stevens, and York Sure. SemVersion
          <string-name>
            <surname>- Versioning</surname>
            <given-names>RDF</given-names>
          </string-name>
          and
          <article-title>Ontologies</article-title>
          .
          <source>Technical report</source>
          , AIFB, University of Karlsruhe,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>