• Post Reply Bookmark Topic Watch Topic
  • New Topic

RESTful query query #1: XML representation

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based upon replies in previous posts (thanks Peer!), I'm setting up a data model query mechanism through a RESTful API.

So, to create a query, giving it a name of let's say "My Magic Query", a PUT request would be made to a URL such as:

http://localhost/whatever/whichever/query/My+Magic+Query

with the representation of the query as XML in the request body. (Stop me now if I'm already going astray).

The query can be against a somewhat rich data model with numerous related items. My question is: is there any standardized (or semi-standardized) query representation format that I should consider before rolling my own? In other words, is there the equivalent of representing a SQL "where clause" in XML already defined somewhere?

 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:My question is: is there any standardized (or semi-standardized) query representation format that I should consider before rolling my own? In other words, is there the equivalent of representing a SQL "where clause" in XML already defined somewhere?


There is something about this question that makes my "spidey sense" tingle.

First of all, I'm not aware of a standardized format for "SQL-style where clauses".

But even if there was, you may want to step back and think about it for a while. Undoubtedly there is a real physical data model behind your application - but do you really want that data model to leak into your query and result representation?

Databases are relational.
Objects are (hopefully) object-oriented.
XML is hopelessly hierarchical.

Can you come up with a "logical model" of the domain that you are querying (got any domain experts handy)? Can you come up with a (simple) query "langauge" that fits that "logical model" better (i.e. makes "SQL where clauses" look hopelessly convoluted (especially to domain experts)). Can that query langauge and the generated results be clearly represented in XML?

In effect you are designing an input XML document (Query Document?) for a Query Object. Or maybe you need a data specification (PDF), defining what data you need to assemble.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65519
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, my spidey sense tingled too. Which is why I wondered if this was a "known and solved" issue.

Thanks for the kick back to square one -- I was thinking that's what was called for; just needed some corroboration.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!