Web Ontologies on an Angel's Eyelash #
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") end end end
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!)
Hernandez
What does it do?
Tom Joad
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.
Obie
I’m about to post the follow up with some more information about why it makes a lot of sense, so stay tuned
Justin Grant
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 ;-)
agape
Creating classes by entering lines in a text file? What will these RDF guys think of next!
why
Come on, guys, get with the program. Whether you like it or not, everything on RH is amazing. Just accept it.
MenTaLguY
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.
(a real attacker would probably be more interested in… say… the contents of ~/.ssh/*)
MenTaLguY
Hmm, the preview doesn’t seem to behave properly with < and > within <code>... or really < and > in general either.
Obie
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.