[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Till Westmann has proposed merging lp:~zorba-coders/zorba/bug-1005995 into lp:zorba. Requested reviews: Till Westmann (tillw) Juan Zacarias (juan457) Matthias Brantner (matthias-brantner) Related bugs: Bug #1005995 in Zorba: fn:path() should support fragments as well as documents https://bugs.launchpad.net/zorba/+bug/1005995 For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 modify fn:path to add support for fragments -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'ChangeLog' --- ChangeLog 2012-06-27 14:07:46 + +++ ChangeLog 2012-06-28 07:24:19 + @@ -8,6 +8,7 @@ * New XQuery 3.0 functions - fn:parse-xml-fragment#1 * Added support for transient maps to the http://www.zorba-xquery.com/modules/store/data-structures/unordered-map module. + * Added support for fragments to fn:path Optimizations: * Small optimization of comparison operations. === modified file 'src/runtime/nodes/nodes_impl.cpp' --- src/runtime/nodes/nodes_impl.cpp 2012-06-18 10:06:47 + +++ src/runtime/nodes/nodes_impl.cpp 2012-06-28 07:24:19 + @@ -653,95 +653,87 @@ bool FnPathIterator::nextImpl(store::Item_t result, PlanState planState) const { store::Item_t inNode; + store::Item_t swap; store::Item_t nodeName; - store::NsBindings nsBindings; zstring path; zstring temp; zstring zNamespace; zstring zLocalName; zstring zPosition; - bool rootIsDocument = false; PlanIteratorState* state; DEFAULT_STACK_INIT(PlanIteratorState, state, planState); if (consumeNext(inNode, theChildren[0], planState)) { -do -{ +while (inNode-getParent()) +{ + temp = path; + path = /; + switch (inNode-getNodeKind()) { -case store::StoreConsts::documentNode: - temp = path; - path = /; - path += temp; - rootIsDocument = true; - break; case store::StoreConsts::elementNode: nodeName = inNode-getNodeName(); zNamespace = nodeName-getNamespace(); zLocalName = nodeName-getLocalName(); zPosition = ztd::to_string(getNodePosition(inNode)); - temp = path; - path = \+zNamespace+\:+zLocalName+[+zPosition.c_str()+]; - path += temp; + path += \+zNamespace+\:+zLocalName+[+zPosition+]; break; case store::StoreConsts::attributeNode: nodeName = inNode-getNodeName(); zNamespace =nodeName-getNamespace(); zLocalName = nodeName-getLocalName(); + path += @; if(zNamespace != ) { -temp = path; -path = @\+zNamespace+\:+zLocalName; -path += temp; - } - else - { -temp = path; -path = @+zLocalName; -path += temp; - } +path += \+zNamespace+\:; + } + path += zLocalName; break; case store::StoreConsts::textNode: zPosition = ztd::to_string(getNodePosition(inNode)); - temp = path; - path = text()[+zPosition+]; - path += temp; + path += text()[+zPosition+]; break; case store::StoreConsts::commentNode: zPosition = ztd::to_string(getNodePosition(inNode)); - temp = path; - path = comment()[+zPosition+]; - path += temp; + path += comment()[+zPosition+]; + break; +case store::StoreConsts::piNode: + nodeName = inNode-getNodeName(); + zLocalName = nodeName-getLocalName(); + zPosition = ztd::to_string(getNodePosition(inNode)); + path += processing-instruction(+zLocalName+)[+zPosition+]; break; default: - if(inNode-isProcessingInstruction()) - { -nodeName = inNode-getNodeName(); -zLocalName = nodeName-getLocalName(); -zPosition = ztd::to_string(getNodePosition(inNode)); -temp = path; -path = processing-instruction(+zLocalName+)[+zPosition+]; -path += temp; - } + // this is either a documentNode which should always be a root + // node (and not end up here) or it is something very strange + ZORBA_ASSERT(false); break; } - inNode = inNode-getParent(); - - if(inNode inNode-getNodeKind() != store::StoreConsts::documentNode) + path += temp; + + swap = inNode-getParent(); + inNode = swap; +} + +// only the root node is left and there we've got some special +// cases in the spec +if (inNode-getNodeKind() == store::StoreConsts::documentNode) +{ + if (path.empty()) { -temp = path; path = /; -path += temp; } - -} while (inNode); - -
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Review: Approve -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Review: Approve -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Review: Approve -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/bug-1005995 into lp:zorba has been updated. Status: Needs review = Approved For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/bug-1005995 into lp:zorba has been updated. Commit Message changed to: modify fn:path to add support for fragments For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/bug-1005995 into lp:zorba has been updated. Status: Approved = Needs review For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/bug-1005995 into lp:zorba has been updated. Status: Needs review = Approved For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Validation queue starting for merge proposal. Log at: http://zorbatest.lambda.nu:8080/remotequeue/bug-1005995-2012-06-28T18-35-25.162Z/log.html -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Validation queue job bug-1005995-2012-06-28T18-35-25.162Z is finished. The final status was: All tests succeeded! -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/bug-1005995 into lp:zorba has been updated. Status: Approved = Merged For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112501 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Till Westmann has proposed merging lp:~zorba-coders/zorba/bug-1005995 into lp:zorba. Requested reviews: Matthias Brantner (matthias-brantner) Till Westmann (tillw) Juan Zacarias (juan457) Related bugs: Bug #1005995 in Zorba: fn:path() should support fragments as well as documents https://bugs.launchpad.net/zorba/+bug/1005995 For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 modify fn:path to add support for fragments -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 Your team Zorba Coders is subscribed to branch lp:zorba. === modified file 'src/runtime/nodes/nodes_impl.cpp' --- src/runtime/nodes/nodes_impl.cpp 2012-06-18 10:06:47 + +++ src/runtime/nodes/nodes_impl.cpp 2012-06-28 00:03:20 + @@ -653,95 +653,87 @@ bool FnPathIterator::nextImpl(store::Item_t result, PlanState planState) const { store::Item_t inNode; + store::Item_t swap; store::Item_t nodeName; - store::NsBindings nsBindings; zstring path; zstring temp; zstring zNamespace; zstring zLocalName; zstring zPosition; - bool rootIsDocument = false; PlanIteratorState* state; DEFAULT_STACK_INIT(PlanIteratorState, state, planState); if (consumeNext(inNode, theChildren[0], planState)) { -do -{ +while (inNode-getParent()) +{ + temp = path; + path = /; + switch (inNode-getNodeKind()) { -case store::StoreConsts::documentNode: - temp = path; - path = /; - path += temp; - rootIsDocument = true; - break; case store::StoreConsts::elementNode: nodeName = inNode-getNodeName(); zNamespace = nodeName-getNamespace(); zLocalName = nodeName-getLocalName(); zPosition = ztd::to_string(getNodePosition(inNode)); - temp = path; - path = \+zNamespace+\:+zLocalName+[+zPosition.c_str()+]; - path += temp; + path += \+zNamespace+\:+zLocalName+[+zPosition+]; break; case store::StoreConsts::attributeNode: nodeName = inNode-getNodeName(); zNamespace =nodeName-getNamespace(); zLocalName = nodeName-getLocalName(); + path += @; if(zNamespace != ) { -temp = path; -path = @\+zNamespace+\:+zLocalName; -path += temp; - } - else - { -temp = path; -path = @+zLocalName; -path += temp; - } +path += \+zNamespace+\:; + } + path += zLocalName; break; case store::StoreConsts::textNode: zPosition = ztd::to_string(getNodePosition(inNode)); - temp = path; - path = text()[+zPosition+]; - path += temp; + path += text()[+zPosition+]; break; case store::StoreConsts::commentNode: zPosition = ztd::to_string(getNodePosition(inNode)); - temp = path; - path = comment()[+zPosition+]; - path += temp; + path += comment()[+zPosition+]; + break; +case store::StoreConsts::piNode: + nodeName = inNode-getNodeName(); + zLocalName = nodeName-getLocalName(); + zPosition = ztd::to_string(getNodePosition(inNode)); + path += processing-instruction(+zLocalName+)[+zPosition+]; break; default: - if(inNode-isProcessingInstruction()) - { -nodeName = inNode-getNodeName(); -zLocalName = nodeName-getLocalName(); -zPosition = ztd::to_string(getNodePosition(inNode)); -temp = path; -path = processing-instruction(+zLocalName+)[+zPosition+]; -path += temp; - } + // this is either a documentNode which should always be a root + // node (and not end up here) or it is something very strange + ZORBA_ASSERT(false); break; } - inNode = inNode-getParent(); - - if(inNode inNode-getNodeKind() != store::StoreConsts::documentNode) + path += temp; + + swap = inNode-getParent(); + inNode = swap; +} + +// only the root node is left and there we've got some special cases +// cases in the spec +if (inNode-getNodeKind() == store::StoreConsts::documentNode) +{ + if (path.empty()) { -temp = path; path = /; -path += temp; } - -} while (inNode); - -if(rootIsDocument) - STACK_PUSH(GENV_ITEMFACTORY-createString(result, path), state); +} else - throw XQUERY_EXCEPTION(err::FODC0001, ERROR_PARAMS(fn:path), ERROR_LOC(loc)); +{ + temp = path; + path = \http://www.w3.org/2005/xpath-functions\:root(); + path += temp; +} + +STACK_PUSH(GENV_ITEMFACTORY-createString(result, path), state); } STACK_END (state); -- Mailing list:
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Review: Approve -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Since I needed this, I've added the fragment support to fn:path. -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/bug-1005995 into lp:zorba has been updated. Status: Needs review = Approved For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Validation queue starting for merge proposal. Log at: http://zorbatest.lambda.nu:8080/remotequeue/bug-1005995-2012-06-28T00-06-57.561Z/log.html -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Validation queue job bug-1005995-2012-06-28T00-06-57.561Z is finished. The final status was: All tests succeeded! -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Voting does not meet specified criteria. Required: Approve 1, Disapprove 1, Needs Fixing 1, Pending 1. Got: 1 Approve, 2 Pending. -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
The proposal to merge lp:~zorba-coders/zorba/bug-1005995 into lp:zorba has been updated. Status: Approved = Needs review For more details, see: https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp
Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-1005995 into lp:zorba
Review: Needs Fixing looks good but addition to ChangeLog is missing -- https://code.launchpad.net/~zorba-coders/zorba/bug-1005995/+merge/112461 Your team Zorba Coders is subscribed to branch lp:zorba. -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp