Summary
In a recent blog post, Dare Obasanjo compares Microsoft's new Astoria API with the Google Base API for querying URL-addressable Web resources.
Advertisement
The RESTful approach to Web development centers around exposing representations of resources via URLs, making such resources, or their representations, universally accessible. This approach conjures up the notion of the Web as a huge database: resources exposed via REST services are often similar to database entities, and resource representations share similarities with database views or query results.
Several Web frameworks make the relationship between a database and RESTful resources simple and explicit. Rails 1.2's ActiveResource framework can directly render database entities into RESTful resources. Restlet and Django make that task similarly easy with Java and Python, respectively.
Two ambitious projects are taking the Web-as-a-database approach to an even higher level by offering database-like features as a Web service. Both allow developers to create entire Web applications that treat those Web services as a database, and provide facilities to manipulate data via RESTful HTTP methods.
One such project is Google's Google Base and its associated API. The other Web-as-a-database project is Microsoft's Live platform and the related Project Astoria API, with goals similar to those of the Google Base API:
The goal of Microsoft ... Astoria is to enable applications to expose data as a data service that can be consumed by web clients within a corporate network and across the internet. The data service is reachable over HTTP, and URIs are used to identify the various pieces of information available through the service. Interactions with the data service happens in terms of HTTP verbs such as GET, POST, PUT and DELETE, and the data exchanged in those interactions is represented in simple formats such as XML and JSON.
Fundamentally URIs identify a single resource or asset of resources. On the other hand, SQL is primarily about dealing with relational data... A syntax for addressing single resources ... is fundamentally incompatible with a query language that operates over multiple resources. This was one of the primary reasons the W3C created XQuery even though we already had XPath.
That said, being able to perform sorting, filtering, and aggregate operations over a single set of resources via a URI is extremely useful and is a fundamental aspect of the Web today...
Both Google's Google Base data API and Microsoft's Project Astoria are RESTful protocols for performing sorting, filtering and aggregate operations similar to what you find in SQL over a hierarchical set of resources...
Obasanjo compares the two frameworks based on the following criteria:
Filtering results using predicates
Supported datatypes, operators and functions
Sorting
Paging
In conclusion, Obasanjo notes that:
There is a lot to like and dislike. I like the "expand" feature in Astoria as well as the fact that I can retrieve XML results from multiple paths of the hierarchy. However there does seem to be a paucity of operators and functions for better filtering of results.
From the Google Base data API, I love the "crowd" feature and having a full library of functions for performing tests within predicates. Also some of the operators such as the ones for finding results near a certain location are quite impressive although unnecessary for the majority of RESTful protocols out there. That said, I do think they went overboard on some of the features such as having if...else blocks within the URIs...
What do you think of the notion of considering RESTful Web services as a sort of database? And what's your take on the Google Base API and Astoria?