[Developers] Comparison operation in write?

Arthur van Hoff AVH at zing.net
Mon Dec 24 05:25:04 UTC 2007


What do you mean legal MQL? This query works just fine as a read query:

"query":[{
    "type": "/user/cotton/default_domain/internet_station",
    "internet_streams": [{
        "uri~=": "*live365*",
        "uri":null,
        "type": "/user/cotton/default_domain/internet_availability"
    }],
    "id": null,
    "name": null
}]

Also, what do you mean [{.....}] vs [{...},{...},{...}]?

Since multiple queries are not transactional I would like to write a
SINGLE query that finds all internet_stations that contain live365 in
the URL and update their broadcaster field. That should be possible,
right?

-----Original Message-----
From: developers-bounces at freebase.com
[mailto:developers-bounces at freebase.com] On Behalf Of Kurt Bollacker
Sent: Sunday, December 23, 2007 8:01 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 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
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
_______________________________________________
Developers mailing list
Developers at freebase.com
http://lists.freebase.com/mailman/listinfo/developers


More information about the Developers mailing list