Commit a24afdb2 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-01-21 15:11:57 by cmiachon] Empty log message

Original author: cmiachon
Date: 2004-01-21 15:11:57+00:00
parent fd968c78
(* Find cases where a user with a rating worse (alphabetically, greater)
than "C" is offering an item with a reserve price of more than 1000.
*)
(* In CQLx *)
<result>
select <warning>[!([u]/Name ) !([u]/Rating) !([i]/Description)
!([i]/Reserve_price)]
from i in [items]/Item_tuple,
u in [users]/User_tuple
where
([i]/Offered_by/_ = [u]/Userid/_) and [u]/Rating/_ >> "C" and
int_of([i]/Reserve_price/_) >> 1000
;;
(* In CQLp *)
<result>
select <warning>[n rat des p]
from <items>[i::Item_tuple*] in [items],
<item_tuple>[_ des&Description <offered_by>off _* p&<reserve_price>p_v] in i,
<users>[u::User_tuple*] in [users],
<user_tuple>[<userid>uid n&Name rat&<rating>rat_v] in u
where uid=off and rat_v>>"C" and int_of(p_v)>>1000 ;;
(* In XQUERY
<result>
{
for $u in doc("users.xml")//user_tuple
for $i in doc("items.xml")//item_tuple
where $u/rating > "C"
and $i/reserve_price > 1000
and $i/offered_by = $u/userid
return
<warning>
{ $u/name }
{ $u/rating }
{ $i/description }
{ $i/reserve_price }
</warning>
}
</result>
*)
...@@ -10,6 +10,8 @@ type Start_date = <start_date {||}>[ ( Char )* ];; ...@@ -10,6 +10,8 @@ type Start_date = <start_date {||}>[ ( Char )* ];;
type Offered_by = <offered_by {||}>[ ( Char )* ];; type Offered_by = <offered_by {||}>[ ( Char )* ];;
type Description = <description {||}>[ ( Char )* ];; type Description = <description {||}>[ ( Char )* ];;
type Itemno = <itemno {||}>[ ( Char )* ];; type Itemno = <itemno {||}>[ ( Char )* ];;
type Item_tuple = type Item_tuple =
<item_tuple {||}>[ <item_tuple {||}>[
(Itemno Description Offered_by Start_date? End_date? (Itemno Description Offered_by Start_date? End_date?
...@@ -18,6 +20,8 @@ type Item_tuple = ...@@ -18,6 +20,8 @@ type Item_tuple =
type Items = <items {||}>[ Item_tuple* ];; type Items = <items {||}>[ Item_tuple* ];;
type Rating = <rating {||}>[ ( Char )* ];; type Rating = <rating {||}>[ ( Char )* ];;
type Name = <name {||}>[ ( Char )* ];; type Name = <name {||}>[ ( Char )* ];;
type Userid = <userid {||}>[ ( Char )* ];; type Userid = <userid {||}>[ ( Char )* ];;
type User_tuple = <user_tuple {||}>[ (Userid Name Rating?) ];; type User_tuple = <user_tuple {||}>[ (Userid Name Rating?) ];;
type Users = <users {||}>[ User_tuple* ];; type Users = <users {||}>[ User_tuple* ];;
......
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