> Date: Tue, 9 Sep 2003 11:41:03 -0400
> From: Ray Denenberg <[log in to unmask]>
>
> > Allow me to repeat the grammar in used by parsers and semantics
> > for it:
> >
> > search-clause ::= ">" [identifier "="] term cql-query
>
> Does this produce unambiguous cql?
Yes.
> Consider:
> >dc1="core-v1" dc1.title=first and dc1.title=second
> Is the second dc1 governed by the first assignment?
Yes.
> If so, is that because the first assignment is "global" (and if so
> how do we know that) or because it is the most recent assignment for
> dc1?
No, just because the grammar specifies that the "and" binds tighter
than the prefix mapping. It's exactly analogous to the way that
arithmetic in nearly all programming languages knows that a+b*c means
a+(b*c) rather than (a+b)*c -- because "*" binds tighter than "+".
This has the desirable side-effect that mappings at the beginning of a
query are "global", if you want to think of them in those terms. But
it's easy to override, as in the classic example
(>dc="http://deepcustard.org/cql/" dc.title=foo) and dc.author=bar
in which the parentheses bind the Deep Custard set only to the
"dc.title=foo" clause, so that the "dc" in "dc.title=foo" has whatever
meaning the application uses by default -- probably Dublin Core.
> How about:
> >dc1="core-v1" dc1.title=first and >dc1="core-v1a" dc1.title=second
> and dc1.title=third
This binds as
>dc1="core-v1" (
dc1.title=first and
>dc1="core-v1a" (
dc1.title=second and dc1.title=third
)
)
(Because binding is the weakest operator in CQL.)
> The third occurence of dc1 -- is it governed by the first or second
> assignment?
The second -- that is, the closest.
> I suppose the only workable rule is that a prefix in a search clause
> without an assignment is governed by the most recent assignment for
> that prefix (thus no global assignment at the beginning of the
> query).
That is a the rule that emerges from the simple grammar, yes.
> Anyway, I don't have any objection to this as long as we know (and
> agree with) the semantics.
Excellent!
_/|_ _______________________________________________________________
/o ) \/ Mike Taylor <[log in to unmask]> http://www.miketaylor.org.uk
)_v__/\ "We are ready for an unforeseen event that may or may not
occur" -- Former U.S. Vice-President Dan Quayle.
--
Listen to my wife's new CD of kids' music, _Child's Play_, at
http://www.pipedreaming.org.uk/childsplay/
|