<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2>You are quite correct that the XQuery specification says
nothing about how xs:redefine is handled. This was a deliberate choice, the WG
discussed the matter and decided that nothing useful could be said. This is
because the specification quite deliberately doesn't say, in the case of "import
schema", where the schema components are obtained from, and this means that if
(as in this case) there are different versions of the schema components
available then it's not defined (by the specification) which version is
loaded.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2>I think there are two possibilities:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2>(a) both modules use the same schema components for
namespace <U>http://www.w3.org/XQueryTest/simple</U>, which must be the
post-redefine components. In this case the answer is true.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2>(b) the two modules use different schema components for
namespace <A
href="http://www.w3.org/XQueryTest/simple">http://www.w3.org/XQueryTest/simple</A>
- one gets the pre-redefine components, the other gets the post-redefine
version. This violates the consistency requirements documented in the
specification; the specification says that in this situation the results are
completely undefined. Clearly a good processor will detect the inconsistency and
refuse to run the query, but the spec makes it clear that anything might happen
- it's like submitting a random binary file to the Java VM.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2>If you're a user, the clear implication is: don't do
this.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2>If you're an implementor, the implication is: either ensure
that both modules use the post-redefine version of the type (which probably
isn't feasible if the modules are compiled separately). Alternatively,
detect and report the inconsistency if you can, but your product is not
nonconformant if you don't.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2>Incidentally, it's no different from having the two modules
import the schema from different locations and picking up different versions; it
doesn't require xs:redefine to trigger this problem.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2>You're right that XSLT handles the issue quite differently.
XSLT builds a single schema that serves all modules, both statically and
dynamically. This has the disadvantage that it makes independent compilation of
modules extremely difficult. But then, it's almost impossible to compile modules
independently in XSLT anyway.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2>Michael Kay</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=661013122-09012008><FONT face=Arial
color=#0000ff size=2><A
href="http://www.saxonica.com/">http://www.saxonica.com/</A></FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> talk-bounces@x-query.com
[mailto:talk-bounces@x-query.com] <B>On Behalf Of </B>he
harrison<BR><B>Sent:</B> 09 January 2008 02:48<BR><B>To:</B>
talk@x-query.com<BR><B>Subject:</B> [xquery-talk] about "module" in XQuery
spec<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT style="COLOR: rgb(0,0,0)" size=-1>Hi,<BR>I come up with a problem
when reading XQuery1.0 spec., following is my case:<BR><BR>a.xq:<BR><BR>module
namespace ma=" <A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/TestModules/moduleA"
target=_blank>http://www.w3.org/TestModules/moduleA</A>";<BR>import schema
namespace simple="<A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/XQueryTest/simple" target=_blank>
http://www.w3.org/XQueryTest/simple</A> " at "schema_a.xsd";<BR>declare
function ma:funcA()<BR>{<BR> "40" cast as
simple:myType<BR>};<BR><BR>b.xq:<BR><BR>declare namespace mb=" <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/TestModules/moduleB"
target=_blank>http://www.w3.org/TestModules/moduleB </A>";<BR>import module
namespace ma="<A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/TestModules/moduleA"
target=_blank>http://www.w3.org/TestModules/moduleA</A>" at " a.xq";<BR>import
schema namespace simple=" <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/XQueryTest/simple"
target=_blank>http://www.w3.org/XQueryTest/simple</A>" at
"schema_b.xsd";<BR><BR>declare function mB:funcB()<BR>{<BR> ma:funcA()
instance of
simple:myType<BR>};<BR><BR><result>{mb:funcB()}</result><BR><BR>schema_a.xsd:
<BR><BR><xs:schema xmlns:xs="<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/2001/XMLSchema"
target=_blank>http://www.w3.org/2001/XMLSchema</A>"<BR>
xmlns:simple=" <A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/XQueryTest/simple"
target=_blank>http://www.w3.org/XQueryTest/simple
</A>"<BR>
targetNamespace="<A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/XQueryTest/simple"
target=_blank>http://www.w3.org/XQueryTest/simple</A>"<BR>
elementFormDefault="qualified" attributeFormDefault="qualified"
<BR>><BR> <xs:simpleType name =
"myType"><BR> <xs:restriction base =
"xs:int"><BR> <xs:minInclusive value =
"1"/><BR> <xs:maxInclusive value =
"50"/> <BR> </xs:restriction><BR>
</xs:simpleType>
<BR></xs:schema><BR><BR>schema_b.xsd:<BR><BR><xs:schema xmlns:xs=" <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/2001/XMLSchema"
target=_blank>http://www.w3.org/2001/XMLSchema</A>
"<BR>
xmlns:simple="<A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/XQueryTest/simple"
target=_blank>http://www.w3.org/XQueryTest/simple</A>"<BR>
targetNamespace=" <A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/XQueryTest/simple"
target=_blank>http://www.w3.org/XQueryTest/simple
</A>"<BR>
elementFormDefault="qualified"
attributeFormDefault="qualified"<BR>><BR>
<redefine<BR>
schemaLocation="schema_a.xsd"><BR> <extension
base="simple:myType"> <BR>
<xs:minInclusive value =
"51"/><BR> <xs:maxInclusive
value = "100"/><BR> </extension><BR>
</redefine><BR></xs:schema><BR><BR>What would be the result of
this case? <BR>true? false? runtime error? or implementation define?<BR>Or in
another word, would the type in module a.xq should<BR>be redefined by module
c.xq's imported schema definition?<BR><BR>This case is related with how to
understand the XQuery's "module". <BR><BR>Let me give my
understanding:<BR></FONT>XSLT's module, in my understanding, should be
"included" in <BR>another module to compile, could not be compiled
independently,<BR>in other words, it's a "white box", its semantic <BR>depends
on where it's included or imported(because its schema type could be
<BR>differently redefined in different including or importing
module).<BR> <BR>While I think XQuery's module is different with XSLT's
module, I think XQuery spec. <BR>allow its module be compiled independently,
no matter where the module is imported,<BR>module's semantic should not be
changed, in other words, XQuery's module<BR>is a "black box", wherever module
is imported, module's schema type definition should not be <BR>affected by
type redefine mechanism.<BR><BR>The reason why I make such conclusion is from
following XQuery spec statement:<BR>1 "A <A title="module import"
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/TR/xquery/#dt-module-import" target=_blank>module
import</A> imports only functions and variable declarations; it does not
import other objects from the imported modules, such as <A
title="in-scope schema definitions"
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/TR/xquery/#dt-issd" target=_blank>in-scope schema
definitions</A> or <A title="statically known namespaces"
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/TR/xquery/#dt-static-namespaces"
target=_blank>statically known namespaces</A>. <SPAN
style="COLOR: rgb(255,0,0)">Module imports are not transitive</SPAN>—that is,
importing a module provides access only to function and variable declarations
contained directly in the imported module." <BR><BR>Here XQuery's statement is
clearly different with XSLT's statement about module import. <BR>In XSLT spec,
module imports are transitive while XQuery clearly stated that they <BR>are
not, so XQuery's module import must be something different with XSLT's module
import.<BR>My thought is, XQuery's module is a "black box" while XSLT's module
is a "white box"<BR><BR>2 "It is a <A title="static error"
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/TR/xquery/#dt-static-error" target=_blank>static
error</A> [<A title=err:XQST0036
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/TR/xquery/#ERRXQST0036"
target=_blank>err:XQST0036</A>] to import a module if the importing module's
<A title="in-scope schema type"
onclick="return top.js.OpenExtLink(window,event,this)"
href="http://www.w3.org/TR/xquery/#dt-is-types" target=_blank>in-scope schema
types</A> do not include definitions for the schema type names that appear in
the declarations of variables and functions (whether in an argument type or
return type) that are present in the imported module and are referenced in the
importing module."<BR><BR>Here spec. force user to import interface needed
schema types, if we consider XQuery's<BR>module as "white box", then all
imported types in "white box" has already imported, then <BR>this statement
seems <SPAN style="MARGIN-RIGHT: 15px"></SPAN>lead to redundancy, however if
we consider XQuery's module<BR>as a "black box", then this statement is quite
nature to understand. <BR><BR>Could someone offer me some comment? <BR>Many
thanks! <BR><SPAN><SPAN><BR></SPAN></SPAN></DIV></BLOCKQUOTE></BODY></HTML>