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 10706 - [XPath30] subtype-itemtype not defined for function types with annotation assertions.
Summary: [XPath30] subtype-itemtype not defined for function types with annotation ass...
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 3.0 (show other bugs)
Version: Member-only Editors Drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: John Snelson
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-23 17:41 UTC by Oliver Hallam
Modified: 2011-10-04 16:28 UTC (History)
4 users (show)

See Also:


Attachments

Description Oliver Hallam 2010-09-23 17:41:52 UTC
This also applies to XQuery 1.1

Section 2.5.5.2 gives a definition for the rule subtype-itemtype(Ai, Bi).

There are no rules given for FunctionTests that have annotation assertions, and so this judgement should always return false for them.  The upshot of this is that matching sequence types containing annotation assertions can never match.

The list of rules should be extended such that:

[Assertions1] FuntionTest1 matches [Assertions2] FunctionTest2

iff

FunctionTest1 matches FunctionTest2
and [Assertions1] matches [Assertions2]

where we need to define what if means for two sets of assertions to match.


I think the rules for matching assertions boil down to:

if [Assertions1] matches [Assertions2] then %assertion [Assertions1] matches [Assertions2]

[Assertions1] matches [] (no assertions)

%assertion matches %assertion

%fn:non-deterministic matches %fn:deterministic

Any rules defined in other specifications (e.g. %simple matches %updating) and any further implementation defined rules.



An alternative solution could be to just remove the subtype() judgement entirely as I don't think it is referred to anywhere!
Comment 1 Oliver Hallam 2010-09-23 17:44:45 UTC
Similarly, the section on Sequence Type matching doesn't explicitly mention assertions, and probably should.  The only normative text about how they affect things is in the Sequence Type Syntax section:

 Annotation assertions further restrict the set of function items that are matched by a FunctionTest.

This should be made more explicit in the Sequence Type Matching section.
Comment 2 Michael Dyck 2010-09-23 18:43:11 UTC
(In reply to comment #0)
> 
> An alternative solution could be to just remove the subtype() judgement
> entirely as I don't think it is referred to anywhere!

It's referred to in 2.5.4.2 (Matching an ItemType and an Item), in the second-last bullet, the one for TypedFunctionTest. I think that's the only use.
Comment 3 John Snelson 2010-11-09 17:27:04 UTC
I don't think we can say anything about annotations and annotation assertions that we don't define, but I agree that we need particular rules for the assertions we do define.

1) The annotations %public and %private should have no effect on subtype-itemtype(), and they should be an error if used as annotation assertions.

2) If two function tests match disregarding annotations, then Ai is a subtype of Bi if Bi has the %non-deterministic annotation, or if Ai does not have the %non-deterministic annotation. That is:

%deterministic (or neither) <: %deterministic (or neither)
%deterministic (or neither) <: %non-deterministic
%non-deterministic <: %non-deterministic
Comment 4 Oliver Hallam 2010-11-09 18:22:21 UTC
The additions you proposed are not a closed set.

We would need an additional rule somthing along the lines of:

In the addition of any other annotations, the result of sequence type matching is implementation defined.

I think we should also add another rule along the lines of:

If Bi is a function test with no annotations then any annotations on Ai do not affect the subtype judgement.
Comment 5 John Snelson 2011-02-01 14:31:16 UTC
Since we've removed %deterministic and %non-deterministic, I think this becomes a bit easier. I propose the following changes to section 2.5.5.2 of the XQuery 3.0 spec:

Change the last bullet from:

"Bi is function(Ba_1, Ba_2, ... Ba_N) as Br, Ai is function(Aa_1, Aa_2, ... Aa_M) as Ar, N (arity of Bi) equals M (arity of Ai), subtype(Ar, Br), and for values of I between 1 and N, subtype(Ba_I, Aa_I)."

to:

"Bi is [AnnotationsB] function(Ba_1, Ba_2, ... Ba_N) as Br, Ai is [AnnotationsA] function(Aa_1, Aa_2, ... Aa_M) as Ar, N (arity of Bi) equals M (arity of Ai), subtype(Ar, Br), for values of I between 1 and N, subtype(Ba_I, Aa_I), and subtype-assertions(AssertionsA, AssertionsB)

The judgement subtype-assertions(AssertionsA, AssertionsB) is defined to ignore annotation assertions in namespaces not understood by the XQuery implementation. For assertions that are understood, their effect on the result of subtype-assertions() is implementation defined."
Comment 6 Jonathan Robie 2011-10-04 16:28:28 UTC
I believe this is fixed in internal draft now.