Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xml-dev] Problem about imported schema type when processing XQuery module import

From: "he harrison" <harrison076@-----.--->
To: "Michael Kay" <mike@--------.--->
Date: 1/2/2008 1:26:00 PM
Hi, Micheal, thanks for your reply, however I am still in doubt.
According to the definition of "participating ISSD", it's a kind of 
in-scope schema definitions,

then whether 
in-scope schema definitions  include schemas imported in other imported modules?


There are two statement in spec.:
A <a title="http://www.w3.org/TR/xquery/#dt-module-import
module import" href="http://www.w3.org/TR/xquery/#dt-module-import">module import imports 
only functions and variable declarations; it does not import other objects from 
the imported modules, such as <a title="http://www.w3.org/TR/xquery/#dt-issd
in-scope schema definitions" href="http://www.w3.org/TR/xquery/#dt-issd">in-scope schema definitions or 
<a title="http://www.w3.org/TR/xquery/#dt-static-namespaces
statically known namespaces" href="http://www.w3.org/TR/xquery/#dt-static-namespaces">statically known 
namespaces.and
It is a <a title="http://www.w3.org/TR/xquery/#dt-static-error
static error" href="http://www.w3.org/TR/xquery/#dt-static-error">static error [<a title="http://www.w3.org/TR/xquery/#ERRXQST0036
err:XQST0036" href="http://www.w3.org/TR/xquery/#ERRXQST0036">err:XQST0036] to import a 
module if the importing module's <a title="http://www.w3.org/TR/xquery/#dt-is-types
in-scope schema type" href="http://www.w3.org/TR/xquery/#dt-is-types">in-scope schema types 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.From upon two statement, we could make the conclusion that 
in-scope schema definitions should not include 
schemas imported in other imported modules, otherwise 
[<a title="http://www.w3.org/TR/xquery/#ERRXQST0036
err:XQST0036" href="http://www.w3.org/TR/xquery/#ERRXQST0036">err:XQST0036] 
will be unnecessary, 
therefore "participating ISSD" should also not include schemas imported in other imported modules, right?

So I think two modules import identical type qname with different difinition is not an error,

unless variables with one of the types are passed to another module.

The section 2.2.5's constraints that require the 
types derived from validating input documents to be consistent with those that 
are imported into the static context helps me to clarify
another problem, thanks.



2008/1/2, Michael Kay <mike@s...
>:




I think the mailing list at talk@x...
 would be a better place for 
such a question. As it happens, your question is very similar to one raised this 
morning on that list by Weihua Jiang of Intel.
 
I believe that your query violates the rule in the 
penultimate bullet of 2.2.5 in the XQuery specification: 
 
"For a 
given query, define a participating ISSD as the 
in-scope schema definitions of a module that is used in evaluating the query. If two 
participating ISSDs contain a definition for the same schema type, element name, 
or attribute name, the definitions must be equivalent in both 
ISSDs."
 
The introductory paragraph of 2.2.5 says "This specification does not define 
the result of a query under 
any condition in which one or more of these constraints is not satisfied." - in other words, it's an error to have two 
different types with the same name, but it's not an error that an implementation 
is required to detect and report. So it's not surprising that you get different 
results from different processors, nor that the results are "obviously 
wrong".
 
Section 2.2.5 also imposes constraints that require the 
types derived from validating input documents to be consistent with those that 
are imported into the static context.
 
Michael Kay
http://www.saxonica.com/



  
  
  From: he harrison 
  [mailto:harrison076@g...] 
Sent: 02 January 2008 
  03:12
To: xml-dev@l...
Subject: [xml-dev] Problem 
  about imported schema type when processing XQuery module 
  import


  Hi, I come up with a problem when reading XQuery spec., following 
  is my case:

a.xq:

module namespace ma="http://www.w3.org/TestModules/moduleA
";
import 
  schema namespace simple="http://www.w3.org/XQueryTest/simple" 
  at "schema_a.xsd";
declare function ma:funcA()
{
   "40" 
  cast as simple:myType 
};

b.xq:

module namespace mb="http://www.w3.org/TestModules/moduleB
";
import 
  module namespace ma=" 
  http://www.w3.org/TestModules/moduleA" at "a.xq";
declare function 
  mb:funcB()
{
   ma:funcA() treat as 
  xs:integer
};

c.xq:

declare namespace mc=" 
  http://www.w3.org/TestModules/moduleC";
import module namespace mb="http://www.w3.org/TestModules/moduleB
" 
  at "b.xq";
import schema namespace simple=" http://www.w3.org/XQueryTest/simple
" 
  at "schema_c.xsd";

declare function mc:funcC()
{
  
  mb:funcB() instance of 
  simple:myType
};

<result>{mc:funcC()}</result> 
  

schema_a.xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  
           
  xmlns:simple=" 
  http://www.w3.org/XQueryTest/simple" 
  
           
  targetNamespace="http://www.w3.org/XQueryTest/simple" 
  
           
  elementFormDefault="qualified" attributeFormDefault="qualified" 
  
>
  <xs:simpleType name = 
  "myType">
     <xs:restriction base = 
  "xs:int">
      <xs:minInclusive value = 
  "1"/>
      <xs:maxInclusive value = 
  "50"/> 
    </xs:restriction>
   
  </xs:simpleType>    
  
</xs:schema>

schema_c.xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema
 " 
  
           
  xmlns:simple="http://www.w3.org/XQueryTest/simple" 
  
           
  targetNamespace="http://www.w3.org/XQueryTest/simple 
  " 
           
  elementFormDefault="qualified" 
  attributeFormDefault="qualified"
>
  <xs:simpleType name = 
  "myType">
     <xs:restriction base = 
  "xs:int"> 
      <xs:minInclusive value = 
  "51"/>
      <xs:maxInclusive value = 
  "100"/>
    </xs:restriction>
   
  </xs:simpleType>    
</xs:schema>

Main 
  module is c.xq, what should be output?
The key problem is, whether we need 
  to keep different type definition in each module,
in case imported types 
  have same name and actually are different?
I tried some XQuery processors, 
  they all give different result and most of them are obviously wrong... 
  

Another further problem is, if we choose to ignore types imported from 
  other modules, while we need to recognize types bring by XML 
  documents,
then it seems confusion when we handle a returned value of a 
  function, as we need to distinguish where the value comes from: 
defined by 
  module or get from document.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent