zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #02882
[Merge] lp:~nbrinza/zorba/bugs into lp:zorba
Nicolae Brinza has proposed merging lp:~nbrinza/zorba/bugs into lp:zorba.
Requested reviews:
Markos Zaharioudakis (markos-za)
Matthias Brantner (matthias-brantner)
Related bugs:
Bug #867256 in Zorba: ""instance of document-node(element(x))" in predicate"
https://bugs.launchpad.net/zorba/+bug/867256
For more details, see:
https://code.launchpad.net/~nbrinza/zorba/bugs/+merge/86408
Fix for lp: bug #867256 - test Steps-leading-lone-slash-8a is failing.
--
https://code.launchpad.net/~nbrinza/zorba/bugs/+merge/86408
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog 2011-12-20 11:50:23 +0000
+++ ChangeLog 2011-12-20 14:39:27 +0000
@@ -1,5 +1,9 @@
Zorba - The XQuery Processor
+version 2.x
+
+ * Fixed bug #867256 (document-node(element(x)) types and tests were not working correctly)
+
version 2.2
* Caching of results for recursive functions with atomic parameter and return types.
=== modified file 'src/types/typeimpl.cpp'
--- src/types/typeimpl.cpp 2011-07-01 05:22:12 +0000
+++ src/types/typeimpl.cpp 2011-12-20 14:39:27 +0000
@@ -361,7 +361,7 @@
bool NodeXQType::is_subtype(
- const TypeManager* tm,
+ const TypeManager* tm,
const NodeXQType& supertype,
const QueryLoc& loc) const
{
@@ -443,7 +443,7 @@
bool NodeXQType::is_supertype(
- const TypeManager* tm,
+ const TypeManager* tm,
const store::Item* subitem,
const QueryLoc& loc) const
{
@@ -488,14 +488,29 @@
}
}
- if (m_node_kind != store::StoreConsts::elementNode &&
- m_node_kind != store::StoreConsts::attributeNode)
+ // document-node( E ) matches any document node that contains exactly one element
+ // node, optionally accompanied by one or more comment and processing instruction
+ // nodes, if E is an ElementTest or SchemaElementTest that matches the element node.
+ bool is_element_test = (
+ m_node_kind == store::StoreConsts::documentNode &&
+ m_content_type != NULL &&
+ m_content_type->type_kind() == XQType::NODE_TYPE_KIND);
+
+ if (m_node_kind != store::StoreConsts::elementNode &&
+ m_node_kind != store::StoreConsts::attributeNode &&
+ !is_element_test)
return true;
if (m_content_type == NULL ||
m_content_type->type_kind() == XQType::ANY_TYPE_KIND)
return true;
+ if (is_element_test)
+ {
+ xqtref_t documentNodeType = tm->create_value_type(subitem, loc);
+ return TypeOps::is_subtype(tm, *documentNodeType, *this);
+ }
+
xqtref_t subContentType = tm->create_named_type(subitem->getType(),
TypeConstants::QUANT_ONE,
loc,
=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-03.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-03.xml.res 2011-12-20 14:39:27 +0000
@@ -0,0 +1,1 @@
+true
\ No newline at end of file
=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-05.xml.res'
--- test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-05.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-05.xml.res 2011-12-20 14:39:27 +0000
@@ -0,0 +1,1 @@
+false
\ No newline at end of file
=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-06.xml.res'
--- test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-06.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-06.xml.res 2011-12-20 14:39:27 +0000
@@ -0,0 +1,1 @@
+false
\ No newline at end of file
=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-07.xml.res'
--- test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-07.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-07.xml.res 2011-12-20 14:39:27 +0000
@@ -0,0 +1,1 @@
+true
\ No newline at end of file
=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-08.xml.res'
--- test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-08.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/schemas/doc-node-schema-elem-test-08.xml.res 2011-12-20 14:39:27 +0000
@@ -0,0 +1,1 @@
+false
\ No newline at end of file
=== modified file 'test/rbkt/Queries/CMakeLists.txt'
--- test/rbkt/Queries/CMakeLists.txt 2011-12-20 09:04:58 +0000
+++ test/rbkt/Queries/CMakeLists.txt 2011-12-20 14:39:27 +0000
@@ -210,7 +210,6 @@
####
IF (FOUND_XQTS AND NOT ZORBA_TEST_W3C_TO_SUBMIT_RESULTS)
- EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/PathExpr/Steps/Steps-leading-lone-slash-8a 3408285)
EXPECTED_FAILURE(test/rbkt/w3c_testsuite/XQuery/Functions/QNameFunc/NamespaceURIForPrefixFunc/K2-NamespaceURIForPrefixFunc-2 872732)
IF(NOT ZORBA_WITH_BIG_INTEGER)
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-01.spec'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-01.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-01.spec 2011-12-20 14:39:27 +0000
@@ -0,0 +1,1 @@
+Error: http://www.w3.org/2005/xqt-errors:XPTY0004
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-01.xq'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-01.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-01.xq 2011-12-20 14:39:27 +0000
@@ -0,0 +1,10 @@
+import schema default element namespace "http://www.w3.org/XQueryTestOrderBy" at "orderData.xsd";
+
+declare variable $source := document { (
+ <!--comment-->,
+ <Strings><orderData>one string</orderData></Strings>,
+ <?processing instruction?>
+ ) };
+
+let $document as document-node(schema-element(Strings)) := $source
+return true()
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-02.spec'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-02.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-02.spec 2011-12-20 14:39:27 +0000
@@ -0,0 +1,1 @@
+Error: http://www.w3.org/2005/xqt-errors:XPTY0004
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-02.xq'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-02.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-02.xq 2011-12-20 14:39:27 +0000
@@ -0,0 +1,10 @@
+import schema default element namespace "http://www.w3.org/XQueryTestOrderBy" at "orderData.xsd";
+
+declare variable $source := document { (
+ <!--comment-->,
+ <Strings><orderData>one string</orderData></Strings>,
+ <?processing instruction?>
+ ) };
+
+let $document as document-node(schema-element(Strings2)) := $source
+return true()
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-03.xq'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-03.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-03.xq 2011-12-20 14:39:27 +0000
@@ -0,0 +1,10 @@
+import schema default element namespace "http://www.w3.org/XQueryTestOrderBy" at "orderData.xsd";
+
+declare variable $source := document { (
+ <!--comment-->,
+ <Strings><orderData>one string</orderData></Strings>,
+ <?processing instruction?>
+ ) };
+
+let $document as document-node(schema-element(Strings)) := validate { $source }
+return true()
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-04.spec'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-04.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-04.spec 2011-12-20 14:39:27 +0000
@@ -0,0 +1,1 @@
+Error: http://www.w3.org/2005/xqt-errors:XPTY0004
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-04.xq'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-04.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-04.xq 2011-12-20 14:39:27 +0000
@@ -0,0 +1,10 @@
+import schema default element namespace "http://www.w3.org/XQueryTestOrderBy" at "orderData.xsd";
+
+declare variable $source := document { (
+ <!--comment-->,
+ <Strings><orderData>one string</orderData></Strings>,
+ <?processing instruction?>
+ ) };
+
+let $document as document-node(schema-element(Strings2)) := validate { $source }
+return true()
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-05.xq'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-05.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-05.xq 2011-12-20 14:39:27 +0000
@@ -0,0 +1,9 @@
+import schema default element namespace "http://www.w3.org/XQueryTestOrderBy" at "orderData.xsd";
+
+declare variable $source := document { (
+ <!--comment-->,
+ <Strings><orderData>one string</orderData></Strings>,
+ <?processing instruction?>
+ ) };
+
+$source instance of document-node(schema-element(Strings))
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-06.xq'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-06.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-06.xq 2011-12-20 14:39:27 +0000
@@ -0,0 +1,9 @@
+import schema default element namespace "http://www.w3.org/XQueryTestOrderBy" at "orderData.xsd";
+
+declare variable $source := document { (
+ <!--comment-->,
+ <Strings><orderData>one string</orderData></Strings>,
+ <?processing instruction?>
+ ) };
+
+$source instance of document-node(schema-element(Strings2))
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-07.xq'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-07.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-07.xq 2011-12-20 14:39:27 +0000
@@ -0,0 +1,9 @@
+import schema default element namespace "http://www.w3.org/XQueryTestOrderBy" at "orderData.xsd";
+
+declare variable $source := document { (
+ <!--comment-->,
+ <Strings><orderData>one string</orderData></Strings>,
+ <?processing instruction?>
+ ) };
+
+validate{$source} instance of document-node(schema-element(Strings))
=== added file 'test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-08.xq'
--- test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-08.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/doc-node-schema-elem-test-08.xq 2011-12-20 14:39:27 +0000
@@ -0,0 +1,9 @@
+import schema default element namespace "http://www.w3.org/XQueryTestOrderBy" at "orderData.xsd";
+
+declare variable $source := document { (
+ <!--comment-->,
+ <Strings><orderData>one string</orderData></Strings>,
+ <?processing instruction?>
+ ) };
+
+validate{$source} instance of document-node(schema-element(Strings2))
=== added file 'test/rbkt/Queries/zorba/schemas/orderData.xsd'
--- test/rbkt/Queries/zorba/schemas/orderData.xsd 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/orderData.xsd 2011-12-20 14:39:27 +0000
@@ -0,0 +1,36 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:order="http://www.w3.org/XQueryTestOrderBy" targetNamespace="http://www.w3.org/XQueryTestOrderBy" elementFormDefault="qualified">
+ <xs:complexType name = "numbers">
+ <xs:sequence>
+ <xs:element name="orderData" type="xs:decimal" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name = "Strings">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="orderData" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name = "Strings2">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="orderData" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name = "NegativeNumbers" type = "order:numbers"/>
+ <xs:element name = "PositiveNumbers" type = "order:numbers"/>
+ <xs:element name = "SmallNegativeNumbers" type = "order:numbers"/>
+ <xs:element name = "SmallPositiveNumbers" type = "order:numbers"/>
+ <xs:element name = "DataValues">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="order:Strings"/>
+ <xs:element ref="order:NegativeNumbers"/>
+ <xs:element ref="order:PositiveNumbers"/>
+ <xs:element ref="order:SmallNegativeNumbers"/>
+ <xs:element ref="order:SmallPositiveNumbers"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file
Follow ups