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

Proposed by Sorin Marian Nasoi
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/bug1147563
Merge into: lp:zorba
Diff against target: 1730 lines (+477/-338)
24 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 (+16/-31)
test/rbkt/Queries/zorba/schemas/books.xsd (+2/-2)
test/update/Scripts/Readme.txt (+2/-3)
test/update/updtestdriver.cpp (+3/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug1147563
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Pending
Cezar Andrei Pending
Sorin Marian Nasoi Pending
Chris Hillery Pending
Review via email: mp+160838@code.launchpad.net

This proposal supersedes a proposal from 2013-03-14.

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

> 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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

I will work on doing the required fixes.

review: Needs Fixing
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

> 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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

> 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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

> 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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal
Revision history for this message
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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

Revision history for this message
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal

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
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,

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
1=== modified file 'ChangeLog'
2--- ChangeLog 2013-04-25 02:37:42 +0000
3+++ ChangeLog 2013-04-25 09:54:30 +0000
4@@ -49,6 +49,8 @@
5 * Fixed bug #1124273 (xqdoc crash because of annotation literals)
6 * Fixed bug #1085408 (xs:date(): casting large year values)
7 * Fixed bug #867027 (XQST0059 error messages inconsistent)
8+ * Fixed fn:nilled function
9+ * Fixed bug concerning nillability during sequnce type matching.
10 * Fixed bug #1095889 (Improve error message for xml-parsing error).
11 * Fixed bug #1131984 (apparently invalid regex in queries)
12 * Fixed bug #1123163 (fn:format-integer failures)
13
14=== modified file 'src/compiler/translator/translator.cpp'
15--- src/compiler/translator/translator.cpp 2013-04-24 03:54:58 +0000
16+++ src/compiler/translator/translator.cpp 2013-04-25 09:54:30 +0000
17@@ -293,9 +293,13 @@
18 {
19 public:
20 CompilerCB * theCCB;
21+
22 hashmap<zstring, static_context_t> mod_sctx_map;
23+
24 hashmap<zstring, zstring> mod_ns_map;
25- checked_vector<expr*> theInitExprs;
26+
27+ checked_vector<expr*> theInitExprs;
28+
29 std::auto_ptr<static_context> globalSctx;
30
31 public:
32@@ -14129,13 +14133,15 @@
33
34 if (axisExpr != NULL)
35 {
36+ bool nillable;
37 store::Item_t typeQNameItem;
38- CTX_TM->get_schema_element_typename(elemQNameItem, typeQNameItem, loc);
39+ CTX_TM->get_schema_element_typeinfo(elemQNameItem, typeQNameItem, nillable, loc);
40
41 match_expr* match = theExprManager->create_match_expr(theRootSctx, theUDF, loc);
42 match->setTestKind(match_xs_elem_test);
43 match->setQName(elemQNameItem);
44 match->setTypeName(typeQNameItem);
45+ match->setNilledAllowed(nillable);
46
47 axisExpr->setTest(match);
48 }
49@@ -14253,7 +14259,7 @@
50 if (axisExpr != NULL)
51 {
52 store::Item_t typeQNameItem;
53- CTX_TM->get_schema_attribute_typename(attrQNameItem, typeQNameItem, loc);
54+ CTX_TM->get_schema_attribute_typeinfo(attrQNameItem, typeQNameItem, loc);
55
56 match_expr* match = theExprManager->create_match_expr(theRootSctx, theUDF, loc);
57 match->setTestKind(match_xs_attr_test);
58
59=== modified file 'src/runtime/accessors/accessors_impl.cpp'
60--- src/runtime/accessors/accessors_impl.cpp 2013-03-15 08:22:41 +0000
61+++ src/runtime/accessors/accessors_impl.cpp 2013-04-25 09:54:30 +0000
62@@ -105,8 +105,15 @@
63 {
64 if (inNode->isNode())
65 {
66- result = inNode->getNilled();
67- STACK_PUSH(result != NULL, state);
68+ if (inNode->getNodeKind() == store::StoreConsts::elementNode)
69+ {
70+ GENV_ITEMFACTORY->createBoolean(result, inNode->getNilled());
71+ STACK_PUSH(true, state);
72+ }
73+ else
74+ {
75+ STACK_PUSH(false, state);
76+ }
77 }
78 else
79 {
80@@ -240,6 +247,8 @@
81 }
82
83 state->theTypedValueIter = 0; // TODO remove???
84+
85+ done:
86 STACK_END(state);
87 }
88
89
90=== modified file 'src/runtime/core/path_iterators.cpp'
91--- src/runtime/core/path_iterators.cpp 2013-04-08 15:07:13 +0000
92+++ src/runtime/core/path_iterators.cpp 2013-04-25 09:54:30 +0000
93@@ -313,7 +313,7 @@
94
95 if ((!TypeOps::is_subtype(sctx->get_typemanager(), *atype, *theType)) ||
96 (theNilledAllowed == false &&
97- node->getNilled()->getBooleanValue() == true))
98+ node->getNilled() == true))
99 {
100 return false;
101 }
102@@ -338,7 +338,7 @@
103
104 if ((!TypeOps::is_subtype(sctx->get_typemanager(), *atype, *theType)) ||
105 (theNilledAllowed == false &&
106- node->getNilled()->getBooleanValue() == true))
107+ node->getNilled() == true))
108 return false;
109
110 return true;
111
112=== modified file 'src/runtime/core/sequencetypes.cpp'
113--- src/runtime/core/sequencetypes.cpp 2013-04-18 08:47:43 +0000
114+++ src/runtime/core/sequencetypes.cpp 2013-04-25 09:54:30 +0000
115@@ -84,7 +84,7 @@
116 store::Item_t item;
117 TypeConstants::quantifier_t quant;
118 bool res = false;
119-
120+ store::Item_t temp;
121 const TypeManager* tm = theSctx->get_typemanager();
122
123 PlanIteratorState* state;
124
125=== modified file 'src/runtime/visitors/printer_visitor_impl.cpp'
126--- src/runtime/visitors/printer_visitor_impl.cpp 2013-03-27 07:55:14 +0000
127+++ src/runtime/visitors/printer_visitor_impl.cpp 2013-04-25 09:54:30 +0000
128@@ -208,21 +208,6 @@
129 thePrinter.endEndVisit();
130 }
131
132-void PrinterVisitor::beginVisit ( const TreatIterator& a )
133-{
134- thePrinter.startBeginVisit("TreatIterator", ++theId);
135- if (a.theCheckPrime)
136- thePrinter.addAttribute("type", a.theTreatType->toString());
137- thePrinter.addAttribute("quant", TypeOps::decode_quantifier(a.theQuantifier));
138- printCommons( &a, theId );
139- thePrinter.endBeginVisit(theId);
140-}
141-
142-void PrinterVisitor::endVisit ( const TreatIterator& )
143-{
144- thePrinter.startEndVisit();
145- thePrinter.endEndVisit();
146-}
147
148 void PrinterVisitor::beginVisit ( const NumArithIterator<AddOperation>& a )
149 {
150@@ -1176,6 +1161,7 @@
151 thePrinter.endEndVisit();
152 }
153
154+
155 void PrinterVisitor::beginVisit(const PromoteIterator& a)
156 {
157 thePrinter.startBeginVisit("PromoteIterator", ++theId);
158@@ -1192,6 +1178,24 @@
159 thePrinter.endEndVisit();
160 }
161
162+
163+void PrinterVisitor::beginVisit ( const TreatIterator& a )
164+{
165+ thePrinter.startBeginVisit("TreatIterator", ++theId);
166+ if (a.theCheckPrime)
167+ thePrinter.addAttribute("type", a.theTreatType->toString());
168+ thePrinter.addAttribute("quant", TypeOps::decode_quantifier(a.theQuantifier));
169+ printCommons( &a, theId );
170+ thePrinter.endBeginVisit(theId);
171+}
172+
173+void PrinterVisitor::endVisit ( const TreatIterator& )
174+{
175+ thePrinter.startEndVisit();
176+ thePrinter.endEndVisit();
177+}
178+
179+
180 void PrinterVisitor::beginVisit(const CastableIterator& a)
181 {
182 thePrinter.startBeginVisit("CastableIterator", ++theId);
183
184=== modified file 'src/store/api/item.h'
185--- src/store/api/item.h 2013-04-08 00:44:26 +0000
186+++ src/store/api/item.h 2013-04-25 09:54:30 +0000
187@@ -674,7 +674,7 @@
188 /** Accessor for element node
189 * @return boolean?
190 */
191- virtual Item_t
192+ virtual bool
193 getNilled() const;
194
195 /** Accessor for document node, element node, attribute node, namespace node,
196
197=== modified file 'src/store/naive/item.cpp'
198--- src/store/naive/item.cpp 2013-04-08 00:44:26 +0000
199+++ src/store/naive/item.cpp 2013-04-25 09:54:30 +0000
200@@ -976,7 +976,7 @@
201 }
202
203
204-store::Item_t Item::getNilled() const
205+bool Item::getNilled() const
206 {
207 throw ZORBA_EXCEPTION(
208 zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
209
210=== modified file 'src/store/naive/node_items.cpp'
211--- src/store/naive/node_items.cpp 2013-04-17 12:37:36 +0000
212+++ src/store/naive/node_items.cpp 2013-04-25 09:54:30 +0000
213@@ -2968,6 +2968,17 @@
214 {
215 zstring rch;
216 getStringValue2(rch);
217+
218+ if (rch.empty())
219+ {
220+ if (getNilled())
221+ {
222+ val = NULL;
223+ iter = NULL;
224+ return;
225+ }
226+ }
227+
228 GET_FACTORY().createUntypedAtomic(val, rch);
229 }
230 }
231@@ -3048,17 +3059,15 @@
232 /*******************************************************************************
233
234 ********************************************************************************/
235-store::Item_t ElementNode::getNilled() const
236+bool ElementNode::getNilled() const
237 {
238 store::Item_t val;
239
240 if (getType()->equals(GET_STORE().XS_UNTYPED_QNAME))
241- {
242- GET_FACTORY().createBoolean(val, false);
243- return val;
244- }
245+ return false;
246
247- bool nilled = true;
248+ if (!isValidated())
249+ return false;
250
251 const_iterator ite = childrenBegin();
252 const_iterator end = childrenEnd();
253@@ -3068,38 +3077,31 @@
254 if ((*ite)->getNodeKind() == store::StoreConsts::elementNode ||
255 (*ite)->getNodeKind() == store::StoreConsts::textNode)
256 {
257- nilled = false;
258- break;
259+ return false;
260 }
261 }
262
263- if (!nilled)
264- {
265- GET_FACTORY().createBoolean(val, false);
266- return val;
267- }
268-
269- nilled = false;
270-
271- //const char* xsi = "http://www.w3.org/2001/XMLSchema-instance";
272- //ulong xsilen = strlen(xsi);
273-
274 ite = attrsBegin();
275 end = attrsEnd();
276
277 for (; ite != end; ++ite)
278 {
279 XmlNode* attr = *ite;
280- if (ZSTREQ(attr->getNodeName()->getNamespace(), "xsi") &&
281- ZSTREQ(attr->getNodeName()->getLocalName(), "nil"))
282+
283+ zstring strval;
284+ attr->getStringValue2(strval);
285+
286+ if (ZSTREQ(attr->getNodeName()->getNamespace(),
287+ "http://www.w3.org/2001/XMLSchema-instance") &&
288+ ZSTREQ(attr->getNodeName()->getLocalName(), "nil") &&
289+ (ZSTREQ(strval, "true") || ZSTREQ(strval, "1") ))
290 {
291- nilled = true;
292+ return true;
293 break;
294 }
295 }
296
297- GET_FACTORY().createBoolean(val, nilled);
298- return val;
299+ return false;
300 }
301
302
303
304=== modified file 'src/store/naive/node_items.h'
305--- src/store/naive/node_items.h 2013-03-07 10:10:10 +0000
306+++ src/store/naive/node_items.h 2013-04-25 09:54:30 +0000
307@@ -500,12 +500,6 @@
308
309 store::Item* copy(store::Item* parent, const store::CopyMode& copymode) const;
310
311- virtual store::Item_t getNilled() const
312- {
313- assert(!isConnectorNode());
314- return 0;
315- }
316-
317 virtual bool isId() const
318 {
319 assert(!isConnectorNode());
320@@ -1072,7 +1066,7 @@
321
322 void appendStringValue(zstring& buf) const;
323
324- store::Item_t getNilled() const;
325+ bool getNilled() const;
326
327 store::Iterator_t getAttributes() const;
328
329
330=== modified file 'src/types/root_typemanager.cpp'
331--- src/types/root_typemanager.cpp 2013-03-20 18:39:54 +0000
332+++ src/types/root_typemanager.cpp 2013-04-25 09:54:30 +0000
333@@ -386,18 +386,21 @@
334 #undef ATOMIC_TYPE_DEFN
335
336 XS_NMTOKENS_TYPE = new UserDefinedXQType(this,
337+ false,
338 XS_NMTOKENS_QNAME,
339 NULL,
340 NMTOKEN_TYPE_ONE.getp(),
341 true);
342
343 XS_ENTITIES_TYPE = new UserDefinedXQType(this,
344+ false,
345 XS_ENTITIES_QNAME,
346 NULL,
347 ENTITY_TYPE_ONE.getp(),
348 true);
349
350 XS_IDREFS_TYPE = new UserDefinedXQType(this,
351+ false,
352 XS_IDREFS_QNAME,
353 NULL,
354 IDREF_TYPE_ONE.getp(),
355
356=== modified file 'src/types/schema/schema.cpp'
357--- src/types/schema/schema.cpp 2013-04-16 21:12:12 +0000
358+++ src/types/schema/schema.cpp 2013-04-25 09:54:30 +0000
359@@ -259,7 +259,8 @@
360
361 return lRetval;
362 }
363- else {
364+ else
365+ {
366 // We didn't find it. If we return NULL here, Xerces will try to
367 // resolve it its own way, which we don't want to happen.
368 throw XQUERY_EXCEPTION(
369@@ -271,7 +272,8 @@
370 );
371 }
372 }
373- catch (ZorbaException const& e) {
374+ catch (ZorbaException const& e)
375+ {
376 TRACE("!!! ZorbaException: " << e );
377 if ( e.diagnostic() == zerr::ZXQP0029_URI_ACCESS_DENIED ||
378 e.diagnostic() == err::XQST0059 )
379@@ -518,82 +520,71 @@
380
381
382 /*******************************************************************************
383- For the given element name find out its declared schema type
384+ Find a global element declaration for a given element name and return the name
385+ of the associated schema type and whether the element can be nillable.
386+ Raise an error if no global element declaration is found for the given name.
387 *******************************************************************************/
388-void Schema::getTypeNameFromElementName(
389+void Schema::getInfoFromGlobalElementDecl(
390 const store::Item* qname,
391 store::Item_t& typeName,
392+ bool& nillable,
393 const QueryLoc& loc)
394 {
395- XSTypeDefinition* typeDef = getTypeDefForElement(qname);
396+ XSElementDeclaration* decl = getDeclForElement(qname);
397
398- if (!typeDef)
399+ if (!decl)
400 {
401 RAISE_ERROR(err::XPST0008, loc,
402 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), qname->getStringValue()));
403 }
404
405- const XMLCh* typeNameStr = typeDef->getName();
406- const XMLCh* typeUri = typeDef->getNamespace();
407-
408- GENV_ITEMFACTORY->createQName(typeName,
409- StrX(typeUri).localForm(),
410- "",
411- StrX(typeNameStr).localForm());
412-}
413-
414-
415-/*******************************************************************************
416- For a given global attribute find out its declared schema type
417-*******************************************************************************/
418-void Schema::getTypeNameFromAttributeName(
419- const store::Item* qname,
420- store::Item_t& typeName,
421- const QueryLoc& loc)
422-{
423- XSTypeDefinition* typeDef = getTypeDefForAttribute(qname);
424-
425- if (!typeDef)
426- {
427- RAISE_ERROR(err::XPST0008, loc,
428- ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), qname->getStringValue()));
429- }
430-
431- const XMLCh* typeNameStr = typeDef->getName();
432- const XMLCh* typeUri = typeDef->getNamespace();
433-
434- GENV_ITEMFACTORY->createQName(typeName,
435- StrX(typeUri).localForm(),
436- "",
437- StrX(typeNameStr).localForm());
438-}
439-
440-
441-/*******************************************************************************
442- Returns an XQType for a global schema element definition if defined,
443- otherwise NULL
444-*******************************************************************************/
445-xqtref_t Schema::createXQTypeFromElementName(
446+ XSTypeDefinition* typeDef = decl->getTypeDefinition();
447+
448+ const XMLCh* typeNameStr = typeDef->getName();
449+ const XMLCh* typeUri = typeDef->getNamespace();
450+
451+ GENV_ITEMFACTORY->createQName(typeName,
452+ StrX(typeUri).localForm(),
453+ "",
454+ StrX(typeNameStr).localForm());
455+
456+ nillable = decl->getNillable();
457+}
458+
459+
460+/*******************************************************************************
461+ Find a global element declaration for a given element name and return an
462+ XQType for the associated schema type and whether the element can be nillable.
463+ Raise an error if the raiseErrors param is true and no global element
464+ declaration is found for the given name.
465+*******************************************************************************/
466+xqtref_t Schema::createXQTypeFromGlobalElementDecl(
467 const TypeManager* typeManager,
468 const store::Item* qname,
469- const bool riseErrors,
470+ const bool raiseErrors,
471+ bool& nillable,
472 const QueryLoc& loc)
473 {
474 TRACE("qn:" << qname->getLocalName() << " @ " <<
475 qname->getNamespace() );
476
477- XSTypeDefinition* typeDef = getTypeDefForElement(qname);
478+ XSElementDeclaration* decl = getDeclForElement(qname);
479
480- if (!riseErrors && !typeDef)
481+ if (!raiseErrors && !decl)
482 return NULL;
483
484- if (!typeDef)
485+ if (!decl)
486 {
487 RAISE_ERROR(err::XPST0008, loc,
488 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), qname->getStringValue()));
489 }
490
491+ nillable = decl->getNillable();
492+
493+ XSTypeDefinition* typeDef = decl->getTypeDefinition();
494+
495 xqtref_t res = createXQTypeFromTypeDefinition(typeManager, typeDef);
496+
497 TRACE("res:" << res->get_qname()->getLocalName() << " @ " <<
498 res->get_qname()->getNamespace());
499
500@@ -602,18 +593,46 @@
501
502
503 /*******************************************************************************
504+ Find a global attribute declaration for a given attribute name and return the
505+ name of the associated schema type. Raise an error if no global attribute
506+ declaration is found for the given name.
507+*******************************************************************************/
508+void Schema::getInfoFromGlobalAttributeDecl(
509+ const store::Item* qname,
510+ store::Item_t& typeName,
511+ const QueryLoc& loc)
512+{
513+ XSTypeDefinition* typeDef = getTypeDefForAttribute(qname);
514+
515+ if (!typeDef)
516+ {
517+ RAISE_ERROR(err::XPST0008, loc,
518+ ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), qname->getStringValue()));
519+ }
520+
521+ const XMLCh* typeNameStr = typeDef->getName();
522+ const XMLCh* typeUri = typeDef->getNamespace();
523+
524+ GENV_ITEMFACTORY->createQName(typeName,
525+ StrX(typeUri).localForm(),
526+ "",
527+ StrX(typeNameStr).localForm());
528+}
529+
530+
531+/*******************************************************************************
532 Returns an XQType for a global schema attribute definition if defined,
533 otherwise NULL
534 *******************************************************************************/
535-xqtref_t Schema::createXQTypeFromAttributeName(
536+xqtref_t Schema::createXQTypeFromGlobalAttributeDecl(
537 const TypeManager* typeManager,
538 const store::Item* qname,
539- const bool riseErrors,
540+ const bool raiseErrors,
541 const QueryLoc& loc)
542 {
543 XSTypeDefinition* typeDef = getTypeDefForAttribute(qname);
544
545- if (!riseErrors && !typeDef)
546+ if (!raiseErrors && !typeDef)
547 return NULL;
548
549 if (!typeDef)
550@@ -744,12 +763,10 @@
551
552
553 /*******************************************************************************
554- Get the type definition for a globally declared element
555+ Get the declaration for a globally declared element
556 *******************************************************************************/
557-XSTypeDefinition* Schema::getTypeDefForElement(const store::Item* qname)
558+XSElementDeclaration* Schema::getDeclForElement(const store::Item* qname)
559 {
560- XSTypeDefinition* typeDef = NULL;
561-
562 TRACE(" element qname: " << qname->getLocalName() << "@" <<
563 qname->getNamespace());
564
565@@ -762,25 +779,7 @@
566 bool xsModelWasChanged;
567 XSModel* model = theGrammarPool->getXSModel(xsModelWasChanged);
568
569- XSElementDeclaration* decl = model->getElementDeclaration(local, uri);
570-
571- if (decl)
572- {
573- typeDef = decl->getTypeDefinition();
574-
575- // this works only on the element that is a substitution,
576- // not on substitution base element
577- //XSElementDeclaration * substGroup =
578- // decl->getSubstitutionGroupAffiliation();
579-
580- //if ( substGroup )
581- //{
582- // TRACE(" substitutionGroup qname: " << StrX(substGroup->getName()) <<
583- // "@" << StrX(substGroup->getNamespace()) << "\n");
584- //}
585- }
586-
587- return typeDef;
588+ return model->getElementDeclaration(local, uri);
589 }
590
591
592@@ -868,6 +867,7 @@
593 xqtref_t baseXQType = createXQTypeFromTypeDefinition(tm, baseTypeDef);
594
595 xqtref_t xqType = new UserDefinedXQType(tm,
596+ xsTypeDef->getAnonymous(),
597 qname,
598 baseXQType,
599 TypeConstants::QUANT_ONE,
600@@ -903,6 +903,7 @@
601 // << endl; cout.flush();
602
603 xqtref_t xqType = new UserDefinedXQType(tm,
604+ xsTypeDef->getAnonymous(),
605 qname,
606 NULL,
607 itemXQType.getp());
608@@ -958,6 +959,7 @@
609 //std::cout << std::endl; std::cout.flush();
610
611 xqtref_t xqType = new UserDefinedXQType(tm,
612+ xsTypeDef->getAnonymous(),
613 qname,
614 baseXQType,
615 TypeConstants::QUANT_ONE,
616@@ -1059,6 +1061,7 @@
617 }
618
619 xqtref_t xqType = new UserDefinedXQType(tm,
620+ xsTypeDef->getAnonymous(),
621 qname,
622 baseXQType,
623 TypeConstants::QUANT_ONE,
624@@ -1310,9 +1313,10 @@
625 bool xsModelWasChanged;
626 XSModel* model = theGrammarPool->getXSModel(xsModelWasChanged);
627
628- XSNamedMap<XSObject> * typeDefs =
629- model->getComponents(XSConstants::TYPE_DEFINITION);
630- for( uint i = 0; i<typeDefs->getLength(); i++)
631+ XSNamedMap<XSObject>* typeDefs =
632+ model->getComponents(XSConstants::TYPE_DEFINITION);
633+
634+ for( uint i = 0; i < typeDefs->getLength(); i++)
635 {
636 XSTypeDefinition* typeDef = (XSTypeDefinition*)(typeDefs->item(i));
637 checkForAnonymousTypesInType(typeManager, typeDef);
638@@ -1529,6 +1533,7 @@
639
640 xqtref_t xqType =
641 xqtref_t(new UserDefinedXQType(typeManager,
642+ xsTypeDef->getAnonymous(),
643 qname,
644 baseXQType,
645 TypeConstants::QUANT_ONE,
646
647=== modified file 'src/types/schema/schema.h'
648--- src/types/schema/schema.h 2013-02-07 17:24:36 +0000
649+++ src/types/schema/schema.h 2013-04-25 09:54:30 +0000
650@@ -43,6 +43,7 @@
651 namespace XERCES_CPP_NAMESPACE {
652 class InputSource;
653 class XSTypeDefinition;
654+ class XSElementDeclaration;
655 class XSParticle;
656 class XMLGrammarPool;
657 }
658@@ -106,31 +107,33 @@
659
660 void registerXSD(
661 const char* xsdURL,
662- static_context * aSctx,
663- internal::StreamResource* aStreamResource,
664+ static_context* sctx,
665+ internal::StreamResource* streamResource,
666 const QueryLoc& loc);
667
668 void getSubstitutionHeadForElement(
669 const store::Item* qname,
670 store::Item_t& result);
671
672- void getTypeNameFromElementName(
673- const store::Item* qname,
674- store::Item_t& typeName,
675- const QueryLoc& loc);
676-
677- void getTypeNameFromAttributeName(
678- const store::Item* qname,
679- store::Item_t& typeName,
680- const QueryLoc& loc);
681-
682- xqtref_t createXQTypeFromElementName(
683+ void getInfoFromGlobalElementDecl(
684+ const store::Item* qname,
685+ store::Item_t& typeName,
686+ bool& nillable,
687+ const QueryLoc& loc);
688+
689+ xqtref_t createXQTypeFromGlobalElementDecl(
690 const TypeManager* typeManager,
691 const store::Item* qname,
692- const bool riseErrors,
693- const QueryLoc& loc);
694-
695- xqtref_t createXQTypeFromAttributeName(
696+ const bool raiseErrors,
697+ bool& nillable,
698+ const QueryLoc& loc);
699+
700+ void getInfoFromGlobalAttributeDecl(
701+ const store::Item* qname,
702+ store::Item_t& typeName,
703+ const QueryLoc& loc);
704+
705+ xqtref_t createXQTypeFromGlobalAttributeDecl(
706 const TypeManager* typeManager,
707 const store::Item* qname,
708 const bool riseErrors,
709@@ -194,11 +197,11 @@
710 private:
711
712 #ifndef ZORBA_NO_XMLSCHEMA
713- XERCES_CPP_NAMESPACE::XSTypeDefinition*
714- getTypeDefForElement(const store::Item* qname);
715+ XERCES_CPP_NAMESPACE::XSElementDeclaration* getDeclForElement(
716+ const store::Item* qname);
717
718- XERCES_CPP_NAMESPACE::XSTypeDefinition*
719- getTypeDefForAttribute(const store::Item* qname);
720+ XERCES_CPP_NAMESPACE::XSTypeDefinition* getTypeDefForAttribute(
721+ const store::Item* qname);
722
723 xqtref_t createXQTypeFromTypeDefinition(
724 const TypeManager* typeManager,
725
726=== modified file 'src/types/schema/validate.cpp'
727--- src/types/schema/validate.cpp 2013-02-07 17:24:36 +0000
728+++ src/types/schema/validate.cpp 2013-04-25 09:54:30 +0000
729@@ -193,20 +193,22 @@
730 {
731 schemaValidator.startDoc();
732
733- // ask for the type of the root element to populate
734- // the cache with anonymous types
735 store::Iterator_t children = sourceNode->getChildren();
736 store::Item_t child;
737 while ( children->next(child) )
738 {
739+ // ask for the type of the element. We don't really need this type here,
740+ // but a side-effect of this call is to add the type to the cache.
741 if ( child->isNode() &&
742 child->getNodeKind()==store::StoreConsts::elementNode )
743 {
744+ bool nillable;
745 typeManager->getSchema()->
746- createXQTypeFromElementName(typeManager,
747- child->getNodeName(),
748- false,
749- loc);
750+ createXQTypeFromGlobalElementDecl(typeManager,
751+ child->getNodeName(),
752+ false,
753+ nillable,
754+ loc);
755 break;
756 }
757 }
758@@ -259,13 +261,15 @@
759 //cout << "Validate element" << "\n"; cout.flush();
760 schemaValidator.startDoc();
761
762- // ask for the type of the root element to populate the cache
763- // with anonymous types
764+ // ask for the type of the element. We don't really need this type here,
765+ // but a side-effect of this call is to add the type to the cache.
766+ bool nillable;
767 typeManager->getSchema()->
768- createXQTypeFromElementName(typeManager,
769- sourceNode->getNodeName(),
770- false,
771- loc);
772+ createXQTypeFromGlobalElementDecl(typeManager,
773+ sourceNode->getNodeName(),
774+ false,
775+ nillable,
776+ loc);
777 }
778
779 store::Item_t newElem = processElement(sctx,
780
781=== modified file 'src/types/typeimpl.cpp'
782--- src/types/typeimpl.cpp 2013-03-22 00:38:18 +0000
783+++ src/types/typeimpl.cpp 2013-04-25 09:54:30 +0000
784@@ -29,6 +29,7 @@
785 #include "zorbaserialization/serialize_template_types.h"
786 #include "zorbaserialization/serialize_zorba_types.h"
787
788+#include "store/api/iterator.h"
789
790 namespace zorba
791 {
792@@ -718,11 +719,11 @@
793 bool builtin)
794 :
795 XQType(manager, NODE_TYPE_KIND, quantifier, builtin),
796- m_node_kind(nodeKind),
797- m_node_name(nodeName),
798+ theNodeKind(nodeKind),
799+ theNodeName(nodeName),
800 theContentType(contentType),
801- m_nillable(nillable),
802- m_schema_test(schematest)
803+ theNillable(nillable),
804+ theIsSchemaTest(schematest)
805 {
806 assert(contentType == NULL ||
807 (nodeKind == store::StoreConsts::documentNode &&
808@@ -754,11 +755,11 @@
809 TypeConstants::quantifier_t quantifier)
810 :
811 XQType(source.theManager, NODE_TYPE_KIND, quantifier, false),
812- m_node_kind(source.m_node_kind),
813- m_node_name(source.m_node_name),
814+ theNodeKind(source.theNodeKind),
815+ theNodeName(source.theNodeName),
816 theContentType(source.theContentType),
817- m_nillable(source.m_nillable),
818- m_schema_test(source.m_schema_test)
819+ theNillable(source.theNillable),
820+ theIsSchemaTest(source.theIsSchemaTest)
821 {
822 }
823
824@@ -769,11 +770,11 @@
825 void NodeXQType::serialize(::zorba::serialization::Archiver& ar)
826 {
827 serialize_baseclass(ar, (XQType*)this);
828- SERIALIZE_ENUM(store::StoreConsts::NodeKind, m_node_kind);
829- ar & m_node_name;
830+ SERIALIZE_ENUM(store::StoreConsts::NodeKind, theNodeKind);
831+ ar & theNodeName;
832 ar & theContentType;
833- ar & m_nillable;
834- ar & m_schema_test;
835+ ar & theNillable;
836+ ar & theIsSchemaTest;
837 }
838
839
840@@ -791,15 +792,15 @@
841 ********************************************************************************/
842 bool NodeXQType::is_equal(const TypeManager* tm, const NodeXQType& other) const
843 {
844- if (m_node_kind != other.m_node_kind)
845+ if (theNodeKind != other.theNodeKind)
846 return false;
847
848- if (m_node_name != other.m_node_name)
849+ if (theNodeName != other.theNodeName)
850 {
851- if (m_node_name == NULL || other.m_node_name == NULL)
852+ if (theNodeName == NULL || other.theNodeName == NULL)
853 return false;
854
855- if (!m_node_name->equals(other.m_node_name))
856+ if (!theNodeName->equals(other.theNodeName))
857 return false;
858 }
859
860@@ -829,7 +830,7 @@
861 const NodeXQType& supertype,
862 const QueryLoc& loc) const
863 {
864- if (supertype.m_node_kind == store::StoreConsts::anyNode)
865+ if (supertype.theNodeKind == store::StoreConsts::anyNode)
866 {
867 if (supertype.theContentType != NULL &&
868 supertype.theContentType->type_kind() == XQType::UNTYPED_KIND)
869@@ -841,17 +842,17 @@
870 return true;
871 }
872
873- if (supertype.m_node_kind != m_node_kind)
874+ if (supertype.theNodeKind != theNodeKind)
875 return false;
876
877- if (supertype.m_node_name != NULL)
878+ if (supertype.theNodeName != NULL)
879 {
880- if (m_node_name == NULL)
881+ if (theNodeName == NULL)
882 return false;
883
884- if (!m_node_name->equals(supertype.m_node_name))
885+ if (!theNodeName->equals(supertype.theNodeName))
886 {
887- if (supertype.m_schema_test)
888+ if (supertype.theIsSchemaTest)
889 {
890 Schema* schema = supertype.theManager->getSchema();
891 ZORBA_ASSERT(schema != NULL);
892@@ -859,11 +860,11 @@
893 store::Item_t headName;
894
895 #ifndef ZORBA_NO_XMLSCHEMA
896- schema->getSubstitutionHeadForElement(m_node_name.getp(), headName);
897+ schema->getSubstitutionHeadForElement(theNodeName.getp(), headName);
898
899 while (headName != NULL)
900 {
901- if (headName->equals(supertype.m_node_name))
902+ if (headName->equals(supertype.theNodeName))
903 {
904 break;
905 }
906@@ -883,10 +884,18 @@
907 }
908
909 if (theContentType == supertype.theContentType)
910+ {
911+ if (supertype.theNillable == false && theNillable == true)
912+ return false;
913+
914 return true;
915+ }
916
917 if (theContentType != NULL && supertype.theContentType != NULL)
918 {
919+ if (supertype.theNillable == false && theNillable == true)
920+ return false;
921+
922 return TypeOps::is_subtype(tm, *theContentType, *supertype.theContentType);
923 }
924 else if (supertype.theContentType == NULL)
925@@ -912,7 +921,7 @@
926 {
927 assert(subitem->isNode());
928
929- if (m_node_kind == store::StoreConsts::anyNode)
930+ if (theNodeKind == store::StoreConsts::anyNode)
931 {
932 if (theContentType != NULL &&
933 theContentType->type_kind() == XQType::UNTYPED_KIND)
934@@ -923,74 +932,152 @@
935 return true;
936 }
937
938- if (m_node_kind != subitem->getNodeKind())
939+ if (theNodeKind != subitem->getNodeKind())
940 return false;
941
942- if (m_node_name != NULL)
943- {
944- if (!subitem->getNodeName()->equals(m_node_name))
945- {
946- if (m_schema_test)
947+ switch (theNodeKind)
948+ {
949+ case store::StoreConsts::textNode:
950+ case store::StoreConsts::commentNode:
951+ case store::StoreConsts::namespaceNode:
952+ {
953+ return true;
954+ }
955+ case store::StoreConsts::piNode:
956+ {
957+ if (theNodeName != NULL && !subitem->getNodeName()->equals(theNodeName))
958+ return false;
959+
960+ return true;
961+ }
962+ case store::StoreConsts::attributeNode:
963+ {
964+ assert(!theIsSchemaTest || (theNodeName && theContentType));
965+
966+ if (theNodeName != NULL && !subitem->getNodeName()->equals(theNodeName))
967+ return false;
968+
969+ if (theContentType != NULL)
970+ {
971+ xqtref_t subContentType =
972+ tm->create_named_type(subitem->getType(), TypeConstants::QUANT_ONE, loc, true);
973+
974+ return TypeOps::is_subtype(tm, *subContentType, *theContentType);
975+ }
976+
977+ return true;
978+ }
979+ case store::StoreConsts::elementNode:
980+ {
981+ if (theIsSchemaTest)
982+ {
983+ assert(theNodeName != NULL);
984+
985+ if (!subitem->getNodeName()->equals(theNodeName))
986 {
987 Schema* schema = theManager->getSchema();
988 ZORBA_ASSERT(schema != NULL);
989-
990+
991 store::Item_t headName;
992-
993+
994 #ifndef ZORBA_NO_XMLSCHEMA
995 schema->getSubstitutionHeadForElement(subitem->getNodeName(), headName);
996-
997+
998 while (headName != NULL)
999 {
1000- if (headName->equals(m_node_name))
1001- {
1002+ if (headName->equals(theNodeName))
1003 break;
1004- }
1005-
1006+
1007 schema->getSubstitutionHeadForElement(headName.getp(), headName);
1008 }
1009 #endif // ZORBA_NO_XMLSCHEMA
1010-
1011+
1012 if (headName == NULL)
1013 return false;
1014 }
1015- else
1016+
1017+ if (theContentType == NULL ||
1018+ theContentType->type_kind() == XQType::ANY_TYPE_KIND)
1019+ return true;
1020+
1021+ xqtref_t subContentType = tm->create_named_type(subitem->getType(),
1022+ TypeConstants::QUANT_ONE,
1023+ loc,
1024+ true);
1025+
1026+ if (!TypeOps::is_subtype(tm, *subContentType, *theContentType))
1027+ return false;
1028+
1029+ bool nillable;
1030+ store::Item_t typeName;
1031+ tm->get_schema_element_typeinfo(subitem->getNodeName(), typeName, nillable, loc);
1032+
1033+ if (!nillable && subitem->getNilled())
1034+ return false;
1035+
1036+ return true;
1037+ }
1038+ else
1039+ {
1040+ if (theNodeName != NULL && !subitem->getNodeName()->equals(theNodeName))
1041+ return false;
1042+
1043+ if (!theNillable && subitem->getNilled())
1044+ return false;
1045+
1046+ if (theContentType == NULL ||
1047+ theContentType->type_kind() == XQType::ANY_TYPE_KIND)
1048+ return true;
1049+
1050+ xqtref_t subContentType =
1051+ tm->create_named_type(subitem->getType(), TypeConstants::QUANT_ONE, loc, true);
1052+
1053+ return TypeOps::is_subtype(tm, *subContentType, *theContentType);
1054+ }
1055+ }
1056+ case store::StoreConsts::documentNode:
1057+ {
1058+ if (theContentType == NULL ||
1059+ theContentType->type_kind() == XQType::ANY_TYPE_KIND)
1060+ return true;
1061+
1062+ if (theContentType->type_kind() == XQType::UNTYPED_KIND)
1063+ {
1064+ return !subitem->isValidated();
1065+ }
1066+
1067+ ZORBA_ASSERT(theContentType->type_kind() == XQType::NODE_TYPE_KIND);
1068+
1069+ store::Iterator_t childrenIte = subitem->getChildren();
1070+ store::Item_t child;
1071+ store::Item_t elemChild;
1072+ csize numElemChildren = 0;
1073+ childrenIte->open();
1074+ while (childrenIte->next(child))
1075+ {
1076+ if (child->getNodeKind() == store::StoreConsts::elementNode)
1077 {
1078- return false;
1079+ if (numElemChildren == 0)
1080+ elemChild.transfer(child);
1081+
1082+ ++numElemChildren;
1083 }
1084 }
1085+ childrenIte->close();
1086+
1087+ if (numElemChildren != 1)
1088+ return false;
1089+
1090+ const NodeXQType* elemTestType =
1091+ static_cast<const NodeXQType*>(theContentType.getp());
1092+
1093+ return elemTestType->is_supertype(tm, elemChild, loc);
1094 }
1095-
1096- // document-node(E) matches any document node that contains exactly one element
1097- // node, optionally accompanied by one or more comment and processing instruction
1098- // nodes, if E is an ElementTest or SchemaElementTest that matches the element node.
1099- bool is_element_test = (
1100- m_node_kind == store::StoreConsts::documentNode &&
1101- theContentType != NULL &&
1102- theContentType->type_kind() == XQType::NODE_TYPE_KIND &&
1103- static_cast<const NodeXQType*>(theContentType.getp())->m_schema_test == false);
1104-
1105- if (m_node_kind != store::StoreConsts::elementNode &&
1106- m_node_kind != store::StoreConsts::attributeNode &&
1107- !is_element_test)
1108- return true;
1109-
1110- if (theContentType == NULL ||
1111- theContentType->type_kind() == XQType::ANY_TYPE_KIND)
1112- return true;
1113-
1114- if (is_element_test)
1115+ default:
1116 {
1117- xqtref_t documentNodeType = tm->create_value_type(subitem, loc);
1118- return TypeOps::is_subtype(tm, *documentNodeType, *this);
1119- }
1120-
1121- xqtref_t subContentType = tm->create_named_type(subitem->getType(),
1122- TypeConstants::QUANT_ONE,
1123- loc,
1124- true);
1125-
1126- return TypeOps::is_subtype(tm, *subContentType, *theContentType);
1127+ ZORBA_ASSERT(false);
1128+ }
1129+ }
1130 }
1131
1132
1133@@ -999,16 +1086,16 @@
1134 ********************************************************************************/
1135 std::ostream& NodeXQType::serialize_ostream(std::ostream& os) const
1136 {
1137- store::StoreConsts::NodeKind node_kind = m_node_kind;
1138+ store::StoreConsts::NodeKind node_kind = theNodeKind;
1139 xqtref_t content_type = get_content_type();
1140
1141 os << "[NodeXQType " << store::StoreConsts::toString(node_kind)
1142 << TypeOps::decode_quantifier(get_quantifier());
1143
1144- if (m_node_name != NULL)
1145+ if (theNodeName != NULL)
1146 {
1147- os << " nametest=[uri: " << m_node_name->getNamespace()
1148- << ", local: " << m_node_name->getLocalName() << "]";
1149+ os << " nametest=[uri: " << theNodeName->getNamespace()
1150+ << ", local: " << theNodeName->getLocalName() << "]";
1151 }
1152
1153 if (content_type != NULL)
1154@@ -1025,7 +1112,7 @@
1155 {
1156 std::ostringstream os;
1157
1158- if (m_node_kind == store::StoreConsts::documentNode)
1159+ if (theNodeKind == store::StoreConsts::documentNode)
1160 {
1161 os << "document-node(";
1162
1163@@ -1035,26 +1122,26 @@
1164 os << ", " << theContentType->toSchemaString();
1165 }
1166 }
1167- else if (m_schema_test)
1168+ else if (theIsSchemaTest)
1169 {
1170 assert(theContentType != NULL);
1171
1172 os << "schema-" << store::StoreConsts::toSchemaString(get_node_kind()) << "("
1173- << m_node_name->getStringValue();
1174+ << theNodeName->getStringValue();
1175 }
1176 else
1177 {
1178 os << store::StoreConsts::toSchemaString(get_node_kind()) << "(";
1179
1180- if (m_node_name != NULL)
1181+ if (theNodeName != NULL)
1182 {
1183- os << m_node_name->getStringValue();
1184+ os << theNodeName->getStringValue();
1185
1186 if (theContentType != NULL)
1187 {
1188 os << ", " << theContentType->toSchemaString();
1189
1190- if (m_nillable)
1191+ if (theNillable)
1192 os << "?";
1193 }
1194 }
1195@@ -1062,7 +1149,7 @@
1196 {
1197 os << "*, " << theContentType->toSchemaString();
1198
1199- if (m_nillable)
1200+ if (theNillable)
1201 os << "?";
1202 }
1203 }
1204@@ -1238,6 +1325,7 @@
1205 ********************************************************************************/
1206 UserDefinedXQType::UserDefinedXQType(
1207 const TypeManager* manager,
1208+ bool isAnonymous,
1209 store::Item_t qname,
1210 const xqtref_t& baseType,
1211 TypeConstants::quantifier_t quantifier,
1212@@ -1246,8 +1334,9 @@
1213 bool builtin)
1214 :
1215 XQType(manager, USER_DEFINED_KIND, quantifier, builtin),
1216+ theIsAnonymous(isAnonymous),
1217 theQName(qname),
1218- m_baseType(baseType),
1219+ theBaseType(baseType),
1220 theUDTKind(udtKind),
1221 m_contentKind(contentKind)
1222 {
1223@@ -1267,14 +1356,16 @@
1224 ********************************************************************************/
1225 UserDefinedXQType::UserDefinedXQType(
1226 const TypeManager* manager,
1227+ bool isAnonymous,
1228 store::Item_t qname,
1229 const xqtref_t& baseType,
1230 const XQType* listItemType,
1231 bool builtin)
1232 :
1233 XQType(manager, USER_DEFINED_KIND, TypeConstants::QUANT_STAR, builtin),
1234+ theIsAnonymous(isAnonymous),
1235 theQName(qname),
1236- m_baseType(baseType),
1237+ theBaseType(baseType),
1238 theUDTKind(LIST_UDT),
1239 m_contentKind(SIMPLE_CONTENT_KIND),
1240 m_listItemType(listItemType)
1241@@ -1288,6 +1379,7 @@
1242 ********************************************************************************/
1243 UserDefinedXQType::UserDefinedXQType(
1244 const TypeManager* manager,
1245+ bool isAnonymous,
1246 store::Item_t qname,
1247 const xqtref_t& baseType,
1248 TypeConstants::quantifier_t quantifier,
1249@@ -1295,8 +1387,9 @@
1250 bool builtin)
1251 :
1252 XQType(manager, USER_DEFINED_KIND, quantifier, builtin),
1253+ theIsAnonymous(isAnonymous),
1254 theQName(qname),
1255- m_baseType(baseType),
1256+ theBaseType(baseType),
1257 theUDTKind(UNION_UDT),
1258 m_contentKind(SIMPLE_CONTENT_KIND),
1259 m_unionItemTypes(unionItemTypes)
1260@@ -1317,7 +1410,7 @@
1261 {
1262 serialize_baseclass(ar, (XQType*)this);
1263 ar & theQName;
1264- ar & m_baseType;
1265+ ar & theBaseType;
1266 SERIALIZE_ENUM(UDTKind, theUDTKind);
1267 SERIALIZE_ENUM(content_kind_t, m_contentKind);
1268 ar & m_listItemType;
1269@@ -1330,7 +1423,7 @@
1270 ********************************************************************************/
1271 xqtref_t UserDefinedXQType::getBaseBuiltinType() const
1272 {
1273- xqtref_t builtinType = m_baseType;
1274+ xqtref_t builtinType = theBaseType;
1275
1276 while (builtinType->type_kind() == XQType::USER_DEFINED_KIND)
1277 {
1278@@ -1501,7 +1594,7 @@
1279 << theQName->getNamespace() << " "
1280 << info.str()
1281 << " base:"
1282- << ( m_baseType ? m_baseType->toString() : "NULL" )
1283+ << ( theBaseType ? theBaseType->toString() : "NULL" )
1284 << "]";
1285 }
1286
1287
1288=== modified file 'src/types/typeimpl.h'
1289--- src/types/typeimpl.h 2013-03-08 15:03:58 +0000
1290+++ src/types/typeimpl.h 2013-04-25 09:54:30 +0000
1291@@ -375,6 +375,8 @@
1292
1293 int card() const;
1294
1295+ virtual bool isAnonymous() const { return false; }
1296+
1297 bool isComplex() const;
1298
1299 bool isList() const;
1300@@ -567,11 +569,11 @@
1301 friend class XQType;
1302
1303 private:
1304- store::StoreConsts::NodeKind m_node_kind;
1305- store::Item_t m_node_name;
1306+ store::StoreConsts::NodeKind theNodeKind;
1307+ store::Item_t theNodeName;
1308 xqtref_t theContentType;
1309- bool m_nillable;
1310- bool m_schema_test;
1311+ bool theNillable;
1312+ bool theIsSchemaTest;
1313
1314 public:
1315 SERIALIZABLE_CLASS(NodeXQType)
1316@@ -589,19 +591,17 @@
1317 bool schematest,
1318 bool builtin = false);
1319
1320- NodeXQType(
1321- const NodeXQType& source,
1322- TypeConstants::quantifier_t quantifier);
1323-
1324- store::StoreConsts::NodeKind get_node_kind() const { return m_node_kind; }
1325-
1326- store::Item* get_node_name() const { return m_node_name.getp(); }
1327-
1328- bool is_schema_test() const { return m_schema_test; }
1329+ NodeXQType(const NodeXQType& source, TypeConstants::quantifier_t quant);
1330+
1331+ store::StoreConsts::NodeKind get_node_kind() const { return theNodeKind; }
1332+
1333+ store::Item* get_node_name() const { return theNodeName.getp(); }
1334+
1335+ bool is_schema_test() const { return theIsSchemaTest; }
1336
1337 const XQType* get_content_type() const { return theContentType.getp(); }
1338
1339- bool get_nillable() const { return m_nillable; }
1340+ bool get_nillable() const { return theNillable; }
1341
1342 bool is_untyped() const;
1343
1344@@ -718,7 +718,7 @@
1345 ------------
1346 The baseType of this type. NULL for list or union types.
1347
1348- m_typeCategory:
1349+ theUDTKind:
1350 ---------------
1351 Whether this is an atomic, list, union, or complex type.
1352
1353@@ -743,9 +743,11 @@
1354
1355
1356 private:
1357+ bool theIsAnonymous;
1358+
1359 store::Item_t theQName;
1360
1361- xqtref_t m_baseType;
1362+ xqtref_t theBaseType;
1363
1364 UDTKind theUDTKind;
1365
1366@@ -767,6 +769,7 @@
1367 // constructor for Atomic and Complex types
1368 UserDefinedXQType(
1369 const TypeManager* manager,
1370+ bool isAnonymous,
1371 store::Item_t qname,
1372 const xqtref_t& baseType,
1373 TypeConstants::quantifier_t quantifier,
1374@@ -777,6 +780,7 @@
1375 // Constructor for List types
1376 UserDefinedXQType(
1377 const TypeManager* manager,
1378+ bool isAnonymous,
1379 store::Item_t qname,
1380 const xqtref_t& baseType,
1381 const XQType* listItemType,
1382@@ -785,6 +789,7 @@
1383 // Constructor for Union types
1384 UserDefinedXQType(
1385 const TypeManager* manager,
1386+ bool isAnonymous,
1387 store::Item_t qname,
1388 const xqtref_t& baseType,
1389 TypeConstants::quantifier_t quantifier,
1390@@ -793,11 +798,13 @@
1391
1392 virtual ~UserDefinedXQType() {}
1393
1394+ virtual bool isAnonymous() const { return theIsAnonymous; }
1395+
1396 virtual content_kind_t content_kind() const { return m_contentKind; };
1397
1398 UDTKind getUDTKind() const { return theUDTKind; }
1399
1400- xqtref_t getBaseType() const { return m_baseType; }
1401+ xqtref_t getBaseType() const { return theBaseType; }
1402
1403 xqtref_t getBaseBuiltinType() const;
1404
1405
1406=== modified file 'src/types/typemanager.h'
1407--- src/types/typemanager.h 2013-02-07 17:24:36 +0000
1408+++ src/types/typemanager.h 2013-04-25 09:54:30 +0000
1409@@ -159,17 +159,18 @@
1410 TypeConstants::quantifier_t quant,
1411 const QueryLoc& loc) const = 0;
1412
1413- virtual void get_schema_element_typename(
1414+ virtual void get_schema_element_typeinfo(
1415 const store::Item* elemName,
1416 store::Item_t& typeName,
1417- const QueryLoc& loc) = 0;
1418+ bool& nillable,
1419+ const QueryLoc& loc) const = 0;
1420
1421 virtual xqtref_t create_schema_attribute_type(
1422 const store::Item_t& aName,
1423 TypeConstants::quantifier_t quant,
1424 const QueryLoc& loc) const = 0;
1425
1426- virtual void get_schema_attribute_typename(
1427+ virtual void get_schema_attribute_typeinfo(
1428 const store::Item* attrName,
1429 store::Item_t& typeName,
1430 const QueryLoc& loc) = 0;
1431
1432=== modified file 'src/types/typemanagerimpl.cpp'
1433--- src/types/typemanagerimpl.cpp 2013-04-16 07:39:27 +0000
1434+++ src/types/typemanagerimpl.cpp 2013-04-25 09:54:30 +0000
1435@@ -893,14 +893,16 @@
1436 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), elemName->getStringValue()));
1437 }
1438
1439+ bool nillable;
1440+
1441 xqtref_t contentType =
1442- m_schema->createXQTypeFromElementName(this, elemName, true, loc);
1443+ m_schema->createXQTypeFromGlobalElementDecl(this, elemName, true, nillable, loc);
1444
1445 return create_node_type(store::StoreConsts::elementNode,
1446 elemName,
1447 contentType,
1448 quant,
1449- false, // nillable
1450+ nillable,
1451 true); // schematest
1452 }
1453
1454@@ -908,10 +910,11 @@
1455 /***************************************************************************//**
1456 Get the name of the type associated with a given globally declared element name.
1457 ********************************************************************************/
1458-void TypeManagerImpl::get_schema_element_typename(
1459+void TypeManagerImpl::get_schema_element_typeinfo(
1460 const store::Item* elemName,
1461 store::Item_t& typeName,
1462- const QueryLoc& loc)
1463+ bool& nillable,
1464+ const QueryLoc& loc) const
1465 {
1466 if (m_schema == NULL)
1467 {
1468@@ -919,7 +922,7 @@
1469 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), elemName->getStringValue()));
1470 }
1471
1472- m_schema->getTypeNameFromElementName(elemName, typeName, loc);
1473+ m_schema->getInfoFromGlobalElementDecl(elemName, typeName, nillable, loc);
1474 }
1475
1476
1477@@ -941,7 +944,7 @@
1478 }
1479
1480 xqtref_t contentType =
1481- m_schema->createXQTypeFromAttributeName(this, attrName, true, loc);
1482+ m_schema->createXQTypeFromGlobalAttributeDecl(this, attrName, true, loc);
1483
1484 return create_node_type(store::StoreConsts::attributeNode,
1485 attrName,
1486@@ -956,7 +959,7 @@
1487 Get the name of the type associated with a given globally declared attribute
1488 name.
1489 ********************************************************************************/
1490-void TypeManagerImpl::get_schema_attribute_typename(
1491+void TypeManagerImpl::get_schema_attribute_typeinfo(
1492 const store::Item* attrName,
1493 store::Item_t& typeName,
1494 const QueryLoc& loc)
1495@@ -967,7 +970,7 @@
1496 ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), attrName->getStringValue()));
1497 }
1498
1499- m_schema->getTypeNameFromAttributeName(attrName, typeName, loc);
1500+ m_schema->getInfoFromGlobalAttributeDecl(attrName, typeName, loc);
1501 }
1502
1503
1504@@ -1062,6 +1065,7 @@
1505 if (udt.isList())
1506 {
1507 return new UserDefinedXQType(this,
1508+ udt.isAnonymous(),
1509 udt.getQName(),
1510 udt.getBaseType(),
1511 udt.getListItemType());
1512@@ -1069,6 +1073,7 @@
1513 else if (udt.isUnion())
1514 {
1515 return new UserDefinedXQType(this,
1516+ udt.isAnonymous(),
1517 udt.getQName(),
1518 udt.getBaseType(),
1519 quantifier,
1520@@ -1077,6 +1082,7 @@
1521 else
1522 {
1523 return new UserDefinedXQType(this,
1524+ udt.isAnonymous(),
1525 udt.getQName(),
1526 udt.getBaseType(),
1527 quantifier,
1528
1529=== modified file 'src/types/typemanagerimpl.h'
1530--- src/types/typemanagerimpl.h 2013-02-07 17:24:36 +0000
1531+++ src/types/typemanagerimpl.h 2013-04-25 09:54:30 +0000
1532@@ -148,17 +148,18 @@
1533 TypeConstants::quantifier_t quant,
1534 const QueryLoc& loc) const;
1535
1536- void get_schema_element_typename(
1537+ void get_schema_element_typeinfo(
1538 const store::Item* elemName,
1539 store::Item_t& typeName,
1540- const QueryLoc& loc);
1541+ bool& nillable,
1542+ const QueryLoc& loc) const;
1543
1544 xqtref_t create_schema_attribute_type(
1545 const store::Item_t& attrName,
1546 TypeConstants::quantifier_t quant,
1547 const QueryLoc& loc) const;
1548
1549- void get_schema_attribute_typename(
1550+ void get_schema_attribute_typeinfo(
1551 const store::Item* attrName,
1552 store::Item_t& typeName,
1553 const QueryLoc& loc);
1554
1555=== modified file 'src/types/typeops.cpp'
1556--- src/types/typeops.cpp 2013-03-16 08:48:16 +0000
1557+++ src/types/typeops.cpp 2013-04-25 09:54:30 +0000
1558@@ -131,20 +131,32 @@
1559 return false;
1560
1561 #ifndef ZORBA_NO_XMLSCHEMA
1562- if (ntype.get_node_kind() == store::StoreConsts::elementNode)
1563- {
1564- return (schema->createXQTypeFromElementName(tm,
1565- ntype.get_node_name(),
1566- false,
1567- QueryLoc::null) != NULL);
1568- }
1569- else
1570- {
1571- return (schema->createXQTypeFromAttributeName(tm,
1572- ntype.get_node_name(),
1573- false,
1574- QueryLoc::null) != NULL);
1575- }
1576+ try
1577+ {
1578+ bool nillable;
1579+ store::Item_t typeName;
1580+ if (ntype.get_node_kind() == store::StoreConsts::elementNode)
1581+ {
1582+ schema->getInfoFromGlobalElementDecl(ntype.get_node_name(),
1583+ typeName,
1584+ nillable,
1585+ QueryLoc::null);
1586+ }
1587+ else
1588+ {
1589+ schema->getInfoFromGlobalAttributeDecl(ntype.get_node_name(),
1590+ typeName,
1591+ QueryLoc::null);
1592+ }
1593+ }
1594+ catch (ZorbaException& e)
1595+ {
1596+ if (e.diagnostic() == err::XPST0008)
1597+ return false;
1598+
1599+ throw;
1600+ }
1601+
1602 #else
1603 throw ZORBA_EXCEPTION(err::XQST0009);
1604 #endif
1605
1606=== modified file 'test/fots/CMakeLists.txt'
1607--- test/fots/CMakeLists.txt 2013-04-25 01:27:33 +0000
1608+++ test/fots/CMakeLists.txt 2013-04-25 09:54:30 +0000
1609@@ -134,6 +134,22 @@
1610 EXPECTED_FOTS_FAILURE (DISPUTED prod-OrderByClause orderBy20 21619)
1611 EXPECTED_FOTS_FAILURE (DISPUTED prod-OrderByClause orderBy21 21619)
1612 EXPECTED_FOTS_FAILURE (DISPUTED misc-CombinedErrorCodes XQST0085 21730)
1613+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-001 21568)
1614+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-003 21568)
1615+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-005 21568)
1616+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-007 21568)
1617+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-009 21568)
1618+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-012 21568)
1619+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-013 21568)
1620+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-015 21568)
1621+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-017 21568)
1622+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-019 21568)
1623+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-021 21568)
1624+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-023 21568)
1625+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-025 21568)
1626+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-027 21568)
1627+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-029 21568)
1628+EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-031 21568)
1629
1630 # Next three possibly unique to old RQ machine, but they need to be
1631 # marked for the RQ to pass.
1632@@ -186,21 +202,6 @@
1633 EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-017 0)
1634 EXPECTED_FOTS_FAILURE (fn-last last-24 0)
1635 EXPECTED_FOTS_FAILURE (fn-matches cbcl-matches-038 1131304)
1636-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-33 0)
1637-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-35 0)
1638-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-37 0)
1639-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-38 0)
1640-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-39 0)
1641-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-41 0)
1642-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-44 0)
1643-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-45 0)
1644-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-46 0)
1645-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-47 0)
1646-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-50 0)
1647-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-51 0)
1648-EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-52 0)
1649-EXPECTED_FOTS_FAILURE (fn-nilled cbcl-nilled-002 0)
1650-EXPECTED_FOTS_FAILURE (fn-nilled cbcl-nilled-005 0)
1651 EXPECTED_FOTS_FAILURE (fn-normalize-space fn-normalize-space-23 0)
1652 EXPECTED_FOTS_FAILURE (fn-normalize-space fn-normalize-space-25 0)
1653 EXPECTED_FOTS_FAILURE (fn-normalize-unicode cbcl-fn-normalize-unicode-001 0)
1654@@ -320,22 +321,6 @@
1655 EXPECTED_FOTS_FAILURE (prod-FunctionCall function-call-reserved-function-names-014 0)
1656 EXPECTED_FOTS_FAILURE (prod-FunctionCall function-call-reserved-function-names-015 0)
1657 EXPECTED_FOTS_FAILURE (prod-FunctionCall function-call-reserved-function-names-016 0)
1658-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-001 21568)
1659-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-003 21568)
1660-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-005 21568)
1661-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-007 21568)
1662-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-009 21568)
1663-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-012 21568)
1664-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-013 21568)
1665-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-015 21568)
1666-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-017 21568)
1667-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-019 21568)
1668-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-021 21568)
1669-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-023 21568)
1670-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-025 21568)
1671-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-027 21568)
1672-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-029 21568)
1673-EXPECTED_FOTS_FAILURE (DISPUTED prod-FunctionDecl function-decl-reserved-function-names-031 21568)
1674 EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof113 0)
1675 EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof139 1160559)
1676 EXPECTED_FOTS_FAILURE (prod-InstanceofExpr instanceof140 0)
1677
1678=== modified file 'test/rbkt/Queries/zorba/schemas/books.xsd'
1679--- test/rbkt/Queries/zorba/schemas/books.xsd 2013-02-07 17:24:36 +0000
1680+++ test/rbkt/Queries/zorba/schemas/books.xsd 2013-04-25 09:54:30 +0000
1681@@ -5,8 +5,8 @@
1682 elementFormDefault="qualified">
1683
1684 <!-- importing the XML namespace makes xml:id an ID attribute under lax validation -->
1685- <xs:import namespace="http://www.w3.org/XML/1998/namespace"/>
1686-
1687+ <xs:import namespace="http://www.w3.org/XML/1998/namespace"
1688+ schemaLocation="http://www.w3.org/2001/xml.xsd"/>
1689
1690 <xs:element name="BOOKLIST">
1691 <xs:complexType>
1692
1693=== modified file 'test/update/Scripts/Readme.txt'
1694--- test/update/Scripts/Readme.txt 2013-02-07 17:24:36 +0000
1695+++ test/update/Scripts/Readme.txt 2013-04-25 09:54:30 +0000
1696@@ -14,12 +14,13 @@
1697 #
1698 To generate a report for submitting to the W3C:
1699
1700-0. For submitting reports to W3C one should compile Zorba with:
1701+0. For submitting reports to W3C one should compile Zorba with
1702 ZORBA_WITH_BIG_INTEGER=ON
1703 ZORBA_XQUERYX=ON
1704 ZORBA_TEST_XQUERYX=ON
1705 ZORBA_TEST_W3C_TO_SUBMIT_RESULTS=ON
1706 ZORBA_WITH_JSON=OFF
1707+ And make sure you are using at least Xerces version 3.1.1.
1708
1709 1. Import XQUTS.
1710
1711@@ -62,5 +63,3 @@
1712 7. Modify /tmp/XQUTS_1_0_1/ReportingResults/Results.xml by adding a result node for every report you copied at step 5.
1713
1714 8. From /tmp/XQUTS_1_0_1/ReportingResults/ run 'ant -buildfile Build.xml' in order to generate XQUTSReport.html and XQUTSReportSimple.html
1715-
1716-
1717
1718=== modified file 'test/update/updtestdriver.cpp'
1719--- test/update/updtestdriver.cpp 2013-03-14 08:01:06 +0000
1720+++ test/update/updtestdriver.cpp 2013-04-25 09:54:30 +0000
1721@@ -44,6 +44,9 @@
1722 #include "system/properties.h"
1723 #include "testdriver_comparator.h"
1724
1725+//#define ZORBA_TEST_PLAN_SERIALIZATION
1726+
1727+
1728 bool isErrorExpected(zorba::ZorbaException& e, State* aState)
1729 {
1730 if ( aState->hasErrors)

Subscribers

People subscribed via source and target branches