Thursday, April 27, 2006

Why GET should always be idempotent: A lesson from Del.icio.us and Sage

This evening I downloaded Sage, a RSS/Atom feed reader extension for Firefox. It is quite a nice feed reader and a big improvement over Firefox's Live Bookmarks which I find hard to use with lots of feeds and IMO over Google's Personalised Homepage which I find doesn't scale too well with lots of feeds and doesn't provide previews of the content.

Sage had a particularly cool feature that jumped out at me, the 'Discover Feeds' feature. This allows you to find all the feeds referenced in a page, rather than just the feed in a link tag in the header. It seems that what it does is follow links that may be potential feeds and checks if they are. You then get a list of all the feeds in the page and can add them to your 'watched' feeds in Sage.

This got me thinking, since I use alot of different computers it is pain trying to manage my list of feeds on each computer, exporting them and copying them around is just asking to get them out of sync and frankly too much effort. ;) So since I already have a Del.icio.us account where I keep my bookmarks I could bookmark all the feeds I care about and tag them with 'feed' in Del.icio.us. Then I just need to navigate to the page for the 'feed' tag click on the Discover Feeds button in Sage and all my bookmarked feeds are there to be added to Sage! Yay online storage of feed links that can easily be added to my feed reader of choice from any computer!!!

Or so I thought. It just so happens that the Delicious 'Delete Bookmark' link is one of the links that Sage follows when it searches for feeds. This has the unfortunate side effect of deleting all my bookmarks in the feed tag. The ideal fix is that Delicious delete action needs to be changed to only respond to a HTTP POST method. This would be comformant with W3C Recommandations too.

I've submitted this bug to Delicious but for now the dream of online bookmarking of feeds to be accessed by Sage remains elusive.

Tags:

Sunday, April 23, 2006

Calling Web Services From Rails

I've notice a few places where people have asked whether Ruby On Rails supports the consumption of web services. Rails itself doesn't. I have found the easiest thing to use is SOAP4R, which according to its web page comes bundled with Ruby 1.8.3 and above.

SOAP4R is really easy to use, it simply generates Ruby stubs from a WSDL which will call the web service for you. You just call the stubs as though they were a Ruby API.

If you have ever used any Java or .NET web service clients, it is pretty much the exact same concept.

Tags:

Thursday, March 09, 2006

Javascript Graph Visualisation

I just found this new graphing library for Javascript. I've been looking for something that does this for a while so I can visualise relationships represented in RDF. The last thing I was looking at was Foafnaut which doesn't seem to be very active and only supports foaf information.

This Javascript library looks really promising though since you should be able update the graph using Ajax which would be really cool. It's just in the beginning stages now but I'll definately be keeping an eye on it.

Technorati:

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: ,

Saturday, February 18, 2006

RDF Schema Generator

I've release my first Rails generator on Ruby Forge. RDF Schema Generator builds a Ruby Module from an RDFS file. The module contains constants for each of the properties and classes in the Schema. If you are using Rails to build RDF based applications you might find it useful.

Install it using gem install rdf_schema_generator.

Once it is installed you can run
ruby script/generate rdf_schema <prefix> <rdfs_url>
and a class called will be generated in the lib directory containing a module with all the classes and properties for the RDFS file retreived from <rdfs_url>.

Enjoy!


Tags: Ruby Rails RDF

First Post

Well, this is my first ever blog post.

By way of introduction - my name is Sean Geoghegan, I'm a geek, I work as a computer programmer. I'm currently into Ruby on Rails and really want to write a Rails based web application in the guise of flickr or 43things that becomes hugely popular, I just need an idea, if you have one post it in a comment.