[Bug 3717] Cardinality inference for 'cast as' should take operand into account

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3717

           Summary: Cardinality inference for 'cast as' should take operand
                    into account
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Formal Semantics
        AssignedTo: simeon@us.ibm.com
        ReportedBy: frans.englich@telia.com
         QAContact: public-qt-comments@w3.org


Recently, there has been reports on tests in the XQTS which uses cast
expressions as operands to expressions that expects exactly-one. An example:

        fn:dateTime(xs:date("1999-12-31"), xs:time("12:00:00"))

This query contains two type errors, because the operands are typed as
xs:date?/xs:time? while xs:date/xs:time is expected.

One runs easily into this problem, because as soon one wants to specify a
literal using a constructor function, one gets a type error, which to me seems
counter intuitive.

Therefore, I suggest to change the inference rule for 'cast as' to have as
cardinality exactly-one if its operand's cardinality is exactly-one(that is,
whether the '?' is specified is ignored for computing the static type).

See:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=3686
http://www.w3.org/Bugs/Public/show_bug.cgi?id=3651

Received on Wednesday, 13 September 2006 11:55:17 UTC