(***********************************************************************)
(*                                                                     *)
(*                               Galax                                 *)
(*                            XQuery Engine                            *)
(*                                                                     *)
(*  Copyright 2001-2003, Lucent Technologies.                          *)
(*  Distributed only by permission.                                    *)
(*                                                                     *)
(***********************************************************************)

(* $Id: datamodel_api.mli,v 1.2 2003/06/27 16:52:00 mff Exp $ *)

open Datatypes
open Datamodel

type _node   = _Node
type _atomic = _AtomicValue
type _uri    = AnyURI._uri
type _item   = _Item

class virtual item :
  object
    method virtual string_value : unit -> string
    method virtual item_sort    : unit -> string
    method virtual getAtomic    : unit -> _atomic
    method virtual getNode      : unit -> _node
  end

class virtual atomicvalue :
  object
    inherit item
    method item_sort : unit -> string
    method string_value : unit -> string
    method getNode : unit -> _node
    method virtual getAtomic : unit -> _atomic
  end

class xs_QName : 
    Datatypes.xs_QName option * _atomic option ->
      object
	inherit atomicvalue
	    (* We should implement xs:QName-in-context *)
	method getAtomic : unit -> _atomic
      end

class xs_string : 
    string option * _atomic option ->
      object
	inherit atomicvalue
	method getAtomic : unit -> _atomic
      end

class xs_boolean : 
    bool  option * _atomic option ->
      object
	inherit atomicvalue
	method getAtomic : unit -> _atomic
      end

class xs_int : 
    Datatypes.xs_int  option * _atomic option ->
      object
	inherit atomicvalue
	method getAtomic : unit -> _atomic
      end

class xs_integer : 
    Datatypes.xs_integer  option * _atomic option ->
      object
	inherit atomicvalue
	method getAtomic : unit -> _atomic
      end

class xs_decimal : 
    Datatypes.xs_decimal option * _atomic option ->
      object
	inherit atomicvalue
	method getAtomic : unit -> _atomic
      end

class xs_float : 
    float option * _atomic option ->
      object
	inherit atomicvalue
	method getAtomic : unit -> _atomic
      end

class xs_double : 
    float  option * _atomic option ->
      object
	inherit atomicvalue
	method getAtomic : unit -> _atomic
      end

class xs_anyURI : 
    string  option * _atomic option ->
      object
	inherit atomicvalue
	method getAtomic : unit -> _atomic
      end

class xs_untyped : 
    string  option * _atomic option ->
      object
	inherit atomicvalue
	method getAtomic : unit -> _atomic
      end

class virtual node :
(*  Datamodel._Node -> *)
  object
    inherit item
    method getAtomic : unit -> _atomic
    method virtual getNode : unit -> _node
    method virtual item_sort : unit -> string
    method string_value : unit -> string
  end

class document :
    (string * node list) option * _node option ->
      object
	inherit node
	method item_sort : unit -> string
	method getNode : unit -> _node
      end

class text :
    xs_string option * _node option ->
      object
	inherit node
	method item_sort : unit -> string
	method getNode : unit -> _node
      end

class attribute :
    (xs_QName * xs_string * xs_QName) option * _node option ->
      object
	inherit node
	method item_sort : unit -> string
	method getNode : unit -> _node
      end

class element :
    (xs_QName * attribute list * node list * xs_QName) option * _node option ->
      object
	inherit node
	method item_sort : unit -> string
	method getNode : unit -> _node
      end

class comment :
    xs_string option * _node option ->
      object
	inherit node
	method item_sort : unit -> string
	method getNode : unit -> _node
      end

class processing_instruction :
    (xs_string * xs_string) option * _node option ->
      object
	inherit node
	method item_sort : unit -> string
	method getNode : unit -> _node
      end

val item_to_Item      : item-> _item
val _Atomic_to_atomic : _atomic-> atomicvalue
val _Node_to_node     : _node-> node
val _Item_to_item     : _item-> item

val uri        : xs_QName -> string
val local_name : xs_QName -> string

