[Developers] multiple create unless_exists in one query

Arthur van Hoff AVH at zing.net
Tue Jan 15 23:00:45 UTC 2008


Hi Tim,

[See your example below] I am trying to write a robust application and I
would like to find a programming pattern that will work in all cases. 

In my case my application generates the query from a data structure
(i.e. it is not hand-crafted), and I would like to be able to execute
that query with a predictable result, automatically handling any edge
case and error codes as necessary.

If an error would be reported, like you suggest, I would not know how my
code could resolve the error automatically without writing a
sophisticated query analyzer that can re-submit the query as multiple
requests, which are no longer atomic.

I understand the complexity of the write semantics, but I don't see how
I can write robust code with the current (or proposed) rules. In my
humble opinion the example you provide should generate a single object.
That may be hard, but is the only reasonable outcome around which I can
write a robust application.
	
Have fun,

    Arthur van Hoff

-----Original Message-----
From: developers-bounces at freebase.com
[mailto:developers-bounces at freebase.com] On Behalf Of Tim Sturge
Sent: Tuesday, January 15, 2008 2:01 PM
To: For discussions about MQL,Freebase API and apps built on Freebase
Subject: Re: [Developers] multiple create unless_exists in one query

<snip snip>

How would you feel if the behaviour changed so that the query:

"query": [{
    "type": "/user/avh/default_domain/foo",
    "name": "foo2",
    "create":"unless_exists",
    "id":null
},{
    "type": "/user/avh/default_domain/foo",
    "name": "foo2",
    "create":"unless_exists",
    "id":null
}]

failed outright, with the message "the missing objects cannot all be 
created simultaneously"? That's probably the most consistent thing to
do.

Tim

-----

_______________________________________________
Developers mailing list
Developers at freebase.com
http://lists.freebase.com/mailman/listinfo/developers


More information about the Developers mailing list