X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=tree.mli;h=c38ab021e05e87fdac2b14cedee48aca0ca565ee;hb=d550133ad7afdf65c5e284c2bcf67a5bdde6faa7;hp=b252bab43dffb3f37964b4c139a00cd1dfc8c550;hpb=83aa6cf8a120ea6681402ce42ae56631fca1ddf4;p=SXSI%2Fxpathcomp.git diff --git a/tree.mli b/tree.mli index b252bab..c38ab02 100644 --- a/tree.mli +++ b/tree.mli @@ -1,62 +1,77 @@ -(******************************************************************************) -(* SXSI : XPath evaluator *) -(* Kim Nguyen (Kim.Nguyen@nicta.com.au) *) -(* Copyright NICTA 2008 *) -(* Distributed under the terms of the LGPL (see LICENCE) *) -(******************************************************************************) -module type BINARY = -sig - type node_content - type string_content - type descr = Nil| Node of node_content | String of string_content - type t - val parse_xml_uri : string -> t - val parse_xml_string : string -> t - val save : t -> string -> unit - val load : ?sample:int -> string -> t - val tag_pool : t -> Tag.pool - val string : t -> string - val descr : t -> descr - val is_node : t -> bool - val left : t -> t - val right : t -> t - val first_child : t -> t - val next_sibling : t -> t - val parent : t -> t - val root : t -> t - val is_root : t -> bool - val id : t -> int - val tag : t -> Tag.t - val print_xml_fast : out_channel -> t -> unit - val compare : t -> t -> int - val equal : t -> t -> bool - module DocIdSet : - sig - include Set.S - end with type elt = string_content - val string_below : t -> string_content -> bool - val contains : t -> string -> DocIdSet.t - val contains_old : t -> string -> DocIdSet.t - val contains_iter : t -> string -> DocIdSet.t - val count_contains : t -> string -> int - val count : t -> string -> int - val dump : t -> unit - val get_string : t -> string_content -> string - val has_tagged_desc : t -> Tag.t -> bool - val has_tagged_foll : t -> Tag.t -> bool - val tagged_desc : t -> Tag.t -> t - val tagged_foll : t -> Tag.t -> t - val tagged_next : t -> Tag.t -> t - val subtree_tags : t -> Tag.t -> int - val is_left : t -> bool -end - -module Binary : BINARY - -IFDEF DEBUG -THEN -module DEBUGTREE : sig - include BINARY - val print_stats : Format.formatter -> unit -end -ENDIF +type t + +val init_contains : t -> string -> unit +val init_naive_contains : t -> string -> unit + + +val parse_xml_uri : string -> t +val parse_xml_string : string -> t +val save : t -> string -> unit +val load : ?sample:int -> string -> t +val tag_pool : t -> Tag.pool + + +type 'a node = private int +type node_kind = [ `Tree | `Text ] +val equal : [ `Tree ] node -> [ `Tree ] node -> bool +val compare : [ `Tree ] node -> [ `Tree ] node -> int +val dump_node : 'a node -> string + + +val nil : [ `Tree ] node +val root : [ `Tree ] node + +val is_root : [ `Tree ] node -> bool +val is_nil : [ `Tree ] node -> bool + +val parent : t -> [ `Tree ] node -> [ `Tree ] node +val first_child : t -> [ `Tree ] node -> [ `Tree ] node +val first_element : t -> [ `Tree ] node -> [ `Tree ] node +val tagged_child : t -> Tag.t -> [ `Tree ] node -> [ `Tree ] node + +val select_child : t -> Ptset.Int.t -> [ `Tree ] node -> [ `Tree ] node + +val next_sibling : t -> [ `Tree ] node -> [ `Tree ] node +val next_element : t -> [ `Tree ] node -> [ `Tree ] node + +val next_sibling_ctx : t -> [ `Tree ] node -> [ `Tree ] node -> [ `Tree ] node +val next_element_ctx : t -> [ `Tree ] node -> [ `Tree ] node -> [ `Tree ] node + +val tagged_sibling : t -> Tag.t -> [ `Tree ] node -> [ `Tree ] node +val tagged_sibling_ctx : t -> Tag.t -> [ `Tree ] node -> [ `Tree ] node -> [ `Tree ] node + +val select_sibling : t -> Ptset.Int.t -> [ `Tree ] node -> [ `Tree ] node +val select_sibling_ctx : t -> Ptset.Int.t -> [ `Tree ] node -> [ `Tree ] node -> [ `Tree ] node + + + +val tag : t -> [ `Tree ] node -> Tag.t +val id : t -> [ `Tree ] node -> int + +val tagged_desc : t -> Tag.t -> [ `Tree ] node -> [`Tree] node +val select_desc : t -> Ptset.Int.t -> [ `Tree ] node -> [`Tree] node + +val tagged_foll_ctx : t -> Tag.t -> [ `Tree ] node -> [`Tree] node -> [ `Tree ] node +val select_foll_ctx : t -> Ptset.Int.t -> [ `Tree ] node -> [`Tree] node -> [ `Tree ] node + +val count : t -> string -> int +val print_xml_fast : out_channel -> t -> [ `Tree ] node -> unit + +val tags_children : t -> Tag.t -> Ptset.Int.t +val tags_below : t -> Tag.t -> Ptset.Int.t +val tags_siblings : t -> Tag.t -> Ptset.Int.t +val tags_after : t -> Tag.t -> Ptset.Int.t +val tags : t -> Tag.t -> Ptset.Int.t*Ptset.Int.t*Ptset.Int.t*Ptset.Int.t +val is_below_right : t -> [`Tree] node -> [`Tree] node -> bool +val is_left : t -> [`Tree] node -> bool + +val binary_parent : t -> [`Tree] node -> [`Tree] node + +val count_contains : t -> string -> int +val unsorted_contains : t -> string -> unit +val text_size : t -> int +val doc_ids : t -> [`Tree] node -> [`Text] node * [`Text] node +val subtree_tags : t -> Tag.t -> [`Tree] node -> int +val get_text : t -> [`Tree] node -> string + +val dump_tree : Format.formatter -> t -> unit