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

[r2003-11-27 15:31:59 by cmiachon] Empty log message

Original author: cmiachon
Date: 2003-11-27 15:31:59+00:00
parent 3cd84884
......@@ -250,16 +250,24 @@ EXTEND
|
[ e1 = expr; op = ["*"]; e2 = expr -> exp loc (Op (op,[e1;e2]))
| e1 = expr; "&&"; e2 = expr -> exp loc (logical_and e1 e2)
| e = expr; op = "/"; p = pat ->
let tag = mk loc (Internal (Types.atom (Atoms.any))) in
| e = expr; "/" ;
t = [a = pat ->
let tag = mk loc (Internal (Types.atom (Atoms.any))) in
let att = mk loc (Internal Types.Record.any) in
let any = mk loc (Internal (Types.any)) in
let re = Star(Alt(SeqCapture(id_dummy,Elem p), Elem any)) in
let re = Star(Alt(SeqCapture(id_dummy,Elem a), Elem any)) in
let ct = mk loc (Regexp (re,any)) in
let p = mk loc (XmlT (tag, multi_prod loc [att;ct])) in
let b = (p, Var (Id.value id_dummy)) in
exp loc (Transform (e,[b]))
(p, Var (Id.value id_dummy))
| "@"; a = [IDENT|keyword]-> (* projection sur 1 attribut *)
let tag = mk loc (Internal(Types.atom Atoms.any)) in
let any = mk loc (Internal(Types.any)) in
let att = mk loc (Record(true,[(label a,mk loc (PatVar(U.mk "$$$")))]))in
let ct= mk loc (Regexp(Elem any , any)) in
let p = mk loc(XmlT (tag,multi_prod loc[att;ct])) in
(p, Pair(Var (Id.value id_dummy),cst_nil))
] -> exp loc (Transform (e,[t]))
]
|
[ e = expr; "."; l = [IDENT | keyword ] ->
......
(* /@ not implemented
let q1x =
<bib>
select <book year=y>t
from b in [doc]/<book>_ ,
y in b/@year,
p in b/<publisher>_,
t in b/<title>_
where (p = [<publisher>"Addison-Wesley"]) and (int_of(y)>>1991);;
*)
select <book year=y>([b]/<title>_)
from b in [doc]/<book>[_* <publisher>"Addison-Wesley";_] ,
y in [b]/@year
where (int_of(y)>>1991);;
let q1p =
......
......@@ -61,3 +61,4 @@ from b in [doc]/<book>[ _* <publisher>['Addison-Wesley'];_],
y in [doc]/@year
where int_of(y) >> 1991
) in <bib>q;;
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