Commit 2ac3c8aa authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-12-01 13:53:25 by cmiachon] CQL: q9

Original author: cmiachon
Date: 2003-12-01 13:53:25+00:00
parent 75a64da6
(* /@ not implemented (* include "tests/cql/doc.cd" ;; *)
(* include "tests/cql/doc-q5.cd" ;; *)
let q5x = let q5x =
<books-with-prices> <books-with-prices>
...@@ -10,8 +11,7 @@ from b in [doc]/<book>_ , ...@@ -10,8 +11,7 @@ from b in [doc]/<book>_ ,
t2 in [e]/<title>_, t2 in [e]/<title>_,
p2 in [e]/<price>_, p2 in [e]/<price>_,
p1 in [b]/<price>_ p1 in [b]/<price>_
where t1=t2 and int_of(y)>>1990;; where t1=t2 and int_of(y)>>1991;;
*)
let q5p = let q5p =
......
include "tests/cql/doc.cd";; include "tests/cql/doc.cd";;
(* tri a bulle *) (* tri a bulle *)
......
(*
In the document books.xml,
find all section or chapter titles that contain the word XML,
regardless of the level of nesting.
include "tests/cql/books.cd" ;;
include "tests/cql/q9.cd";;
*)
(* This query needs the Xpath // *)
(* first version of // *)
let stack = ref [<title>[_* 'XML' ;_]*] []
in let result ( [] : [] ) : [<title>[_* 'XML' ;_]*] =
match !stack with [x; y] -> [x;y] | _ -> []
in let _ = xtransform [books] with
t&<title>[_* 'XML' ;_] -> stack := [t;!stack]; [t]
in result [] ;;
(* problem: l ordre est inverse wrt the Use Case s response *)
(* subjection
e//T
where e is a sequence and T a type
is translated as :
let stack = ref [T*] []
in let result ( [] : [] ) : [T*] =
match !stack with l -> stack := [] ; l
in let _ = xtransform [books] with
x&T -> stack := [x;! stack]; [x]
in result [] ;;
maybe stack and the function result should be only defined one time
an other problem is that we are not CQLp corresponding ...
*)
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