Commit 0ea892e2 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-01-22 14:50:28 by cmiachon] Empty log message

Original author: cmiachon
Date: 2004-01-22 14:50:28+00:00
parent b1b004da
(* How many items were actioned (auction ended) in March 1999? *)
let fun count(x : [Any*]) : Int =
let tr_count((Int,[Any*]) -> Int)
| (n,[]) -> n
| (n,[_;t]) -> tr_count(n+1,t)
in tr_count(0,x);;
(* In CQLx *)
<item_count>( count(
select [ed]/_
from ed in [items]/Item_tuple/End_date
where [ed]/Char <= "1999-03-31" and [ed]/Char >= "1999-03-01"));;
(* In CQLp *)
<item_count>( count(
select ed
from <items>[i::Item_tuple*] in [items],
<item_tuple>[_* <end_date>ed ;_] in i
where ed<= "1999-03-31" and ed >= "1999-03-01"));;
(* Solution in XQuery:
let $item := doc("items.xml")//item_tuple
[end_date >= xs:date("1999-03-01") and end_date <= xs:date("1999-03-31")]
return
<item_count>
{
count($item)
}
</item_count>
*)
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