(***********************************************************************)
(*                                                                     *)
(*                                 GALAX                               *)
(*                            XML Query Engine                         *)
(*                                                                     *)
(*  Copyright 2000, Lucent Technologies.                               *)
(*  Distributed only by permission.                                    *)
(*                                                                     *)
(***********************************************************************)

(* $Id: typeutil.mli,v 1.10 2002/10/03 19:11:46 mff Exp $ *)

(******************)
(* Type shortcuts *)
(******************)

(* Empty types *)

val empty_sequence_model : Xquery_ast.model

(* Simple types *)

val anysimpletype_model : Xquery_ast.model
    (* xs:AnySimpleType *)
val anyscalar_model     : Xquery_ast.model
    (* xs:AnyScalar *)
val anyatomic_model     : Xquery_ast.model
    (* xs:AnyAtomic *)
val anynumeric_model    : Xquery_ast.model
    (* xs:AnyNumeric *)

(* Sequences of simple types *)

val anyatomic_optional_model : Xquery_ast.model
    (* xs:AnyAtomic? *)
val anyatomic_sequence_model : Xquery_ast.model
    (* xs:AnyAtomic* *)

(* Complex types *)

val anyelem_model : Xquery_ast.model
    (* xs:AnyElement *)
val anyattr_model : Xquery_ast.model
    (* xs:AnyAttribute *)
val anynode_model : Xquery_ast.model
    (* xs:AnyNode *)
val anyitem_model : Xquery_ast.model
    (* xs:AnyItem *)

val anyparent_model : Xquery_ast.model
val anyancestor_model : Xquery_ast.model

(************************)
(* Subtyping operations *)
(************************)

(* Main subtyping function *)

val is_subtype_of : Schema.schema -> Xquery_ast.model -> Xquery_ast.model -> bool


(* Specific subtyping functions *)

val is_anysimpletype : Schema.schema -> Xquery_ast.model -> bool

val is_anyscalar     : Schema.schema -> Xquery_ast.model -> bool
    
val is_anynumeric    : Schema.schema -> Xquery_ast.model -> bool

val is_anyatomic     : Schema.schema -> Xquery_ast.model -> bool

val is_anyatomic_optional : Schema.schema -> Xquery_ast.model -> bool

val is_anyatomic_sequence : Schema.schema -> Xquery_ast.model -> bool

val is_empty_sequence     : Schema.schema -> Xquery_ast.model -> bool

val is_anynode  : Schema.schema -> Xquery_ast.model -> bool

val is_sorttype : Schema.schema -> Xquery_ast.model -> bool

val is_element  : Schema.schema -> Xquery_ast.model -> bool

(*************)
(* Factoring *)
(*************)

val factor_with_units    : Schema.schema -> Xquery_ast.model -> Xquery_ast.model list * Bound.bound * Bound.bound
val factor    		 : Schema.schema -> Xquery_ast.model -> Xquery_ast.model * Bound.bound * Bound.bound
val defactor  		 : Schema.schema -> Xquery_ast.model * Bound.bound * Bound.bound -> Xquery_ast.model
val recfactor 		 : Schema.schema -> Xquery_ast.model -> Xquery_ast.model

val factor_datatype : Xquery_ast.datatype -> Xquery_ast.datatype_kind * Bound.bound * Bound.bound

(***************************)
(* Intersection operations *)
(***************************)

(* Main intersects function *)
(*
val has_some_intersection_with : Schema.schema -> Xquery_ast.model -> Xquery_ast.model -> bool

*)
