Re: static typing and computed elements

Holger,

The XQuery static typing handles dynamic element names fine. The trick
is to realize that wildcard names are part of the type system and can be
used to type such an operation.

For instance:

element title { "Lord of the Rings" }
 has type
element title { xs:string }

and:

element { if $language = "french" then "titre" else "title" } { "LoTR" }
 has type
element * { xs:string }

where the * is a wildcard that stands for all possible QNames.

So you can statically type this expression without problem, you just get
a less precise type.

You can see more details about the typing for element constructors in
section 4.4 of the XQuery formal semantics (June working draft).

- Jerome

On Thu, 2002-01-17 at 05:09, hme@informatik.uni-rostock.de wrote:
> Hello,
> 
> I'm wondering how computed elements and static type checking fit
> together, especially if the element name is computed by an expression.
> 
> Since the element name is computed in the second dynamic evaluation
> phase how can it be used in the static typing phase?  I think for using
> computed elements You have *always* to switch to a conformance level
> which does not include static type checking. So is it really a user
> option to disable static typing as stated in the draft?  Or did I
> missed something?
> 
> And another question, will there be a way to specify different Schemas
> for the input document collection XQuery operates on and the
> constructed result set?
> 
> Regards
> 
> Holger
> 
> -- 
> Holger Meyer, Uni of Rostock, Dpt. of CS, DB Research Group
> hm at GUUG.de, http://www.informatik.uni-rostock.de/~hme/
> 

Received on Thursday, 17 January 2002 10:17:53 UTC