Tuesday, February 28, 2006

Options with RDF

Now, I don't claim to be an RDF guru, far from it, however I have been working a lot with it recently at the office, and think I have a pretty good handle on it. For that reason, I'm blogging a bit about a pet peeve of how RDF is sometimes written by tools/people who don't really understand it--or at least share my understanding of it.

In RDF if you want to have a list of items, you can use a container of either a <rdf:Bag> type or <rdf:Seq> depending on if you want an unordered, or ordered list. In each of them, you end up having a list of <rdf:li> list items. For people with HTML experience this is pretty simple.

What happens when you generate a list from a multi-select box or drop-down type Option selection widget? Well, it should simply create an XML/RDF structure thusly:

<RDF:Bag>
<RDF:li>Foo</RDF:li>
<RDF:li>Bar</RDF:li>
</RDF:Bag>


Only some people/tools add their own slice of XML:

<RDF:Bag>
<RDF:li>
<option>Foo</option>
</RDF:li>
<RDF:li>
<option>Bar</option>
</RDF:li>
</RDF:Bag>


Not only is this harder to read and understand in a large RDF graph, it generates completely unnessesary triples. Even in RDF, which is by far the most complex XML syntax I've worked with (save XMI from the OMG) the KISS principle should apply.


Cheers,

Sean

Technorati Tags:

No comments: