HTML in Turtle

Because of the graph structure behind the scenes, pretty much any data can be expressed in the RDF model and hence in an RDF syntax, although it might get a bit nonsensical when it comes to interpreting the triples. Here is a case in point. There was definitely some sensible discussion of Atom syntax being RDF/XML (but the handful of extra attributes needed were considered too much overhead). But also I vaguely remember (or maybe imagine) HTML/RDF mappings being done pre-Turtle. It just crossed my mind, couldn't resist having a go.

So here's an example:

@prefix : <http://example.org/html9/> .

<http://example.org/hello> a :html ;
:head [ :title "A Page" ] ;
:body [
:h1 "My Page" ;
:p "Hello World!"
] .

The placing of the bnodes is a bit arbitrary, but I rather like the idea of a resource being a HTML. I believe this corresponds to the RDF/XML:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://example.org/html9/">
<html rdf:about="http://example.org/hello">
<head rdf:parseType="Resource">
<title>A Page</title>
</head>
<body rdf:parseType="Resource">
<h1>My Page</h1>
<p>Hello World!</p>
</body>
</html>
</rdf:RDF>

Hmm, actually it seems quite sensible at this level of nesting, not all that far from Reto's DiscoBits idea. In fact those bnodes could usefully be swapped for # URIs. But I'd prefer not to think how it gets with e.g. a load of nested <div>s.

Dunno, I could imagine an advanced (RDF-friendly!) Wiki syntax looking something like that Turtle.


danja
2010-08-14T16:59:04+01:00
ideas wikis rdf
Related
Comments
Edit