From benito at benibela.de Sun Oct 13 06:07:38 2013 From: benito at benibela.de (Benito van der Zander) Date: Sun, 13 Oct 2013 15:07:38 +0200 Subject: [xquery-talk] context item in module variable Message-ID: <525A9B1A.9060702@benibela.de> 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 From msokolov at safaribooksonline.com Sun Oct 13 09:43:26 2013 From: msokolov at safaribooksonline.com (Michael Sokolov) Date: Sun, 13 Oct 2013 12:43:26 -0400 Subject: [xquery-talk] context item in module variable In-Reply-To: <525A9B1A.9060702@benibela.de> References: <525A9B1A.9060702@benibela.de> Message-ID: <525ACDAE.9010508@safaribooksonline.com> On 10/13/13 9:07 AM, 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 > _______________________________________________ > talk at x-query.com > http://x-query.com/mailman/listinfo/talk I haven't looked, but I would assume the XQTS may define the context item for that test, no? From mike at saxonica.com Sun Oct 13 15:18:26 2013 From: mike at saxonica.com (Michael Kay) Date: Sun, 13 Oct 2013 23:18:26 +0100 Subject: [xquery-talk] context item in module variable In-Reply-To: <525A9B1A.9060702@benibela.de> References: <525A9B1A.9060702@benibela.de> Message-ID: <2564219F-BD3E-4CD1-B8CD-AB31E36535DE@saxonica.com> 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 > _______________________________________________ > talk at x-query.com > http://x-query.com/mailman/listinfo/talk From benito at benibela.de Sun Oct 13 16:03:00 2013 From: benito at benibela.de (Benito van der Zander) Date: Mon, 14 Oct 2013 01:03:00 +0200 Subject: [xquery-talk] context item in module variable In-Reply-To: <2564219F-BD3E-4CD1-B8CD-AB31E36535DE@saxonica.com> References: <525A9B1A.9060702@benibela.de> <2564219F-BD3E-4CD1-B8CD-AB31E36535DE@saxonica.com> Message-ID: <525B26A4.9050802@benibela.de> > 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. Otherwise such a test would rather be pointless > It would be useful to identify the test in question This is the test: Document containing some nasty cases for fn:data. Schema containing some nasty cases for fn:data. Test that the context item can be used in a library import module namespace context="http://www.xqsharp.com/test/context"; count($context:item/node()/*) 6 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 >> _______________________________________________ >> talk at x-query.com >> http://x-query.com/mailman/listinfo/talk From mike at saxonica.com Mon Oct 14 00:07:57 2013 From: mike at saxonica.com (Michael Kay) Date: Mon, 14 Oct 2013 08:07:57 +0100 Subject: [xquery-talk] context item in module variable In-Reply-To: <525B26A4.9050802@benibela.de> References: <525A9B1A.9060702@benibela.de> <2564219F-BD3E-4CD1-B8CD-AB31E36535DE@saxonica.com> <525B26A4.9050802@benibela.de> Message-ID: <1C4F0731-57A9-4334-BB2A-D7D24596F629@saxonica.com> 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: > > > > Document containing some nasty cases for fn:data. > > > > Schema containing some nasty cases for fn:data. > > > > > > Test that the context item can be used in a library > > > > > > import module namespace context="http://www.xqsharp.com/test/context"; > count($context:item/node()/*) > > > 6 > > > > > 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 >>> _______________________________________________ >>> talk at x-query.com >>> http://x-query.com/mailman/listinfo/talk > From benito at benibela.de Mon Oct 14 04:43:49 2013 From: benito at benibela.de (Benito van der Zander) Date: Mon, 14 Oct 2013 13:43:49 +0200 Subject: [xquery-talk] context item in module variable In-Reply-To: <1C4F0731-57A9-4334-BB2A-D7D24596F629@saxonica.com> References: <525A9B1A.9060702@benibela.de> <2564219F-BD3E-4CD1-B8CD-AB31E36535DE@saxonica.com> <525B26A4.9050802@benibela.de> <1C4F0731-57A9-4334-BB2A-D7D24596F629@saxonica.com> Message-ID: <525BD8F5.80602@benibela.de> > 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 had read that before, which is why the post is about XQuery 1... Then perhaps the test should have a XQuery 3 dependency? (My implementation evaluates all variables in a module only once and then shares the cached value with all queries that import the module; much more logical like compile and link in traditional languages) Benito On 10/14/2013 09:07 AM, Michael Kay wrote: > 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: >> >> >> >> Document containing some nasty cases for fn:data. >> >> >> >> Schema containing some nasty cases for fn:data. >> >> >> >> >> >> Test that the context item can be used in a library >> >> >> >> >> >> import module namespace context="http://www.xqsharp.com/test/context"; >> count($context:item/node()/*) >> >> >> 6 >> >> >> >> >> 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 >>>> _______________________________________________ >>>> talk at x-query.com >>>> http://x-query.com/mailman/listinfo/talk From mike at saxonica.com Mon Oct 14 05:19:23 2013 From: mike at saxonica.com (Michael Kay) Date: Mon, 14 Oct 2013 13:19:23 +0100 Subject: [xquery-talk] context item in module variable In-Reply-To: <525BD8F5.80602@benibela.de> References: <525A9B1A.9060702@benibela.de> <2564219F-BD3E-4CD1-B8CD-AB31E36535DE@saxonica.com> <525B26A4.9050802@benibela.de> <1C4F0731-57A9-4334-BB2A-D7D24596F629@saxonica.com> <525BD8F5.80602@benibela.de> Message-ID: On 14 Oct 2013, at 12:43, Benito van der Zander wrote: > >> 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 had read that before, which is why the post is about XQuery 1... > > Then perhaps the test should have a XQuery 3 dependency? If you think so, then you are free to challenge the test by raising a bug report. > > (My implementation evaluates all variables in a module only once and then shares the cached value with all > queries that import the module; much more logical like compile and link in traditional languages) > I don't think that was the intent of the 1.0 spec, but I agree that the spec was not clear on the point. If you raise a bug against the test then the WG will have to make a decision on the question. Michael Kay Saxonica From benito at benibela.de Mon Oct 14 05:42:39 2013 From: benito at benibela.de (Benito van der Zander) Date: Mon, 14 Oct 2013 14:42:39 +0200 Subject: [xquery-talk] context item in module variable In-Reply-To: References: <525A9B1A.9060702@benibela.de> <2564219F-BD3E-4CD1-B8CD-AB31E36535DE@saxonica.com> <525B26A4.9050802@benibela.de> <1C4F0731-57A9-4334-BB2A-D7D24596F629@saxonica.com> <525BD8F5.80602@benibela.de> Message-ID: <525BE6BF.1070807@benibela.de> > If you raise a bug against the test then the WG will have to make a decision on the question. But do they even read those? There is still no answer to my "every integer-valued xs:decimal could also be a xs:integer"-bug from last month... Your answers to the mailing list are way faster Benito On 10/14/2013 02:19 PM, Michael Kay wrote: > On 14 Oct 2013, at 12:43, Benito van der Zander wrote: > >>> 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 had read that before, which is why the post is about XQuery 1... >> >> Then perhaps the test should have a XQuery 3 dependency? > If you think so, then you are free to challenge the test by raising a bug report. >> (My implementation evaluates all variables in a module only once and then shares the cached value with all >> queries that import the module; much more logical like compile and link in traditional languages) >> > I don't think that was the intent of the 1.0 spec, but I agree that the spec was not clear on the point. If you raise a bug against the test then the WG will have to make a decision on the question. > > Michael Kay > Saxonica > > > _______________________________________________ > talk at x-query.com > http://x-query.com/mailman/listinfo/talk > From mike at saxonica.com Mon Oct 14 07:24:58 2013 From: mike at saxonica.com (Michael Kay) Date: Mon, 14 Oct 2013 15:24:58 +0100 Subject: [xquery-talk] context item in module variable In-Reply-To: <525BE6BF.1070807@benibela.de> References: <525A9B1A.9060702@benibela.de> <2564219F-BD3E-4CD1-B8CD-AB31E36535DE@saxonica.com> <525B26A4.9050802@benibela.de> <1C4F0731-57A9-4334-BB2A-D7D24596F629@saxonica.com> <525BD8F5.80602@benibela.de> <525BE6BF.1070807@benibela.de> Message-ID: On 14 Oct 2013, at 13:42, Benito van der Zander wrote: >> If you raise a bug against the test then the WG will have to make a decision on the question. > > But do they even read those? > Yes, they will find their way onto the WG agenda for discussion. But the WG doesn't look at test suite issues every week, especially if they aren't on the current critical path. Michael Kay Saxonica From mike at saxonica.com Mon Oct 14 07:43:48 2013 From: mike at saxonica.com (Michael Kay) Date: Mon, 14 Oct 2013 15:43:48 +0100 Subject: [xquery-talk] context item in module variable In-Reply-To: <525BE6BF.1070807@benibela.de> References: <525A9B1A.9060702@benibela.de> <2564219F-BD3E-4CD1-B8CD-AB31E36535DE@saxonica.com> <525B26A4.9050802@benibela.de> <1C4F0731-57A9-4334-BB2A-D7D24596F629@saxonica.com> <525BD8F5.80602@benibela.de> <525BE6BF.1070807@benibela.de> Message-ID: <76D520BF-4C94-4BEA-92FD-DB38E6EF09BB@saxonica.com> > > > There is still no answer to my "every integer-valued xs:decimal could also be a xs:integer"-bug from last month... > You raised this bug against the XQuery 1.0 test suite. XQuery 1.0 issues are a very low priority for the working group. I have transferred the problem to the QT3 test suite, where it is more likely to receive prompt attention; though it could still take a month. Michael Kay Saxonica