RDF Site Summary 1.0: SRDF (Simple RDF)

Authors

Kevin A. Burton , Independent

Version

Latest Version: http://purl.org/rss/1.0/modules/proposed/SRDF/

Mon Jul 22 2002 06:15 PM ( init ) kab

Status

Proposed, Mon Jul 22 2002 06:28 PM

Rights

Copyright © 2000 by the Authors.

Permission to use, copy, modify and distribute the RDF Site Summary 1.0 SRDF (Simple RDF) Specification and its accompanying documentation for any purpose and without fee is hereby granted in perpetuity, provided that the above copyright notice and this paragraph appear in all copies. The copyright holders make no representation about the suitability of the specification for any purpose. It is provided "as is" without expressed or implied warranty.

This copyright applies to the RDF Site Summary 1.0 SRDF (Simple RDF) Specification and accompanying documentation and does not extend to the RSS Module's format itself.

Abstract

The SRDF (Simple RDF) format is an mechanism for incorporation of RDF within RSS modules while preserving a simple XML format necessary for the adoption of RSS.

Description

RDF is a format that is used to represent the semantic relationships within metadata. The core RSS 1.0 specification is an application of RDF and can be used by RDF aware applications. It would be ideal for new RSS modules to be developed as an RDF format so that the same model was extended to the new semantics of the new module.

The main problem here is that the RDF format would quickly become unmanageable and grow into a format that would be difficult for content producers to understand. The main advantage of SRDF is that it does not require the use of rdf:Bag or rdf:li elements or N-triple RDF format. This yields a more logical and readable XML format that can be used to build application with SAX/DOM/XPATH/etc APIs and still maintain readable code.

Simple RDF solves this problem. SRDF is a compromise between the semantic world of RDF and the simple world of RSS.

With SRDF we have:

  1. a simple RSS format for modules which content producers can easily understand.
  2. an RDF format that can be used by RDF aware applications.
  3. the ability to link an external RDF file to an RSS channel so that implementing RSS modules can be included at runtime and stored externally.
  4. the ability use XSLT in order to produce RDF for given module at runtime for use with RDF applications.

Design

SRDF compatible modules design their format in a simple and straight-forward manner. This allows them to be used within XPath, SAX, DOM, etc APIs without having to deal with complicated and unnecessary RDF.


<?xml version="1.0" encoding="utf-8"?> 

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:ref="http://purl.org/rss/1.0/modules/reference/"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:foo="http://purl.org/rss/1.0/modules/foo/"
         xmlns="http://purl.org/rss/1.0/"> 

    <channel rdf:about="http://example.org/rss.rdf">
        <title>Example Feed</title>
        <link>http://www.example.org</link>
        <description>Simply for the purpose of demonstration.</description>
        
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="http://example.org/item/"/>
            </rdf:Seq>
        </items>

        <!-- foo module -->
        <foo:bar rdf:about="http://www.foo.com/bar">  
                    
            <dc:title>Foo Bar Module</dc:title>

        </foo:bar>

    </channel>
    
    <item rdf:about="http://example.org/item/">

        <title>Relax NG schemas for XML Encryption and XML Signature</title> 
        <link>http://www.xmlhack.com/read.php?item=1725</link>

    </item> 
    
</rdf:RDF>

An XSL file is provided with the module for producing valid RDF. RDF applications can use the stylesheet to generate RDF at runtime.


<?xml version="1.0"?> 

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                xmlns:rss="http://purl.org/rss/1.0/"
                xmlns:dc="http://purl.org/dc/elements/1.1/"
                xmlns:foo="http://purl.org/rss/1.0/modules/foo/"
                version="1.0">
    
    <xsl:output indent="yes"/>

    <xsl:template match="/rdf:RDF">
        
        <rdf:RDF>

            <rdf:Description rdf:about="{rss:channel/@rdf:about}">

                <foo:bar>

                    <rdf:Bag>

                        <xsl:for-each select="rss:channel/foo:bar">
                            
                            <rdf:li rdf:resource="{@rdf:about}"/>
                            
                        </xsl:for-each>
                        
                    </rdf:Bag>

                </foo:bar>

            </rdf:Description>

            <xsl:apply-templates select="rss:channel/foo:bar"/>

        </rdf:RDF>

    </xsl:template>

    <xsl:template match="@*|node()">

        <xsl:copy-of select="."/>

    </xsl:template>

</xsl:stylesheet>

This stylesheet will then output RDF which can be used by RDF aware applications.


<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:foo="http://purl.org/rss/1.0/modules/foo/" 
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:rss="http://purl.org/rss/1.0/" 
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

    <rdf:Description rdf:about="http://example.org/rss.rdf">
        <foo:bar>
            <rdf:Bag>
                <rdf:li rdf:resource="http://www.foo.com/bar"/>
            </rdf:Bag>
        </foo:bar>
    </rdf:Description>

    <foo:bar rdf:about="http://www.foo.com/bar">  
        
        <dc:title>Foo Bar Module</dc:title>
        
    </foo:bar>

</rdf:RDF>

The RDF produced will form the following RDF graph:

Instead of including the module directly the RSS file can link directly to the external RDF file. See the mod_link specification for more information on linking within RSS. Note that this only includes modules that define a linking mechanism..


<?xml version="1.0" encoding="utf-8"?> 

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:ref="http://purl.org/rss/1.0/modules/reference/"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:l="http://purl.org/rss/1.0/modules/link/"
         xmlns="http://purl.org/rss/1.0/"> 

    <channel rdf:about="http://example.org/rss.rdf">
        <title>Example Feed</title>
        <link>http://www.example.org</link>
        <description>Simply for the purpose of demonstration.</description>
        
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="http://example.org/item/"/>
            </rdf:Seq>
        </items>

        <l:link l:rel="http://purl.org/rss/1.0/modules/foo/"
                l:type="application/rdf+xml"
                l:title="Subscriptions"
                rdf:resource="example.rdf"/>

    </channel>
    
    <item rdf:about="http://example.org/item/">

        <title>Relax NG schemas for XML Encryption and XML Signature</title> 
        <link>http://www.xmlhack.com/read.php?item=1725</link>

    </item> 
    
</rdf:RDF>