RDF Collection

Created on Feb. 18, 2013, 12:04 p.m. by Hevok & updated by Hevok on May 2, 2013, 5:16 p.m.

To define a list that is closed by definition. This is achieved with collections in the form of linear lists. This kind of representation of some knowledge in RDF reflects closely the connection that RDF has to languages from Artificial Intelligence. There one has a simple linear list in which a Subject has a predefined number of Blank Nodes that each represent the head of the list. The header element is the first element in the list with the property rdf:first and a URI or value representing the Object as list item. Then it is stated that after it comes the rest of the list. The rest of the list is structured in the same way with a Blank Node that points to the head of the rest of the list the first element. In this way it can be go on on go on and in the end it is stated that the list stops and therefore it is defined that the rest of the list is null, which cna be expressed with rdf:nil. This means here e

  • List is splitted recursively in Head (first) and Tail (rest)

The according RDF encoding looks is pretty simple. For instance in Turtle there are first of all some definition of prefixes that are required, then the default base prefix is declared. After this it is stated that an meeting event has participants. For each participant and Blank Node and therefore a brackets opening is declared. In the end the rest of the list points to nil. After this it need to be taken care to close all brackets again as well as a period that represents the end of the statement.

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>] .
@prefix ev: <http://denigma.de/events#>] .
@base: <http://denigma.de/>]

:meeting event:hasParticipant [
    rdf:first: <Hevok>; rdf:rest [
    rdf:first: <Hikowa>; rdf:rest [
    rdf:first: <Naos>; rdf:rest [
    rdf:first: <Eva>;
    rdf:rst rdf:nil .

As this is pretty much to write there are some shortcuts. It can be expressed much more easier, but will be interpreted in the same way. There one has other kind of brackets, namely braces. All the URI elements that are contained in the list are simple listed. An RDF reader does than nothing else than to substitute this list in the corresponding graph structure. Thus, it is just a syntactic extension that saves a lot of time when writing this.

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>] .
@prefix ev: <http://denigma.de/events#>] .
@base <http://denigma.de

:swt ev:hasParticipant
( <Hevok> <Hikowa> <Naos> <Eva> ) .

Tags: list, unorded
Categories: Tutorial
Parent: List

Update entry (Admin) | See changes

Comment on This Data Unit