Merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba

Proposed by Juan Zacarias
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/bug1147563
Merge into: lp:zorba
Diff against target: 1711 lines (+470/-323)
25 files modified
ChangeLog (+2/-0)
src/compiler/translator/translator.cpp (+9/-3)
src/runtime/accessors/accessors_impl.cpp (+11/-2)
src/runtime/core/path_iterators.cpp (+2/-2)
src/runtime/core/sequencetypes.cpp (+1/-1)
src/runtime/visitors/printer_visitor_impl.cpp (+19/-15)
src/store/api/item.h (+1/-1)
src/store/naive/item.cpp (+1/-1)
src/store/naive/node_items.cpp (+26/-24)
src/store/naive/node_items.h (+1/-7)
src/types/root_typemanager.cpp (+3/-0)
src/types/schema/schema.cpp (+85/-80)
src/types/schema/schema.h (+24/-21)
src/types/schema/validate.cpp (+16/-12)
src/types/typeimpl.cpp (+181/-88)
src/types/typeimpl.h (+24/-17)
src/types/typemanager.h (+4/-3)
src/types/typemanagerimpl.cpp (+14/-8)
src/types/typemanagerimpl.h (+4/-3)
src/types/typeops.cpp (+26/-14)
test/fots/CMakeLists.txt (+0/-15)
test/rbkt/Queries/zorba/schemas/books.xsd (+2/-2)
test/update/Scripts/Readme.txt (+4/-1)
test/update/Scripts/import_w3c_update_testsuite.sh (+7/-3)
test/update/updtestdriver.cpp (+3/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug1147563
Reviewer Review Type Date Requested Status
Cezar Andrei Approve
Sorin Marian Nasoi Needs Fixing
Markos Zaharioudakis Approve
Chris Hillery Approve
Review via email: mp+153485@code.launchpad.net

This proposal has been superseded by a proposal from 2013-04-25.

Commit message

Fixes for nilled function

Description of the change

Fixes for nilled function

To post a comment you must log in.
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

Only 7 of the failures were fixed (as you can see from the changes in 'test/fots/CMakeLists.txt').

There are 8 more failures and, from what I've seen all check the behaviour of the fn:nilled in XQuery 1.1 (please see that there is a XQ10 dependency for these tests).

This is the <a href="http://www.w3.org/TR/2009/WD-xpath-functions-11-20091215/#func-nilled">fn:nilled spec in XQuery 1.1</a> and this in the <a href="http://www.w3.org/TR/xpath-functions-30/#func-nilled">fn:nilled spec in XQuery 3.0</a>.

review: Needs Fixing
Revision history for this message
Juan Zacarias (juan457) wrote :

I will take a look of this but if I am not wrong the ones failing are not actually using the function nilled. not sure why these tests are done for nilled but I will take a look.

And actually not only 7 tests were solved the whole function was actually broken it had a behavior in which it always returned false so all the tests that expected a false response were passing.

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

> I will take a look of this but if I am not wrong the ones failing are not
> actually using the function nilled. not sure why these tests are done for
> nilled but I will take a look.
Please look in
http://bazaar.launchpad.net/~zorba-coders/zorba/bug1147563/revision/11279
Line 336 to 340, line 342, 344 and 345.
Those are the 8 fn:nilled test cases I am referring to as still failing.

> And actually not only 7 tests were solved the whole function was actually
> broken it had a behavior in which it always returned false so all the tests
> that expected a false response were passing.
After your fix, there were 7 progressions:
Please see
http://bazaar.launchpad.net/~zorba-coders/zorba/bug1147563/revision/11279
Lines 333, 334, 335, 341, 343, 346 and 347.
These are the 7 test cases I am referring to as progressions.

Revision history for this message
Juan Zacarias (juan457) wrote :

Hi,

I fixed all the tests including the ones that were not using fn:nill and were using fn:data and instance of functions, this functions should work now correctly with nilled documents now. I am not sure if this 2 functions had errors of their own when handling nilled elements, if so they should be working now.

There is just one test failing though I think is a FOTs driver problem.
fn-nilled-49
The problem is that the query throws an error because a function in the main module is described like this

variable $queryID := xqxq:prepare-main-module
(
'
xquery version "1.0";
declare default element namespace "http://www.w3.org/XQueryTest/nillable";
        import schema default element namespace "http://www.w3.org/XQueryTest/nillable";
       /root/branch/date instance of element(*, date?)
'
, (), mapper:uri-mapper#2
);

thus throwing an error because of 2 references as default namespace. I am not sure why this happen or if this should work, but is the only example which imports the schema as a default element namespace together with a delcaration of an element namespace.

All the other tests are working.

Revision history for this message
Chris Hillery (ceejatec) wrote :

Juan - I've updated the branch to remove the EXPECTED_FOTS_FAILURE()s for 8 more tests - fn-nilled-38, 39, 41, 44, 45, 47, 51, and 52. Sorin, please confirm that these are the tests you mentioned (your link above doesn't go anywhere useful, I'm afraid).

Also Juan - at least here I don't see any problem with fn-nilled-49. It's not marked EXPECTED_FOTS_FAILURE() and it passes. I'll try running it through the queue.

review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-03-27T01-37-02.629Z is finished. The
  final status was:

  86 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in test/fots/CMakeLists.txt

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-01T17-49-41.587Z is finished. The
  final status was:

  85 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-01T20-46-44.342Z is finished. The
  final status was:

  370 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-01T22-19-51.324Z is finished. The
  final status was:

  62 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-02T21-06-57.343Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

I will work on doing the required fixes.

review: Needs Fixing
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-09T12-18-00.681Z is finished. The
  final status was:

  48 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-10T01-07-48.536Z is finished. The
  final status was:

  48 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-10T08-46-10.479Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-11T22-49-55.328Z is finished. The
  final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-12T00-25-59.104Z is finished. The
  final status was:

  112 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-12T16-30-06.66Z is finished. The
  final status was:

  47 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-15T23-46-04.439Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

A few comments:
 - for following method, getting the type of the content of a global element shouldn't have anything to do with element's nillable property. Please add a different method to return the nillable of a global element or it's definition.

void Schema::getTypeNameFromElementName(
 const store::Item* qname,
 store::Item_t& typeName,
>>> + bool& nillable,
 const QueryLoc& loc);

Same comment goes for:
 - CTX_TM->get_schema_element_typename(elemQNameItem, typeQNameItem, nillable, loc);
 - Schema:: createXQTypeFromElementName(typeManager,
503 + sourceNode->getNodeName(),
504 + false,
505 + nillable,
506 + loc);

review: Needs Fixing
Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

> A few comments:
> - for following method, getting the type of the content of a global element
> shouldn't have anything to do with element's nillable property. Please add a
> different method to return the nillable of a global element or it's
> definition.
>
> void Schema::getTypeNameFromElementName(
> const store::Item* qname,
> store::Item_t& typeName,
> >>> + bool& nillable,
> const QueryLoc& loc);
>
> Same comment goes for:
> - CTX_TM->get_schema_element_typename(elemQNameItem, typeQNameItem,
> nillable, loc);
> - Schema:: createXQTypeFromElementName(typeManager,
> 503 + sourceNode->getNodeName(),
> 504 + false,
> 505 + nillable,
> 506 + loc);

Adding a second method is unnecessary overhead, as the callers of these methods need both the type and the nillable property of a global element declaration. Intead, I have changed the names of these methods to better reflect what they do and how they are used.

Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

I still think that the overhead of an extra call makes the code more readable and it's worth it in the long run. Still the nillable is not a property of the type of the element but of the element itself.

Please leave the create word in "createXQTypeFromElementName", these methods have side effects they aren't just simple gets and I think a good name should tell this. A more correct name for this method would be: createXQTypeFromElementNameAndGetNillable. But I still think makes more sense to have them separate and leave the compiler do the optimizations for this case.

At least leave createXQTypeFromElementName name if you think the first part has a significant effect on performance.

review: Needs Fixing
Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

> I still think that the overhead of an extra call makes the code more readable
> and it's worth it in the long run. Still the nillable is not a property of the
> type of the element but of the element itself.
>
> Please leave the create word in "createXQTypeFromElementName", these methods
> have side effects they aren't just simple gets and I think a good name should
> tell this. A more correct name for this method would be:
> createXQTypeFromElementNameAndGetNillable. But I still think makes more sense
> to have them separate and leave the compiler do the optimizations for this
> case.
>
> At least leave createXQTypeFromElementName name if you think the first part
> has a significant effect on performance.

I am sorry but I disagree. The callers of these methods want to get both type info (either just the name or a full XQType) and the nillable property from a global declaration. Why make two calls for this, when the two calls make almost the same work underneath? Maybe it doesn't make too much difference in the overall query performance, but it's not good coding practice, IMO. I can rename the methods to "getInfoFromGlobalElementDecl" if you think that makes them more readable. And if in the future a new caller needs only the type info or only the nillable info, we can add new methods that return just the needed info.

By the way, in validate.cpp line 207 and 268 there are calls to getTypeInfoFromGlobalElementDecl() that look like noops to me, because they just discard the returned XQType and do not raise any exception if the declaration is not found. Do I miss something?

Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

1. Sounds good.

2. It's exactly what I'm talking about, since it's called getTypeInfo...() and not createType...() it looks like a noop. It does actually do something which is also described in the previous line comments: "// ask for the type of the root element to populate the cache with anonymous types". That's why I want to keep the createType.. name.

Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

> 1. Sounds good.
>
> 2. It's exactly what I'm talking about, since it's called getTypeInfo...() and
> not createType...() it looks like a noop. It does actually do something which
> is also described in the previous line comments: "// ask for the type of the
> root element to populate the cache with anonymous types". That's why I want to
> keep the createType.. name.

Ah, thanks for the clarification. But I had the same question even before I changed the names. So, to me at least, the createType...() name gives no indication about the side effect. And the comment did not help either because since the method does return a type, I thought the caller was supposed to take *that* type and then put it into the cache himself. I will take a closer look at the code and see if I can up with a better solution.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-23T11-37-52.12Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-23T12-53-52.402Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-23T13-30-59.452Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-23T14-50-48.718Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-23T17-28-56.159Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-23T18-48-53.864Z is finished. The
  final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :
review: Needs Fixing
Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

Looks good.
It will most likely not pass in the current remote queue setup because it's still running libxercesc 2.8). It has been tested with libxerces 3.1.1 and is running correctly, should pass when Chris will update remote queue to use the newer xerces.

review: Approve
Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

In trunk at least the following tests are passing: cbcl-schema-element-1 2,4,5,8. Which makes them a regression.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Chris Hillery (ceejatec) wrote :

Guys, FYI, this RQ run is running with Xerces 3.1.1. Look for any test progressions/regressions.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug1147563 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug1147563-2013-04-25T00-35-04.776Z is finished. The
  final status was:

  2 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

lp:~zorba-coders/zorba/bug1147563 updated
11311. By sorin.marian.nasoi <email address hidden>

- reverted changes to import_w3c_update_testsuite script.

11312. By sorin.marian.nasoi <email address hidden>

- merge lp:zorba trunk

11313. By sorin.marian.nasoi <email address hidden>

Merged lp:~zorba-coders/zorba/bug1147563,

Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

Status of the last run:
- Passing but marked as expected failure:
  - prod-CastExpr/CastAs674a
  - prod-CastExpr/CastAsNamespaceSensitiveType-10
  - prod-CastExpr/K-SeqExprCast-71b

- WrongError
  - prod-CastExpr/CastAs675a - Expected error: XPTY0117. Found error: XPTY0004
  - prod-CastExpr/CastAsNamespaceSensitiveType-1 - Expected error: XPTY0117. Found error: XPTY0004
  - prod-CastExpr/CastAsNamespaceSensitiveType-2 - Expected error: XPTY0117. Found error: XPTY0004
  - prod-CastExpr/CastAsNamespaceSensitiveType-8 - Expected error: XPTY0117. Found error: FORG0001
  - prod-CastExpr/CastAsNamespaceSensitiveType-9 - Expected error: XPTY0117. Found error: FORG0001
  - prod-CastExpr/CastAsNamespaceSensitiveType-11 - Expected error: XPTY0117. Found error: XPTY0004
  - prod-CastExpr/CastAsNamespaceSensitiveType-12 - Expected error: XPTY0117. Found error: XPTY0004
  - prod-CastExpr/K-SeqExprCast-4a - Expected error: XPST0080. Found error: ZXQP0002
  - prod-CastExpr/K-SeqExprCast-422a - Expected error: FORG0001. Found error: XPTY0004

And test w3c_update_testsuite/XQueryX/ValTrans/revalidate-valtrans-ins-003 is reported as failed but the details show:

Test output

test w3c_update_testsuite/XQueryX/ValTrans/revalidate-valtrans-ins-003

updtestdriver: success

Sorin, can you take a look at revalidate-valtrans-ins-003?

lp:~zorba-coders/zorba/bug1147563 updated
11314. By sorin.marian.nasoi <email address hidden>

Merged lp:~zorba-coders/zorba/bug1123835.

11315. By sorin.marian.nasoi <email address hidden>

- merge lp:zorba trunk after fixing conflits

11316. By sorin.marian.nasoi <email address hidden>

- reverted changes dune in r11314.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2013-04-23 14:35:32 +0000
+++ ChangeLog 2013-04-23 20:40:48 +0000
@@ -48,6 +48,8 @@
48 * Fixed bug #1124273 (xqdoc crash because of annotation literals)48 * Fixed bug #1124273 (xqdoc crash because of annotation literals)
49 * Fixed bug #1085408 (xs:date(): casting large year values)49 * Fixed bug #1085408 (xs:date(): casting large year values)
50 * Fixed bug #867027 (XQST0059 error messages inconsistent)50 * Fixed bug #867027 (XQST0059 error messages inconsistent)
51 * Fixed fn:nilled function
52 * Fixed bug concerning nillability during sequnce type matching.
51 * Fixed bug #1095889 (Improve error message for xml-parsing error).53 * Fixed bug #1095889 (Improve error message for xml-parsing error).
52 * Fixed bug #1131984 (apparently invalid regex in queries)54 * Fixed bug #1131984 (apparently invalid regex in queries)
53 * Fixed bug #1123163 (fn:format-integer failures)55 * Fixed bug #1123163 (fn:format-integer failures)
5456
=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp 2013-04-23 13:20:31 +0000
+++ src/compiler/translator/translator.cpp 2013-04-23 20:40:48 +0000
@@ -293,9 +293,13 @@
293{293{
294public:294public:
295 CompilerCB * theCCB;295 CompilerCB * theCCB;
296
296 hashmap<zstring, static_context_t> mod_sctx_map;297 hashmap<zstring, static_context_t> mod_sctx_map;
298
297 hashmap<zstring, zstring> mod_ns_map;299 hashmap<zstring, zstring> mod_ns_map;
298 checked_vector<expr*> theInitExprs;300
301 checked_vector<expr*> theInitExprs;
302
299 std::auto_ptr<static_context> globalSctx;303 std::auto_ptr<static_context> globalSctx;
300304
301public:305public:
@@ -14146,13 +14150,15 @@
1414614150
14147 if (axisExpr != NULL)14151 if (axisExpr != NULL)
14148 {14152 {
14153 bool nillable;
14149 store::Item_t typeQNameItem;14154 store::Item_t typeQNameItem;
14150 CTX_TM->get_schema_element_typename(elemQNameItem, typeQNameItem, loc);14155 CTX_TM->get_schema_element_typeinfo(elemQNameItem, typeQNameItem, nillable, loc);
1415114156
14152 match_expr* match = theExprManager->create_match_expr(theRootSctx, theUDF, loc);14157 match_expr* match = theExprManager->create_match_expr(theRootSctx, theUDF, loc);
14153 match->setTestKind(match_xs_elem_test);14158 match->setTestKind(match_xs_elem_test);
14154 match->setQName(elemQNameItem);14159 match->setQName(elemQNameItem);
14155 match->setTypeName(typeQNameItem);14160 match->setTypeName(typeQNameItem);
14161 match->setNilledAllowed(nillable);
1415614162
14157 axisExpr->setTest(match);14163 axisExpr->setTest(match);
14158 }14164 }
@@ -14270,7 +14276,7 @@
14270 if (axisExpr != NULL)14276 if (axisExpr != NULL)
14271 {14277 {
14272 store::Item_t typeQNameItem;14278 store::Item_t typeQNameItem;
14273 CTX_TM->get_schema_attribute_typename(attrQNameItem, typeQNameItem, loc);14279 CTX_TM->get_schema_attribute_typeinfo(attrQNameItem, typeQNameItem, loc);
1427414280
14275 match_expr* match = theExprManager->create_match_expr(theRootSctx, theUDF, loc);14281 match_expr* match = theExprManager->create_match_expr(theRootSctx, theUDF, loc);
14276 match->setTestKind(match_xs_attr_test);14282 match->setTestKind(match_xs_attr_test);
1427714283
=== modified file 'src/runtime/accessors/accessors_impl.cpp'
--- src/runtime/accessors/accessors_impl.cpp 2013-03-15 08:22:41 +0000
+++ src/runtime/accessors/accessors_impl.cpp 2013-04-23 20:40:48 +0000
@@ -105,8 +105,15 @@
105 {105 {
106 if (inNode->isNode())106 if (inNode->isNode())
107 {107 {
108 result = inNode->getNilled();108 if (inNode->getNodeKind() == store::StoreConsts::elementNode)
109 STACK_PUSH(result != NULL, state);109 {
110 GENV_ITEMFACTORY->createBoolean(result, inNode->getNilled());
111 STACK_PUSH(true, state);
112 }
113 else
114 {
115 STACK_PUSH(false, state);
116 }
110 }117 }
111 else118 else
112 {119 {
@@ -240,6 +247,8 @@
240 }247 }
241248
242 state->theTypedValueIter = 0; // TODO remove???249 state->theTypedValueIter = 0; // TODO remove???
250
251 done:
243 STACK_END(state);252 STACK_END(state);
244}253}
245254
246255
=== modified file 'src/runtime/core/path_iterators.cpp'
--- src/runtime/core/path_iterators.cpp 2013-04-08 15:07:13 +0000
+++ src/runtime/core/path_iterators.cpp 2013-04-23 20:40:48 +0000
@@ -313,7 +313,7 @@
313313
314 if ((!TypeOps::is_subtype(sctx->get_typemanager(), *atype, *theType)) ||314 if ((!TypeOps::is_subtype(sctx->get_typemanager(), *atype, *theType)) ||
315 (theNilledAllowed == false &&315 (theNilledAllowed == false &&
316 node->getNilled()->getBooleanValue() == true))316 node->getNilled() == true))
317 {317 {
318 return false;318 return false;
319 }319 }
@@ -338,7 +338,7 @@
338338
339 if ((!TypeOps::is_subtype(sctx->get_typemanager(), *atype, *theType)) ||339 if ((!TypeOps::is_subtype(sctx->get_typemanager(), *atype, *theType)) ||
340 (theNilledAllowed == false &&340 (theNilledAllowed == false &&
341 node->getNilled()->getBooleanValue() == true))341 node->getNilled() == true))
342 return false;342 return false;
343343
344 return true;344 return true;
345345
=== modified file 'src/runtime/core/sequencetypes.cpp'
--- src/runtime/core/sequencetypes.cpp 2013-04-18 08:47:43 +0000
+++ src/runtime/core/sequencetypes.cpp 2013-04-23 20:40:48 +0000
@@ -84,7 +84,7 @@
84 store::Item_t item;84 store::Item_t item;
85 TypeConstants::quantifier_t quant;85 TypeConstants::quantifier_t quant;
86 bool res = false;86 bool res = false;
8787 store::Item_t temp;
88 const TypeManager* tm = theSctx->get_typemanager();88 const TypeManager* tm = theSctx->get_typemanager();
8989
90 PlanIteratorState* state;90 PlanIteratorState* state;
9191
=== modified file 'src/runtime/visitors/printer_visitor_impl.cpp'
--- src/runtime/visitors/printer_visitor_impl.cpp 2013-03-27 07:55:14 +0000
+++ src/runtime/visitors/printer_visitor_impl.cpp 2013-04-23 20:40:48 +0000
@@ -208,21 +208,6 @@
208 thePrinter.endEndVisit();208 thePrinter.endEndVisit();
209}209}
210210
211void PrinterVisitor::beginVisit ( const TreatIterator& a )
212{
213 thePrinter.startBeginVisit("TreatIterator", ++theId);
214 if (a.theCheckPrime)
215 thePrinter.addAttribute("type", a.theTreatType->toString());
216 thePrinter.addAttribute("quant", TypeOps::decode_quantifier(a.theQuantifier));
217 printCommons( &a, theId );
218 thePrinter.endBeginVisit(theId);
219}
220
221void PrinterVisitor::endVisit ( const TreatIterator& )
222{
223 thePrinter.startEndVisit();
224 thePrinter.endEndVisit();
225}
226211
227void PrinterVisitor::beginVisit ( const NumArithIterator<AddOperation>& a )212void PrinterVisitor::beginVisit ( const NumArithIterator<AddOperation>& a )
228{213{
@@ -1176,6 +1161,7 @@
1176 thePrinter.endEndVisit();1161 thePrinter.endEndVisit();
1177}1162}
11781163
1164
1179void PrinterVisitor::beginVisit(const PromoteIterator& a)1165void PrinterVisitor::beginVisit(const PromoteIterator& a)
1180{1166{
1181 thePrinter.startBeginVisit("PromoteIterator", ++theId);1167 thePrinter.startBeginVisit("PromoteIterator", ++theId);
@@ -1192,6 +1178,24 @@
1192 thePrinter.endEndVisit();1178 thePrinter.endEndVisit();
1193}1179}
11941180
1181
1182void PrinterVisitor::beginVisit ( const TreatIterator& a )
1183{
1184 thePrinter.startBeginVisit("TreatIterator", ++theId);
1185 if (a.theCheckPrime)
1186 thePrinter.addAttribute("type", a.theTreatType->toString());
1187 thePrinter.addAttribute("quant", TypeOps::decode_quantifier(a.theQuantifier));
1188 printCommons( &a, theId );
1189 thePrinter.endBeginVisit(theId);
1190}
1191
1192void PrinterVisitor::endVisit ( const TreatIterator& )
1193{
1194 thePrinter.startEndVisit();
1195 thePrinter.endEndVisit();
1196}
1197
1198
1195void PrinterVisitor::beginVisit(const CastableIterator& a)1199void PrinterVisitor::beginVisit(const CastableIterator& a)
1196{1200{
1197 thePrinter.startBeginVisit("CastableIterator", ++theId);1201 thePrinter.startBeginVisit("CastableIterator", ++theId);
11981202
=== modified file 'src/store/api/item.h'
--- src/store/api/item.h 2013-04-08 00:44:26 +0000
+++ src/store/api/item.h 2013-04-23 20:40:48 +0000
@@ -674,7 +674,7 @@
674 /** Accessor for element node674 /** Accessor for element node
675 * @return boolean?675 * @return boolean?
676 */676 */
677 virtual Item_t677 virtual bool
678 getNilled() const;678 getNilled() const;
679679
680 /** Accessor for document node, element node, attribute node, namespace node,680 /** Accessor for document node, element node, attribute node, namespace node,
681681
=== modified file 'src/store/naive/item.cpp'
--- src/store/naive/item.cpp 2013-04-08 00:44:26 +0000
+++ src/store/naive/item.cpp 2013-04-23 20:40:48 +0000
@@ -976,7 +976,7 @@
976}976}
977977
978978
979store::Item_t Item::getNilled() const979bool Item::getNilled() const
980{980{
981 throw ZORBA_EXCEPTION(981 throw ZORBA_EXCEPTION(
982 zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,982 zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
983983
=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp 2013-04-17 12:37:36 +0000
+++ src/store/naive/node_items.cpp 2013-04-23 20:40:48 +0000
@@ -2968,6 +2968,17 @@
2968 {2968 {
2969 zstring rch;2969 zstring rch;
2970 getStringValue2(rch);2970 getStringValue2(rch);
2971
2972 if (rch.empty())
2973 {
2974 if (getNilled())
2975 {
2976 val = NULL;
2977 iter = NULL;
2978 return;
2979 }
2980 }
2981
2971 GET_FACTORY().createUntypedAtomic(val, rch);2982 GET_FACTORY().createUntypedAtomic(val, rch);
2972 }2983 }
2973 }2984 }
@@ -3048,17 +3059,15 @@
3048/*******************************************************************************3059/*******************************************************************************
30493060
3050********************************************************************************/3061********************************************************************************/
3051store::Item_t ElementNode::getNilled() const3062bool ElementNode::getNilled() const
3052{3063{
3053 store::Item_t val;3064 store::Item_t val;
30543065
3055 if (getType()->equals(GET_STORE().XS_UNTYPED_QNAME))3066 if (getType()->equals(GET_STORE().XS_UNTYPED_QNAME))
3056 {3067 return false;
3057 GET_FACTORY().createBoolean(val, false);
3058 return val;
3059 }
30603068
3061 bool nilled = true;3069 if (!isValidated())
3070 return false;
30623071
3063 const_iterator ite = childrenBegin();3072 const_iterator ite = childrenBegin();
3064 const_iterator end = childrenEnd();3073 const_iterator end = childrenEnd();
@@ -3068,38 +3077,31 @@
3068 if ((*ite)->getNodeKind() == store::StoreConsts::elementNode ||3077 if ((*ite)->getNodeKind() == store::StoreConsts::elementNode ||
3069 (*ite)->getNodeKind() == store::StoreConsts::textNode)3078 (*ite)->getNodeKind() == store::StoreConsts::textNode)
3070 {3079 {
3071 nilled = false;3080 return false;
3072 break;
3073 }3081 }
3074 }3082 }
30753083
3076 if (!nilled)
3077 {
3078 GET_FACTORY().createBoolean(val, false);
3079 return val;
3080 }
3081
3082 nilled = false;
3083
3084 //const char* xsi = "http://www.w3.org/2001/XMLSchema-instance";
3085 //ulong xsilen = strlen(xsi);
3086
3087 ite = attrsBegin();3084 ite = attrsBegin();
3088 end = attrsEnd();3085 end = attrsEnd();
30893086
3090 for (; ite != end; ++ite)3087 for (; ite != end; ++ite)
3091 {3088 {
3092 XmlNode* attr = *ite;3089 XmlNode* attr = *ite;
3093 if (ZSTREQ(attr->getNodeName()->getNamespace(), "xsi") &&3090
3094 ZSTREQ(attr->getNodeName()->getLocalName(), "nil"))3091 zstring strval;
3092 attr->getStringValue2(strval);
3093
3094 if (ZSTREQ(attr->getNodeName()->getNamespace(),
3095 "http://www.w3.org/2001/XMLSchema-instance") &&
3096 ZSTREQ(attr->getNodeName()->getLocalName(), "nil") &&
3097 (ZSTREQ(strval, "true") || ZSTREQ(strval, "1") ))
3095 {3098 {
3096 nilled = true;3099 return true;
3097 break;3100 break;
3098 }3101 }
3099 }3102 }
31003103
3101 GET_FACTORY().createBoolean(val, nilled);3104 return false;
3102 return val;
3103}3105}
31043106
31053107
31063108
=== modified file 'src/store/naive/node_items.h'
--- src/store/naive/node_items.h 2013-03-07 10:10:10 +0000
+++ src/store/naive/node_items.h 2013-04-23 20:40:48 +0000
@@ -500,12 +500,6 @@
500500
501 store::Item* copy(store::Item* parent, const store::CopyMode& copymode) const;501 store::Item* copy(store::Item* parent, const store::CopyMode& copymode) const;
502502
503 virtual store::Item_t getNilled() const
504 {
505 assert(!isConnectorNode());
506 return 0;
507 }
508
509 virtual bool isId() const 503 virtual bool isId() const
510 {504 {
511 assert(!isConnectorNode());505 assert(!isConnectorNode());
@@ -1072,7 +1066,7 @@
10721066
1073 void appendStringValue(zstring& buf) const;1067 void appendStringValue(zstring& buf) const;
10741068
1075 store::Item_t getNilled() const;1069 bool getNilled() const;
10761070
1077 store::Iterator_t getAttributes() const;1071 store::Iterator_t getAttributes() const;
10781072
10791073
=== modified file 'src/types/root_typemanager.cpp'
--- src/types/root_typemanager.cpp 2013-03-20 18:39:54 +0000
+++ src/types/root_typemanager.cpp 2013-04-23 20:40:48 +0000
@@ -386,18 +386,21 @@
386#undef ATOMIC_TYPE_DEFN386#undef ATOMIC_TYPE_DEFN
387387
388 XS_NMTOKENS_TYPE = new UserDefinedXQType(this,388 XS_NMTOKENS_TYPE = new UserDefinedXQType(this,
389 false,
389 XS_NMTOKENS_QNAME,390 XS_NMTOKENS_QNAME,
390 NULL,391 NULL,
391 NMTOKEN_TYPE_ONE.getp(),392 NMTOKEN_TYPE_ONE.getp(),
392 true);393 true);
393394
394 XS_ENTITIES_TYPE = new UserDefinedXQType(this,395 XS_ENTITIES_TYPE = new UserDefinedXQType(this,
396 false,
395 XS_ENTITIES_QNAME,397 XS_ENTITIES_QNAME,
396 NULL,398 NULL,
397 ENTITY_TYPE_ONE.getp(),399 ENTITY_TYPE_ONE.getp(),
398 true);400 true);
399401
400 XS_IDREFS_TYPE = new UserDefinedXQType(this,402 XS_IDREFS_TYPE = new UserDefinedXQType(this,
403 false,
401 XS_IDREFS_QNAME,404 XS_IDREFS_QNAME,
402 NULL,405 NULL,
403 IDREF_TYPE_ONE.getp(),406 IDREF_TYPE_ONE.getp(),
404407
=== modified file 'src/types/schema/schema.cpp'
--- src/types/schema/schema.cpp 2013-04-03 07:43:27 +0000
+++ src/types/schema/schema.cpp 2013-04-23 20:40:48 +0000
@@ -259,7 +259,8 @@
259 259
260 return lRetval;260 return lRetval;
261 }261 }
262 else {262 else
263 {
263 // We didn't find it. If we return NULL here, Xerces will try to264 // We didn't find it. If we return NULL here, Xerces will try to
264 // resolve it its own way, which we don't want to happen.265 // resolve it its own way, which we don't want to happen.
265 throw XQUERY_EXCEPTION(266 throw XQUERY_EXCEPTION(
@@ -271,7 +272,8 @@
271 );272 );
272 }273 }
273 }274 }
274 catch (ZorbaException const& e) {275 catch (ZorbaException const& e)
276 {
275 TRACE("!!! ZorbaException: " << e );277 TRACE("!!! ZorbaException: " << e );
276 if ( e.diagnostic() == zerr::ZXQP0029_URI_ACCESS_DENIED ||278 if ( e.diagnostic() == zerr::ZXQP0029_URI_ACCESS_DENIED ||
277 e.diagnostic() == err::XQST0059 )279 e.diagnostic() == err::XQST0059 )
@@ -518,82 +520,71 @@
518520
519521
520/*******************************************************************************522/*******************************************************************************
521 For the given element name find out its declared schema type523 Find a global element declaration for a given element name and return the name
524 of the associated schema type and whether the element can be nillable.
525 Raise an error if no global element declaration is found for the given name.
522*******************************************************************************/526*******************************************************************************/
523void Schema::getTypeNameFromElementName(527void Schema::getInfoFromGlobalElementDecl(
524 const store::Item* qname,528 const store::Item* qname,
525 store::Item_t& typeName,529 store::Item_t& typeName,
530 bool& nillable,
526 const QueryLoc& loc)531 const QueryLoc& loc)
527{532{
528 XSTypeDefinition* typeDef = getTypeDefForElement(qname);533 XSElementDeclaration* decl = getDeclForElement(qname);
529534
530 if (!typeDef)535 if (!decl)
531 {536 {
532 RAISE_ERROR(err::XPST0008, loc,537 RAISE_ERROR(err::XPST0008, loc,
533 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), qname->getStringValue()));538 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), qname->getStringValue()));
534 }539 }
535540
536 const XMLCh* typeNameStr = typeDef->getName();541 XSTypeDefinition* typeDef = decl->getTypeDefinition();
537 const XMLCh* typeUri = typeDef->getNamespace();542
538543 const XMLCh* typeNameStr = typeDef->getName();
539 GENV_ITEMFACTORY->createQName(typeName,544 const XMLCh* typeUri = typeDef->getNamespace();
540 StrX(typeUri).localForm(),545
541 "",546 GENV_ITEMFACTORY->createQName(typeName,
542 StrX(typeNameStr).localForm());547 StrX(typeUri).localForm(),
543}548 "",
544549 StrX(typeNameStr).localForm());
545550
546/*******************************************************************************551 nillable = decl->getNillable();
547 For a given global attribute find out its declared schema type552}
548*******************************************************************************/553
549void Schema::getTypeNameFromAttributeName(554
550 const store::Item* qname,555/*******************************************************************************
551 store::Item_t& typeName,556 Find a global element declaration for a given element name and return an
552 const QueryLoc& loc)557 XQType for the associated schema type and whether the element can be nillable.
553{558 Raise an error if the raiseErrors param is true and no global element
554 XSTypeDefinition* typeDef = getTypeDefForAttribute(qname);559 declaration is found for the given name.
555560*******************************************************************************/
556 if (!typeDef)561xqtref_t Schema::createXQTypeFromGlobalElementDecl(
557 {
558 RAISE_ERROR(err::XPST0008, loc,
559 ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), qname->getStringValue()));
560 }
561
562 const XMLCh* typeNameStr = typeDef->getName();
563 const XMLCh* typeUri = typeDef->getNamespace();
564
565 GENV_ITEMFACTORY->createQName(typeName,
566 StrX(typeUri).localForm(),
567 "",
568 StrX(typeNameStr).localForm());
569}
570
571
572/*******************************************************************************
573 Returns an XQType for a global schema element definition if defined,
574 otherwise NULL
575*******************************************************************************/
576xqtref_t Schema::createXQTypeFromElementName(
577 const TypeManager* typeManager,562 const TypeManager* typeManager,
578 const store::Item* qname,563 const store::Item* qname,
579 const bool riseErrors,564 const bool raiseErrors,
565 bool& nillable,
580 const QueryLoc& loc)566 const QueryLoc& loc)
581{567{
582 TRACE("qn:" << qname->getLocalName() << " @ " <<568 TRACE("qn:" << qname->getLocalName() << " @ " <<
583 qname->getNamespace() );569 qname->getNamespace() );
584570
585 XSTypeDefinition* typeDef = getTypeDefForElement(qname);571 XSElementDeclaration* decl = getDeclForElement(qname);
586572
587 if (!riseErrors && !typeDef)573 if (!raiseErrors && !decl)
588 return NULL;574 return NULL;
589575
590 if (!typeDef)576 if (!decl)
591 {577 {
592 RAISE_ERROR(err::XPST0008, loc,578 RAISE_ERROR(err::XPST0008, loc,
593 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), qname->getStringValue()));579 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), qname->getStringValue()));
594 }580 }
595581
582 nillable = decl->getNillable();
583
584 XSTypeDefinition* typeDef = decl->getTypeDefinition();
585
596 xqtref_t res = createXQTypeFromTypeDefinition(typeManager, typeDef);586 xqtref_t res = createXQTypeFromTypeDefinition(typeManager, typeDef);
587
597 TRACE("res:" << res->get_qname()->getLocalName() << " @ " <<588 TRACE("res:" << res->get_qname()->getLocalName() << " @ " <<
598 res->get_qname()->getNamespace());589 res->get_qname()->getNamespace());
599590
@@ -602,18 +593,46 @@
602593
603594
604/*******************************************************************************595/*******************************************************************************
596 Find a global attribute declaration for a given attribute name and return the
597 name of the associated schema type. Raise an error if no global attribute
598 declaration is found for the given name.
599*******************************************************************************/
600void Schema::getInfoFromGlobalAttributeDecl(
601 const store::Item* qname,
602 store::Item_t& typeName,
603 const QueryLoc& loc)
604{
605 XSTypeDefinition* typeDef = getTypeDefForAttribute(qname);
606
607 if (!typeDef)
608 {
609 RAISE_ERROR(err::XPST0008, loc,
610 ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), qname->getStringValue()));
611 }
612
613 const XMLCh* typeNameStr = typeDef->getName();
614 const XMLCh* typeUri = typeDef->getNamespace();
615
616 GENV_ITEMFACTORY->createQName(typeName,
617 StrX(typeUri).localForm(),
618 "",
619 StrX(typeNameStr).localForm());
620}
621
622
623/*******************************************************************************
605 Returns an XQType for a global schema attribute definition if defined,624 Returns an XQType for a global schema attribute definition if defined,
606 otherwise NULL625 otherwise NULL
607*******************************************************************************/626*******************************************************************************/
608xqtref_t Schema::createXQTypeFromAttributeName(627xqtref_t Schema::createXQTypeFromGlobalAttributeDecl(
609 const TypeManager* typeManager,628 const TypeManager* typeManager,
610 const store::Item* qname,629 const store::Item* qname,
611 const bool riseErrors,630 const bool raiseErrors,
612 const QueryLoc& loc)631 const QueryLoc& loc)
613{632{
614 XSTypeDefinition* typeDef = getTypeDefForAttribute(qname);633 XSTypeDefinition* typeDef = getTypeDefForAttribute(qname);
615634
616 if (!riseErrors && !typeDef)635 if (!raiseErrors && !typeDef)
617 return NULL;636 return NULL;
618637
619 if (!typeDef)638 if (!typeDef)
@@ -744,12 +763,10 @@
744763
745764
746/*******************************************************************************765/*******************************************************************************
747 Get the type definition for a globally declared element766 Get the declaration for a globally declared element
748*******************************************************************************/767*******************************************************************************/
749XSTypeDefinition* Schema::getTypeDefForElement(const store::Item* qname)768XSElementDeclaration* Schema::getDeclForElement(const store::Item* qname)
750{769{
751 XSTypeDefinition* typeDef = NULL;
752
753 TRACE(" element qname: " << qname->getLocalName() << "@" <<770 TRACE(" element qname: " << qname->getLocalName() << "@" <<
754 qname->getNamespace());771 qname->getNamespace());
755772
@@ -762,25 +779,7 @@
762 bool xsModelWasChanged;779 bool xsModelWasChanged;
763 XSModel* model = theGrammarPool->getXSModel(xsModelWasChanged);780 XSModel* model = theGrammarPool->getXSModel(xsModelWasChanged);
764781
765 XSElementDeclaration* decl = model->getElementDeclaration(local, uri);782 return model->getElementDeclaration(local, uri);
766
767 if (decl)
768 {
769 typeDef = decl->getTypeDefinition();
770
771 // this works only on the element that is a substitution,
772 // not on substitution base element
773 //XSElementDeclaration * substGroup =
774 // decl->getSubstitutionGroupAffiliation();
775
776 //if ( substGroup )
777 //{
778 // TRACE(" substitutionGroup qname: " << StrX(substGroup->getName()) <<
779 // "@" << StrX(substGroup->getNamespace()) << "\n");
780 //}
781 }
782
783 return typeDef;
784}783}
785784
786785
@@ -868,6 +867,7 @@
868 xqtref_t baseXQType = createXQTypeFromTypeDefinition(tm, baseTypeDef);867 xqtref_t baseXQType = createXQTypeFromTypeDefinition(tm, baseTypeDef);
869868
870 xqtref_t xqType = new UserDefinedXQType(tm,869 xqtref_t xqType = new UserDefinedXQType(tm,
870 xsTypeDef->getAnonymous(),
871 qname,871 qname,
872 baseXQType,872 baseXQType,
873 TypeConstants::QUANT_ONE,873 TypeConstants::QUANT_ONE,
@@ -903,6 +903,7 @@
903 // << endl; cout.flush();903 // << endl; cout.flush();
904904
905 xqtref_t xqType = new UserDefinedXQType(tm,905 xqtref_t xqType = new UserDefinedXQType(tm,
906 xsTypeDef->getAnonymous(),
906 qname,907 qname,
907 NULL,908 NULL,
908 itemXQType.getp());909 itemXQType.getp());
@@ -958,6 +959,7 @@
958 //std::cout << std::endl; std::cout.flush();959 //std::cout << std::endl; std::cout.flush();
959960
960 xqtref_t xqType = new UserDefinedXQType(tm,961 xqtref_t xqType = new UserDefinedXQType(tm,
962 xsTypeDef->getAnonymous(),
961 qname,963 qname,
962 baseXQType,964 baseXQType,
963 TypeConstants::QUANT_ONE,965 TypeConstants::QUANT_ONE,
@@ -1059,6 +1061,7 @@
1059 }1061 }
10601062
1061 xqtref_t xqType = new UserDefinedXQType(tm,1063 xqtref_t xqType = new UserDefinedXQType(tm,
1064 xsTypeDef->getAnonymous(),
1062 qname,1065 qname,
1063 baseXQType,1066 baseXQType,
1064 TypeConstants::QUANT_ONE,1067 TypeConstants::QUANT_ONE,
@@ -1310,9 +1313,10 @@
1310 bool xsModelWasChanged;1313 bool xsModelWasChanged;
1311 XSModel* model = theGrammarPool->getXSModel(xsModelWasChanged);1314 XSModel* model = theGrammarPool->getXSModel(xsModelWasChanged);
13121315
1313 XSNamedMap<XSObject> * typeDefs =1316 XSNamedMap<XSObject>* typeDefs =
1314 model->getComponents(XSConstants::TYPE_DEFINITION);1317 model->getComponents(XSConstants::TYPE_DEFINITION);
1315 for( uint i = 0; i<typeDefs->getLength(); i++)1318
1319 for( uint i = 0; i < typeDefs->getLength(); i++)
1316 {1320 {
1317 XSTypeDefinition* typeDef = (XSTypeDefinition*)(typeDefs->item(i));1321 XSTypeDefinition* typeDef = (XSTypeDefinition*)(typeDefs->item(i));
1318 checkForAnonymousTypesInType(typeManager, typeDef);1322 checkForAnonymousTypesInType(typeManager, typeDef);
@@ -1529,6 +1533,7 @@
15291533
1530 xqtref_t xqType =1534 xqtref_t xqType =
1531 xqtref_t(new UserDefinedXQType(typeManager,1535 xqtref_t(new UserDefinedXQType(typeManager,
1536 xsTypeDef->getAnonymous(),
1532 qname,1537 qname,
1533 baseXQType,1538 baseXQType,
1534 TypeConstants::QUANT_ONE,1539 TypeConstants::QUANT_ONE,
15351540
=== modified file 'src/types/schema/schema.h'
--- src/types/schema/schema.h 2013-02-07 17:24:36 +0000
+++ src/types/schema/schema.h 2013-04-23 20:40:48 +0000
@@ -43,6 +43,7 @@
43namespace XERCES_CPP_NAMESPACE {43namespace XERCES_CPP_NAMESPACE {
44 class InputSource;44 class InputSource;
45 class XSTypeDefinition;45 class XSTypeDefinition;
46 class XSElementDeclaration;
46 class XSParticle;47 class XSParticle;
47 class XMLGrammarPool;48 class XMLGrammarPool;
48}49}
@@ -106,31 +107,33 @@
106107
107 void registerXSD(108 void registerXSD(
108 const char* xsdURL,109 const char* xsdURL,
109 static_context * aSctx,110 static_context* sctx,
110 internal::StreamResource* aStreamResource,111 internal::StreamResource* streamResource,
111 const QueryLoc& loc);112 const QueryLoc& loc);
112113
113 void getSubstitutionHeadForElement(114 void getSubstitutionHeadForElement(
114 const store::Item* qname,115 const store::Item* qname,
115 store::Item_t& result);116 store::Item_t& result);
116117
117 void getTypeNameFromElementName(118 void getInfoFromGlobalElementDecl(
118 const store::Item* qname,119 const store::Item* qname,
119 store::Item_t& typeName,120 store::Item_t& typeName,
120 const QueryLoc& loc);121 bool& nillable,
121122 const QueryLoc& loc);
122 void getTypeNameFromAttributeName(123
123 const store::Item* qname,124 xqtref_t createXQTypeFromGlobalElementDecl(
124 store::Item_t& typeName,
125 const QueryLoc& loc);
126
127 xqtref_t createXQTypeFromElementName(
128 const TypeManager* typeManager,125 const TypeManager* typeManager,
129 const store::Item* qname,126 const store::Item* qname,
130 const bool riseErrors,127 const bool raiseErrors,
131 const QueryLoc& loc);128 bool& nillable,
132129 const QueryLoc& loc);
133 xqtref_t createXQTypeFromAttributeName(130
131 void getInfoFromGlobalAttributeDecl(
132 const store::Item* qname,
133 store::Item_t& typeName,
134 const QueryLoc& loc);
135
136 xqtref_t createXQTypeFromGlobalAttributeDecl(
134 const TypeManager* typeManager,137 const TypeManager* typeManager,
135 const store::Item* qname,138 const store::Item* qname,
136 const bool riseErrors,139 const bool riseErrors,
@@ -194,11 +197,11 @@
194private:197private:
195198
196#ifndef ZORBA_NO_XMLSCHEMA199#ifndef ZORBA_NO_XMLSCHEMA
197 XERCES_CPP_NAMESPACE::XSTypeDefinition*200 XERCES_CPP_NAMESPACE::XSElementDeclaration* getDeclForElement(
198 getTypeDefForElement(const store::Item* qname);201 const store::Item* qname);
199202
200 XERCES_CPP_NAMESPACE::XSTypeDefinition*203 XERCES_CPP_NAMESPACE::XSTypeDefinition* getTypeDefForAttribute(
201 getTypeDefForAttribute(const store::Item* qname);204 const store::Item* qname);
202205
203 xqtref_t createXQTypeFromTypeDefinition(206 xqtref_t createXQTypeFromTypeDefinition(
204 const TypeManager* typeManager,207 const TypeManager* typeManager,
205208
=== modified file 'src/types/schema/validate.cpp'
--- src/types/schema/validate.cpp 2013-02-07 17:24:36 +0000
+++ src/types/schema/validate.cpp 2013-04-23 20:40:48 +0000
@@ -193,20 +193,22 @@
193 {193 {
194 schemaValidator.startDoc();194 schemaValidator.startDoc();
195 195
196 // ask for the type of the root element to populate
197 // the cache with anonymous types
198 store::Iterator_t children = sourceNode->getChildren();196 store::Iterator_t children = sourceNode->getChildren();
199 store::Item_t child;197 store::Item_t child;
200 while ( children->next(child) )198 while ( children->next(child) )
201 {199 {
200 // ask for the type of the element. We don't really need this type here,
201 // but a side-effect of this call is to add the type to the cache.
202 if ( child->isNode() &&202 if ( child->isNode() &&
203 child->getNodeKind()==store::StoreConsts::elementNode )203 child->getNodeKind()==store::StoreConsts::elementNode )
204 {204 {
205 bool nillable;
205 typeManager->getSchema()->206 typeManager->getSchema()->
206 createXQTypeFromElementName(typeManager,207 createXQTypeFromGlobalElementDecl(typeManager,
207 child->getNodeName(),208 child->getNodeName(),
208 false,209 false,
209 loc);210 nillable,
211 loc);
210 break;212 break;
211 }213 }
212 }214 }
@@ -259,13 +261,15 @@
259 //cout << "Validate element" << "\n"; cout.flush();261 //cout << "Validate element" << "\n"; cout.flush();
260 schemaValidator.startDoc();262 schemaValidator.startDoc();
261263
262 // ask for the type of the root element to populate the cache264 // ask for the type of the element. We don't really need this type here,
263 // with anonymous types265 // but a side-effect of this call is to add the type to the cache.
266 bool nillable;
264 typeManager->getSchema()->267 typeManager->getSchema()->
265 createXQTypeFromElementName(typeManager,268 createXQTypeFromGlobalElementDecl(typeManager,
266 sourceNode->getNodeName(),269 sourceNode->getNodeName(),
267 false,270 false,
268 loc);271 nillable,
272 loc);
269 }273 }
270 274
271 store::Item_t newElem = processElement(sctx,275 store::Item_t newElem = processElement(sctx,
272276
=== modified file 'src/types/typeimpl.cpp'
--- src/types/typeimpl.cpp 2013-03-22 00:38:18 +0000
+++ src/types/typeimpl.cpp 2013-04-23 20:40:48 +0000
@@ -29,6 +29,7 @@
29#include "zorbaserialization/serialize_template_types.h"29#include "zorbaserialization/serialize_template_types.h"
30#include "zorbaserialization/serialize_zorba_types.h"30#include "zorbaserialization/serialize_zorba_types.h"
3131
32#include "store/api/iterator.h"
3233
33namespace zorba34namespace zorba
34{35{
@@ -718,11 +719,11 @@
718 bool builtin)719 bool builtin)
719 :720 :
720 XQType(manager, NODE_TYPE_KIND, quantifier, builtin),721 XQType(manager, NODE_TYPE_KIND, quantifier, builtin),
721 m_node_kind(nodeKind),722 theNodeKind(nodeKind),
722 m_node_name(nodeName),723 theNodeName(nodeName),
723 theContentType(contentType),724 theContentType(contentType),
724 m_nillable(nillable),725 theNillable(nillable),
725 m_schema_test(schematest)726 theIsSchemaTest(schematest)
726{727{
727 assert(contentType == NULL ||728 assert(contentType == NULL ||
728 (nodeKind == store::StoreConsts::documentNode &&729 (nodeKind == store::StoreConsts::documentNode &&
@@ -754,11 +755,11 @@
754 TypeConstants::quantifier_t quantifier)755 TypeConstants::quantifier_t quantifier)
755 :756 :
756 XQType(source.theManager, NODE_TYPE_KIND, quantifier, false),757 XQType(source.theManager, NODE_TYPE_KIND, quantifier, false),
757 m_node_kind(source.m_node_kind),758 theNodeKind(source.theNodeKind),
758 m_node_name(source.m_node_name),759 theNodeName(source.theNodeName),
759 theContentType(source.theContentType),760 theContentType(source.theContentType),
760 m_nillable(source.m_nillable),761 theNillable(source.theNillable),
761 m_schema_test(source.m_schema_test)762 theIsSchemaTest(source.theIsSchemaTest)
762{763{
763}764}
764765
@@ -769,11 +770,11 @@
769void NodeXQType::serialize(::zorba::serialization::Archiver& ar)770void NodeXQType::serialize(::zorba::serialization::Archiver& ar)
770{771{
771 serialize_baseclass(ar, (XQType*)this);772 serialize_baseclass(ar, (XQType*)this);
772 SERIALIZE_ENUM(store::StoreConsts::NodeKind, m_node_kind);773 SERIALIZE_ENUM(store::StoreConsts::NodeKind, theNodeKind);
773 ar & m_node_name;774 ar & theNodeName;
774 ar & theContentType;775 ar & theContentType;
775 ar & m_nillable;776 ar & theNillable;
776 ar & m_schema_test;777 ar & theIsSchemaTest;
777}778}
778779
779780
@@ -791,15 +792,15 @@
791********************************************************************************/792********************************************************************************/
792bool NodeXQType::is_equal(const TypeManager* tm, const NodeXQType& other) const793bool NodeXQType::is_equal(const TypeManager* tm, const NodeXQType& other) const
793{794{
794 if (m_node_kind != other.m_node_kind)795 if (theNodeKind != other.theNodeKind)
795 return false;796 return false;
796797
797 if (m_node_name != other.m_node_name)798 if (theNodeName != other.theNodeName)
798 {799 {
799 if (m_node_name == NULL || other.m_node_name == NULL)800 if (theNodeName == NULL || other.theNodeName == NULL)
800 return false;801 return false;
801802
802 if (!m_node_name->equals(other.m_node_name))803 if (!theNodeName->equals(other.theNodeName))
803 return false;804 return false;
804 }805 }
805806
@@ -829,7 +830,7 @@
829 const NodeXQType& supertype,830 const NodeXQType& supertype,
830 const QueryLoc& loc) const831 const QueryLoc& loc) const
831{832{
832 if (supertype.m_node_kind == store::StoreConsts::anyNode)833 if (supertype.theNodeKind == store::StoreConsts::anyNode)
833 {834 {
834 if (supertype.theContentType != NULL &&835 if (supertype.theContentType != NULL &&
835 supertype.theContentType->type_kind() == XQType::UNTYPED_KIND)836 supertype.theContentType->type_kind() == XQType::UNTYPED_KIND)
@@ -841,17 +842,17 @@
841 return true;842 return true;
842 }843 }
843844
844 if (supertype.m_node_kind != m_node_kind)845 if (supertype.theNodeKind != theNodeKind)
845 return false;846 return false;
846847
847 if (supertype.m_node_name != NULL)848 if (supertype.theNodeName != NULL)
848 {849 {
849 if (m_node_name == NULL)850 if (theNodeName == NULL)
850 return false;851 return false;
851852
852 if (!m_node_name->equals(supertype.m_node_name))853 if (!theNodeName->equals(supertype.theNodeName))
853 {854 {
854 if (supertype.m_schema_test)855 if (supertype.theIsSchemaTest)
855 {856 {
856 Schema* schema = supertype.theManager->getSchema();857 Schema* schema = supertype.theManager->getSchema();
857 ZORBA_ASSERT(schema != NULL);858 ZORBA_ASSERT(schema != NULL);
@@ -859,11 +860,11 @@
859 store::Item_t headName;860 store::Item_t headName;
860861
861#ifndef ZORBA_NO_XMLSCHEMA862#ifndef ZORBA_NO_XMLSCHEMA
862 schema->getSubstitutionHeadForElement(m_node_name.getp(), headName);863 schema->getSubstitutionHeadForElement(theNodeName.getp(), headName);
863864
864 while (headName != NULL)865 while (headName != NULL)
865 {866 {
866 if (headName->equals(supertype.m_node_name))867 if (headName->equals(supertype.theNodeName))
867 {868 {
868 break;869 break;
869 }870 }
@@ -883,10 +884,18 @@
883 }884 }
884885
885 if (theContentType == supertype.theContentType)886 if (theContentType == supertype.theContentType)
887 {
888 if (supertype.theNillable == false && theNillable == true)
889 return false;
890
886 return true;891 return true;
892 }
887893
888 if (theContentType != NULL && supertype.theContentType != NULL)894 if (theContentType != NULL && supertype.theContentType != NULL)
889 {895 {
896 if (supertype.theNillable == false && theNillable == true)
897 return false;
898
890 return TypeOps::is_subtype(tm, *theContentType, *supertype.theContentType);899 return TypeOps::is_subtype(tm, *theContentType, *supertype.theContentType);
891 }900 }
892 else if (supertype.theContentType == NULL)901 else if (supertype.theContentType == NULL)
@@ -912,7 +921,7 @@
912{921{
913 assert(subitem->isNode());922 assert(subitem->isNode());
914923
915 if (m_node_kind == store::StoreConsts::anyNode)924 if (theNodeKind == store::StoreConsts::anyNode)
916 {925 {
917 if (theContentType != NULL &&926 if (theContentType != NULL &&
918 theContentType->type_kind() == XQType::UNTYPED_KIND)927 theContentType->type_kind() == XQType::UNTYPED_KIND)
@@ -923,74 +932,152 @@
923 return true;932 return true;
924 }933 }
925934
926 if (m_node_kind != subitem->getNodeKind())935 if (theNodeKind != subitem->getNodeKind())
927 return false;936 return false;
928937
929 if (m_node_name != NULL)938 switch (theNodeKind)
930 {939 {
931 if (!subitem->getNodeName()->equals(m_node_name))940 case store::StoreConsts::textNode:
932 {941 case store::StoreConsts::commentNode:
933 if (m_schema_test)942 case store::StoreConsts::namespaceNode:
943 {
944 return true;
945 }
946 case store::StoreConsts::piNode:
947 {
948 if (theNodeName != NULL && !subitem->getNodeName()->equals(theNodeName))
949 return false;
950
951 return true;
952 }
953 case store::StoreConsts::attributeNode:
954 {
955 assert(!theIsSchemaTest || (theNodeName && theContentType));
956
957 if (theNodeName != NULL && !subitem->getNodeName()->equals(theNodeName))
958 return false;
959
960 if (theContentType != NULL)
961 {
962 xqtref_t subContentType =
963 tm->create_named_type(subitem->getType(), TypeConstants::QUANT_ONE, loc, true);
964
965 return TypeOps::is_subtype(tm, *subContentType, *theContentType);
966 }
967
968 return true;
969 }
970 case store::StoreConsts::elementNode:
971 {
972 if (theIsSchemaTest)
973 {
974 assert(theNodeName != NULL);
975
976 if (!subitem->getNodeName()->equals(theNodeName))
934 {977 {
935 Schema* schema = theManager->getSchema();978 Schema* schema = theManager->getSchema();
936 ZORBA_ASSERT(schema != NULL);979 ZORBA_ASSERT(schema != NULL);
937980
938 store::Item_t headName;981 store::Item_t headName;
939982
940#ifndef ZORBA_NO_XMLSCHEMA983#ifndef ZORBA_NO_XMLSCHEMA
941 schema->getSubstitutionHeadForElement(subitem->getNodeName(), headName);984 schema->getSubstitutionHeadForElement(subitem->getNodeName(), headName);
942985
943 while (headName != NULL)986 while (headName != NULL)
944 {987 {
945 if (headName->equals(m_node_name))988 if (headName->equals(theNodeName))
946 {
947 break;989 break;
948 }990
949
950 schema->getSubstitutionHeadForElement(headName.getp(), headName);991 schema->getSubstitutionHeadForElement(headName.getp(), headName);
951 }992 }
952#endif // ZORBA_NO_XMLSCHEMA993#endif // ZORBA_NO_XMLSCHEMA
953994
954 if (headName == NULL)995 if (headName == NULL)
955 return false;996 return false;
956 }997 }
957 else998
999 if (theContentType == NULL ||
1000 theContentType->type_kind() == XQType::ANY_TYPE_KIND)
1001 return true;
1002
1003 xqtref_t subContentType = tm->create_named_type(subitem->getType(),
1004 TypeConstants::QUANT_ONE,
1005 loc,
1006 true);
1007
1008 if (!TypeOps::is_subtype(tm, *subContentType, *theContentType))
1009 return false;
1010
1011 bool nillable;
1012 store::Item_t typeName;
1013 tm->get_schema_element_typeinfo(subitem->getNodeName(), typeName, nillable, loc);
1014
1015 if (!nillable && subitem->getNilled())
1016 return false;
1017
1018 return true;
1019 }
1020 else
1021 {
1022 if (theNodeName != NULL && !subitem->getNodeName()->equals(theNodeName))
1023 return false;
1024
1025 if (!theNillable && subitem->getNilled())
1026 return false;
1027
1028 if (theContentType == NULL ||
1029 theContentType->type_kind() == XQType::ANY_TYPE_KIND)
1030 return true;
1031
1032 xqtref_t subContentType =
1033 tm->create_named_type(subitem->getType(), TypeConstants::QUANT_ONE, loc, true);
1034
1035 return TypeOps::is_subtype(tm, *subContentType, *theContentType);
1036 }
1037 }
1038 case store::StoreConsts::documentNode:
1039 {
1040 if (theContentType == NULL ||
1041 theContentType->type_kind() == XQType::ANY_TYPE_KIND)
1042 return true;
1043
1044 if (theContentType->type_kind() == XQType::UNTYPED_KIND)
1045 {
1046 return !subitem->isValidated();
1047 }
1048
1049 ZORBA_ASSERT(theContentType->type_kind() == XQType::NODE_TYPE_KIND);
1050
1051 store::Iterator_t childrenIte = subitem->getChildren();
1052 store::Item_t child;
1053 store::Item_t elemChild;
1054 csize numElemChildren = 0;
1055 childrenIte->open();
1056 while (childrenIte->next(child))
1057 {
1058 if (child->getNodeKind() == store::StoreConsts::elementNode)
958 {1059 {
959 return false;1060 if (numElemChildren == 0)
1061 elemChild.transfer(child);
1062
1063 ++numElemChildren;
960 }1064 }
961 }1065 }
1066 childrenIte->close();
1067
1068 if (numElemChildren != 1)
1069 return false;
1070
1071 const NodeXQType* elemTestType =
1072 static_cast<const NodeXQType*>(theContentType.getp());
1073
1074 return elemTestType->is_supertype(tm, elemChild, loc);
962 }1075 }
9631076 default:
964 // document-node(E) matches any document node that contains exactly one element
965 // node, optionally accompanied by one or more comment and processing instruction
966 // nodes, if E is an ElementTest or SchemaElementTest that matches the element node.
967 bool is_element_test = (
968 m_node_kind == store::StoreConsts::documentNode &&
969 theContentType != NULL &&
970 theContentType->type_kind() == XQType::NODE_TYPE_KIND &&
971 static_cast<const NodeXQType*>(theContentType.getp())->m_schema_test == false);
972
973 if (m_node_kind != store::StoreConsts::elementNode &&
974 m_node_kind != store::StoreConsts::attributeNode &&
975 !is_element_test)
976 return true;
977
978 if (theContentType == NULL ||
979 theContentType->type_kind() == XQType::ANY_TYPE_KIND)
980 return true;
981
982 if (is_element_test)
983 {1077 {
984 xqtref_t documentNodeType = tm->create_value_type(subitem, loc);1078 ZORBA_ASSERT(false);
985 return TypeOps::is_subtype(tm, *documentNodeType, *this);1079 }
986 }1080 }
987
988 xqtref_t subContentType = tm->create_named_type(subitem->getType(),
989 TypeConstants::QUANT_ONE,
990 loc,
991 true);
992
993 return TypeOps::is_subtype(tm, *subContentType, *theContentType);
994}1081}
9951082
9961083
@@ -999,16 +1086,16 @@
999********************************************************************************/1086********************************************************************************/
1000std::ostream& NodeXQType::serialize_ostream(std::ostream& os) const1087std::ostream& NodeXQType::serialize_ostream(std::ostream& os) const
1001{1088{
1002 store::StoreConsts::NodeKind node_kind = m_node_kind;1089 store::StoreConsts::NodeKind node_kind = theNodeKind;
1003 xqtref_t content_type = get_content_type();1090 xqtref_t content_type = get_content_type();
10041091
1005 os << "[NodeXQType " << store::StoreConsts::toString(node_kind)1092 os << "[NodeXQType " << store::StoreConsts::toString(node_kind)
1006 << TypeOps::decode_quantifier(get_quantifier());1093 << TypeOps::decode_quantifier(get_quantifier());
10071094
1008 if (m_node_name != NULL)1095 if (theNodeName != NULL)
1009 {1096 {
1010 os << " nametest=[uri: " << m_node_name->getNamespace()1097 os << " nametest=[uri: " << theNodeName->getNamespace()
1011 << ", local: " << m_node_name->getLocalName() << "]";1098 << ", local: " << theNodeName->getLocalName() << "]";
1012 }1099 }
10131100
1014 if (content_type != NULL)1101 if (content_type != NULL)
@@ -1025,7 +1112,7 @@
1025{1112{
1026 std::ostringstream os;1113 std::ostringstream os;
10271114
1028 if (m_node_kind == store::StoreConsts::documentNode)1115 if (theNodeKind == store::StoreConsts::documentNode)
1029 {1116 {
1030 os << "document-node(";1117 os << "document-node(";
1031 1118
@@ -1035,26 +1122,26 @@
1035 os << ", " << theContentType->toSchemaString();1122 os << ", " << theContentType->toSchemaString();
1036 }1123 }
1037 }1124 }
1038 else if (m_schema_test)1125 else if (theIsSchemaTest)
1039 {1126 {
1040 assert(theContentType != NULL);1127 assert(theContentType != NULL);
10411128
1042 os << "schema-" << store::StoreConsts::toSchemaString(get_node_kind()) << "("1129 os << "schema-" << store::StoreConsts::toSchemaString(get_node_kind()) << "("
1043 << m_node_name->getStringValue();1130 << theNodeName->getStringValue();
1044 }1131 }
1045 else1132 else
1046 {1133 {
1047 os << store::StoreConsts::toSchemaString(get_node_kind()) << "(";1134 os << store::StoreConsts::toSchemaString(get_node_kind()) << "(";
1048 1135
1049 if (m_node_name != NULL)1136 if (theNodeName != NULL)
1050 {1137 {
1051 os << m_node_name->getStringValue();1138 os << theNodeName->getStringValue();
10521139
1053 if (theContentType != NULL)1140 if (theContentType != NULL)
1054 {1141 {
1055 os << ", " << theContentType->toSchemaString();1142 os << ", " << theContentType->toSchemaString();
10561143
1057 if (m_nillable)1144 if (theNillable)
1058 os << "?";1145 os << "?";
1059 }1146 }
1060 }1147 }
@@ -1062,7 +1149,7 @@
1062 {1149 {
1063 os << "*, " << theContentType->toSchemaString();1150 os << "*, " << theContentType->toSchemaString();
10641151
1065 if (m_nillable)1152 if (theNillable)
1066 os << "?";1153 os << "?";
1067 }1154 }
1068 }1155 }
@@ -1238,6 +1325,7 @@
1238********************************************************************************/1325********************************************************************************/
1239UserDefinedXQType::UserDefinedXQType(1326UserDefinedXQType::UserDefinedXQType(
1240 const TypeManager* manager,1327 const TypeManager* manager,
1328 bool isAnonymous,
1241 store::Item_t qname,1329 store::Item_t qname,
1242 const xqtref_t& baseType,1330 const xqtref_t& baseType,
1243 TypeConstants::quantifier_t quantifier,1331 TypeConstants::quantifier_t quantifier,
@@ -1246,8 +1334,9 @@
1246 bool builtin)1334 bool builtin)
1247 :1335 :
1248 XQType(manager, USER_DEFINED_KIND, quantifier, builtin),1336 XQType(manager, USER_DEFINED_KIND, quantifier, builtin),
1337 theIsAnonymous(isAnonymous),
1249 theQName(qname),1338 theQName(qname),
1250 m_baseType(baseType),1339 theBaseType(baseType),
1251 theUDTKind(udtKind),1340 theUDTKind(udtKind),
1252 m_contentKind(contentKind)1341 m_contentKind(contentKind)
1253{1342{
@@ -1267,14 +1356,16 @@
1267********************************************************************************/1356********************************************************************************/
1268UserDefinedXQType::UserDefinedXQType(1357UserDefinedXQType::UserDefinedXQType(
1269 const TypeManager* manager,1358 const TypeManager* manager,
1359 bool isAnonymous,
1270 store::Item_t qname,1360 store::Item_t qname,
1271 const xqtref_t& baseType,1361 const xqtref_t& baseType,
1272 const XQType* listItemType,1362 const XQType* listItemType,
1273 bool builtin)1363 bool builtin)
1274 :1364 :
1275 XQType(manager, USER_DEFINED_KIND, TypeConstants::QUANT_STAR, builtin),1365 XQType(manager, USER_DEFINED_KIND, TypeConstants::QUANT_STAR, builtin),
1366 theIsAnonymous(isAnonymous),
1276 theQName(qname),1367 theQName(qname),
1277 m_baseType(baseType),1368 theBaseType(baseType),
1278 theUDTKind(LIST_UDT),1369 theUDTKind(LIST_UDT),
1279 m_contentKind(SIMPLE_CONTENT_KIND),1370 m_contentKind(SIMPLE_CONTENT_KIND),
1280 m_listItemType(listItemType)1371 m_listItemType(listItemType)
@@ -1288,6 +1379,7 @@
1288********************************************************************************/1379********************************************************************************/
1289UserDefinedXQType::UserDefinedXQType(1380UserDefinedXQType::UserDefinedXQType(
1290 const TypeManager* manager,1381 const TypeManager* manager,
1382 bool isAnonymous,
1291 store::Item_t qname,1383 store::Item_t qname,
1292 const xqtref_t& baseType,1384 const xqtref_t& baseType,
1293 TypeConstants::quantifier_t quantifier,1385 TypeConstants::quantifier_t quantifier,
@@ -1295,8 +1387,9 @@
1295 bool builtin)1387 bool builtin)
1296 :1388 :
1297 XQType(manager, USER_DEFINED_KIND, quantifier, builtin),1389 XQType(manager, USER_DEFINED_KIND, quantifier, builtin),
1390 theIsAnonymous(isAnonymous),
1298 theQName(qname),1391 theQName(qname),
1299 m_baseType(baseType),1392 theBaseType(baseType),
1300 theUDTKind(UNION_UDT),1393 theUDTKind(UNION_UDT),
1301 m_contentKind(SIMPLE_CONTENT_KIND),1394 m_contentKind(SIMPLE_CONTENT_KIND),
1302 m_unionItemTypes(unionItemTypes)1395 m_unionItemTypes(unionItemTypes)
@@ -1317,7 +1410,7 @@
1317{1410{
1318 serialize_baseclass(ar, (XQType*)this);1411 serialize_baseclass(ar, (XQType*)this);
1319 ar & theQName;1412 ar & theQName;
1320 ar & m_baseType;1413 ar & theBaseType;
1321 SERIALIZE_ENUM(UDTKind, theUDTKind);1414 SERIALIZE_ENUM(UDTKind, theUDTKind);
1322 SERIALIZE_ENUM(content_kind_t, m_contentKind);1415 SERIALIZE_ENUM(content_kind_t, m_contentKind);
1323 ar & m_listItemType;1416 ar & m_listItemType;
@@ -1330,7 +1423,7 @@
1330********************************************************************************/1423********************************************************************************/
1331xqtref_t UserDefinedXQType::getBaseBuiltinType() const1424xqtref_t UserDefinedXQType::getBaseBuiltinType() const
1332{1425{
1333 xqtref_t builtinType = m_baseType;1426 xqtref_t builtinType = theBaseType;
13341427
1335 while (builtinType->type_kind() == XQType::USER_DEFINED_KIND)1428 while (builtinType->type_kind() == XQType::USER_DEFINED_KIND)
1336 {1429 {
@@ -1501,7 +1594,7 @@
1501 << theQName->getNamespace() << " "1594 << theQName->getNamespace() << " "
1502 << info.str()1595 << info.str()
1503 << " base:"1596 << " base:"
1504 << ( m_baseType ? m_baseType->toString() : "NULL" )1597 << ( theBaseType ? theBaseType->toString() : "NULL" )
1505 << "]";1598 << "]";
1506}1599}
15071600
15081601
=== modified file 'src/types/typeimpl.h'
--- src/types/typeimpl.h 2013-03-08 15:03:58 +0000
+++ src/types/typeimpl.h 2013-04-23 20:40:48 +0000
@@ -375,6 +375,8 @@
375375
376 int card() const;376 int card() const;
377377
378 virtual bool isAnonymous() const { return false; }
379
378 bool isComplex() const;380 bool isComplex() const;
379381
380 bool isList() const;382 bool isList() const;
@@ -567,11 +569,11 @@
567 friend class XQType;569 friend class XQType;
568570
569private:571private:
570 store::StoreConsts::NodeKind m_node_kind;572 store::StoreConsts::NodeKind theNodeKind;
571 store::Item_t m_node_name;573 store::Item_t theNodeName;
572 xqtref_t theContentType;574 xqtref_t theContentType;
573 bool m_nillable;575 bool theNillable;
574 bool m_schema_test;576 bool theIsSchemaTest;
575577
576public:578public:
577 SERIALIZABLE_CLASS(NodeXQType)579 SERIALIZABLE_CLASS(NodeXQType)
@@ -589,19 +591,17 @@
589 bool schematest,591 bool schematest,
590 bool builtin = false);592 bool builtin = false);
591593
592 NodeXQType(594 NodeXQType(const NodeXQType& source, TypeConstants::quantifier_t quant);
593 const NodeXQType& source,595
594 TypeConstants::quantifier_t quantifier);596 store::StoreConsts::NodeKind get_node_kind() const { return theNodeKind; }
595597
596 store::StoreConsts::NodeKind get_node_kind() const { return m_node_kind; }598 store::Item* get_node_name() const { return theNodeName.getp(); }
597599
598 store::Item* get_node_name() const { return m_node_name.getp(); }600 bool is_schema_test() const { return theIsSchemaTest; }
599
600 bool is_schema_test() const { return m_schema_test; }
601601
602 const XQType* get_content_type() const { return theContentType.getp(); }602 const XQType* get_content_type() const { return theContentType.getp(); }
603603
604 bool get_nillable() const { return m_nillable; }604 bool get_nillable() const { return theNillable; }
605605
606 bool is_untyped() const;606 bool is_untyped() const;
607607
@@ -718,7 +718,7 @@
718 ------------718 ------------
719 The baseType of this type. NULL for list or union types.719 The baseType of this type. NULL for list or union types.
720720
721 m_typeCategory:721 theUDTKind:
722 ---------------722 ---------------
723 Whether this is an atomic, list, union, or complex type.723 Whether this is an atomic, list, union, or complex type.
724724
@@ -743,9 +743,11 @@
743743
744744
745private:745private:
746 bool theIsAnonymous;
747
746 store::Item_t theQName;748 store::Item_t theQName;
747749
748 xqtref_t m_baseType;750 xqtref_t theBaseType;
749751
750 UDTKind theUDTKind;752 UDTKind theUDTKind;
751753
@@ -767,6 +769,7 @@
767 // constructor for Atomic and Complex types769 // constructor for Atomic and Complex types
768 UserDefinedXQType(770 UserDefinedXQType(
769 const TypeManager* manager,771 const TypeManager* manager,
772 bool isAnonymous,
770 store::Item_t qname,773 store::Item_t qname,
771 const xqtref_t& baseType,774 const xqtref_t& baseType,
772 TypeConstants::quantifier_t quantifier,775 TypeConstants::quantifier_t quantifier,
@@ -777,6 +780,7 @@
777 // Constructor for List types780 // Constructor for List types
778 UserDefinedXQType(781 UserDefinedXQType(
779 const TypeManager* manager,782 const TypeManager* manager,
783 bool isAnonymous,
780 store::Item_t qname,784 store::Item_t qname,
781 const xqtref_t& baseType,785 const xqtref_t& baseType,
782 const XQType* listItemType,786 const XQType* listItemType,
@@ -785,6 +789,7 @@
785 // Constructor for Union types789 // Constructor for Union types
786 UserDefinedXQType(790 UserDefinedXQType(
787 const TypeManager* manager,791 const TypeManager* manager,
792 bool isAnonymous,
788 store::Item_t qname,793 store::Item_t qname,
789 const xqtref_t& baseType,794 const xqtref_t& baseType,
790 TypeConstants::quantifier_t quantifier,795 TypeConstants::quantifier_t quantifier,
@@ -793,11 +798,13 @@
793798
794 virtual ~UserDefinedXQType() {}799 virtual ~UserDefinedXQType() {}
795800
801 virtual bool isAnonymous() const { return theIsAnonymous; }
802
796 virtual content_kind_t content_kind() const { return m_contentKind; };803 virtual content_kind_t content_kind() const { return m_contentKind; };
797804
798 UDTKind getUDTKind() const { return theUDTKind; }805 UDTKind getUDTKind() const { return theUDTKind; }
799806
800 xqtref_t getBaseType() const { return m_baseType; }807 xqtref_t getBaseType() const { return theBaseType; }
801808
802 xqtref_t getBaseBuiltinType() const;809 xqtref_t getBaseBuiltinType() const;
803810
804811
=== modified file 'src/types/typemanager.h'
--- src/types/typemanager.h 2013-02-07 17:24:36 +0000
+++ src/types/typemanager.h 2013-04-23 20:40:48 +0000
@@ -159,17 +159,18 @@
159 TypeConstants::quantifier_t quant,159 TypeConstants::quantifier_t quant,
160 const QueryLoc& loc) const = 0;160 const QueryLoc& loc) const = 0;
161161
162 virtual void get_schema_element_typename(162 virtual void get_schema_element_typeinfo(
163 const store::Item* elemName,163 const store::Item* elemName,
164 store::Item_t& typeName,164 store::Item_t& typeName,
165 const QueryLoc& loc) = 0;165 bool& nillable,
166 const QueryLoc& loc) const = 0;
166167
167 virtual xqtref_t create_schema_attribute_type(168 virtual xqtref_t create_schema_attribute_type(
168 const store::Item_t& aName,169 const store::Item_t& aName,
169 TypeConstants::quantifier_t quant,170 TypeConstants::quantifier_t quant,
170 const QueryLoc& loc) const = 0;171 const QueryLoc& loc) const = 0;
171172
172 virtual void get_schema_attribute_typename(173 virtual void get_schema_attribute_typeinfo(
173 const store::Item* attrName,174 const store::Item* attrName,
174 store::Item_t& typeName,175 store::Item_t& typeName,
175 const QueryLoc& loc) = 0;176 const QueryLoc& loc) = 0;
176177
=== modified file 'src/types/typemanagerimpl.cpp'
--- src/types/typemanagerimpl.cpp 2013-04-16 07:39:27 +0000
+++ src/types/typemanagerimpl.cpp 2013-04-23 20:40:48 +0000
@@ -893,14 +893,16 @@
893 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), elemName->getStringValue()));893 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), elemName->getStringValue()));
894 }894 }
895895
896 bool nillable;
897
896 xqtref_t contentType =898 xqtref_t contentType =
897 m_schema->createXQTypeFromElementName(this, elemName, true, loc);899 m_schema->createXQTypeFromGlobalElementDecl(this, elemName, true, nillable, loc);
898900
899 return create_node_type(store::StoreConsts::elementNode,901 return create_node_type(store::StoreConsts::elementNode,
900 elemName,902 elemName,
901 contentType,903 contentType,
902 quant,904 quant,
903 false, // nillable905 nillable,
904 true); // schematest906 true); // schematest
905}907}
906908
@@ -908,10 +910,11 @@
908/***************************************************************************//**910/***************************************************************************//**
909 Get the name of the type associated with a given globally declared element name.911 Get the name of the type associated with a given globally declared element name.
910********************************************************************************/912********************************************************************************/
911void TypeManagerImpl::get_schema_element_typename(913void TypeManagerImpl::get_schema_element_typeinfo(
912 const store::Item* elemName,914 const store::Item* elemName,
913 store::Item_t& typeName,915 store::Item_t& typeName,
914 const QueryLoc& loc)916 bool& nillable,
917 const QueryLoc& loc) const
915{918{
916 if (m_schema == NULL)919 if (m_schema == NULL)
917 {920 {
@@ -919,7 +922,7 @@
919 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), elemName->getStringValue()));922 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), elemName->getStringValue()));
920 }923 }
921924
922 m_schema->getTypeNameFromElementName(elemName, typeName, loc);925 m_schema->getInfoFromGlobalElementDecl(elemName, typeName, nillable, loc);
923}926}
924927
925928
@@ -941,7 +944,7 @@
941 }944 }
942945
943 xqtref_t contentType =946 xqtref_t contentType =
944 m_schema->createXQTypeFromAttributeName(this, attrName, true, loc);947 m_schema->createXQTypeFromGlobalAttributeDecl(this, attrName, true, loc);
945948
946 return create_node_type(store::StoreConsts::attributeNode,949 return create_node_type(store::StoreConsts::attributeNode,
947 attrName,950 attrName,
@@ -956,7 +959,7 @@
956 Get the name of the type associated with a given globally declared attribute959 Get the name of the type associated with a given globally declared attribute
957 name.960 name.
958********************************************************************************/961********************************************************************************/
959void TypeManagerImpl::get_schema_attribute_typename(962void TypeManagerImpl::get_schema_attribute_typeinfo(
960 const store::Item* attrName,963 const store::Item* attrName,
961 store::Item_t& typeName,964 store::Item_t& typeName,
962 const QueryLoc& loc)965 const QueryLoc& loc)
@@ -967,7 +970,7 @@
967 ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), attrName->getStringValue()));970 ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), attrName->getStringValue()));
968 }971 }
969972
970 m_schema->getTypeNameFromAttributeName(attrName, typeName, loc);973 m_schema->getInfoFromGlobalAttributeDecl(attrName, typeName, loc);
971}974}
972975
973976
@@ -1062,6 +1065,7 @@
1062 if (udt.isList())1065 if (udt.isList())
1063 {1066 {
1064 return new UserDefinedXQType(this,1067 return new UserDefinedXQType(this,
1068 udt.isAnonymous(),
1065 udt.getQName(),1069 udt.getQName(),
1066 udt.getBaseType(),1070 udt.getBaseType(),
1067 udt.getListItemType());1071 udt.getListItemType());
@@ -1069,6 +1073,7 @@
1069 else if (udt.isUnion())1073 else if (udt.isUnion())
1070 {1074 {
1071 return new UserDefinedXQType(this,1075 return new UserDefinedXQType(this,
1076 udt.isAnonymous(),
1072 udt.getQName(),1077 udt.getQName(),
1073 udt.getBaseType(),1078 udt.getBaseType(),
1074 quantifier,1079 quantifier,
@@ -1077,6 +1082,7 @@
1077 else1082 else
1078 {1083 {
1079 return new UserDefinedXQType(this,1084 return new UserDefinedXQType(this,
1085 udt.isAnonymous(),
1080 udt.getQName(),1086 udt.getQName(),
1081 udt.getBaseType(),1087 udt.getBaseType(),
1082 quantifier,1088 quantifier,
10831089
=== modified file 'src/types/typemanagerimpl.h'
--- src/types/typemanagerimpl.h 2013-02-07 17:24:36 +0000
+++ src/types/typemanagerimpl.h 2013-04-23 20:40:48 +0000
@@ -148,17 +148,18 @@
148 TypeConstants::quantifier_t quant,148 TypeConstants::quantifier_t quant,
149 const QueryLoc& loc) const;149 const QueryLoc& loc) const;
150150
151 void get_schema_element_typename(151 void get_schema_element_typeinfo(
152 const store::Item* elemName,152 const store::Item* elemName,
153 store::Item_t& typeName,153 store::Item_t& typeName,
154 const QueryLoc& loc);154 bool& nillable,
155 const QueryLoc& loc) const;
155156
156 xqtref_t create_schema_attribute_type(157 xqtref_t create_schema_attribute_type(
157 const store::Item_t& attrName,158 const store::Item_t& attrName,
158 TypeConstants::quantifier_t quant,159 TypeConstants::quantifier_t quant,
159 const QueryLoc& loc) const;160 const QueryLoc& loc) const;
160 161
161 void get_schema_attribute_typename(162 void get_schema_attribute_typeinfo(
162 const store::Item* attrName,163 const store::Item* attrName,
163 store::Item_t& typeName,164 store::Item_t& typeName,
164 const QueryLoc& loc);165 const QueryLoc& loc);
165166
=== modified file 'src/types/typeops.cpp'
--- src/types/typeops.cpp 2013-03-16 08:48:16 +0000
+++ src/types/typeops.cpp 2013-04-23 20:40:48 +0000
@@ -131,20 +131,32 @@
131 return false;131 return false;
132132
133#ifndef ZORBA_NO_XMLSCHEMA133#ifndef ZORBA_NO_XMLSCHEMA
134 if (ntype.get_node_kind() == store::StoreConsts::elementNode)134 try
135 {135 {
136 return (schema->createXQTypeFromElementName(tm,136 bool nillable;
137 ntype.get_node_name(),137 store::Item_t typeName;
138 false,138 if (ntype.get_node_kind() == store::StoreConsts::elementNode)
139 QueryLoc::null) != NULL);139 {
140 }140 schema->getInfoFromGlobalElementDecl(ntype.get_node_name(),
141 else141 typeName,
142 {142 nillable,
143 return (schema->createXQTypeFromAttributeName(tm,143 QueryLoc::null);
144 ntype.get_node_name(),144 }
145 false,145 else
146 QueryLoc::null) != NULL);146 {
147 }147 schema->getInfoFromGlobalAttributeDecl(ntype.get_node_name(),
148 typeName,
149 QueryLoc::null);
150 }
151 }
152 catch (ZorbaException& e)
153 {
154 if (e.diagnostic() == err::XPST0008)
155 return false;
156
157 throw;
158 }
159
148#else160#else
149 throw ZORBA_EXCEPTION(err::XQST0009);161 throw ZORBA_EXCEPTION(err::XQST0009);
150#endif162#endif
151163
=== modified file 'test/fots/CMakeLists.txt'
--- test/fots/CMakeLists.txt 2013-04-23 20:25:27 +0000
+++ test/fots/CMakeLists.txt 2013-04-23 20:40:48 +0000
@@ -187,21 +187,6 @@
187EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-017 0)187EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-017 0)
188EXPECTED_FOTS_FAILURE (fn-last last-24 0)188EXPECTED_FOTS_FAILURE (fn-last last-24 0)
189EXPECTED_FOTS_FAILURE (fn-matches cbcl-matches-038 1131304)189EXPECTED_FOTS_FAILURE (fn-matches cbcl-matches-038 1131304)
190EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-33 0)
191EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-35 0)
192EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-37 0)
193EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-38 0)
194EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-39 0)
195EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-41 0)
196EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-44 0)
197EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-45 0)
198EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-46 0)
199EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-47 0)
200EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-50 0)
201EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-51 0)
202EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-52 0)
203EXPECTED_FOTS_FAILURE (fn-nilled cbcl-nilled-002 0)
204EXPECTED_FOTS_FAILURE (fn-nilled cbcl-nilled-005 0)
205EXPECTED_FOTS_FAILURE (fn-normalize-space fn-normalize-space-23 0)190EXPECTED_FOTS_FAILURE (fn-normalize-space fn-normalize-space-23 0)
206EXPECTED_FOTS_FAILURE (fn-normalize-space fn-normalize-space-25 0)191EXPECTED_FOTS_FAILURE (fn-normalize-space fn-normalize-space-25 0)
207EXPECTED_FOTS_FAILURE (fn-normalize-unicode cbcl-fn-normalize-unicode-001 0)192EXPECTED_FOTS_FAILURE (fn-normalize-unicode cbcl-fn-normalize-unicode-001 0)
208193
=== modified file 'test/rbkt/Queries/zorba/schemas/books.xsd'
--- test/rbkt/Queries/zorba/schemas/books.xsd 2013-02-07 17:24:36 +0000
+++ test/rbkt/Queries/zorba/schemas/books.xsd 2013-04-23 20:40:48 +0000
@@ -5,8 +5,8 @@
5 elementFormDefault="qualified">5 elementFormDefault="qualified">
6 6
7 <!-- importing the XML namespace makes xml:id an ID attribute under lax validation -->7 <!-- importing the XML namespace makes xml:id an ID attribute under lax validation -->
8 <xs:import namespace="http://www.w3.org/XML/1998/namespace"/> 8 <xs:import namespace="http://www.w3.org/XML/1998/namespace"
99 schemaLocation="http://www.w3.org/2001/xml.xsd"/>
1010
11 <xs:element name="BOOKLIST">11 <xs:element name="BOOKLIST">
12 <xs:complexType>12 <xs:complexType>
1313
=== modified file 'test/update/Scripts/Readme.txt'
--- test/update/Scripts/Readme.txt 2013-02-07 17:24:36 +0000
+++ test/update/Scripts/Readme.txt 2013-04-23 20:40:48 +0000
@@ -12,7 +12,8 @@
12# See the License for the specific language governing permissions and12# See the License for the specific language governing permissions and
13# limitations under the License.13# limitations under the License.
14#14#
15To generate a report for submitting to the W3C:15
16To generate a report for submitting to the W3C be sure to use at least Xerces 3.1.1
1617
170. For submitting reports to W3C one should compile Zorba with:180. For submitting reports to W3C one should compile Zorba with:
18 ZORBA_WITH_BIG_INTEGER=ON19 ZORBA_WITH_BIG_INTEGER=ON
@@ -21,6 +22,8 @@
21 ZORBA_TEST_W3C_TO_SUBMIT_RESULTS=ON22 ZORBA_TEST_W3C_TO_SUBMIT_RESULTS=ON
22 ZORBA_WITH_JSON=OFF23 ZORBA_WITH_JSON=OFF
2324
25Update the import_w3c_update_testsuite.sh by removing lines 136, 139 and 140.
26
241. Import XQUTS.271. Import XQUTS.
2528
262. Run a CTest dashboard from your build directory:292. Run a CTest dashboard from your build directory:
2730
=== modified file 'test/update/Scripts/import_w3c_update_testsuite.sh'
--- test/update/Scripts/import_w3c_update_testsuite.sh 2013-02-07 17:24:36 +0000
+++ test/update/Scripts/import_w3c_update_testsuite.sh 2013-04-23 20:40:48 +0000
@@ -101,7 +101,7 @@
101 for $src in //source return concat ("%src ", $src/@ID, " ", $src/@FileName),101 for $src in //source return concat ("%src ", $src/@ID, " ", $src/@FileName),
102102
103 for $tc in //test-case103 for $tc in //test-case
104 return 104 return
105 (105 (
106 concat("case=", $tc/@FilePath, $tc/@name),106 concat("case=", $tc/@FilePath, $tc/@name),
107107
@@ -132,9 +132,13 @@
132132
133 for $error in $state/expected-error133 for $error in $state/expected-error
134 return concat("Error: ",134 return concat("Error: ",
135 if ($error/text() eq "*")135 if ($error/text() eq "*"
136 or ($tc/@name = "revalidate-valtrans-ins-003")
137 )
136 then "" else "http://www.w3.org/2005/xqt-errors:",138 then "" else "http://www.w3.org/2005/xqt-errors:",
137 $error/text())139 if($tc/@name = "revalidate-valtrans-ins-003")
140 then ""
141 else $error/text())
138 ),142 ),
139143
140 "end"144 "end"
141145
=== modified file 'test/update/updtestdriver.cpp'
--- test/update/updtestdriver.cpp 2013-03-14 08:01:06 +0000
+++ test/update/updtestdriver.cpp 2013-04-23 20:40:48 +0000
@@ -44,6 +44,9 @@
44#include "system/properties.h"44#include "system/properties.h"
45#include "testdriver_comparator.h"45#include "testdriver_comparator.h"
4646
47//#define ZORBA_TEST_PLAN_SERIALIZATION
48
49
47bool isErrorExpected(zorba::ZorbaException& e, State* aState) 50bool isErrorExpected(zorba::ZorbaException& e, State* aState)
48{51{
49 if ( aState->hasErrors) 52 if ( aState->hasErrors)

Subscribers

People subscribed via source and target branches