GUO - Graph Update Ontology

This Document:
http://webr3.org/guo/
Namespace:
http://webr3.org/owl/guo#
Last update:
Date: 2010/03/21 00:45:19
Revision:
Revision: 0.02
Author:
Nathan

Introduction

GUO (http://webr3.org/owl/guo#) is an intentionally skinny ontology aimed at enabling lightweight RDF graph updates and graph synchronisation on a per triple level.

GUO could be thought of as an RDF based diff for RDF graphs.

The aim of GUO is to complement the likes of SPARQL Update and SPARQL 1.1 Uniform HTTP Protocol for Managing RDF Graphs, without the need for Quads (as seen in TriG and TriX) or Reification as seen in Changesets.

GUO is work in progress, and community feedback is requested before progressing this from version 0.01 to something more stable / complete ;) - please do email me your comments and suggestions.


Update - GUO Graph Diff demo available

GUO Graph Diff is a prototype script for performing "diffs" on RDF Graphs; you can find out more here and indeed try it out!


Basics

The following example of GUO describes a change in the description of http://webr3.org/r/Special_Document

@prefix guo: <http://webr3.org/owl/guo#> .
@prefix dcterms: <http://purl.org/dc/terms/> .

_:u1 a guo:UpdateInstruction ;
     guo:target_graph <http://webr3.org> ;
     guo:target_subject <http://webr3.org/r/Special_Document> ;
     guo:delete _:d1 ;
     guo:insert _:i2 .

_:d1 dcterms:title "Draft Special Document"@en .

_:i2 dcterms:title "Special Document"@en ;
     dcterms:published "2010-03-18T15:26:13Z" .

The above example describes the removal of a single triple:

<http://webr3.org/r/Special_Document> <http://purl.org/dc/terms/title> "Draft Special Document"@en .

And the addition of two new triples:

<http://webr3.org/r/Special_Document> <http://purl.org/dc/terms/title> "Special Document"@en .
<http://webr3.org/r/Special_Document> <http://purl.org/dc/terms/published> "2010-03-18T15:26:13Z" .

Behind the scenes, this could be transformed in to the following two SPARQL Update queries:

DELETE DATA FROM <http://webr3.org> {
  <http://webr3.org/r/Special_Document> <http://purl.org/dc/terms/title> "Draft Special Document"@en .
}

INSERT DATA INTO <http://webr3.org> {
  <http://webr3.org/r/Special_Document> <http://purl.org/dc/terms/title> "Draft Special Document"@en ;
  <http://purl.org/dc/terms/published> "2010-03-18T15:26:13Z" .
}

Simple Concept

GUO works by:

The method to be performed is specified by the predicate used to link a guo:UpdateInstruction to resources, namely guo:insert / guo:delete combined with a target_subject, and / or a guo:merge instruction.

guo:UpdateInstruction(s) comprise of (a guo:target_subject and at least one guo:insert or guo:delete statement) and / or (a guo:merge statement).

guo:target_graph is optional; multiple guo:target_graph statements can be combined in a single guo:UpdateInstruction to enable the updating of multiple named graphs at the same time.

guo:merge is also optional, multiple guo:merge statements can be combined in a single guo:UpdateInstruction to merge multiple graphs in to the output.

Similarly, multiple guo:insert and guo:delete statements can be combined together in a single guo:UpdateInstruction; this allows several resources to be merged in to one, or data from multiple transactions to be processed in a single batch.

guo:UpdateInstructions and resources can either be anonymous (blank nodes) or named resources (with a uri), this keeps GUO highly versatile, for example the resource referenced by a guo:insert or guo:delete statement could easily be a resource found elsewhere on the web, or the results of a SPARQL DESCRIBE / CONSTRUCT query.

RDF Graphs can contain multiple guo:UpdateInstruction's, and GUO places no constraints on the serialization nor content of an RDF graph containing guo:UpdateInstruction(s), thus GUO can be combined with other Ontologies to provide any functionality required by implementing systems.

For example GUO could be used with DCMI Terms to allow annotation of guo:UpdateInstruction's, using description, creator, modified and so forth. Version control could easily be achieved by using GUO with ontologies such as sioc (previous_version, latest_version etc.); Access control, provenance and more can be achieved through using GUO with FOAF+SSL and ACL.


Ontology

Namespace
http://webr3.org/owl/guo#

Class - guo:UpdateInstruction

comment
The class of an RDF Update Instruction, an UpdateInstruction defines a target_subject, optional target_graph(s) and at least one object to insert or delete

property - guo:target_graph

domain
guo:UpdateInstruction
comment
Optional property of an UpdateInstruction which allows updates to apply only to the specified Named Graph(s)

property - guo:target_subject

REQUIRED
domain
guo:UpdateInstruction
range
owl:Thing
comment
The target_subject is a required property of all UpdateInstructions which include one or more guo:insert/guo:delete instructions, target_subject is combined with the predicate and object values from insert/delete nodes to form triples which are to be either inserted or deleted (optionally constrained to one or more target_graphs, and optionally merged with triples from graphs specified by guo:merge)

property - guo:merge

domain
guo:UpdateInstruction
comment
The merge property defines a graph from which all triples should be merged in to the target_graph(s), unlike insert which works on a resource level rewriting subjects, merge works on a graph level where all triples are added "as is".

property - guo:insert

domain
guo:UpdateInstruction
comment
The insert property defines a blank node or resource whose predicate and object values will be used to create new triples inside target_graph(s) if specified with target_subject.

property - guo:delete

domain
guo:UpdateInstruction
comment
The delete property defines blank node or resource whose predicate and object values will be used to remove triples { target_subject predicate object } from target_graph(s) if specified

Examples

Merging multiple resource in to one new resource

<rdf:RDF xmlns:guo="http://webr3.org/owl/guo#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <guo:UpdateInstruction>
        <guo:insert rdf:resource="http://dbpedia.org/resource/London"/>
        <guo:insert rdf:resource="http://mpii.de/yago/resource/London"/>
        <guo:insert rdf:resource="http://statistics.data.gov.uk/id/eer?name=London"/>
        <guo:target_subject rdf:resource="http://example.com/resource/London"/>
    </guo:UpdateInstruction>

</rdf:RDF>

Merging multiple graphs

<rdf:RDF xmlns:guo="http://webr3.org/owl/guo#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <guo:UpdateInstruction>
        <guo:merge rdf:resource="http://dbpedia.org/data/Linked_Data"/>
        <guo:merge rdf:resource="http://dbpedia.org/data/Semantic_Web"/>
    </guo:UpdateInstruction>

</rdf:RDF>

Adding additional meta data w/ dcterms.

@prefix guo: <http://webr3.org/owl/guo#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix dcterms: <http://purl.org/dc/terms/> .

_:u1
	a guo:UpdateInstruction ;
	rdfs:comment "updated the title and published."@en ;
	dcterms:creator <http://webr3.org/nathan> ;
	dcterms:created "2010-03-18T17:05:01Z" ;
	guo:target_subject <http://webr3.org/r/temp> ;
	guo:delete _:d1 ;
	guo:insert _:i1 .

_:d1 dcterms:title "GUO working"@en .

_:i1 dcterms:title "GUO Spec Initial Release"@en ;
	dcterms:publisher <http://webr3.org/nathan> ;
	dcterms:published "2010-03-18T17:05:01Z" .

Inserting a triple

<rdf:RDF xmlns="http://webr3.org/owl/guo#"
    xmlns:foaf="http://xmlns.com/foaf/0.1/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

    <UpdateInstruction>
        <insert rdf:parseType="Resource">
            <foaf:name xml:lang="en">nathan</foaf:name>
        </insert>
        <target_subject rdf:resource="http://webr3.org/r/nathan"/>
    </UpdateInstruction>
</rdf:RDF>

Insert triples from the results of a SPARQL CONSTRUCT

<rdf:RDF xmlns="http://webr3.org/owl/guo#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

    <UpdateInstruction>
        <insert rdf:resource="http://dbpedia.org/sparql?query=construct+{+%3Fs+%3Fp+%3Fo+}+where+{..."/>
        <target_subject rdf:resource="http://webr3.org/r/linked_to_haxe"/>
    </UpdateInstruction>
</rdf:RDF>