Commit 066f67f1 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2005-04-24 18:07:07 by cmiachon] modifying queries + or -> || + adding .. + correcting typos

Original author: cmiachon
Date: 2005-04-24 18:07:07+00:00
parent 57664be5
......@@ -239,7 +239,7 @@ let sel = select y
from x in [bib]/<paper>_ ,
y in [x]/<title>_,
z in [x]/<author>_
where z = <author>"Alain Frisch" or z = <author>"Veronique Benzaken"
where ((z = <author>"Alain Frisch") || (z = <author>"Veronique Benzaken"));;
]]>
</sample>
<p> Which yields: </p>
......@@ -272,8 +272,8 @@ any XPath-like projections)
<sample><![CDATA[
let sel = select t
from <_>[(x::<paper>_ | _ )*] in [bib],
<_>[ _* (<author>"Alain Frisch" | <author>"Veronique Benzaken") _* (t&<title>_ ); _] in x
from <_ ..>[(x::<paper>_ | _ )*] in [bib],
<_ ..>[ _* (<author>"Alain Frisch" | <author>"Veronique Benzaken") _* (t&<title>_ ); _] in x
]]>
</sample>
......@@ -345,14 +345,14 @@ from b in [biblio]/Book ,
<sample><![CDATA[
<books-with-prices>
select <book-with-price>[t1 <price-amazon>x11 <price-bn>x10 ]
from <_>[(x3::Book|_)*] in [biblio],
<_>[(x9::Price|x5::Title|_)*] in x3,
from <_ ..>[(x3::Book|_)*] in [biblio],
<_ ..>[(x9::Price|x5::Title|_)*] in x3,
t1 in x5,
<_>[(x6::Entry|_)*] in [amazon],
<_>[(x7::Title|x8::Price|_)*] in x6,
<_ ..>[(x6::Entry|_)*] in [amazon],
<_ ..>[(x7::Title|x8::Price|_)*] in x6,
t2 in x7,
<_>[(x10::_)*] in x9,
<_>[(x11::_)*] in x8
<_ ..>[(x10::_)*] in x9,
<_ ..>[(x11::_)*] in x8
where t1=t2
]]>
</sample>
......@@ -377,6 +377,8 @@ where t1=t2
<section title="More complex Queries: on the power of patterns">
<sample><![CDATA[
let bib = [biblio]/Book;;
<bib>
select <book (a)> x
from <book (a)>[ (x::(Any\Editor)|_ )* ] in bib
......@@ -389,21 +391,21 @@ If one wants to write more explicitly:
</p>
<sample><![CDATA[
select <book (a)> x
from <book (a)>[ (x::(Any\<editor>_)|_ )* ] in bib
from <book (a)>[ (x::(Any\$$<editor ..>_$$)|_ )* ] in bib
]]>
</sample>
<p>Or even:
</p>
<sample><![CDATA[
select <book (a)> x
from <book (a)>[ (x::(<(_\`editor) ..>_)|_ )* ] in bib
from <book (a)>[ (x::(<($$_$$\$$`editor$$) ..>_)|_ )* ] in bib
]]>
</sample>
<p>Back to the first one:</p>
<sample><![CDATA[
<bib>
select <book (a)> x
from <(book) (a)>[ (x::(Any\Editor)|_ )* ] in bib
from <$$($$book$$)$$ (a)>[ (x::(Any\Editor)|_ )* ] in bib
]]>
</sample>
<p>
......@@ -412,14 +414,14 @@ removes sub-elements editor, but you will get a warning as capture variable <co
the from
</p>
<sample><![CDATA[
select <(book) (a)> x
select <$$($$book$$)$$ (a)> x
from <(book) (a)>[ (x::(Any\Editor)|_ )* ] in bib
]]>
</sample>
<p> Same thing but without tranforming tag to "book".
<p> Same thing but without tranforming tag to "book".<br/>
More interestingly:</p>
<sample><![CDATA[
select <(b) (a\id)> x
select <(b) (a\$$id$$)> x
from <(b) (a)>[ (x::(Any\Editor)|_ )* ] in bib
]]>
</sample>
......@@ -437,7 +439,7 @@ if such is not the case the expression is ill-typed. If one wants to perform thi
</p>
<sample><![CDATA[
select <(b) (a\id+{bing=a.id})> x
from <(b) (a&{id=_ ..}))>[ (x::(Any\Editor)|_ )* ] in bib
from <(b) (a&{id=_})>[ (x::(Any\Editor)|_ )* ] in bib
]]>
</sample>
</section>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment