Channel 9 (a Microsoft community site) has an interesting video, by Rob Bagby, about the use of dynamic language capabilities in C# to expose XML elements as though they were object properties. I'd like to do the same for a C# class representing an OWL class. I could then expose more Properties on my object as more of it's OWL properties become known.
Is there a commonly accepted way of doing this in the dynamic language community? Have you done this, or do you know of a framework that does it? What would be the programming idiom for working with code that uses dynamic properties like this? This is a new feature in C# so there are no common idioms for working with properties that may or may not exist.
Every object in Ruby has a method called 'method_missing' which is called as a last resort if the interpreter can't find any declaration of a method call on an object.
The implementation of ActiveRecord in Ruby on Rails makes heavy use of this to dynamically create methods according to some conventions it defines. This includes automatically creating methods corresponding to names of columns in database tables for subclasses of ActiveRecord.
I don't know what is included in the C# dynamic language features, but this type of approach might be of some use to you.
This explains some of it: http://weblog.jamisbuck.org/2006/12/1/under-the-hood-activerecord-base-find-part-3
Eyal Oren and colleagues from DERI applied some of these ideas to develop ActiveRDF http://www.activerdf.org/ I'm not familiar with the details of how they have implemented this, but I'm sure it would be worth a look.
answered 17 Nov '09, 07:53
There is a nice post by Alexandra Rusina about Expando object type that is new to .Net 4 at
answered 18 Nov '09, 11:35
Disclaimer: this code is not optimized in any way. I am absolutely open to suggestion of any kind. As a matter of fact, I am keen on learning the best way to work with semantic data, but so far I have not found solid code which will help convince my colleagues.
This code is an adaptation of the code in this blogpost. It basically converts a Json object into an dynamic object which can then be easily queried. Since Freebase returns Json I found this extension method very helpful. You will need the Json.Net library which can be downloaded from codeplex.
answered 27 Dec '09, 17:12