Saturday, September 09, 2006

Prolixity of RDF vs Lisp

I'm messing with OWL/RDF and other semantic web goodness. Here is how you define an enumerated lists of strings (that can be the value of some property:

<code>
<owl:oneof parsetype="Resource">
<rdf:rest parsetype="Resource">
<rdf:first datatype="http://www.w3.org/2001/XMLSchema#string">ACTIVATION</rdf:first>
<rdf:rest parsetype="Resource">
<rdf:first datatype="http://www.w3.org/2001/XMLSchema#string">INHIBITION-ALLOSTERIC</rdf:first>
<rdf:rest parsetype="Resource">
<rdf:first datatype="http://www.w3.org/2001/XMLSchema#string">INHIBITION-COMPETITIVE</rdf:first>
<rdf:rest parsetype="Resource">
<rdf:rest parsetype="Resource">
<rdf:first datatype="http://www.w3.org/2001/XMLSchema#string">INHIBITION-NONCOMPETITIVE</rdf:first>
<rdf:rest parsetype="Resource">
<rdf:rest parsetype="Resource">
<rdf:rest parsetype="Resource">
<rdf:rest parsetype="Resource">
<rdf:rest resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil">
<rdf:first datatype="http://www.w3.org/2001/XMLSchema#string">ACTIVATION-ALLOSTERIC</rdf:first>
</rdf:rest>
<rdf:first datatype="http://www.w3.org/2001/XMLSchema#string">ACTIVATION-NONALLOSTERIC</rdf:first>
</rdf:rest>
<rdf:first datatype="http://www.w3.org/2001/XMLSchema#string">INHIBITION-UNCOMPETITIVE</rdf:first>
</rdf:rest>
<rdf:first datatype="http://www.w3.org/2001/XMLSchema#string">INHIBITION-OTHER</rdf:first>
</rdf:rest>
</rdf:rest>
<rdf:first datatype="http://www.w3.org/2001/XMLSchema#string">INHIBITION-IRREVERSIBLE</rdf:first>
</rdf:rest>
</rdf:rest>
</rdf:rest>
</rdf:rest>
<rdf:first datatype="http://www.w3.org/2001/XMLSchema#string">INHIBITION</rdf:first>
</rdf:rest></owl:oneof>
</code>

That's 1853 characters, to do something that is obviously derived from Lisp and which in Lispy syntax can be done like this:


(oneof
"ACTIVATION"
"INHIBITION-ALLOSTERIC"
"INHIBITION-COMPETITIVE"
"INHIBITION-NONCOMPETITIVE"
"ACTIVATION-ALLOSTERIC"
"ACTIVATION-NONALLOSTERIC"
"INHIBITION-UNCOMPETITIVE"
"INHIBITION-OTHER"
"INHIBITION-IRREVERSIBLE"
"INHIBITION")

Or 244 characters. The OWL format is 7.6 times the size, and this is a relatively simple example.

Of course the RDF format is grossly inefficient in terms of space and bandwidth, but my real problem with it is that it is also vastly inferior in terms of human comprehensibility.

One of Lisp's real strength is in human interface -- its external representations are simple and direct representations of its internal structures. This is what makes hacking Lisp fun, and powerful. As some Lisp guru once said, "you can feel the bits between your toes", but it's not the bits, its the actual conceptual data structures that have an almost tangible existence in a Lispy environment.

Pretty much nothing since Lisp has retained this quality. Modern IDEs do a lot to make code more tangible, but are pretty primitive when it comes to data. And XML/RDF is only barely human-readable, and not at all human-typable at any scale.

No comments: