[Developers] Comparison operation in write?

Kurt Bollacker kurt at metaweb.com
Mon Dec 24 04:36:31 UTC 2007


On Mon, Dec 24, 2007 at 04:00:49AM +0000, Kurt Bollacker wrote:
> 
> On Sun, Dec 23, 2007 at 06:30:50PM -0800, Arthur van Hoff wrote:
> > Here is an example: set the broadcaster for all stations that have
> > live365 in a stream URL.
> > 
> > "query":[{
> >     "type": "/user/cotton/default_domain/internet_station",
> >     "internet_streams": [{
> >         "uri~=": "*live365*",
> >         "uri":null,
> >         "type": "/user/cotton/default_domain/internet_availability"
> >     }],
> >     "/user/cotton/default_domain/broadcast/broadcaster":{
> >         "id":"/topic/en/live365",
> >         "connect":"update"
> >     }
> > }]
> 
> Before I address what I think you are asking for, let me mention that
> MQL write syntax requires that arrays of writes be explicit.  In your
> query, you are using the MQL read syntax of [{.....}] to request an
> array result.  You should be using [{...},{...},{...}] to specify an
> array read.  Also, this particular example also falls afoul of MQL

OOPS!  I meant:  "array read" --> "array write"

> write rules by asking for a literal value ("uri") in a write.  Could
> you give an example of the query you need that only requires
> additional comparison operators, but is otherwise legal MQL?  That
> might help me understand more clearly.
> 
> As a workaround, you can break this into a read then a write query
> without any loss of expressiveness.  If that won't work, let's try to
> figure something out that does.
> 
> 								Kurt :-)
> 
> > The result is:
> > 
> > {
> >   "status": "200 OK", 
> >   "code": "/api/status/error", 
> >   "messages": [
> >     {
> >       "info": {
> >         "mode": "write", 
> >         "key": "uri~="
> >       }, 
> >       "query": [
> >         {
> >           "/user/cotton/default_domain/broadcast/broadcaster": {
> >             "id": "/topic/en/live365", 
> >             "connect": "update"
> >           }, 
> >           "type": "/user/cotton/default_domain/internet_station", 
> >           "internet_streams": [
> >             {
> >               "type":
> > "/user/cotton/default_domain/internet_availability", 
> >               "uri~=": "*live365*", 
> >               "uri": null, 
> >               "error_inside": "."
> >             }
> >           ]
> >         }
> >       ], 
> >       "message": "Can't use comparison operators in a write, only in a
> > read", 
> >       "code": "/api/status/error/mql/parse", 
> >       "path": "internet_streams"
> >     }
> >   ]
> > }
> > 
> > -----Original Message-----
> > From: developers-bounces at freebase.com
> > [mailto:developers-bounces at freebase.com] On Behalf Of Kurt Bollacker
> > Sent: Sunday, December 23, 2007 6:22 PM
> > To: For discussions about MQL,Freebase API and apps built on Freebase
> > Subject: Re: [Developers] Comparison operation in write?
> > 
> > 
> > On Sun, Dec 23, 2007 at 05:46:46PM -0800, Arthur van Hoff wrote:
> > > Hi,
> > > 
> > >  
> > > 
> > > Why can't I use a comparison operation in a write? I need to fix a
> > bunch
> > > of objects that contain a particular hostname in a URL. I would seem
> > > reasonable to do this in a single operation.
> > 
> > Can you give an example of this?
> > 
> > 							Kurt :-)
> > 
> >  
> > >  
> > > 
> > > Have fun,
> > > 
> > >  
> > > 
> > >     Arthur van Hoff
> > > 
> > >  
> > > 
> > > ___________________________________________
> > > 
> > > Arthur van Hoff, Dell-ZING, CTO Software and Services.
> > > 
> > > W: 650-267-2413, F: 650-267-2498, M: 650-283-0842
> > > 
> > >  
> > > 
> > 
> > > _______________________________________________
> > > Developers mailing list
> > > Developers at freebase.com
> > > http://lists.freebase.com/mailman/listinfo/developers
> > 
> > _______________________________________________
> > Developers mailing list
> > Developers at freebase.com
> > http://lists.freebase.com/mailman/listinfo/developers
> > _______________________________________________
> > Developers mailing list
> > Developers at freebase.com
> > http://lists.freebase.com/mailman/listinfo/developers


More information about the Developers mailing list