RE: What are the XQuery built-in types?

More generally, probably all derived types will be provided through type
annotations in the data model -- so xs:NMTOKENS is supported (and built-in
to XML Schema) just like any other derived type, but it seems that it is not
really a "built-in" type in XQuery, by the terminology in the drafts.

I am skeptical that I can query "of type xs:NMTOKENS" (or any other list
type), since it seems that I am not allowed to use that type as a
constructor: xs:NMTOKENS("A1 B2").  But then again maybe one or both of
these are allowed?

Also, what if I were to query
  if (@att instance of attribute of type xs:NMTOKEN*) ...
or
  if (data(@att) instance of xs:NMTOKEN*) ...
Do these queries succeed or fail with att is annotated with type
xs:NMTOKENS?



Thanks for the quick reply,

Michael Brundage
xquery@attbi.com

-----Original Message-----
From: Kay, Michael [mailto:Michael.Kay@softwareag.com] 
Sent: Monday, February 10, 2003 6:34 AM
To: xquery@attbi.com; public-qt-comments@w3.org
Subject: RE: What are the XQuery built-in types?


> I thought that I knew, but when I listed them all out, my
> answer was non-intuitive and I realized that there does not 
> exist a complete taxonomy in the current drafts against which 
> I can check my work.
> 
...
> 
> So it seems from the above definitions that XQuery has all of
> the built-in atomic types from XML Schema except those that 
> are derived by list, plus the extra types that XQuery adds.
> 

My understanding is that the three built-in list types of XML Schema are
available for use in XQuery as type annotations on element and attribute
nodes. You can ask:

if (@att instance of attribute of type xs:NMTOKENS) ...

What you cannot do is to associate the type xs:NMTOKENS with an atomic value
or a sequence of atomic values. Like the names of user-defined complex
types, it exists only as a name that can be used to annotate nodes. When you
atomize the node, the value that you get back is of type xs:NMTOKEN*.

I hope I've got it right...

Michael Kay

Received on Monday, 10 February 2003 16:45:51 UTC