if SetT.is_empty z
then Format.fprintf fmt "ø"
else
- SetT.iter (fun x -> Format.fprintf fmt "| %a@ " Transition.print x) z in
+ SetT.iter (fun x -> Format.fprintf fmt "| %a @ " Transition.print x) z in
let print_box_list fmt trans =
Format.fprintf fmt " @[<hov 0>%a @]" print_list_tr trans in
Format.fprintf fmt "@[<v 0># Queries transitions:@ %a@ @]"
print_box_list asta.trans_q;
Format.fprintf fmt "@[<v 0># Recognizing transitions:@ %a@ @]"
print_box_list asta.trans_r in
- Format.fprintf fmt "@[<v 0> ##### ASTA #####@. %a@ @]" print_box 0
+ Format.fprintf fmt "@[<v 1> ##### ASTA #####@, %a@ @]" print_box 0
let to_file out asta = ()
(** Give the list of top states of an ASTA *)
val print : Format.formatter -> t -> unit
-(** Describe the automaton as text *)
+(** Pretty printer *)
val to_file : out_channel -> t -> unit
(** Outputs the description of the automaton on the given out_channel *)
Asta.add_top asta q
and trans_pr = function (* either we apply De Morgan rules
- in xPath:parse or here *)
+ in xPath.parse or here *)
| Expr True -> Formula.true_
| Expr False -> Formula.false_
| Or (p_1,p_2) -> trans_pr(p_1) +| trans_pr(p_2)
--- /dev/null
+(***********************************************************************)
+(* *)
+(* Lucca Hirschi, ? *)
+(* ? *)
+(* *)
+(* Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
+(* Recherche Scientifique. All rights reserved. This file is *)
+(* distributed under the terms of the GNU Lesser General Public *)
+(* License, with the special exception on linking described in file *)
+(* ../LICENSE. *)
+(* *)
+(***********************************************************************)
+
+type t = int
+
+let compute tree asta = 0
+
+let print fmt run = ()
--- /dev/null
+(***********************************************************************)
+(* *)
+(* Lucca Hirschi, ? *)
+(* ? *)
+(* *)
+(* Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
+(* Recherche Scientifique. All rights reserved. This file is *)
+(* distributed under the terms of the GNU Lesser General Public *)
+(* License, with the special exception on linking described in file *)
+(* ../LICENSE. *)
+(* *)
+(***********************************************************************)
+
+(** Implementation of runs in ASTA and algorithms for computing them *)
+
+type t
+(** The type of runs in ASTA *)
+
+val compute : Tree.t -> Asta.t -> t
+(** Gives the maximal run of an ASTA on a tree *)
+
+val print : Format.formatter -> t -> unit
+(** Pretty printer *)
let build_asta query =
let asta = Compil.trans query in
- fprintf err_formatter "Compil OK !\n";
+ fprintf err_formatter "Compil OK ! ";
asta
+let compute_run doc query =
+ let run = Run.compute doc query in
+ fprintf err_formatter "Run OK ! \n";
+ run
+
let () =
let query = query () in
let doc = doc () in
let asta = build_asta query in
- fprintf err_formatter "@[<v 0> ##### Query #####@. %a@]@ "
+ let run = compute_run doc asta in
+ fprintf err_formatter "@[<v 0>##### Query #####@. %a@]@ "
XPath.Ast.print query;
- Asta.print err_formatter asta;
output_string stderr "\n##### Doc #####\n";
Tree.print_xml stderr doc (Tree.root doc);
output_string stderr "\n";
+ Asta.print err_formatter asta;
+ fprintf err_formatter "@[<v 0> ##### Run #####@. %a@]@ "
+ Run.print run;
exit 0
-
-Parse query OK ! Parse Tree OK ! Compil OK !
- ##### Query #####
- /descendant::a[descendant::c[child::e and not descendant::f[not descendant::e]/descendant::g]]/descendant::b[child::g]
- ##### ASTA #####
- # Query states: { q₁ q₂ q₈ q₉ }
- # Recognizing states: { q₀ q₃ q₄ q₅ q₆ q₇ }
- # Selecting states: { q₁ }
- # Bottom states: { q₁ q₂ q₈ }
- # Tom states: { q₉ }
- # Queries transitions:
- | q₁ ----F(b)---> ↓₁q₀
- | q₂ ----Cof(ø)---> ↓₁q₂ ∨ ↓₂q₂ ∨ ↓₁q₁ ∨ ↓₂q₁
- | q₈ ----F(a)---> (↓₁q₂ ∨ ↓₁q₁) ∧ ↓₁q₇
- | q₈ ----Cof(ø)---> ↓₁q₈ ∨ ↓₂q₈
- | q₉ ----Cof(ø)---> ↓₁q₈
- # Recognizing transitions:
- | q₀ ----F(g)---> ⊤ | q₀ ----Cof(ø)---> ↓₂q₀
- | q₃ ----F(g)---> ⊤ | q₃ ----Cof(ø)---> ↓₁q₃ ∨ ↓₂q₃
- | q₄ ----F(e)---> ⊤ | q₄ ----Cof(ø)---> ↓₁q₄ ∨ ↓₂q₄
- | q₅ ----F(f)---> ̅↓̅₁̅q̅₄ ∧ ↓₁q₃
- | q₅ ----Cof(ø)---> ↓₁q₅ ∨ ↓₂q₅ | q₆ ----F(e)---> ⊤
- | q₆ ----Cof(ø)---> ↓₂q₆
- | q₇ ----F(c)---> ↓₁q₆ ∧ ̅↓̅₁̅q̅₅
- | q₇ ----Cof(ø)---> ↓₁q₇ ∨ ↓₂q₇
+Parse query OK ! Parse Tree OK ! Compil OK ! Run OK !
+##### Query #####
+ /descendant::a[descendant::c[child::e and not descendant::f[not descendant::e]/descendant::g]]/descendant::b[child::g]
##### Doc #####
<#document><a>
<b/>
</e>
<j> <k/> <l/> <m/> </j>
</a></#document>
+
+ ##### ASTA #####
+ # Query states: { q₁ q₂ q₈ q₉ }
+ # Recognizing states: { q₀ q₃ q₄ q₅ q₆ q₇ }
+ # Selecting states: { q₁ }
+ # Bottom states: { q₁ q₂ q₈ }
+ # Tom states: { q₉ }
+ # Queries transitions:
+ | q₁ ----F(b)---> ↓₁q₀
+ | q₂ ----Cof(ø)---> ↓₁q₂ ∨ ↓₂q₂ ∨ ↓₁q₁ ∨ ↓₂q₁
+ | q₈ ----F(a)---> (↓₁q₂ ∨ ↓₁q₁) ∧ ↓₁q₇
+ | q₈ ----Cof(ø)---> ↓₁q₈ ∨ ↓₂q₈
+ | q₉ ----Cof(ø)---> ↓₁q₈
+ # Recognizing transitions:
+ | q₀ ----F(g)---> ⊤ | q₀ ----Cof(ø)---> ↓₂q₀
+ | q₃ ----F(g)---> ⊤
+ | q₃ ----Cof(ø)---> ↓₁q₃ ∨ ↓₂q₃
+ | q₄ ----F(e)---> ⊤
+ | q₄ ----Cof(ø)---> ↓₁q₄ ∨ ↓₂q₄
+ | q₅ ----F(f)---> ̅↓̅₁̅q̅₄ ∧ ↓₁q₃
+ | q₅ ----Cof(ø)---> ↓₁q₅ ∨ ↓₂q₅
+ | q₆ ----F(e)---> ⊤ | q₆ ----Cof(ø)---> ↓₂q₆
+ | q₇ ----F(c)---> ↓₁q₆ ∧ ̅↓̅₁̅q̅₅
+ | q₇ ----Cof(ø)---> ↓₁q₇ ∨ ↓₂q₇
+
+ ##### Run #####