Commit 4cb1e23b authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-01-05 16:49:57 by cmiachon] Empty log message

Original author: cmiachon
Date: 2004-01-05 16:49:57+00:00
parent e4137992
(*
For each book with an author, return the book with its title and authors.
For each book with an editor, return a reference with the book title and the
editor s affiliation.
Solution in XQuery:
<bib>
{
for $b in doc("http://www.bn.com/bib.xml")//book[author]
return
<book>
{ $b/title }
{ $b/author }
</book>
}
{
for $b in doc("http://www.bn.com/bib.xml")//book[editor]
return
<reference>
{ $b/title }
{$b/editor/affiliation}
</reference>
}
</bib>
include "tests/cql/doc.cd" ;;
include "tests/cql/q11.cd";;
*)
(* in CQLx *)
<bib>((
select <book>(([b]/Title) @ ([b]/Author))
from b in [doc]/<book>[_ Author;_])
@
(select <reference>(([b]/Title) @ ([b]/Editor/Affiliation))
from b in [doc]/<book>[_ Editor;_]
));;
(* in CQLp *)
<bib>((
select <book>([t] @ la)
from <bib>[b::Book+] in [doc],
<book>[t&Title la::Author+ ;_] in b
)@(
select <reference>([t] @ [aff])
from <bib>[b::Book+] in [doc],
<book>[t&Title _* <editor>[_* aff&Affiliation] ;_] in b
));;
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