On 14 Oct 2013, at 00:03, Benito van der Zander wrote:

>> I haven't looked, but I would assume the XQTS may define the context item 
>> for that test, no? 
> 
> I was assuming that this definition only affect the test query itself, not 
> the loaded module.

XQuery 3.0 is explicit that all modules share the same initial context item:

[Definition: The initial context item is a context item that an implementation 
can set before processing a query begins. The query body and the prolog of 
every module in a query share the same initial context item.]

I don't think this is clearly stated in 1.0.

Michael Kay
Saxonica

> 
> 
> 
> This is the test:
> 
>   <environment name="complexData">
>      <source role="." file="../fn/data/complexData.xml" validation="strict">
>         <description>Document containing some nasty cases for 
> fn:data.</description>
>         <created by="Oliver Hallam" on="2009-02-27"/>
>      </source>
>      <schema uri="http://www.cbcl.co.uk/XQueryTest/complexData"; 
> file="../fn/data/complexData.xsd">
>                  <description>Schema containing some nasty cases for 
> fn:data.</description>
>                  <created by="Oliver Hallam" on="2009-02-27"/>
>          </schema>
>   </environment>
> 
>   <test-case name="cbcl-module-004">
>      <description> Test that the context item can be used in a library 
> </description>
>      <created by="Oliver Hallam" on="2009-07-29"/>
>      <modified by="O'Neil Delpratt" on="2013-03-18" change="Corrected case of 
> directory name 'ModuleImport'"/>
>      <environment ref="complexData"/>
>      <module uri="http://www.xqsharp.com/test/context"; 
> file="ModuleImport/contextitem-lib.xq"/>
>      <test>
>        import module namespace context="http://www.xqsharp.com/test/context";;
>        count($context:item/node()/*)
>      </test>
>      <result>
>         <assert-string-value>6</assert-string-value>
>      </result>
>   </test-case>
> 
> 
> Benito
> 
> On 10/14/2013 12:18 AM, Michael Kay wrote:
>> It would be useful to identify the test in question so we can see what its 
>> dependencies are, and whether the test results have been challenged. 
>> Presumably the test metadata identifies an environment which includes a 
>> definition of the value of the initial context item for tests using that 
>> environment.
>> 
>> The basic principle is that the initial context for execution of a query is 
>> implementation-defined, but in some cases there is quite a strong 
>> expectation that the query engine will provide an API that makes it 
>> user-defined; certainly, the design of QT3 assumes that implementations will 
>> provide a way to set the context item for a query.
>> 
>> The test suite documentation says this: "Also: XQuery and XPath do not 
>> explicitly require implementations to provide a way for all values in the 
>> static and dynamic context to be set. For example, an implementation that 
>> does not allow any collations to be defined (other than the Unicode 
>> Codepoint Collation) would be technically conformant; so also would be an 
>> implementation in which the default collection is always an empty sequence. 
>> There is therefore an implicit dependency, when values are set in the 
>> environment, that the implementation allows such values to be set. An 
>> implementation that cannot set the context as required should behave in the 
>> same way as if a dependency has not been satisfied, ideally reporting the 
>> test as "notRun" with a reason."
>> 
>> In other words, it is recognized that some tests are dependent on features 
>> which not every implementation is required to provide. One of these is the 
>> ability for a calling application to set the initial context item. Where 
>> tests depend on optional features that an implementation does not provide, 
>> the implementation should not run that test, and if results are submitted to 
>> W3C, the result for that test should be documented as "notRun" with a reason.
>> 
>> Michael Kay
>> Saxonica
>> 
>> 
>> On 13 Oct 2013, at 14:07, Benito van der Zander wrote:
>> 
>>> Hi,
>>> what is the value of the context item in a variable declaration of an 
>>> module in XQuery 1?
>>> Since the spec says "The context item, position, and size in the dynamic 
>>> context of the initializing expression have initial values as described in 
>>> C.2 Dynamic Context Components." where it says "Default initial value = 
>>> none", it should be undefined.
>>> 
>>> But the new XQTS has a test
>>> 
>>>  module namespace context="http://www.xqsharp.com/test/context";;
>>>  declare variable $context:item := .;
>>> 
>>> where it is then tested for not undefined...
>>> 
>>> Benito
>>> _______________________________________________
>>> [email protected]
>>> http://x-query.com/mailman/listinfo/talk
> 


_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk

Reply via email to