Bug 4321 - [XQuery] Importing the types used in the signature of an imported function
: [XQuery] Importing the types used in the signature of an imported function
Status: CLOSED FIXED
Product: XPath / XQuery / XSLT
XQuery 1.0
: Recommendation
: PC Windows XP
: P2 normal
: ---
Assigned To: Don Chamberlin
: Mailing list for public feedback on specs from XSL and XML Query WGs
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2007-02-13 14:10 UTC by Michael Kay
Modified: 2007-03-07 19:21 UTC (History)
0 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kay 2007-02-13 14:10:40 UTC
The specification says:

<quote>
It is a static error [err:XQST0036] to import a module if the importing
module's 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.
</quote>

This says nothing about a function declared as, say,

declare function f:foo($param as schema-element(f:bar)) {
  ...
}

I believe that the logic that led us to introduce XQST0036 applies equally in
this case, and that the error should be generalized to require the calling
module to import the schema containing the element declaration f:bar.
Comment 1 Don Chamberlin 2007-02-27 18:36:28 UTC
Michael,
Thanks for your comment, which was considered by the Query Working Group on
Feb. 27, 2007. The working group agreed to replace the paragraph quoted in your
comment with the following new paragraph:

It is a static error [err:XQST0036] to import a module if the in-scope schema
definitions of the importing module fail to include any of the following:
(a) A schema type definition for each type-name that appears in a variable or
function declaration in the imported module, if that variable or function is
referenced in the importing module.
(b) An element declaration for each element-name EN that appears in a
SequenceType of form schema-element(EN) in a variable or function declaration
in the imported module, if that variable or function is referenced in the
importing module.
(c) An attribute declaration for each attribute-name AN that appears in a
SequenceType of form schema-attribute(AN) in a variable or function declaration
in the imported module, if that variable or function is referenced in the
importing module.

Corresponding changes will be made in the definition of error XQST0036.

If you agree that these changes resolve your issue, please change the status of
this comment to Closed.

Regards,
Don Chamberlin (for the Query Working Group)
Comment 2 Michael Kay 2007-02-27 19:29:12 UTC
A couple of comments on the wording.

(a) I think "fail to include any" should perhaps be "fail to include all", or
perhaps more clearly "do not include all".

(b) The old text read "that appear in the declarations of variables and
functions (whether in an argument type or return type)" and we've lost the
phrase in parentheses, which was a useful way of saying that we're only
interested in type names that appear in the signature of a variable/function
and not in names that appear in its body.

Here's another attempt, which isn't perfect either.

It is a static error [err:XQST0036] to import a module and to reference a
function F or a variable V declared in that module if the return type or any
argument type of F, or the declared type of V, is a SequenceType containing any
of the following names, unless that name is present in the in-scope schema
definitions of the importing module:
(a) A type-name 
(b) An element-name EN that appears in a SequenceType of form
schema-element(EN) 
(c) An attribute-name AN that appears in a SequenceType of form
schema-attribute(AN) 
Comment 3 Don Chamberlin 2007-03-07 19:21:28 UTC
Michael,
Thanks for your suggestions regarding wording of this correction. On 6 Mar 2007
the working group discussed this bug report and agreed to replace the paragraph
you quoted with the following:

It is a static error [err:XQST0036] to import a module if the in-scope
schema definitions of the importing module do not include all of the following:

(a) A schema type definition for each type-name that appears:
(i) in the type of a variable that is declared in the imported module
and referenced in the importing module, OR 
(ii) in a parameter-type or result-type of a function that is declared
in the imported module and referenced in the importing module.

(b) An element declaration for each element-name EN such that:
(i) schema-element(EN) appears in the declared type of a variable 
in the imported module, and that variable is referenced in the importing
module, 
OR
(ii) schema-element(EN) appears in a parameter-type or 
result-type of
a function declared in the imported module, and that function is
referenced in the importing module.

(c) An attribute declaration for each attribute-name AN such that:
(i) schema-attribute(AN) appears in the declared type of a variable 
in the imported module, and that variable is referenced in the importing
module, 
OR
(ii) schema-attribute(AN) appears in a parameter-type or 
result-type of
a function declared in the imported module, and that function is
referenced in the importing module.

Corresponding changes will also be made in the definition of error XQST0036.
These changes will appear in a future erratum to the XQuery specification.

Since you were present at the meeting and agreed with the working group
decision, I am changing the status of this bug report to Closed.

Regards,
Don Chamberlin (for the XML Query Working Group)


  翻译: