[Developers] API for queries

Larry Maccherone larry at maccherone.com
Thu May 3 13:17:35 UTC 2007


I found this mailing list from the mjt site.  Having used Kid and
Genshi, I'm very impressed with mjt.  It's now at the top of the short
list for a project I'm ramping up.  Keep up the good work.  However,
that's not the reason for my email.  Another aspect of this project is
also related to the work you are doing at freebase. 

 

I need a RESTful interface to my data.  

 

I'm going to build the controller myself and I'm now in the process of
designing the URL conventions.  I was hoping to mimic the  conventions
of some popular service or tool but that's not working out great.

 

I looked at Amazon's S3.  The biggest problem there is that as far as I
can tell, the only query capability is a match at the start of the key.
Also, I'm also a bit worried about the flat key/data model.  That
probably helps performance but it means that the object lives in that
place forever.  So access to http://mydata/invoices/1234/invoicelines is
impossible.  I'd have to imbed the invoice key as the start of the key
for the invoicelines bucket or I'd have to store pointers to the keys
for the invoicelines inside the invoices/1234 object.  Neither is a good
fit for my mental model which is a RESTful interface to (probably
normalized) table data.

 

I looked at MS Code Named Astoria
(http://astoria.mslivelabs.com/gettingStarted.aspx).  It's closer to my
tables of data mental model and it includes a lot of the concepts that I
was planning on including: skip/top, expand, callback, orderby, etc.  It
specifies the python/javascript square bracket key notation right in the
URL so the address for invoice 1234 is http://mydata/invoices[1234]/
<http://mydata/invoices%5b1234%5d/>  and its lines are at
http://mydata/invoices[1234]/invoicelines
<http://mydata/invoices%5b1234%5d/invoicelines> .  It deviates from
Python/JavaScript notation in that you can embed very simple queries in
the brackets.  You could write http://mydata/invoices[OrderDate gt
'1998-1-1'], where "gt" means ">".  At first blush I can't think of a
concrete objection to this but my instinct is that this sort of thing
should be done in the URL parameters.  So I would prefer
http://mydata/invoices/1234 and
http://mydata/invoices?OrderDate='>1998-1-1
<http://mydata/invoices?OrderDate='%3e1998-1-1> '.  Also, it only
supports eq, ne, gt, gteq, lt, lteq.  I also need a way to match strings
with at least what freebase provides: startswith, endswith, includes
(discerned from running the query builder linked to in earlier posts);
or maybe something like SQL's LIKE operator.   

 

I can sort of reverse engineer the freebase URL and query scheme by
looking at the output of the query builder (URL encoded JSON query
string).  It looks like your scheme may be a better fit.  Can I get
access to the freebase docs that fully describes the URL mechanisms?
Also, I'd like to hear your opinion on the Astoria URL scheme.  Do you
think square bracket notation will be a problem down the road? 

 

As an aside, I'm also curios about why implemented your own database.
I'm planning on using SQL.

 

Larry Maccherone

Carnegie Mellon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freebase.com/pipermail/developers/attachments/20070503/69e2b827/attachment-0002.htm 


More information about the Developers mailing list