5025Re: [rest-discuss] The role of queries in REST?
- May 7, 2005Roger,
I'm curious if these questions were triggered by Adam Bosworth's
"Web of Data" presentation,
because after reading these, I was left with similar thoughts.
See especially the slides "Queries" and "Changes from normal queries."
He seems to be advocating for a simpler view of data with some
reasonable set of metadata (RSS/Atom being a good first
approximation) that can be used to gather data "sloppily." I assume
then, that more complex analysis (i.e., the equivalent of sub-queries,
would be the responsibility of the client (which seems to underlie what
you are suggesting.)
I don't think that this necessarily goes against the principles of REST
per se; complex XPath expressions could always be encoded as URLs in
some manner to provide the sort of complex joins you are talking about.
I believe Bosworth is saying that supporting that kind of functionality
simply won't scale massively because the amount of information would need
to be collected in one place. In the presentation he asks, "what do you
do if Oracle isn't big enough?" By simplifying what is being stored, there
are opportunities to scale linearly much more easily (but again, I assume
that this means some burden is shifted to the client.)
I actually think he's correct that RSS/Atom is becoming the standard
"Noun" format that is the subject of the HTTP "Verbs" (with proxies
and other intermediaries becoming the "Adverbs" I guess.)
I'd be curious to hear what others think of this.
----- Original Message -----
From: "Roger L. Costello" <costello@...>
Sent: Friday, May 06, 2005 4:14 PM
Subject: [rest-discuss] The role of queries in REST?
My question is with regards to the role of a Web site in supporting queries.
Let me give an example to demonstrate what I mean.
Suppose that a Web site implements this "hierarchical model of resources"
for a bombing mission:
By implementing this hierarchy the Web site gives users the ability to get
any resource by simply composing a URL, where "/" is used to express a
parent-child relationship in the resource hierarchy. For example, to obtain
the AA36 aircraft resource in Plan2 the user issues this URL:
This is, of course, standard REST.
Now consider this problem: how would the Web site support the many kinds of
queries that a user might want to make, e.g.,
"Tell me all the Aircraft that carry Bomb1"
The first approach that comes to mind is for the Web site to make available
a "form" that the user can retrieve, fill in, and return. The Web site
parses the form to extract the query, processes it, and returns the results
to the user.
However, there is a problem with this approach. There are virtually
infinitely many different kinds of queries that users may want to make.
How can a Web site possibly provide a form for every conceivable kind of
query? It would be impossible to anticipate every kind of query that users
might want to make.
More importantly, I believe that focusing on "forms" is missing the point of
Let me now restate my original question:
What is the role of queries in a REST-based system? How can a Web site
users the ability to retrieve the kinds of custom data that they desire?
How are queries done in a RESTful manner?
Below are some thoughts that I have on this issue.
I believe that the REST model can be simply summed up as:
"A Web site is composed of resources. A Web site should provide a URL
each resource and enable the exchange, updating and deleting of
Thus, with REST it is always an exchange of resources and nothing else.
So when we start talking about a user filling in a form we are either
talking about a "form resource" or we are breaking away from the REST model.
If we are talking about a "form resource" then how would it fit into the
above mission resource hierarchy?
I believe that it is not appropriate in REST to talk about forms. Instead,
we should talk about resources.
I believe that with the REST model the idea of issuing queries doesn't make
sense. With REST we exchange resources, not queries.
That said, I understand the desire to enable a user to query to a Web site
for information such as "what aircraft carry Bomb1?".
One solution is: this is a user processing issue, not a Web site resource
issue, so it is outside the scope of REST. In other words, if a user wants
to know what aircraft carry Bomb1 then it is up to the user to retrieve each
aircraft resource and do processing on each aircraft resource to determine
if it carries Bomb1.
That's not a particularly satisfying solution. Perhaps there a way to
rephrase the question so that it involves an exchange of resources, rather
than a query exchange?
I would appreciate hearing your thoughts on this issue. /Roger
- << Previous post in topic Next post in topic >>