Solid Wiki Journal

Home

A simple Solid Wiki Data Model

The Data Model

Let’s create a straightforward Wiki data model by creating an ontology. We describe the ontology with the Turtle syntax. RDF, RDFS and OWL are the underlying ontologies, which help us model the data we would like to represent. Further, LDP is used to provide information for Linked Data Platform agents and DCTERMS to define some metadata.

@base            <http://example.org/ns/solid/wiki> .
@prefix:         <http://example.org//ns/solid/wiki> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix ldp:     <http://www.w3.org/ns/ldp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .

Schema.org defines a schema, as a set of types, each associated with a set of properties [1]. Therefore, we first define the types, denoted as a rdf:Class.

:
    a          owl:Ontology ;
    rdfs:label "Simple Wiki Ontology" ;
.

:Wiki
    a          rdfs:Class ;
    rdfs:label "Wiki" ;
.

:Page
    rdfs:label "Page" ;
    a          rdfs:Class ;
.

:Body
    rdfs:label "Body" ;
    a          rdfs:Class ;
.

:Title
    rdfs:label "Title" ;
    a          rdfs:Class ;
.

:SourceList
    rdfs:label  "Source List" ;
    a           rdfs:Class ;
    rdfs:domain ldp:Resource ;
.

Next, we define the set of properties, by denoting the association with rdfs:domain :aType and the type of the property with rdfs:range :aType. For clarification, try to think of rdfs:domain as who/what holds the property and rdf:range to express what the property is.

:source
    a           rdf:Property ;
    owl:sameAs  dcterms:source ;
    owl:sameAs  dcterms:URI ;
    rdfs:label  "source" ;
    rdfs:domain :SourceList ;
    rdfs:range  :Wiki ;
.

:page
    a           rdf:Property ;
    owl:sameAs  dcterms:source ;
    owl:sameAs  dcterms:URI ;
    rdfs:label  "page" ;
    rdfs:domain :Wiki ;
    rdfs:range  :Page ;
.

:title
    a           rdf:Property ;
    owl:sameAs  dcterms:source ;
    owl:sameAs  dcterms:URI ;
    rdfs:label  "title" ;
    rdfs:domain :Page ;
    rdfs:range  :Title ;
.

:body
    a           rdf:Property ;
    owl:sameAs  dcterms:source ;
    owl:sameAs  dcterms:URI ;
    rdfs:label  "body" ;
    rdfs:domain :Page ;
    rdfs:range  :Body ;
.

Great, that’s it. You can have a look at the complete Turtle file here. To visualize the ontology, I used WebVOWL, see Figure 1.

Figure 1: Simple Wiki Data Model Diagram
Figure 1: Simple Wiki Data Model Diagram

Some examples

Given our data model, we can start to create a exemplary Wiki. The files which represent the Wiki must follow the defined model. An application would fetch all these files and preset them. For now, we assume the app know where to find these files. The process of finding all data of interest to a particular application is called Data Discovery, which we will discuss in a later post.

According to or ontology, we define four Turtle files which represent our Wiki. The source list https://alice.localhost:8443/public/wiki/source-list.ttl defines the source composition of our Wiki.

@prefix :        <#> .
@prefix ldp:     <http://www.w3.org/ns/ldp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix wiki:    <http://example.org/ns/solid/wiki> .

:
    a             wiki:SourceList,
                  ldp:Resource ;
    dcterms:title "The main wiki source list" ;
.

: wiki:Wiki <./wiki.ttl> .
: wiki:Wiki <https://bob.localhost:8443/public/wiki/wiki.ttl> .

The wiki https://alice.localhost:8443/public/wiki/wiki.ttl lists all the pages which it contains.

@prefix :        <#> .
@prefix ldp:     <http://www.w3.org/ns/ldp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix wiki:    <http://example.org/ns/solid/wiki> .

:
    a             wiki:Wiki,
                  ldp:Resource ;
    dcterms:title "Alice Wiki" ;
.

: wiki:page <./pages/example-page-1.ttl> .
: wiki:page <./pages/example-page-2.ttl> .

Finally, the wiki pages https://alice.localhost:8443/public/wiki/pages/example-page-1.ttl and https://alice.localhost:8443/public/wiki/example-page-2.ttl store the title and the body of the Wiki page.

Example Page 1

@prefix :        <#> .
@prefix ldp:     <http://www.w3.org/ns/ldp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix wiki:    <http://example.org/ns/solid/wiki> .

:
    a             wiki:Page,
                  ldp:Resource ;
    wiki:title "Example Page 1" ;
    wiki:body  "Example Page 1 Body" ;

Example Page 2

@prefix :        <#> .
@prefix ldp:     <http://www.w3.org/ns/ldp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix wiki:    <http://example.org/ns/solid/wiki> .

:
    a             wiki:Page,
                  ldp:Resource ;
    wiki:title "Example Page 1" ;
    wiki:body  "Example Page 1 Body" ;
.

[1] “Organization of schemas.” [Online]. Available: https://schema.org/docs/schemas.html.