(* *)
(* TAToo *)
(* *)
-(* Lucca Hirschi, ? *)
-(* ? *)
+(* Lucca Hirschi, LRI UMR8623 *)
+(* Université Paris-Sud & CNRS *)
(* *)
(* Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
(* Recherche Scientifique. All rights reserved. This file is *)
| [s] -> trans_last s
| s :: tl -> trans tl; trans_step s
| [] -> ()
-
+
(* Add THE top most state for top-level query (done in the end) *)
and trans_init () =
let top_st = Asta.new_state () in
let or_top =
- List.fold_left (fun acc x -> ((`Left *+ x) +| acc))
+ List.fold_left (fun acc x -> ((`Left *+ x) +| acc))
(Formula.false_) (Asta.top_states asta)
in
Asta.add_quer asta top_st;
Asta.add_top asta top_st;
Asta.add_bot asta top_st; (* for trees which are leaves *)
Asta.add_tr asta (top_st, Asta.any_label, or_top) true
-
+
(* A selecting state is needed *)
and trans_last (ax,test,pred) =
let fo_p = trans_pr pred in
and tr_q = (q, Asta.any_label, form_propa_selec q q' ax) in
Asta.add_tr asta tr_selec true;
Asta.add_tr asta tr_q true
-
+
(* Add a new state and its transitions for the step *)
and trans_step (ax,test,pred) =
let fo_p = trans_pr pred
let Simple label = test
and form_next = (fo_p) *& (* (\/ top_next) /\ predicat *)
(List.fold_left (fun acc x -> (`Left *+ x ) +| acc)
- Formula.false_ (Asta.top_states asta)) in
+ Formula.false_ (Asta.top_states asta)) in
let tr_next = (q, label, form_next)
and tr_propa = (q, Asta.any_label, form_propa q ax) in
Asta.add_quer asta q;
Asta.add_tr asta tr_propa true;
Asta.init_top asta;
Asta.add_top asta q
-
+
(* Translating of predicates. Either we apply De Morgan rules
in xPath.parse or here *)
and trans_pr = function
| Not (Expr Path q) -> (trans_pr_path false q)
| Expr Path q -> (trans_pr_path true q)
| x -> print_predicate pr_er x; raise Not_core_XPath
-
+
(* Builds asta for predicate and gives the formula which must be satsified *)
and trans_pr_path posi = function
| Relative [] -> if posi then Formula.true_ else Formula.false_
Formula.false_ (trans_pr_step_l steps)
| AbsoluteDoS steps as x -> print pr_er x; raise Not_core_XPath
| Absolute steps as x -> print pr_er x; raise Not_core_XPath
-
+
(* Builds asta for a predicate query and give the formula *)
and trans_pr_step_l = function
| [step] -> trans_pr_step [] step