LML, XML and RDF
Bill de HÓra published a nice-and-simple List Markup Language today. He’s framed it as an XML language, and notes that it would be nice to have an XSLT transform into RDF. In a subsequent post, he talks a bit – basically – about the RDF tax.
So, given that RDF is not RDF/XML, and since it may be time to deprecate RDF/XML anyways, I was thinking two things:
- What’s the trivial translation into the RDF model?
- How far is the presented XML from RDF?
In Turtle
To get at the first, I simply re-wrote the presented data in Turtle, though I wanted a bit more meat, so I added some content into the example ( more specifically, since there’s so little syntactic framing in Turtle, there’s not much left if you don’t put example data in… ):
-- n3 --
turtle, actually, but I only have an ‘n3′ mode for emacs…
@prefix i: http://www.dehora.net/lml/2005/01. @prefix xsd: http://www.w3.org/2001/XMLSchema# .
<#> a i:lml ; i:version “001″ ; i:published [ i:when “2005-01-08T10:57-0500″^^xsd:datetime ] ; i:changed [ i:when “2005-01-08T10:57-0500″^^xsd:datetime ] ; i:author [ i:name “Bill de h\u00D3ra” ] ,[ i:name “jsled” ] ; i:category [ i:name “rdf”; i:subject “http://www.w3.org/RDF/” ] ,[ i:name “markup”; i:subject “http://www.w3.org/XML/” ] ; i:list [ i:ordered “yes” ; i:href “http://asynchronous.org/ns/lml” ; i:items ( [ a i:item ; i:content “original post” ; i:href “http://www.dehora.net/journal/2005/01/lmllistmarkuplanguage.html” ] [ a i:item ; i:content “Danny’s response” ; i:href “http://dannyayers.com/archives/2005/01/08/list-markup-language/” ] [ a i:item ; i:content “followup to Danny” ; i:href “http://www.dehora.net/journal/2005/01/dataabovethelevelofasinglesite.html” ] ) ] .
I noted a few things in doing this:
- The namespace should end in a ‘/’ or ‘#’ to make things prettier.
- It’d be nice if the
versionwas an integer. I’m curious about it’s structure and semantics — does it need to be 3 digits? Does it represent some sort of compatability assurance? - It’d be nice if the
orderedattribute could trivially be axsd:boolean“true”/”false” rather than “yes”/”no”. - The
publishedandchangeddates probably don’t need to be to wrapped in bnodes [owl:ObjectProperties], but could more directly be straight data-type properties [owl:DatatypeProperties]. - The item-list construct doesn’t map directly.
The first three are more spec quibbles, and the 4th is just a modeling question. But the last is bit more interesting of an issue. I’ve seen before and don’t yet fully understand the mis-match, but it’s definitely a sticking point about RDF…
… in any case, above I’ve inserted the itemsproperty, allowing the list bnode to hold it’s properties [ordered and href], and the “striping” to work out in the RDF model. It does make more sense to me this way — the list has 3 properties: ordered, href and it’s children/items…
I believe the primary mismatch is that in RDF there’s no notion of implicit children or containment. That is, in XML there is an un-named “hasA” or “isA” relation of a node being inside another node. In RDF, all relations are typed via a property.
In XML
The second question can be re-phrased as “what’s the minimum set of changes that need to be made in order for the presented example to be parsed as RDF/XML?” The answer is: very few, kinda.
Here, I’ve inserted parseType="Resource" in a couple of places, as well as parseType="Collection" on the items element; this last one prevents rapper from parsing it correctly as RDF/XML, but I think it’s a bug in rapper, actually.
Now, what would happen if parseType="Resource" was the default? And there was a simpler way to specify collection-style parsing? I fear that the constraints imposed by RDF would continue to retard it’s adoption, but it might make for something a lot more palatable.