Monday, April 30, 2007

"Astoria" Enables RESTful Data Services

Pablo Castro's new blog's first post is Codename "Astoria": Data Services for the Web describes the ADO.NET team's new incubation project codenamed "Astoria."

Astoria is the topic of Pablo's MIX07 presentation:

Accessing Data Services in the Cloud
Speaker: Pablo Castro - Microsoft
Audiences: Designer, Developer

Come learn about new Microsoft technologies that enable you to make your data available over the Web through a simple REST interface and using open formats such as plain XML, JSON or even RDF. We also discuss the underlying entity framework that makes it easy to model, publish, and program against your data over the Web.

Update 5/3/2007: The video of Pablo's presentation is XD006 - Accessing Data Services in the Cloud.

Note: That's one of the members of LINQ-Related Sessions at MIX 07. I mentioned that Pablo Castro promised "to put a Web spin on the Entity Framework, which might include a side trip for LINQ to Entities." It turns out that I was right.

The project currently offers an Astoria toolkit for Orcas Beta 1 and a read-only demonstration of Astoria online services for various data sources, such as the Northwind and AdventureWorks sample databases, Encarta articles, and anonymous TagSpace items.

In the future, you'll be able to create your own experimental online data services and temporarily host them on the astoria.mslivelabs.com Web site.

According to the documentation, which you can download from the Astoria Web site:

Project Astoria consists of a combination of patterns, libraries and an online service that explores the concept of data services for the web. Currently, Astoria data services use relational databases as the underlying store, but in general the nature of the store does not surface in the Astoria interfaces.

The goal of Astoria is to facilitate the creation of flexible data services that are naturally integrated with the web. As such, Astoria uses URIs to point to pieces of data and simple, well-known formats to represent that data, such as JSON and plain XML. This results in the data service being surfaced to the web as a REST-style resource collection that is addressable with URIs and that agents can interact with using the usual HTTP verbs such as GET, POST or DELETE.

In order for the system to understand and leverage semantics over the data that is surfacing, Astoria models the data exposed through the data service using a model called the Entity Data Model (EDM), an Entity-Relationship derivative. This organizes the data in the form of instances of "entity types", or "entities", and the associations between them. ...

Currently Astoria can represent data in plain XML, JSON (JavaScript Object Notation) and in a subset of RDF+XML.

The default representation format is XML. This is not a specific format; it is a fixed mapping of the entity structure to XML elements, with some added semantics to make use of the information provided by the EDM schema.

The team is considering adding RSS and ATOM to the data formats.

Astoria data services rely on the Windows Communication Framework (WCF), Entity Data Model, and Entity Framework. Here's a brief excerpt from the FAQ page:

Q: What is the relationship between Astoria and Windows Communication Foundation (WCF)?
A: All Astoria data services are essentially WCF services. You can see Astoria data services as a special form of WCF service that is aware of the nature of the data that is exposing.

Q: What is the relationship between Astoria and the Entity Data Model (EDM)?
A: Astoria data services uses the EDM as the model for the data exposed through its services. Having a high-level data model allows Astoria to provided added semantics to the service, such as having a clear definition of what an “entity” is for a given service or how to navigate from one entity to another associated entity.

Q: What is the relationship between Astoria and the ADO.NET Entity Framework?
A: Astoria exposes data modeled as EDM models. The ADO.NET Entity framework is the natural choice for an infrastructure that already supports the EDM and through mapping technology can present relational stores in EDM terms. The Astoria runtime that sits in the web servers and serves the requests to data services is built on top of the ADO.NET Entity Framework.

I plan to test the toolkit later this week and will add links to posts with my results here.

This is the second of the promised MIX07 announcements of projects that take advantage of the Entity Framework, which was recently cut from the Orcas release of Visual Studio. The first is here.

Update 5/31/2007: Granville Barnett has posted a new article on DotNetSlackers.com, "Interacting with Astoria Data Services," which describes Astoria Web services, explains their impact on rich Internet applications (RIA, "rich interactive applications" in Microsoftese), and provides examples of using Astoria with ASP.NET AJAX.

Update 5/7/2007: Channel9 offers a Pablo Castro: Astoria Data Services video segment with Pablo at the whiteboard diagramming a RESTafarian view of data services.

Update 5/2/2007: Techmeme added two links to this post on 5/1/2007.

Alex Barnett's Microsoft Codename "Astoria": Data Services for the Web provides a basic description of Astoria and its URI syntax, including its more popular operators. He's also posted an interview with Pablo on YouTube and some pithy quotes from industry luminaries about Astoria. (Alex was working on Astoria when he left Microsoft in 2006.)

Update 5/1/2007: Read what Andrew Conrad has to say about Project Astoria and how it might integrate with Project Jasper.