You are right, from the implementation's angle, I also don't think XQuery implementation has to provide independent compilation. But the behavior or result must be conformant with<br>the implementation who provide independent compilation, right?
<br><br>Take the "redefine" as an example, no matter uniform compilation or independent <br>compilation is implemented, a module's type should not be redefined by other module.<br style="color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0);">Therefore if outside "redefine" happens, you can either consider the two types with identical<br>qname as different </span><span style="color: rgb(0, 0, 0);">types or report error when do consistency checking across modules according to
<font face="Arial" size="2">consistency
requirements. But can never consider them as the same type.<br><br>Therefore, </font></span>in my first example, the result of b.xq will be either<br>"false" or throw an error when do consistency check, but can
<br>never be "true"(even if "myType" still have same definition content after redefine),<br>right?<br><br><div><span class="gmail_quote">2008/1/12, Michael Kay <<a href="mailto:mike@saxonica.com">mike@saxonica.com
</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">I don't think a product has to provide independent
compilation to be conformant (clearly).</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">The specification says that there are consistency
requirements such that the schemas imported by different modules must be
consistent with each other in various ways. Doing such a consistency check can
be done when you "link" the modules together. In the old days "linking" was
identified as a separate step that happened between the compile and run steps;
these days it is usually done as part of loading and running. I think there's
definitely an implication that some consistency checking across modules should
be done at linking time, whenever this might be.</font></span></div><span class="q">
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Michael Kay</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"><a href="http://www.saxonica.com/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.saxonica.com/</a></font></span>
</div><br>
</span><blockquote style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> he harrison
[mailto:<a href="mailto:harrison076@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">harrison076@gmail.com</a>] <br><b>Sent:</b> 11 January 2008
03:01<br><b>To:</b> Michael Kay<br><b>Cc:</b>
<a href="mailto:talk@x-query.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">talk@x-query.com</a><br><b>Subject:</b> Re: [xquery-talk] about "module" in XQuery
spec<br></font><br></div><div><span class="e" id="q_1176d2b31dfc4bcf_3">
<div></div>Thank you Michael, seems we are now getting closer about this
issue.<br>We all agree that modules in XQuery could be compiled
independently.<br>(Original definition:<a title="module" name="1176d2b31dfc4bcf_dt-module"></a>A <b>module</b> is a fragment of XQuery code <br>that
conforms to the <a href="http://www.w3.org/TR/xquery/#doc-xquery-Module" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Module</a> grammar and
can independently undergo <br>the <a title="static analysis phase" href="http://www.w3.org/TR/xquery/#dt-static-analysis" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">static analysis
phase</a> described in <a href="http://www.w3.org/TR/xquery/#id-expression-processing" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"><b>2.2.3
Expression Processing</b></a>. )<br><br>Then to what extent this definition
"can independently undergo <br>the <a title="static analysis phase" href="http://www.w3.org/TR/xquery/#dt-static-analysis" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">static analysis
phase</a> " should be followed?<br><br>Is it an optional feature of module, or
a strict rule for any XQuery implementation?<br>This two choices will lead to
two design---although for "normal" case the two<br>designs will show no
difference, but still the two designs are different in essence, and
will<br>show different behavior under some special case such as
"redefine".<br><br>For example, if we consider it's a strict rule, then any
design <br>that could not be implemented in independent module
compilation<br>should be considered as not conformant to spec.<br>Otherwise,
we have to consider that, "can independently undergo <br>the <a title="static analysis phase" href="http://www.w3.org/TR/xquery/#dt-static-analysis" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
static analysis
phase</a> " is an optional feature of XQuery's module.<br><br>Harrison<br><br>
<div><span class="gmail_quote">2008/1/11, Michael Kay <<a href="mailto:mike@saxonica.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mike@saxonica.com</a>>:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">I think
there are two possibilities:</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">(a) both
modules use the same schema components for namespace <u><a href="http://www.w3.org/XQueryTest/simple" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/XQueryTest/simple</a></u>
, which must be the
post-redefine components. In this case the answer is
true.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">(b) the
two modules use different schema components for namespace <a href="http://www.w3.org/XQueryTest/simple" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">If
you're a user, the clear implication is: don't do this.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" 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><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Michael
Kay</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"><a href="http://www.saxonica.com/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.saxonica.com/</a></font>
</span> </div><br>
<blockquote dir="ltr" style="border-left: 2px solid rgb(0, 0, 255); padding-left: 5px; margin-left: 5px; margin-right: 0px;">
<div dir="ltr" align="left" lang="en-us">
<hr>
<font face="Tahoma" size="2"><b>From:</b> <a href="mailto:talk-bounces@x-query.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">talk-bounces@x-query.com</a> [mailto:<a href="mailto:talk-bounces@x-query.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
talk-bounces@x-query.com</a>] <b>On Behalf Of </b>he
harrison<br><b>Sent:</b> 09 January 2008 02:48<br><b>To:</b> <a href="mailto:talk@x-query.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">talk@x-query.com</a><br><b>Subject:</b> [xquery-talk] about
"module" in XQuery spec<br></font><br></div>
<div><span>
<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 href="http://www.w3.org/TestModules/moduleA" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/TestModules/moduleA</a>";
<br>import schema
namespace simple="<a href="http://www.w3.org/XQueryTest/simple" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
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 href="http://www.w3.org/TestModules/moduleB" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/TestModules/moduleB
</a>";<br>import
module namespace ma="<a href="http://www.w3.org/TestModules/moduleA" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/TestModules/moduleA</a>" at "
a.xq";<br>import schema namespace simple=" <a href="http://www.w3.org/XQueryTest/simple" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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 href="http://www.w3.org/2001/XMLSchema" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/2001/XMLSchema</a>"<br>
xmlns:simple=" <a href="http://www.w3.org/XQueryTest/simple" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/XQueryTest/simple
</a>"<br>
targetNamespace="<a href="http://www.w3.org/XQueryTest/simple" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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 href="http://www.w3.org/2001/XMLSchema" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/2001/XMLSchema
</a>"<br>
xmlns:simple="<a href="http://www.w3.org/XQueryTest/simple" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.w3.org/XQueryTest/simple</a>"<br>
targetNamespace=" <a href="http://www.w3.org/XQueryTest/simple" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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" href="http://www.w3.org/TR/xquery/#dt-module-import" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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" href="http://www.w3.org/TR/xquery/#dt-issd" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">in-scope schema
definitions</a> or <a title="statically known namespaces" href="http://www.w3.org/TR/xquery/#dt-static-namespaces" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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" href="http://www.w3.org/TR/xquery/#dt-static-error" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">static
error</a> [<a title="err:XQST0036" href="http://www.w3.org/TR/xquery/#ERRXQST0036" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">err:XQST0036</a>] to import a module if the importing
module's <a title="in-scope schema type" href="http://www.w3.org/TR/xquery/#dt-is-types" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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></span></div></blockquote></div></blockquote></div><br></span></div></blockquote></div>
</blockquote></div><br>