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

(* $Id: typeutil.mli,v 1.13 2003/01/08 20:32:55 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 *)
val integer_model       : Xquery_ast.model
    (* xs:integer *)

(* 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 anynode_sequence_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 *)

(* <: xs:anySimpleType *)
val is_anysimpletype : Schema.schema -> Xquery_ast.model -> bool

(* <: atomic *)
val is_anyscalar     : Schema.schema -> Xquery_ast.model -> bool
    
(* <: numeric *)
val is_anynumeric    : Schema.schema -> Xquery_ast.model -> bool

(* <: atomic *)
val is_anyatomic     : Schema.schema -> Xquery_ast.model -> bool

(* <: atomic? *)
val is_anyatomic_optional : Schema.schema -> Xquery_ast.model -> bool

(* <: atomic* *)
val is_anyatomic_sequence : Schema.schema -> Xquery_ast.model -> bool

(* <: empty *)
val is_empty_sequence     : Schema.schema -> Xquery_ast.model -> bool

(* <: none *)
val is_empty_choice     : Schema.schema -> Xquery_ast.model -> bool

(* <: node *)
val is_anynode  : Schema.schema -> Xquery_ast.model -> bool

(* <: node* *)
val is_anynode_sequence  : Schema.schema -> Xquery_ast.model -> bool

(* <: node+ *)
val is_anynode_plus  : Schema.schema -> Xquery_ast.model -> bool

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

(* <: element *)
val is_element  : Schema.schema -> Xquery_ast.model -> bool

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

val factor_with_units    : Schema.schema -> Xquery_ast.model -> Xquery_ast.model list * Occurrence.occurs * Occurrence.occurs
val factor    		 : Schema.schema -> Xquery_ast.model -> Xquery_ast.model * Occurrence.occurs * Occurrence.occurs
val defactor  		 : Schema.schema -> Xquery_ast.model * Occurrence.occurs * Occurrence.occurs -> Xquery_ast.model
val recfactor 		 : Schema.schema -> Xquery_ast.model -> Xquery_ast.model

val factor_datatype : Xquery_ast.datatype -> Xquery_ast.datatype_kind * Occurrence.occurs * Occurrence.occurs

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

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

*)
