This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13300 - [UPD] revalidation and in-scope schemas
Summary: [UPD] revalidation and in-scope schemas
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Update Facility (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-19 16:32 UTC by Tim Mills
Modified: 2014-10-14 09:35 UTC (History)
2 users (show)

See Also:


Attachments

Description Tim Mills 2011-07-19 16:32:43 UTC
XQuery specifies that the In-scope element declarations and In-scope attribute declarations are module scoped.

Validation (with the 'validate' expression) validates with respect to the in-scope schema definitions, so the effect of a validate expression may be different depending on the module in which it is located.

In its description of upd:revalidate, XQuery Update talks about revalidation, but doesn't specify which schema definitions this is in respect to.

In the case of an updating query, I presume that this is the schema definitions of the main module.

In the case of a transform expression, I presume that this is the schema definitions of the module in which the transform expression is situated.
Comment 1 Jonathan Robie 2011-07-19 17:50:15 UTC
(In reply to comment #0)
> XQuery specifies that the In-scope element declarations and In-scope attribute
> declarations are module scoped.
> Validation (with the 'validate' expression) validates with respect to the
> in-scope schema definitions, so the effect of a validate expression may be
> different depending on the module in which it is located.
> In its description of upd:revalidate, XQuery Update talks about revalidation,
> but doesn't specify which schema definitions this is in respect to.

It's pretty clear about which schema definitions are in scope. These are the ones that will be used.

> In the case of an updating query, I presume that this is the schema 
> definitions of the main module.

These are only in scope in the main module.

> In the case of a transform expression, I presume that this is the schema
> definitions of the module in which the transform expression is situated.

For any expression, I presume they are the schema definitions that are in scope, and those are the schema definitions of the module in which the expression is found.

Jonathan
Comment 2 Michael Kay 2011-07-19 22:14:17 UTC
Jonathan, I think you have missed the point of the comment, which is that upd:revalidate does not belong unambiguously to any particular module: it is performed while committing a pending update list, which might include updates generated from expressions in many different modules.

The other problem here is that we've moved to a situation where the in-scope schema for a module is almost entirely implementation-defined - so long as it includes as a minimum the components that are directly imported into the module, it can include anything else the implementor chooses. This doesn't give a high confidence in interoperability.
Comment 3 Tim Mills 2011-07-21 08:41:27 UTC
Here's an example.

(: library module atomic.xqm :)

module namespace example = "http://www.example.org/";
declare revalidation lax;
declare copy-namespaces preserve, no-inherit;
import schema namespace atomic="http://www.w3.org/XQueryTest" at "atomic.xsd";

declare updating function example:update()
{
  let $validated := validate strict { doc('atomic.xml') }
  return
    insert node
      <atomic:integer>1</atomic:integer>
    into $validated
};

(: main module atomic.xq :)

declare revalidation strict;
declare copy-namespaces preserve, inherit;
import module namespace example="http://www.example.org/" at "atomic.xqm";

example:update()

If I'm not mistaken, applyUpdates is called with arguments $revalidation-mode "strict" and $inherit-namespaces true.

The query may (will? should?) fail, because revalidation would use the in-scope schemas of the main module (which doesn't import the 'atomic.xsd').
Comment 4 Jonathan Robie 2013-01-15 17:14:38 UTC
The Working Group discussed this and agreed that:

1. The main module's revalidation declaration governs revalidation of the query as a whole, using the schema declarations of the  main module.

2. Revalidation declarations in other modules are used in transform expressions only.
Comment 5 Jonathan Robie 2013-01-15 17:18:48 UTC
(In reply to comment #4)

A further clarification:

> 2. Revalidation declarations in other modules are used in transform
> expressions only.

All transforms in a module with a revalidation declaration use the revalidation mode declared for that module.  The schemas used for revalidation are the schemas of that module.
Comment 6 Tim Mills 2014-10-14 09:18:43 UTC
I'm reopening, as I'm unable to find the agreed change in the XQuery Update 3.0 editor's draft.
Comment 7 John Snelson 2014-10-14 09:34:31 UTC
I'm closing this bug again, as the decision is recorded in changes.txt and will be made in the course of time.