Atom plus RDFa

From RDFa Working Group Wiki
Revision as of 10:46, 15 November 2010 by Tinkster (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Atom 1.0 + RDFa 1.1

14 November 2010

Editor:
Toby Inkster, Invited Expert

Abstract

This document provides guidance for embedding RDFa in Atom 1.0 entries and feeds; and details for how to parse it.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document was developed by the RDFa Working Group. This document has no formal status (it is neither a W3C Recommendation nor a Working Group Note).

Introduction

@@TODO - gist is that we want to retain compatibility with Yahoo's DataRSS; also be compatible with Atom 1.0 sytax and semantics.

Here is an example Atom+RDFa feed:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
	xmlns:rdfa="http://www.w3.org/ns/rdfa#"
	xmlns:dc="http://purl.org/dc/terms/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
	xmlns:foaf="http://xmlns.com/foaf/0.1/">

	<title>Example Feed</title>
	<link rel="self" href="http://example.org/"/>
	<updated>2003-12-13T18:30:02Z</updated>
	<author>
		<name>John Doe</name>
	</author>
	<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>

	<entry>
		<title>Atom-Powered Robots Run Amok</title>
		<link rel="self" href="http://example.org/2003/12/13/atom03"/>
		<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
		<updated>2003-12-13T18:30:02Z</updated>
		<summary>Some text.</summary>
		<rdfa:meta property="dc:dateCopyrighted" content="2003-12-11" datatype="xsd:date" />
		<rdfa:meta rel="dc:rightsHolder">
			<rdfa:meta typeof="foaf:Person" property="foaf:name" content="John Doe" />
		</rdfa:meta>
	</entry>

</feed>

This results in the following RDF data:

@prefix dc:   <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rel:  <http://www.iana.org/assignments/relation/> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .

_:feed rel:self <http://example.org/> .

_:entry rel:self <http://example.org/2003/12/13/atom03> ;
    dc:dateCopyrighted "2003-12-11"^^xsd:date ;
    dc:rightsHolder _:r .

_:r a foaf:Person ;
    foaf:name "John Doe" .

Conformance

Document Conformance

[RFC 4287] offers a number of places for extensions to slot in without disrupting existing Atom parsing tools. However, this specification only allows RDFa attributes in a conservative set of places:

  1. On extension elements (non-Atom namespace) which are the direct children of <feed> or <entry>, or the descendants of any such extension elements; and
  2. On elements that are descendants of Atom <content> elements which do not have a type attribute with value "text" or "html".

For the first case, this specification defines a namespaced element {http://www.w3.org/ns/rdfa#}meta suitable for using as a child of <feed> or <entry>.

Additionally, the Atom <link> element has rel and href attributes which will be interpreted as RDFa. Publishers must ensure that they do not use RDFa features on <link> elements which are not supported in Atom 1.0 - in particular, rel should be a term from the default profile, or should be a full absolute URI.

User Agent Conformance

@@TODO - gist should be that RDFa should be processed wherever it's found, even if it would be non-conforming according to section above.

Additional RDFa Processing Rules

Documents conforming to the rules in this specification are processed according to [CORE] with the following extensions:

  • The default vocabulary URI is undefined.
  • The default collection of terms is defined via an RDFa Profile document detailed in the section below.
  • The base can be set using the xml:base attribute as defined in [XMLBASE].
  • The current language can be set using only the @xml:lang attribute.
  • In section 7.5, processing step 6, if no URI is provided by a resource attribute (e.g., @about, @href, @resource, or @src), then first check to see if the element is an <entry> element. If it is, then act as if there is an empty @typeof present, and process it according to the rule for @typeof.
  • In section 7.5, processing step 7, if no URI is provided by a resource attribute (e.g., @about, @href, @resource, or @src), then first check to see if the element is an <entry> element. If it is, then act as if there is an empty @typeof present, and process it according to the rule for @typeof.

@@TODO - maybe mention the <?profile ?> processing instruction?

Default Profile

The default profile is obtained by processing the XML version of the IETF Link Registry (see [REL]) with the following XSL Transformation:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:reg="http://www.iana.org/assignments"
	xmlns:dc="http://purl.org/dc/terms/"
	xmlns:rel="http://www.iana.org/assignments/relation/"
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
	xmlns:rdfa="http://www.w3.org/ns/rdfa#">
	
	<xsl:output method="xml" indent="yes"/> 
 
	<xsl:template match="//reg:registry[@id]">
		<reg:registry id="{@id}" about="#{@id}">
			<xsl:apply-templates select="reg:title"/>
			<xsl:apply-templates select="reg:updated"/>
			<xsl:apply-templates select="reg:registry"/>
			<xsl:apply-templates select="reg:record"/>
		</reg:registry>
	</xsl:template> 

	<xsl:template match="reg:title">
		<reg:title property="dc:title" xml:lang="en">
			<xsl:value-of select="."/>
		</reg:title>
	</xsl:template>

	<xsl:template match="reg:updated">
		<reg:updated property="dc:modified" datatype="xsd:date">
			<xsl:value-of select="."/>
		</reg:updated>
	</xsl:template>
	
	<xsl:template match="reg:record">
		<reg:record typeof="rdfa:TermMapping"
			property="rdfa:uri"
			content="http://www.iana.org/assignments/relation/{reg:value}">
			<xsl:apply-templates select="reg:value"/>
			<xsl:apply-templates select="reg:description"/>
			<xsl:apply-templates select="reg:xref[@type='uri']"/>
		</reg:record>
	</xsl:template>

	<xsl:template match="reg:value">
		<reg:value property="rdfa:term">
			<xsl:value-of select="."/>
		</reg:value>
	</xsl:template>

	<xsl:template match="reg:description">
		<reg:description
			about="[rel:{ancestor::reg:record/reg:value}]"
			property="rdfs:comment"
			xml:lang="en">
			<xsl:value-of select="."/>
		</reg:description>
	</xsl:template>

	<xsl:template match="reg:xref[@type='uri']">
		<reg:xref
			about="[rel:{ancestor::reg:record/reg:value}]"
			rel="rdfs:seeAlso"
			resource="{./@data}">
			<xsl:value-of select="."/>
		</reg:xref>
	</xsl:template>

</xsl:stylesheet>

Native Atom Semantics

@@TODO - gist is that Atom's native semantics can be uplifted to an RDF graph via AtomOWL; describe how to merge this graph with the default RDFa graph.

References