RDF Representation

Created on Feb. 17, 2013, 10:12 p.m. by Hevok & updated by Hevok on May 2, 2013, 5:17 p.m.

There are several different Representations of RDF.

  1. Node-Edge-Node Triple (=Graph Representation)

    Subject -Predicate-> Object

    http://denigma.de/data/entry/aging http://denigma.de/data/entry/causes http://denigma.de/data/entry/cancer

  2. N3 Notation

    • Simple listing of Triples

      { http://denigma.de/data/entry/aging, http://denigma.de/data/entry/causes, http://denigma.de/data/entry/cancer }

    An alternative representation is the N3 Notation in which the for instance the three URI, i.e. for the resources, for Subject, Predicate and Object are separated by a comma and enclosed in curly braces. However, this gets for longer and more complicated knowledge pretty expensive.

  3. Turtle (Terse RDF Triple Language)

    • Extension of N3
    • URIs in angle brackets
    • Literals in quotation marks
    • Whitespace will be ignored

    The turtle language is a simplification of the N3 language. It uses URIs in angle brackets, Literals are given in quotation mark and every Triple ends with a period, while whitespaces within the Triple will be ignored.

    <Subject><Property><Object> .
    <Subject><Property>"Object" .
    

    In Turtle simple Triples/Statements look like that:

    <http://denigma.de/data/entry/aging>]
    <http://denigma.de/data/entry/causes>]
    <http://denigma.de/data/entry/cancer>].
    

    In order to avoid long URIs there are shortcuts. For prefixes that are used rather often one has some ways to define certain prefixes via declaring a namespace:

    @prefix xsd: <http://www.w3.org/2001/XMLSchema#>] .
    @prefix dc: <http://purl.org/dc/elements/1.1/>] .
    @prefix ex: <http://example.org/stuff/1.0>] .
    
    <http://www.w3.org/TR/rdf-syntax-grammar>]
        dc:title "RDF/XML Syntax Specification (Revised)"@en ;
        ex: editor [
            ex:fullname "Dave Beckett"^^xsd:string ;
            ex:homePage <http://purl.org/net/dajobe/>]
        ].
    

    So prefixes will be substituted in the statements. Here editor defines a blank node with Value and a resources associated to it.

  4. RDF XML-Serialization*

    • RDF can be written in XML but it is less readable and becomes more. RDF XML-Serialization is the standard for each Web document, therefore it can be embedded very simple into the web, because XML can be read by most text processors and parsers. RDF can be read from and written in XML.

Example:

<xml version="1.0" encoding="utf-8">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntaz-ns#"
         xmlns:prof="http://denigma.de/profiles/">]

    <rdf:Description rdf:about="http://denigma.de/Hevok>]
        <prof:hasPhoneNr>"++49-123-1234-123"</prof:hasPhoneNr>
    <rdf:Description>

    <rdf:Description rdf:about="http://denigma.de/Hevok">]
        <prof:hasBlog rdf:resource="http://denigma.de/blog/" />]
    <rdf:Description>
</rdf:RDF>

Shortcut version with base Definition:

<xml version="1.0" encoding="utf-8">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntaz-ns#"
         xmlns:prof="http://denigma.de/profiles/">]
         xml:base="http://denigma.de/">]

    <rdf:Description rdf:about="Hevok
                     prof:hasPhoneNr>"++49-123-1234-123"</prof:hasPhoneNr>
        <prof:hasBlog rdf:resource="blog" />
    <rdf:Description>
</rdf:RDF>

If there is not base URI, relatives paths refer to the URI where the Document itself is located.

triple-spiral-rdf.png

Tags: language, semantics, respresenting
Parent: Resource Description Framework

Update entry (Admin) | See changes

Comment on This Data Unit