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 3012 - xqts static type errors
Summary: xqts static type errors
Status: RESOLVED FIXED
Alias: None
Product: XML Query Test Suite
Classification: Unclassified
Component: XML Query Test Suite (show other bugs)
Version: 0.8.4
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Ravindranath (Ravi) Chennoju
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-16 22:43 UTC by Bill Patton
Modified: 2006-05-17 23:31 UTC (History)
0 users

See Also:


Attachments

Description Bill Patton 2006-03-16 22:43:56 UTC
Our version of XQuery implements static typing and passed all but one of
the 43 static typing tests.  We also statically type checked roughly 
4000 of the XQTS test cases and found 40 cases that had one or more
static type errors, 34 of these are listed below:

The most common errors were passing sequences of length * to functions 
requiring an optional item.

The second most common type error involved queries returning the empty
type such as count(<elem/>/text()) which is an error according FS 4.0.

We only implemented the empty type rule for path expressions but found
that it reported many misspelled element names in our queries some of which 
were running in production.

We would like to know if others agree that these are static errors.
It may be premature to fix them in XQTS if the FS is still undergoing change.  
We are experimenting with type coercions that are more lenient when 
dealing with xdt:untypedAtomic sequences and are getting good results.  This
would eliminate 7 of the cases reported below.

For our tests (as allowed in the XQTS instructions) we replaced statements 
of the form:

    declare variable $input-context external;

with statements of the form:

   declare variable $input-context := doc("...");

This allows our type checker to infer the type of $input-context as
document-node().  If this is not done, the inferred type of $input-context
is item()* which will produce an enormous number of type errors.


nametest-9                  path expression returns () which is a type error
predicates-24               empnum is a sequence, xs:string takes an item?
unabbreviatedSyntax-14      $h/self::hours is empty which is a type error
filterexpressionhc4         xs:integer(hours) is a type error
nodeexpression31            $input-context1/works/employee[1]/empnum is a seq
nodeexpression47            $input-context1/works/employee[1]/empnum is a seq
Constr-elem-empty-3         (<elem/>)/node() is empty and so is a type error
Constr-elem-empty-4         ((<elem></elem>)/node()) is empty, a type error
Constr-cont-adjtext-3       (<elem>{''}</elem>)/text() is empty, a type error
Constr-cont-adjtext-4       ((<elem>{()}</elem>)/text()) is empty, a type error
Constr-docnode-parent-1     document {()})/..) is empty, a type error
ForExprType002              should use attribute(name,xdt:anyAtomicType*) 
fn-node-name-2              node-name takes an optional node()
fn-node-name-3              $input-context1/works/employee[2] is a sequence
fn-normalize-space0args-1   a[normalize-space() = '...'] is a sequence
fn-name-2                   $input-context1/works/employee[1] is a sequence
fn-name-3                   $input-context1/works/employee[1] is a sequence
fn-name-5                   $input-context1/works/nonexistent is empty
fn-name-17                  $h/self::div is empty and so is a type error
fn-name-18                  $input-context1/works/employee[2] is a sequence
fn-name-21                  $input-context1/works/employee[1] is a sequence
fn-name-22                  $input-context1/works/employee[1] is a sequence
fn-document-uri-13          type error works not present in emptydoc
fn-document-uri-14          type error works not present in emptydoc
fn-indexof-mix-args-019     bib/book[1]/publisher/text() is a sequence
xmp-queries-results-q9      $t/text() is a sequence
rdb-queries-results-q2      $i/description is a sequence
rdb-queries-results-q2      $item/description is a sequence
rdb-queries-results-q6      $item/reserve_price is a sequence
rdb-queries-results-q7      description is a sequence
sgml-queries-results-q10    $x is a sequence
string-queries-results-q2   $t/text() is a sequence
string-queries-results-q4   $c/name is a sequence
string-queries-results-q5   $item/title and $item/date are sequences
Comment 1 Carmelo Montanez 2006-04-13 20:44:05 UTC
Bill:

Thank you for the comment.  The testing Task Force is discussing 
your points and acknowledges that a number of them are bugs the 
need fixing.  The rest will be evaluated in the next few weeks.

Thanks,
Carmelo Montanez
Comment 2 Jonathan Robie 2006-04-24 21:33:29 UTC
(In reply to comment #1)
> Bill:
> 
> Thank you for the comment.  The testing Task Force is discussing 
> your points and acknowledges that a number of them are bugs the 
> need fixing.  The rest will be evaluated in the next few weeks.
> 
> Thanks,
> Carmelo Montanez
> 



I think one way of doing this would be to replace declarations of the following form:

    declare variable $input-context external;

with declarations that explicitly give the type:

   declare variable $input-context as document-node()  external;

That might require less reshuffling of the framework.
Comment 3 Carmelo Montanez 2006-04-25 19:30:57 UTC
Bill:

Once again thanks. As you indicated you can always change the "declare variable $input-context external;" to suit your needs.  In regards to the NIST tests and Use Cases tests:

1) Reviewed the NIST tests and attempted to remove the static typing issues.
2) The Use Cases are being reviewed at this time, so it is better to wait on those.

Assigning this bug to Ravi as this may involve some of his tests.

Thanks,
Carmelo
Comment 4 Ravindranath (Ravi) Chennoju 2006-05-17 23:31:19 UTC
Fixed fn-indexof-mix-args-019. 
Changed    bib/book[1]/publisher/text()   ->   bib/book[1]/publisher[1]/text()