Generic extraction (and Atom extension)

Hi,

This partly a marginally off-topic fyi, partly a more on-topic hunt for a
code snippet. It's early days stuff, so any thoughts/suggestions would be
greatly appreciated.

I've been looking at applying essentially the same techniques as the
rdf-in-xhtml proposal on a proposed extension mechanism for the Atom
syndication language [1]. Within Atom, the key part here is the <link>
element, which will be used to point to external resources, e.g.

<link rel="comments" href="http://www.example.org/blog/entry1"
type="text/html">

There will be a set of standard values for rel [2], but the construct is
ideal for extension using the ideas of RFC 2731 [3] (Encoding Dublin Core
Metadata in HTML). I made a start at writing this up at [4] (without
reference to RDF for political reasons ;-), and Eric Scheid has begun
turning this into a formal RFC (which will eventually contain the RDF
mapping).

Following the same path as rdf-in-xhtml, something of the form above should
be transformable into RDF.

e.g. the Atom source:

<feed>
    <link rel="schema.FOAF" href="http://xmlns.com/foaf/0.1/" / >
...
<entry>
   <id>http://example.org/blog/post123</id>
   <title>Fear of Vegemite</title>
   <link rel="FOAF.depiction"
        type="image/jpeg"
        href="http://rdfweb.org/vegemite.jpg"
        title="danbri with yeast extract" />
...

would map (in part) to something like:

<rdf:RDF xmlns:atom="http://purl.org/atom
         xmlns:foaf="http://xmlns.com/foaf"
         ...>

<atom:entry rdf:about="http://example.org/blog/post123">
    <foaf:depiction rdf:resource="http://rdfweb.org/vegemite.jpg" />
</atom:entry>

</rdf:RDF>

(btw, a link rev="..." attribute has been proposed, which would reverse the
role of the URIs in the statement).

Ok, that's the fyi. Now the snippet-hunt. I'll put it in terms of atom:link,
but I believe it would be essentially the same for xhtml:meta or whatever
else is used in rdf-in-xhtml.

Given that XSLT is a complete language, presumably it should be possible to
do this transformation in a generic fashion on arbitrary namespaces and
properties. So:

<link rel="schema.NS" href="http://example.org/namespace" / >
...
<id>http://example.org/subjectURI</id>
...
<link rel="NS.property" href="http://example.org/objectURI" />

=>

<rdf:RDF ...
	xmlns:ns="http://example.org/namespace">

<rdf:Description rdf:about="http://example.org/subjectURI">
	<ns:property rdf:resource="http://example.org/objectURI" />
</rdf:Description>

</rdf:RDF>

(the <id> element is a little clunky, but that looks like the way it's going
to be done in Atom)

I was wondering if anyone had a bit of code that did something like this -
I'm only a novice with XSLT, so it would take me a good while to figure out.

Cheers,
Danny.

[1] http://www.intertwingly.net/wiki/pie/FrontPage
[2] http://www.intertwingly.net/wiki/pie/LinkTagMeaning
[3] http://www.ietf.org/rfc/rfc2731.txt

----

http://dannyayers.com

Received on Friday, 16 January 2004 06:39:23 UTC