<!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>
      <journal-title-group>
        <journal-title>George Svarovsky[</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>m-ld: Realtime Information Sharing with RDF</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>m-ld.io Ltd.</institution>
          ,
          <addr-line>Lyndale House, 24 High Street, Addlestone, KT15 1TN</addr-line>
          ,
          <country>UK https</country>
          <institution>://m-ld.org/</institution>
        </aff>
      </contrib-group>
      <pub-date>
        <year>0000</year>
      </pub-date>
      <volume>0002</volume>
      <abstract>
        <p>Users of information systems increasingly expect information to be available to edit from multiple devices and by multiple users, online and o ine. Strategies exist for shared data types with strong eventual consistency guarantees. These can be complex and fault-prone to implement de novo for application data, and library implementations do not present standard APIs. To improve data interoperability, portability and extensibility, these strategies can be applied to a standard and self-describing data format, RDF. We introduce m-ld, a component providing eventual consistency for RDF data, showing how it can be used to create a collaborative message board program.</p>
      </abstract>
      <kwd-group>
        <kwd>Realtime collaborative editing</kwd>
        <kwd>CRDT</kwd>
        <kwd>RDF</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Real-time collaborative editing of documents is now a well-established pattern in
groupware programs, popularised by Google Docs. Other notable ad hoc
implementations include Figma [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] and Wikidocs [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. Evan Wallace (Figma) justi es
their investment with the comment \it just felt wrong not to o er multiplayer
as a tool on the web".
      </p>
      <p>
        However, collaborative editing features are particularly complex to
implement from scratch. Reasons for this relate to ensuring strong eventual consistency
in the face of concurrent edits for a non-trivial data structure [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ];
implementing the consistency algorithm in the face of network and compute failures; and
testing the implementation. Haymo Meran (Wikidocs) comments, in relation to
his subsequent work integrating collaborative editing into Atlassian's tools, \you
need a lot of endurance" (https://youtu.be/EgCYd6ei7QI?t=21).
      </p>
      <p>
        To address this, re-usable software components have been developed that
provide abstract shared data types. Active open-source projects include Yjs [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]
and automerge [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. These tools alleviate the implementation complexity of
realtime collaborative editing for stand-alone programs.
      </p>
      <p>If two di erent programs are to support collaborative editing on the same
information, it is necessary for the shared data types' behaviours to be correctly
implemented in both. This will generally require changes to source code, whether
to re-implement an ad-hoc data type, or to include a library.
? Copyright © 2021 for this paper by its authors. Use permitted under Creative</p>
      <p>Commons License Attribution 4.0 International (CC BY 4.0).</p>
      <p>We can conceive improvements to this integration complexity. First, if each
program were to publish the identities of the shared data types in use, other
programs would be able to dynamically select and apply a suitable
implementation. However, this would still require a speci c mapping of the program's
presentation layer to each of the supported data types' interfaces. This could
be addressed with a common representation such as the Resource Description
Framework (RDF).</p>
      <p>A key feature of RDF is that it is extensible, including with new data
structures, which can be strongly identi ed in the data so consuming applications can
adapt to them. Extensions to RDF use vocabularies of known Internationalised
Resource Identi ers (IRIs), given meanings by speci cations or conventions. An
extension may de ne an entailment regime, that is, a set of logical consequences
of the statements in an RDF graph. It may also impose syntactic conditions or
restrictions.</p>
      <p>The m-ld project is exploring how to use these properties for shared data
types. The goal is to facilitate the re-use of shared information in di erent
contexts and by di erent applications.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>
        m-ld builds directly on prior work on the theoretical basis for real-time
collaborative editing of RDF [
        <xref ref-type="bibr" rid="ref15 ref3 ref6">3,6,15</xref>
        ]. Besides implementing strong eventual consistency
for RDF graphs, this project also seeks to consider the automatic maintenance
of extended semantics in real-time.
      </p>
      <p>
        Other work has focused on a Distributed Version Control System (DVCS)
approach [
        <xref ref-type="bibr" rid="ref13 ref2">2,13</xref>
        ], such as for improving the quality of Linked Open Data [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. The
DVCS model supports extended semantics by requiring an external intervention
if concurrent operations give rise to an inconsistent state. So, this approach
is better suited to systems without a real-time constraint, or with a central
authority such as a database.
      </p>
      <p>
        Consistency can also be achieved in a decentralised system using distributed
consensus, often used with blockchains. RDF is being considered in this space, for
example, for indexing [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. Consensus does not itself address the merge algorithm
for concurrent or o ine edits, but is a means for an observer to know that a state
has been agreed. This property is likely to be useful in future work on m-ld.
3
      </p>
    </sec>
    <sec id="sec-3">
      <title>Approach</title>
      <p>The m-ld project (https://m-ld.org/) approaches RDF shared data types by:
1. Implementing the RDF graph itself as a shared data type.
2. Establishing a pattern for the composition of extended shared data types
within the RDF graph, using vocabularies.</p>
      <sec id="sec-3-1">
        <title>Shared RDF</title>
        <p>
          The realisation of an RDF graph as a shared data type is a direct implementation
of SU-Set, a Con ict-free Replicated Data Type (CRDT) [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ]. Sharing is e ected
by making a copy of the graph (a clone), with a new process identity. Upon
mutation, clones publish operations which are delivered to every peer clone and
merged into their graphs. The SU-Set permits these mutations to be concurrent,
while guaranteeing that all clones will eventually converge on the same graph.
        </p>
        <p>
          As a CRDT, the SU-Set does not require central coordination for a total
ordering of operation messages. Instead, it requires causal ordering. This is
realised in m-ld using a logical clock and re-ordering of incoming messages, as
necessary, in each clone. The clock chosen is a simpli cation of an Interval Tree
Clock [
          <xref ref-type="bibr" rid="ref1">1</xref>
          ], which is more space-e cient than a vector clock.
        </p>
        <p>The SU-Set also does not require \tombstones" (markers for deleted data).
However, this means that it is not possible to arbitrarily merge clone graphs
without knowledge of the operations applied to each since they diverged. For
this reason, m-ld clones maintain a journal of operations, to allow clones to
rev-up from a peer if they have missed operation messages.
3.2</p>
      </sec>
      <sec id="sec-3-2">
        <title>Shared Data Type Vocabularies</title>
        <p>The realisation of the RDF graph as a shared data type ensures eventual
consistency for all graph mutations. However, it does not guarantee correctness of
the graph content according to any applicable extended semantics.</p>
        <p>
          The m-ld project has explored the embedding of ordered lists in the shared
graph, using a sequence CRDT inspired by LSEQ [
          <xref ref-type="bibr" rid="ref8">8</xref>
          ]. The CRDT behaviour is
not core to m-ld but rather implemented using a constraint, which encapsulates
the list syntax and semantics. The input into a constraint is the current state
and the proposed operation, whether local or received from a remote clone, and
it is able to reject an invalid local operation, rewrite the operation, entail
consequences of the operation, or even assert new data. The constraint is dynamically
selected and executed based on the vocabulary used in the data (or also, in this
case, as the default list implementation in m-ld [
          <xref ref-type="bibr" rid="ref11">11</xref>
          ]).
        </p>
        <p>In principle the same process, of de ning a vocabulary and providing a
constraint implementation, can be used to implement other shared data type
extensions.
4</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Demonstration</title>
      <p>The m-ld website provides two web applications that demonstrate the
component, using an engine running in the browser. In both cases the Javascript of
the web application loads and uses the engine as a library. The dynamic RDF
graph is stored locally in the browser; services are only used for website content
delivery and operation message delivery.</p>
      <p>The demo web application (https://m-ld.org/demo/; Fig. 1, left) presents
a \message board" which can be edited concurrently by multiple users worldwide.
The playground (https://m-ld.org/playground/; Fig. 1, right) is a utility for
interrogating a m-ld graph using the API syntax. In the gure, the playground
has been directed to share a graph with the message board, and the
representation of the one of the messages is visible, as JSON-LD.
The m-ld project has built a shared data types engine using RDF as its
foundational data representation. m-ld supports real-time collaborative editing of
information, including maintenance of extended semantics for ordered lists.
Further work is needed to validate the extensibility pattern against other shared
data types, and in realistic use-cases.</p>
      <p>Other ongoing and future work in the m-ld project includes:
{ Publication of the m-ld protocol speci cation.
{ Research into supporting strong cryptographic assurance of data integrity
and traceability, with authority assignable to identi ed users or groups.
{ Research into tunable strategies to truncate or compress the clone journal
to balance availability against storage consumption.</p>
      <p>{ Performance characterisation and tuning.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Almeida</surname>
            ,
            <given-names>P.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Baquero</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fonte</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          :
          <article-title>Interval Tree Clocks</article-title>
          . In: Baker,
          <string-name>
            <given-names>T.P.</given-names>
            ,
            <surname>Bui</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Tixeuil</surname>
          </string-name>
          , S. (eds.)
          <source>Principles of Distributed Systems</source>
          . pp.
          <volume>259</volume>
          {
          <fpage>274</fpage>
          . Lecture Notes in Computer Science, Springer, Berlin, Heidelberg (
          <year>2008</year>
          ). https://doi.org/10.1007/978-3-
          <fpage>540</fpage>
          -92221-6 18
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Cassidy</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ballantine</surname>
          </string-name>
          , J.:
          <article-title>Version Control for RDF Triple Stores</article-title>
          .
          <source>ICSOFT 2007 - 2nd International Conference on Software and Data Technologies</source>
          , Proceedings p.
          <volume>12</volume>
          (
          <year>Jan 2007</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3. Iban~ez, L.D.,
          <string-name>
            <surname>Skaf-Molli</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Molli</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Corby</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          :
          <article-title>Live linked data: Synchronising semantic stores with commutative replicated data types</article-title>
          .
          <source>International Journal of Metadata, Semantics and Ontologies</source>
          <volume>8</volume>
          (
          <issue>2</issue>
          ),
          <volume>119</volume>
          {133 (Jan
          <year>2013</year>
          ). https://doi.org/10.1504/IJMSO.
          <year>2013</year>
          .056605
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. Iban~ez, L.D.,
          <string-name>
            <surname>Skaf-Molli</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Molli</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Corby</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          :
          <string-name>
            <surname>Col-Graph</surname>
          </string-name>
          :
          <article-title>Towards Writable and Scalable Linked Open Data</article-title>
          . In: Mika,
          <string-name>
            <given-names>P.</given-names>
            ,
            <surname>Tudorache</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.</given-names>
            ,
            <surname>Bernstein</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Welty</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            ,
            <surname>Knoblock</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            ,
            <surname>Vrandecic</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            ,
            <surname>Groth</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            ,
            <surname>Noy</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            ,
            <surname>Janowicz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            ,
            <surname>Goble</surname>
          </string-name>
          , C. (eds.)
          <source>The Semantic Web { ISWC 2014</source>
          . pp.
          <volume>325</volume>
          {
          <fpage>340</fpage>
          . Lecture Notes in Computer Science, Springer International Publishing,
          <string-name>
            <surname>Cham</surname>
          </string-name>
          (
          <year>2014</year>
          ). https://doi.org/10.1007/978-3-
          <fpage>319</fpage>
          -11964-9 21
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Kleppmann</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Beresford</surname>
            ,
            <given-names>A.R.</given-names>
          </string-name>
          : Automerge:
          <article-title>Realtime data sync between edge devices</article-title>
          .
          <source>In: 1st UK Mobile, Wearable and Ubiquitous Systems Research Symposium (MobiUK</source>
          <year>2018</year>
          ) (
          <year>2018</year>
          ), https://mobiuk.org/abstract/ S4-P5
          <string-name>
            <surname>-</surname>
          </string-name>
          Kleppmann-Automerge.pdf
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Mechaoui</surname>
            ,
            <given-names>M.D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Guetmi</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Imine</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Towards Real-Time Co-authoring of Linked-Data on the Web</article-title>
          . In: Amine,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Bellatreche</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            ,
            <surname>Elberrichi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Z.</given-names>
            ,
            <surname>Neuhold</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.J.</given-names>
            ,
            <surname>Wrembel</surname>
          </string-name>
          ,
          <string-name>
            <surname>R</surname>
          </string-name>
          . (eds.)
          <source>Computer Science and Its Applications</source>
          . pp.
          <volume>538</volume>
          {
          <fpage>548</fpage>
          .
          <source>IFIP Advances in Information and Communication Technology</source>
          , Springer International Publishing,
          <string-name>
            <surname>Cham</surname>
          </string-name>
          (
          <year>2015</year>
          ). https://doi.org/10.1007/978-3-
          <fpage>319</fpage>
          -19578-0 44
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Meran</surname>
          </string-name>
          , H.:
          <article-title>Wikidocs - Real time collaborative editing for HTML (</article-title>
          <year>Oct 2013</year>
          ), https://www.slideshare.net/draftkraft/ wikidocs-real
          <article-title>-time-collaborative</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Nedelec</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Molli</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Mostefaoui</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Desmontils</surname>
            ,
            <given-names>E.: LSEQ</given-names>
          </string-name>
          :
          <article-title>An adaptive structure for sequences in distributed collaborative editing</article-title>
          .
          <source>In: Proceedings of the 2013 ACM Symposium on Document Engineering</source>
          . pp.
          <volume>37</volume>
          {
          <fpage>46</fpage>
          . DocEng '13,
          <string-name>
            <surname>Association</surname>
          </string-name>
          for Computing Machinery, New York, NY, USA (Sep
          <year>2013</year>
          ). https://doi.org/10.1145/2494266.2494278
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Nicolaescu</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jahns</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Derntl</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Klamma</surname>
          </string-name>
          , R.:
          <article-title>Yjs: A Framework for Near Real-Time P2P Shared Editing on Arbitrary Data Types</article-title>
          . In: Cimiano,
          <string-name>
            <given-names>P.</given-names>
            ,
            <surname>Frasincar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Houben</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.J.</given-names>
            ,
            <surname>Schwabe</surname>
          </string-name>
          ,
          <string-name>
            <surname>D</surname>
          </string-name>
          . (eds.)
          <article-title>Engineering the Web in the Big Data Era</article-title>
          . pp.
          <volume>675</volume>
          {
          <fpage>678</fpage>
          . Lecture Notes in Computer Science, Springer International Publishing,
          <string-name>
            <surname>Cham</surname>
          </string-name>
          (
          <year>2015</year>
          ). https://doi.org/10.1007/978-3-
          <fpage>319</fpage>
          -19890-3 55
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Shapiro</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Preguica</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Baquero</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zawirski</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Con ict-Free Replicated Data Types</article-title>
          . In: Defago,
          <string-name>
            <given-names>X.</given-names>
            ,
            <surname>Petit</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Villain</surname>
          </string-name>
          , V. (eds.) Stabilization, Safety, and
          <article-title>Security of Distributed Systems</article-title>
          . pp.
          <volume>386</volume>
          {
          <fpage>400</fpage>
          . Lecture Notes in Computer Science, Springer, Berlin, Heidelberg (
          <year>2011</year>
          ). https://doi.org/10.1007/978-3-
          <fpage>642</fpage>
          -24550-3 29
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Svarovsky</surname>
          </string-name>
          , G.:
          <article-title>Truth and Just Lists (Feb</article-title>
          <year>2021</year>
          ), https://codeburst.io/ truth-and
          <article-title>-just-lists-67c0e0e22a9d</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <surname>Third</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Domingue</surname>
          </string-name>
          , J.:
          <article-title>Linked Data Indexing of Distributed Ledgers</article-title>
          .
          <source>In: Proceedings of the 26th International Conference on World Wide Web Companion</source>
          . pp.
          <volume>1431</volume>
          {
          <fpage>1436</fpage>
          . WWW '17 Companion, International World Wide Web Conferences Steering Committee, Republic and Canton of Geneva,
          <source>CHE (Apr</source>
          <year>2017</year>
          ). https://doi.org/10.1145/3041021.3053895
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13. van Otterdijk,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Mendel-Gleason</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            ,
            <surname>Feeney</surname>
          </string-name>
          ,
          <string-name>
            <surname>K.</surname>
          </string-name>
          :
          <article-title>Succinct Data Structures and Delta Encoding for Modern Databases</article-title>
          (
          <year>Jan 2020</year>
          ), https://terminusdb.com/t/ papers/terminusdb-git.pdf
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14.
          <string-name>
            <surname>Wallace</surname>
          </string-name>
          , E.:
          <article-title>How Figma's multiplayer technology works</article-title>
          (
          <year>Oct 2019</year>
          ), https://www. figma.com/blog/how
          <article-title>-figmas-multiplayer-technology-works/</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <string-name>
            <surname>Zarzour</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sellami</surname>
            ,
            <given-names>M.:</given-names>
          </string-name>
          <article-title>srCE: A collaborative editing of scalable semantic stores on P2P networks</article-title>
          .
          <source>International Journal of Computer Applications in Technology 48(1)</source>
          ,
          <volume>1</volume>
          {
          <fpage>13</fpage>
          (Jan
          <year>2013</year>
          ). https://doi.org/10.1504/IJCAT.
          <year>2013</year>
          .055562
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>