[Developers] mql boolean constraint
Tim Sturge
tsturge at metaweb.com
Wed Jun 13 03:24:55 UTC 2007
That would be really nice, but unfortunately MQL doesn't work that way.
null in MQL is a special value which indicates the absence of a value.
So bar: null (there is no value for bar) is like name: null (there is no
name).
false is just another value, so bar: false is like name: "anything
here", there's a value that you can exactly match on. Likewise the
integer 0 and the floating point value 0.0 are just values like any
other integer or floating point value.
There's currently no way in MQL to ask "give me only the things that
don't have a value for bar (or for name)". It's been requested several
times, but is hard to implement (mostly because you have to look at
everything to decide that nothing matches).
I'm trying to think of a way to work around this, but nothing obvious
comes to mind. Since it's pretty common just to use true and leave
things that should be false unset entirely I agree MQL should provide a
way to ask for "false or not set at all" even if we don't solve the
general "things that don't have a value" problem (although whether this
one case is easier than the general problem is doubtful.)
Tim
Dae Park wrote:
> If I have a unique property (i.e., /type/foo/bar) who's expected type
> is /type/boolean, does providing a "false" constraint on that
> property also match those that have null values for that property.
> For example:
>
> [{
> id: null,
> type: "/type/foo",
> bar: false
> }]
>
> Will this give me all instances of /type/foo that has not yet set a
> boolean value for the "bar" property?
>
> -dae
> _______________________________________________
> Developers mailing list
> Developers at freebase.com
> http://lists.freebase.com/mailman/listinfo/developers
>
More information about the Developers
mailing list