Sunday, February 19, 2006

Active Ontology for Ruby on Rails

Obie Fernandaz has some ideas for a Ontology based ActiveRecord alternative.

This is a really interesting idea, something I've also been thinking about for a while. One of the tricky things in doing this would be determining what properties a class has. In a RDBMS table you declare that a table (class) has a number of columns (attributes) the mapping to an object model is fairly obvious.

However with OWL and RDF you declare a class and you declare properties, however properties are independant of classes. You can, in RDFS, say that a property has the domain of a specific class, which means that if a Resource has that property it is a member of that class. This is different to RDBMS/OO land where you declare that a class has a property. The difference is subtle but important as it allows you to say things like:
  1. There is a Employee class.
  2. There is a Manager class which is a subclass of Employee.
  3. There is a manages property that has domain Manager.
  4. We can then infer that the manages property also has Employee as its domain since all Managers and Employees. (Note that this the opposite of OO where properties and inherited down the class heirarchy).
  5. We can then create an instance of Employee. It is valid to give that Employee a manages property pointing at another Employee instance. We can then infer that the Employee is also a manager.
When you want to map this to OO though, which class gets the manages property? It is correct to give it Employee since we infered that Employee is a valid domain for manages. Except any Employee who manages someone is a Manager too.

This is one of the tricky things that will arise out of the differences between Ontologies and OO. A couple of the others are multiple inheritence and multiple class membership.

Most of these issues could be worked out after the initial functionality is there, but it should interesting to see how they are tackled.

Update: Man I really need to look at dates before I respond to blogs.

Technorati: ,

1 comment:

Admiral Adney said...

I was searching for ruby on rails development and landed up onto your column and i ought say thank you for sharing such practical information.