From Atom 1.0 to RDF by XSLT

Atom Syndication Format 1.0で記述されたフィードを、XSLTによってRDFに変換する実験です。

This is an experiment to transfer an Atom Syndication Format 1.0 feed to an RDF graph by an XSLT style sheet.

XSLT

テスト用XSLTスタイルシート atom2rdf.xsl は、主として次のような変換を試みます。

Atomの語彙は(atom:feedを除いて)基本的にプロパティとして扱い、ノードの型にはRSS1.0などの語彙を充てています。

The XSLT style sheet atom2rdf.xsl will perform the following transformation (See the style sheet for detailed comment).

  • Add rdf:parseType="Resource" to some atom elements. Especially, rss:item will be added as child node of atom:entry so as to construct a nice RDF triple.
  • atom:link elements will be transformed to rdf:about of parent node, or to a property element with rel attribute value for its name, according to the context.
  • Each element with type attribute will be treated as plain literal, XMLLiteral or external link accordingly.
  • atom:generator has both text content and property attributes that violates RDF. Thus its text content will be transformed to rdf:value attribute.
  • Output atom: namespace URI will be concatinated '#'.

All Atom 1.0 terms (except atom:feed) are regarded as property, and some RSS 1.0 classes are used to give a type to nodes.

Test cases

Atom WikiのKnownAtomFeedsに掲載されているいくつかのAtom1.0フィードを、W3CのXSLTサービスを利用してこのXSLTでRDFに変換し、RDF Validatorで確認してみます。ひととおり、うまく行っていると思われます。

Here some 30 Atom 1.0 feeds listed on KnownAtomFeeds will be transformed to RDF graphs with this XSLT, via W3C's service, and validated with RDF Validator.

Atom 1.0 FeedGenerated RDFRDF Validator
Alex Harden - cygwebRDF of Alex...Validate
atompub.org - Atom News in Atom.RDF of atompub.org...Validate
Blog@CaseRDF of Blog@Case...Validate
Conforme by Philippe JanvierRDF of Conforme...Validate
Dave Johnson's Blogging RollerRDF of Dave...Validate
David Czarnecki's bedeviled mojo slopRDF of David...Validate
Elias TorresRDF of Elias...Validate
Fribbler - blogs blogs blogsRDF of Fribbler...Validate
Game TomorrowRDF of Game...Validate
Graham ParksRDF of Graham...Validate
Hacking gadfliesRDF of Hacking...Validate
Hayo BethlehemRDF of Hayo...Validate
Henrik Lied - misinterpreted.orgRDF of Henrik...Validate
JPN - JornalismoPortoNetRDF of JPN...Validate
Lussumo - Get VanillaRDF of Lussumo...Validate
More Like This WeblogRDF of More...Validate
Musings - Thoughts on Science...RDF of Musings...Validate
Niall Kennedy's weblogRDF of Niall...Validate
M. David Peterson's XSLTBlogRDF of XSLTBlogValidate
Niklas GustavsonRDF of Niklas...Validate
Norman Walsh's musingsRDF of Norman...Validate
Ongoing fragmented essay by Tim BrayRDF of Ongoing...Validate
Rakaz - The weblog of Niels LeenheerRDF of Rakaz...Validate
Sam Pearson's Random and IrrelevantRDF of Sam Pearson...Validate
Sam Ruby - It's Just DataRDF of Sam Ruby...Validate
Sjoerd Visscher's WeblogRDF of Sjoerd...Validate
Tantek's ThoughtsRDF of Tantek's...Validate
The BabelFish BlogRDF of BabelFish...Validate
This Space Intentionally Left BlankRDF of This...Validate
Random thoughts from Tristan LouisRDF of Random...Validate

All of above transformed RDF's are valid as of 2005-07-26T12:00+09:00.

Related Works