Haven’t posted in a while -- I’ve been working on a ruby utility that generates RDF and RDFS files from a Ruby On Rails application.
The goal is to enable the use of semantic tools to explore the underlying structure of your data, using the built in-capabilities of these tools to quickly discover contradictions between postulated structure and the actual data. e.g., “I think that every event only has a single location”
In this scenario, one uses the utility to build a base ontology (including instances) from the production system. An application could then be deployed with relatively loose constraints, with the constraints being refined after the application has had the opportunity to accumulate real data. This is especially useful where the character of the data is not well understood/controversial at the time of the initial deployment.
The project has a useful side benefit of allowing me to gain a better understanding of both Ruby and the RoR framework (see the note on class loading below)
The good news is that it was relatively straightforward to get .rdf and .rdfs files generated so that I could read them into Protege (which may not be the best tool for this, but it is one with which I’m familiar and has a substantial amount of documentation)
The bad news is that I couldn’t add any refinements to the an rdf/rdfs project in Protege -- it requires a ‘real ontology’ e.g., an .owl file (which is obvious in retrospect but.....)
I’m now in the process of generating the .owl file.
Class Loading: The classes in a Ruby On Rails application are not loaded when the console is started. ActiveRecord subclasses are loaded on demand from a hook added to the missing_const exception
The way it is handled is interesting so I’m reproducing it here
(from le: /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/active_support/dependencies.rb in my installation)
class Module #:nodoc:
# Rename the original handler so we can
# chain it to the new one
alias :rails_original_const_missing :const_missing
# Use const_missing to autoload associations
# so we don’t have to
# require_association when using single-table inheritance.
Dependencies.load_missing_constant self, class_id
def unloadable(const_desc = self)