W3C home > Mailing lists > Public > www-rdf-interest@w3.org > March 2001

Getting RDF N3 From HyperText

From: Sean B. Palmer <sean@mysterylights.com>
Date: Fri, 2 Mar 2001 17:40:02 -0000
Message-ID: <01df01c0a33f$d2a88320$77da93c3@z5n9x1>
To: <www-rdf-interest@w3.org>
Cc: "Seth Russell" <seth@robustai.net>
If you Webize "rel" and mark up your HyperText links like so:-

   <a href="http://robustai.net/#Seth" rel="#collaborator">Seth</a>

With "rel" as the predicate, and "href" as the object. Then it becomes
very easy to XSLT transform it into N3:-

   <> <#collaborator> <http://robustai.net/#Seth> .

Plus, you can use the "title" element to display the predicate as
well, so you can "browse" the RDF. I wrote the following XSLT script
to extract the rel attribute as a predicate, and the href attribute as
the object:-

    xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:h="http://www.w3.org/1999/xhtml" >
<output method="text"/>
<template match="h:html">
<text>@prefix : &lt;#&gt; .
<template match="/h:html/h:body">
 <for-each select=".//h:a">
   <text>&lt;&gt; </text><value-of select="(@rel)" /><text>
&lt;</text><value-of select="(@href)" /><text>&gt; .
<template match="text()|@*">

It's up at http://infomesh.net/2001/03/xhtmlton3/xhtmlton3.xsl You can
use http://infomesh.net/2001/03/xhtmlton3/test.html as a test
document. Dan Connolly has a form up at
http://www.w3.org/2000/06/dc-extract/form.html that I often use for
this sort of thing... the output for the above is at:-


Which gives:-

     @prefix : <#> .
     <> <#collaborator> <http://robustai.net/Person/#Seth> .
     <> <#collaborator> <http://purl.org/swag/Person/#Sean> .

Hey, now you can use your Web browser as a makeshift semBrowser :-)

Kindest Regards,
Sean B. Palmer
@prefix : <http://webns.net/roughterms/> .
:Sean :hasHomepage <http://infomesh.net/sbp/> .
Received on Friday, 2 March 2001 12:39:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:51:48 GMT