FWIW, YAZ CQL parser produces similar result, except that prefix
<name></name>
is not present.
I expect there would be other areas where result would not be similar.
For example:
[email protected]:~/proj/yaz/test$ ../util/cql2xcql
>dc="first" >dc="second" dc.title=x
<searchClause>
<prefixes>
<prefix>
<identifier>second</identifier>
</prefix>
</prefixes>
<index>title</index>
<relation>
<value>=</value>
</relation>
<term>x</term>
</searchClause>
YAZ CQL parser always try to _resolve_ the prefixes. And prefixes only
occur in <searchClause> and nowhere else. In other words, prefixes only
occur at leaves in the parse tree.
For example:
[email protected]:~/proj/yaz/test$ ../util/cql2xcql
>p1 (f=a and f=b)
<triple>
<boolean>
<value>and</value>
</boolean>
<leftOperand>
<searchClause>
<prefixes>
<prefix>
<identifier>p1</identifier>
</prefix>
</prefixes>
<index>f</index>
<relation>
<value>=</value>
</relation>
<term>a</term>
</searchClause>
</leftOperand>
<rightOperand>
<searchClause>
<prefixes>
<prefix>
<identifier>p1</identifier>
</prefix>
</prefixes>
<index>f</index>
<relation>
<value>=</value>
</relation>
<term>b</term>
</searchClause>
</rightOperand>
</triple>
The reason for choosing this route, is that a backend (CQL-to-something)
then don't have to do prefix-to-identifier resolving.
/ Adam
Robert Sanderson wrote:
>> In the past I have found that this query is legal and very ugly:
>> prox and/or <dc:title>and or</dc:title> and or
>
>
> Here's the equally ugly XCQL output from my parser:
>
> <triple xmlns="http://www.loc.gov/zing/cql/xcql/">
> <boolean>
> <value>and</value>
> <modifiers>
> <modifier>
> <type>or</type>
> <comparison><</comparison>
> <value>dc:title</value>
> </modifier>
> </modifiers>
> </boolean>
> <leftOperand>
> <searchClause>
> <index>cql.serverchoice</index>
> <relation>
> <value>scr</value>
> </relation>
> <term>prox</term>
> </searchClause>
> </leftOperand>
> <rightOperand>
> <searchClause>
> <prefixes>
> <prefix>
> <name></name>
> <identifier>and</identifier>
> </prefix>
> </prefixes>
> <index>or</index>
> <relation>
> <value><</value>
> <modifiers>
> <modifier>
> <type>dc:title</type>
> <comparison>></comparison>
> <value>and</value>
> </modifier>
> </modifiers>
> </relation>
> <term>or</term>
> </searchClause>
> </rightOperand>
> </triple>
>
>
> ,'/:. Dr Robert Sanderson ([log in to unmask])
> ,'-/::::. http://www.o-r-g.org/~azaroth/
> ,'--/::(@)::. Dept. of Computer Science, Room 805
> ,'---/::::::::::. University of Liverpool
> ____/:::::::::::::. L5R Shop: http://www.cardsnotwords.com/
> I L L U M I N A T I
>
|