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 3832 - Static typing in use cases
Summary: Static typing in use cases
Status: RESOLVED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 1.0.1
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: Frans Englich
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-13 15:59 UTC by Nick Jones
Modified: 2007-09-14 11:35 UTC (History)
0 users

See Also:


Attachments

Description Nick Jones 2006-10-13 15:59:51 UTC
The following use cases tests are giving us static type checking error for function calls on the lines indicated. I am unsure of the best resolution, but here is the list anyway:

xmp-queries-results-q9

where contains($t/text(), "XML")

Cbcl.Xml.XPath2.XPathException: Static type check failed for function 'http://www.w3.org/2005/xpath-functions:contains'.  Expected 'http://www.w3.org/2001/XMLSchema:string?' for argument '0', but found 'http://www.w3.org/2001/XMLSchema:string*'.



rdb-queries-results-q1
rdb-queries-results-q5
rdb-queries-results-q7

contains($i/description, "Bicycle")

Cbcl.Xml.XPath2.XPathException: Static type check failed for function 'http://www.w3.org/2005/xpath-functions:contains'.  Expected 'http://www.w3.org/2001/XMLSchema:string?' for argument '0', but found 'http://www.w3.org/2001/XMLSchema:string*'.



rdb-queries-results-q9

item_tuple[year-from-date(end_date) = 1999 and month-from-date(end_date) = $m]

Cbcl.Xml.XPath2.XPathException: Static type check failed for function 'http://www.w3.org/2005/xpath-functions:year-from-date'. Expected 'http://www.w3.org/2001/XMLSchema:date?' for argument '0', but found 'http://www.w3.org/2001/XMLSchema:date*'.



string-queries-results-q2

contains($t/text(), "Foobar Corporation")

Cbcl.Xml.XPath2.XPathException: Static type check failed for function 'http://www.w3.org/2005/xpath-functions:contains'.  Expected 'http://www.w3.org/2001/XMLSchema:string?' for argument '0', but found 'http://www.w3.org/2001/XMLSchema:string*'.



string-queries-results-q4

let $partners := local:partners($c/name)

Cbcl.Xml.XPath2.XPathException: Static type check failed for function 'http://www.w3.org/2005/xquery-local-functions:partners'.  Expected 'http://www.w3.org/2001/XMLSchema:string' for argument '0', but found 'http://www.w3.org/2001/XMLSchema:string*'.



string-queries-results-q5

where contains(string($item/content), "Gorilla Corporation")

Cbcl.Xml.XPath2.XPathException: Static type check failed for function 'http://www.w3.org/2005/xpath-functions:string'.  Expected '(http://www.w3.org/2001/XMLSchema:anyAtomicType | attribute() | comment() | document() | element() | processing-instruction() | text())?' for argument '0', but found 'element()*'.
Comment 1 Michael Kay 2006-10-13 16:38:12 UTC
>where contains($t/text(), "XML")

This is one of the few cases reported where static typing is quite right to reject the query. This use of /text() in the published use cases is really bad coding style and has been slavishly copied by large sections of the XQuery user community. It's wrong, of course, because it fails when an element contains comments or PIs. It's too late to undo the damage now, but such tests should be changed to say

where contains(string($t), "XML")

Michael Kay
Comment 2 Nick Jones 2006-12-15 13:19:26 UTC
The following use cases also have functions which have expressions typed as being * passed in which causes static typing errors

ns-queries-results-q7: normalize-uri(...)
sgml-queries-results-q10: << ...
rdb-queries-results-q6: ... *
rdb-queries-results-q2: contains(...)
Comment 3 Frans Englich 2007-09-14 09:34:51 UTC
A fix has been attempted in CVS, XQTS_current.zip is updated.

If the resolution is satisfactory, feel free to change status to CLOSED. Otherwise, reopen this report. If no feedback is returned within two weeks, status will be changed to CLOSED. Thanks for reporting!
Comment 4 Nick Jones 2007-09-14 11:35:56 UTC
I think as a result of the change for this xmp-queries-results-q2 is now not working, due to an extra exactly-one for $b; the enclosed expression does contain more than one item.