The problem of data sharing
Sharing data can be performed with, or without, using a third party. It is also possible to do it in a synchronous or asynchronous way. For instance, mails are indirect and asynchronous whereas instant messaging are indirect and synchronous. Direct exchanges are typically used in P2P networks where all the devices are considered to behave equally. The problem is the lack of direct asynchronous data sharing: this would enable applications to share data without having to rely on an external server or having to wait for the receiver to be online when the message is sent.
Description of SemanticXO
SemanticXO is a data management stack aimed at facilitating data sharing across devices. It has been originally developed for the XO, a low-cost rugged laptop from One Laptop Per Child. Once installed, SemanticXO enhances an XO with asynchronous data sharing capabilities. Every activity gets access to an API to store and retrieve structured information. A given payload of data can be marked as publicly shared, or be shared with a specific set of contacts. SemanticXO will then ensure the data is received by the target contacts.
Because every XO will publish data without any form of central coordination, the design principles of Linked Data are applied to re-conciliate the data published individually. URIs are used when referencing a given resources and the resource description framework to store the description of the resources.
On the technical side, SemanticXO uses a triple store to store all the description of the resources. The triple store is advertise on the network using Avahi. Every data payload is wrapped into a named graph for which an author and a list of contacts is stored. A synchronization daemon ensures that these named graphs are duplicated into the triple stores of every other device listed as a cont act.
Installation and testing
The best way to test SemanticXO is to install it on an XO-1 running the operating system version 12.1.0. Go to the GIT repository and download the files “setup.sh” and “semanticxo.tar.gz” somewhere the XO (these files are in the directory “patch_my_xo”). Then, log in as root and execute “sh setup.sh setup”. The installation package will copy the API onto the XO, setup the triple store and install two demo activity. Once the procedure is complete, reboot the XO to activate everything.
After the installation you will notice the presence of two new activities: the with a Journal icon (beginning of the spiral) is a tool that makes it possible to remotely browse the content of the Journal of an XO. The second activity (second in the spiral) with a document icon is a minimalistic asynchronous messaging application.
When you install SemanticXO the genuine data store for the Journal will be replaced by a new one using the API from SemanticXO. None of the Journal entries are marked public so they are not shared with any other XO. It is however possible to browse them remotely using this simple activity. The column on the left list the SemanticXO-enabled devices found on the network, the column in the middle list the Journal entries, and the column on the right list the content of one Journal entry. Hit the refresh button on the bottom left if you miss a device, there is currently no auto-refresh for the devices list. The source code of this activity is available on GIT.
This activity showcases the asynchronous data sharing feature of SemanticXO. After typing a message, a hit on “send message” will result in the creation of a graph object containing this message. This graph is marked as public and stored locally on the XO. Later on, the graph replication daemon will duplicate this graph on the other XOs found in the network. This process takes place even when the mail activity is not running. There is also no need to share the activity and there is no external server needed. The code of this activity is also available on GIT. The most interesting part to look at is “Model.py” which shows how the graph API from SemanticXO is used to store and retrieve messages.
Remark: when using the Mail activity, allow for 5 minutes for a mail to be dispatched. This is the frequency at which the graph replication daemon is executed.
Feedback and more information
SemanticXO is under heavy development and any kind of feedback would be very helpful. Please feel free to mail me or drop a comment to this page. You may also find more information on the blog about the development, the source repository or the Sugar feature page.