<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>13300</bug_id>
          
          <creation_ts>2011-07-19 16:32:43 +0000</creation_ts>
          <short_desc>[UPD] revalidation and in-scope schemas</short_desc>
          <delta_ts>2014-10-14 09:35:18 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Update Facility</component>
          <version>Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim Mills">tim</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>john.snelson</cc>
    
    <cc>mike</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>51272</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2011-07-19 16:32:43 +0000</bug_when>
    <thetext>XQuery specifies that the In-scope element declarations and In-scope attribute declarations are module scoped.

Validation (with the &apos;validate&apos; 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&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>51280</commentid>
    <comment_count>1</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2011-07-19 17:50:15 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; XQuery specifies that the In-scope element declarations and In-scope attribute
&gt; declarations are module scoped.
&gt; Validation (with the &apos;validate&apos; expression) validates with respect to the
&gt; in-scope schema definitions, so the effect of a validate expression may be
&gt; different depending on the module in which it is located.
&gt; In its description of upd:revalidate, XQuery Update talks about revalidation,
&gt; but doesn&apos;t specify which schema definitions this is in respect to.

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

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

These are only in scope in the main module.

&gt; In the case of a transform expression, I presume that this is the schema
&gt; 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>51297</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2011-07-19 22:14:17 +0000</bug_when>
    <thetext>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&apos;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&apos;t give a high confidence in interoperability.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>51341</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2011-07-21 08:41:27 +0000</bug_when>
    <thetext>Here&apos;s an example.

(: library module atomic.xqm :)

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

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

(: main module atomic.xq :)

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

example:update()

If I&apos;m not mistaken, applyUpdates is called with arguments $revalidation-mode &quot;strict&quot; and $inherit-namespaces true.

The query may (will? should?) fail, because revalidation would use the in-scope schemas of the main module (which doesn&apos;t import the &apos;atomic.xsd&apos;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81406</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2013-01-15 17:14:38 +0000</bug_when>
    <thetext>The Working Group discussed this and agreed that:

1. The main module&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81408</commentid>
    <comment_count>5</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2013-01-15 17:18:48 +0000</bug_when>
    <thetext>(In reply to comment #4)

A further clarification:

&gt; 2. Revalidation declarations in other modules are used in transform
&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113075</commentid>
    <comment_count>6</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2014-10-14 09:18:43 +0000</bug_when>
    <thetext>I&apos;m reopening, as I&apos;m unable to find the agreed change in the XQuery Update 3.0 editor&apos;s draft.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113080</commentid>
    <comment_count>7</comment_count>
    <who name="John Snelson">john.snelson</who>
    <bug_when>2014-10-14 09:34:31 +0000</bug_when>
    <thetext>I&apos;m closing this bug again, as the decision is recorded in changes.txt and will be made in the course of time.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>