[Developers] "Must ask for a value when you use a comparison operator"

Tim Sturge tsturge at metaweb.com
Wed Mar 14 22:44:13 UTC 2007


Hi William,

This is a very good question. The restriction is indeed artificial and I 
agree it would be good to remove it. If you're not interested in the 
value, there's no reason for MQL to require you to ask about it.

It would be more difficult to return the value automatically. Consider 
the Bradbury Building (a location in Blade Runner):

{ "id": "#9202a8c04000641f800000000047b022", "type": [], 
"/common/topic/alias": [], "name": null }

{
"alias" : [
"Bradbury Apartment Building",
"Bradbury Apartments"
],
"id" : "#9202a8c04000641f800000000047b022",
"name" : "Bradbury Building",
"type" : [
"\/common\/topic",
"\/film\/film_location"
]
}

This topic has a name and two aliases that all match ~= "Bradbury". 
Asking for:

[{ "name": null, "name~=": "Bradbury", "id": null, "type": 
"/film/film_location" }

produces

[ {
"id" : "#9202a8c04000641f800000000047b022",
"name" : "Bradbury Building",
"type" : "\/film\/film_location"
} ]

but asking for:

[{ "/common/topic/alias~=": "Bradbury", "id": null, "type": 
"/film/film_location", "/common/topic/alias": null }]

results in:

{
"info" : {
"count" : 2,
"result" : [
"Bradbury Apartment Building",
"Bradbury Apartments"
]
},
"message" : "Unique query may have at most one result. Got 2",
"path" : "\/common\/topic\/alias",
"query" : [ {
"\/common\/topic\/alias" : null,
"\/common\/topic\/alias~=" : "Bradbury",
"error_inside" : "\/common\/topic\/alias",
"id" : null,
"type" : "\/film\/film_location"
} ],
"status" : "\/mql\/status\/result_error",
"type" : "\/mql\/error"
}

as there is more than one matching alias.

This is a case where inferring "/common/topic/alias": null from 
"/common/topic/alias~=": "Bradbury" would break the query, whereas if 
MQL does not return the value there is no problem to solve.

Thanks for asking,

Tim

William Pietri wrote:
> In working my way through the docs, I've been playing around with the 
> comparison operators. I am occasionally getting the error "Must ask for 
> a value when you use a comparison operator".
>
> Why must I? For the particular query I was doing, I didn't care what the 
> value was.
>
> Or alternatively, if the value is either necessary or something that 
> almost everybody wants, wouldn't it be better just to return the value 
> without me explicitly asking for it?
>
>
> Thanks,
>
> William
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>   




More information about the Developers mailing list