Merge lp:~zorba-coders/zorba/xquery3.0_funcs into lp:zorba

Proposed by Matthias Brantner
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/xquery3.0_funcs
Merge into: lp:zorba
Diff against target: 1389 lines (+654/-224)
28 files modified
ChangeLog (+13/-15)
modules/w3c/xpath_functions.xq (+17/-1)
src/compiler/translator/translator.cpp (+4/-0)
src/functions/pregenerated/func_accessors.cpp (+20/-0)
src/functions/pregenerated/func_accessors.h (+17/-1)
src/functions/pregenerated/func_nodes.cpp (+44/-0)
src/functions/pregenerated/func_nodes.h (+15/-0)
src/functions/pregenerated/func_parse_fragment.cpp (+1/-1)
src/functions/pregenerated/function_enum.h (+4/-0)
src/runtime/accessors/accessors_impl.cpp (+10/-2)
src/runtime/collections/collections_impl.cpp (+116/-116)
src/runtime/collections/pregenerated/collections.h (+3/-3)
src/runtime/nodes/nodes_impl.cpp (+117/-0)
src/runtime/nodes/pregenerated/nodes.cpp (+22/-0)
src/runtime/nodes/pregenerated/nodes.h (+34/-0)
src/runtime/parsing_and_serializing/parse_fragment_impl.cpp (+65/-13)
src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp (+0/-1)
src/runtime/parsing_and_serializing/pregenerated/parse_fragment.cpp (+15/-15)
src/runtime/parsing_and_serializing/pregenerated/parse_fragment.h (+11/-11)
src/runtime/spec/accessors/accessors.xml (+5/-2)
src/runtime/spec/collections/collections.xml (+26/-26)
src/runtime/spec/nodes/nodes.xml (+27/-0)
src/runtime/spec/parsing_and_serializing/parse_fragment.xml (+32/-3)
src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml (+3/-3)
src/runtime/visitors/pregenerated/planiter_visitor.h (+8/-3)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+19/-5)
src/runtime/visitors/pregenerated/printer_visitor.h (+5/-2)
test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-7.xml.res (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/xquery3.0_funcs
Reviewer Review Type Date Requested Status
Matthias Brantner Pending
Review via email: mp+104341@code.launchpad.net

This proposal supersedes a proposal from 2012-05-02.

This proposal has been superseded by a proposal from 2012-05-02.

Commit message

Added XQuery 3.0 Functions
path, has-children#0, nilled#0

Description of the change

Added XQuery 3.0 Functions
path, has-children#0, nilled#0

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

- The fn:path functions returns a wrong result for the following doc/query:

doc.xml
<a><b/><b/></a>

fn:path(doc("doc.xml")/a/b[2])
/"":a[2]/"":b[1]

- As far as I understood from the spec, fn:parse-xml-fragment should return true for the query

fn:parse-xml-fragment("<alpha>abcd</alpha><beta>abcd</beta>") instance of document-node()

review: Needs Fixing
Revision history for this message
Juan Zacarias (juan457) wrote : Posted in a previous version of this proposal

> - The fn:path functions returns a wrong result for the following doc/query:
>
> doc.xml
> <a><b/><b/></a>
>
> fn:path(doc("doc.xml")/a/b[2])
> /"":a[2]/"":b[1]
Oh It seems I used the wrong value for the position. I have a question about this I was using Item->getRefCount() for the value of the position of the node, but it appears to be wrong is that info on the node stored anywhere else? if not should I implement it as info inside the Item? or just for the function?

>
> - As far as I understood from the spec, fn:parse-xml-fragment should return
> true for the query
>
> fn:parse-xml-fragment("<alpha>abcd</alpha><beta>abcd</beta>") instance of
> document-node()
I will take a look on this

Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

> > - The fn:path functions returns a wrong result for the following doc/query:
> >
> > doc.xml
> > <a><b/><b/></a>
> >
> > fn:path(doc("doc.xml")/a/b[2])
> > /"":a[2]/"":b[1]
> Oh It seems I used the wrong value for the position. I have a question about
> this I was using Item->getRefCount() for the value of the position of the
> node, but it appears to be wrong is that info on the node stored anywhere
> else? if not should I implement it as info inside the Item? or just for the
> function?
getRefCount() returns the number of references to the node. It cannot be used as the position among siblings. I'm afraid there is no such information stored in a node. You probably have to count the number of preceding siblings, i.e. go to the parent and iterate over the children until you reached the node in question.

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/xquery3.0_funcs into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job xquery3.0_funcs-2012-05-02T06-49-10.108Z 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/xquery3.0_funcs into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job xquery3.0_funcs-2012-05-02T06-57-56.708Z 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/xquery3.0_funcs into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job xquery3.0_funcs-2012-05-02T07-18-08.166Z is finished.
  The final status was:

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

  Not commiting changes.

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

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

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

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job xquery3.0_funcs-2012-05-02T07-59-03.884Z is finished.
  The final status was:

  3 tests did not succeed - changes not commited.

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

10745. By Matthias Brantner

fixed failing tests

10747. By Nicolae Brinza

Enabled fn:parse-xml-fragment() which now correctly retuns only one document node holding all the fragments

10748. By Nicolae Brinza

Fixed a new bug in the parse-fragment code reported by Juan. Added relevant testcases

10749. By Nicolae Brinza

Merged with Zorba trunk.

10750. By Nicolae Brinza

Fixed a reported bug in the parse-fragment code.

10751. By Nicolae Brinza

Merged with Zorba trunk

10752. By Juan Zacarias

Fixed failing tests

10753. By Nicolae Brinza

Fixed the parse-fragment() bug where an empty string input would not return a document node.

10754. By Juan Zacarias

updated changelog

10755. By Nicolae Brinza

Merged with Zorba trunk

10756. By Nicolae Brinza

Fixed the Changelog note for the fn:parse-xml-fragment#1 implementation

10757. By Nicolae Brinza

Merged with Zorba trunk

10758. By Nicolae Brinza

Fixed the fn:parse-xml-fragment() pregenerated files so that Zorba now correctly builds

10759. By Nicolae Brinza

Fixed the backwards-compatible zorba:parse-xml-fragment() function so that it works with the 'w' option enabled

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 2012-05-01 15:54:27 +0000
3+++ ChangeLog 2012-05-02 12:31:20 +0000
4@@ -3,11 +3,15 @@
5 version 2.5
6
7 New Features:
8- * fn:available-environment-variables
9- * fn:environment-variables
10- * fn:uri-collection
11- * fn:unparsed-text
12- * fn:unparsed-text-available
13+ * XQuery 3.0 functions
14+ - fn:available-environment-variables
15+ - fn:environment-variables
16+ - fn:uri-collection
17+ - fn:unparsed-text
18+ - fn:unparsed-text-available
19+ - fn:has-children#0
20+ - fn:nilled#0
21+ - fn:path
22 * Extended API for Python, Java, PHP and Ruby.
23 * Add jvm classpath to zorbacmd and to Zorba API. Tracked by #931816
24 * Added full-text module.
25@@ -15,14 +19,11 @@
26 * Added XQJ support.
27 * Added CollectionManager and DocumentManager support for XQJ.
28
29-Optimization:
30-
31 Bug Fixes/Other Changes:
32 * Fixed bugs #931501 and #866987 (improved error messages for fn:format-number(). Additionally, the function now throws the FODF1310 error instead of XTDE1310, as the 3.0 spec requires)
33 * Fixed bug 955170 (Catch clause with URILiteral-based wilcard NameTest)
34 * Fixed bug 955135 (err:XQDY0044 not caught by try-catch expressions)
35- * Fixed bug #986075 (encountering flwor expr with no clauses; due to common
36- subexression being formed when inlining var in if-then-else expression)
37+ * Fixed bug #986075 (encountering flwor expr with no clauses; due to common subexression being formed when inlining var in if-then-else expression)
38 * Fixed bug #967864 (var substitution did not update theFreeVars property)
39 * Fixed bug #891650 (context size var not always declared within path expr)
40 * Fixed bug #948879 (--uri-path doesn't work with fetch:content())
41@@ -36,17 +37,14 @@
42 * Fixed bug #988412 (date:current-dateTime daylight saving)
43 * Fixed bug #912586, #912593 and #912722 (assertion failures with lax validation)
44 * Fixed bug #921458 (file:read-text-lines() blocking)
45- * Fixed bug #981405 (do not hoist expr containing try-catch variables out of the
46- associated try-catch expression)
47- * Fixed bug #947627 (throw XQST0099 if more than one declarations of context item
48- type in same module)
49+ * Fixed bug #981405 (do not hoist expr containing try-catch variables out of the associated try-catch expression)
50+ * Fixed bug #947627 (throw XQST0099 if more than one declarations of context item type in same module)
51 * Fixed bug #980526 (no-copy rule bug due to global var being set in "distant" udf)
52 * Fixed bug #949910 (has-children may be invoked on all nodes). Internally, zorba::store::Item::getChildren() now returns NULL on node classes without offspring (instead of raising an error).
53- * Fixed Bug #933490: Error ItemFactoryImpl::createBase64Binary with istream
54+ * Fixed Bug #933490 (Error ItemFactoryImpl::createBase64Binary with istream)
55 * Fixed bug #867112 (Diagnostic Handler was not working on external APIs)
56 * Fixed bug #857842 (Assertion failed with simple content element with comments)
57
58-
59 version 2.2
60
61 New Features:
62
63=== modified file 'modules/w3c/xpath_functions.xq'
64--- modules/w3c/xpath_functions.xq 2012-04-24 12:39:38 +0000
65+++ modules/w3c/xpath_functions.xq 2012-05-02 12:31:20 +0000
66@@ -522,6 +522,12 @@
67 declare function fn:parse-xml( $arg as xs:string?, $baseURI as xs:string) as document-node(element(*, xs:untyped)) external;
68
69 (:~
70+ : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-parse-xml-fragment">fn:parse-xml-fragment</a>
71+ :)
72+declare function fn:parse-xml-fragment( $arg as xs:string?) as document-node(element(*, xs:untyped)) external;
73+
74+
75+(:~
76 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-prefix-from-QName">fn:prefix-from-QName</a>
77 :)
78 declare function fn:prefix-from-QName($arg as xs:QName?) as xs:NCName? external;
79@@ -864,6 +870,11 @@
80 (:~
81 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-has-children">fn:has-children</a>
82 :)
83+declare function fn:has-children() as xs:boolean external;
84+
85+(:~
86+ : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-has-children">fn:has-children</a>
87+ :)
88 declare function fn:has-children($node as node()?) as xs:boolean external;
89
90 (:~
91@@ -923,12 +934,17 @@
92
93 (:~
94 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-namespace-uri">fn:namespace-uri</a>
95- :)
96+ :)
97 declare function fn:namespace-uri($arg as node()?) as xs:anyURI external;
98
99 (:~
100 : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-nilled">fn:nilled</a>
101 :)
102+declare function fn:nilled() as xs:boolean external;
103+
104+(:~
105+ : @see for semantics please check <a href="http://www.w3.org/TR/xpath-functions-30/#func-nilled">fn:nilled</a>
106+ :)
107 declare function fn:nilled($arg as node()?) as xs:boolean? external;
108
109 (:~
110
111=== modified file 'src/compiler/translator/translator.cpp'
112--- src/compiler/translator/translator.cpp 2012-05-01 21:21:04 +0000
113+++ src/compiler/translator/translator.cpp 2012-05-02 12:31:20 +0000
114@@ -694,6 +694,10 @@
115 xquery_fns_def_dot.set(FunctionConsts::FN_DATA_0);
116 xquery_fns_def_dot.set(FunctionConsts::FN_DOCUMENT_URI_0);
117 xquery_fns_def_dot.set(FunctionConsts::FN_NODE_NAME_0);
118+ xquery_fns_def_dot.set(FunctionConsts::FN_NILLED_0);
119+ xquery_fns_def_dot.set(FunctionConsts::FN_HAS_CHILDREN_0);
120+ xquery_fns_def_dot.set(FunctionConsts::FN_PATH_0);
121+
122
123 op_concatenate = GET_BUILTIN_FUNCTION(OP_CONCATENATE_N);
124 assert(op_concatenate != NULL);
125
126=== modified file 'src/functions/pregenerated/func_accessors.cpp'
127--- src/functions/pregenerated/func_accessors.cpp 2012-04-24 12:39:38 +0000
128+++ src/functions/pregenerated/func_accessors.cpp 2012-05-02 12:31:20 +0000
129@@ -50,6 +50,15 @@
130 return new NodeNameIterator(sctx, loc, argv);
131 }
132
133+PlanIter_t fn_nilled_3_0::codegen(
134+ CompilerCB*,
135+ static_context* sctx,
136+ const QueryLoc& loc,
137+ std::vector<PlanIter_t>& argv,
138+ expr& ann) const
139+{
140+ return new NilledIterator(sctx, loc, argv);
141+}
142 PlanIter_t fn_nilled::codegen(
143 CompilerCB*,
144 static_context* sctx,
145@@ -138,6 +147,17 @@
146 {
147
148
149+ DECL_WITH_KIND(sctx, fn_nilled_3_0,
150+ (createQName("http://www.w3.org/2005/xpath-functions","","nilled"),
151+ GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
152+ FunctionConsts::FN_NILLED_0);
153+
154+ }
155+
156+
157+ {
158+
159+
160 DECL_WITH_KIND(sctx, fn_nilled,
161 (createQName("http://www.w3.org/2005/xpath-functions","","nilled"),
162 GENV_TYPESYSTEM.ANY_NODE_TYPE_QUESTION,
163
164=== modified file 'src/functions/pregenerated/func_accessors.h'
165--- src/functions/pregenerated/func_accessors.h 2012-04-24 12:39:38 +0000
166+++ src/functions/pregenerated/func_accessors.h 2012-05-02 12:31:20 +0000
167@@ -72,6 +72,22 @@
168
169
170 //fn:nilled
171+class fn_nilled_3_0 : public function
172+{
173+public:
174+ fn_nilled_3_0(const signature& sig, FunctionConsts::FunctionKind kind)
175+ :
176+ function(sig, kind)
177+ {
178+theXQueryVersion = StaticContextConsts::xquery_version_3_0;
179+ }
180+
181+ bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
182+
183+ CODEGEN_DECL();
184+};
185+
186+//fn:nilled
187 class fn_nilled : public function
188 {
189 public:
190@@ -82,7 +98,7 @@
191
192 }
193
194- bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
195+ bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
196
197 CODEGEN_DECL();
198 };
199
200=== modified file 'src/functions/pregenerated/func_nodes.cpp'
201--- src/functions/pregenerated/func_nodes.cpp 2012-04-24 12:39:38 +0000
202+++ src/functions/pregenerated/func_nodes.cpp 2012-05-02 12:31:20 +0000
203@@ -231,6 +231,16 @@
204 return new LeastCommonAncestor(sctx, loc, argv);
205 }
206
207+PlanIter_t fn_path_3_0::codegen(
208+ CompilerCB*,
209+ static_context* sctx,
210+ const QueryLoc& loc,
211+ std::vector<PlanIter_t>& argv,
212+ expr& ann) const
213+{
214+ return new FnPathIterator(sctx, loc, argv);
215+}
216+
217 void populate_context_nodes(static_context* sctx)
218 {
219 {
220@@ -356,6 +366,17 @@
221
222 DECL_WITH_KIND(sctx, fn_has_children_3_0,
223 (createQName("http://www.w3.org/2005/xpath-functions","","has-children"),
224+ GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
225+ FunctionConsts::FN_HAS_CHILDREN_0);
226+
227+ }
228+
229+
230+ {
231+
232+
233+ DECL_WITH_KIND(sctx, fn_has_children_3_0,
234+ (createQName("http://www.w3.org/2005/xpath-functions","","has-children"),
235 GENV_TYPESYSTEM.ANY_NODE_TYPE_QUESTION,
236 GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
237 FunctionConsts::FN_HAS_CHILDREN_1);
238@@ -538,6 +559,29 @@
239
240 }
241
242+
243+ {
244+
245+
246+ DECL_WITH_KIND(sctx, fn_path_3_0,
247+ (createQName("http://www.w3.org/2005/xpath-functions","","path"),
248+ GENV_TYPESYSTEM.STRING_TYPE_QUESTION),
249+ FunctionConsts::FN_PATH_0);
250+
251+ }
252+
253+
254+ {
255+
256+
257+ DECL_WITH_KIND(sctx, fn_path_3_0,
258+ (createQName("http://www.w3.org/2005/xpath-functions","","path"),
259+ GENV_TYPESYSTEM.ANY_NODE_TYPE_QUESTION,
260+ GENV_TYPESYSTEM.STRING_TYPE_QUESTION),
261+ FunctionConsts::FN_PATH_1);
262+
263+ }
264+
265 }
266
267
268
269=== modified file 'src/functions/pregenerated/func_nodes.h'
270--- src/functions/pregenerated/func_nodes.h 2012-04-24 12:39:38 +0000
271+++ src/functions/pregenerated/func_nodes.h 2012-05-02 12:31:20 +0000
272@@ -372,6 +372,21 @@
273 };
274
275
276+//fn:path
277+class fn_path_3_0 : public function
278+{
279+public:
280+ fn_path_3_0(const signature& sig, FunctionConsts::FunctionKind kind)
281+ :
282+ function(sig, kind)
283+ {
284+theXQueryVersion = StaticContextConsts::xquery_version_3_0;
285+ }
286+
287+ CODEGEN_DECL();
288+};
289+
290+
291 } //namespace zorba
292
293
294
295=== modified file 'src/functions/pregenerated/func_parse_fragment.cpp'
296--- src/functions/pregenerated/func_parse_fragment.cpp 2012-04-24 12:39:38 +0000
297+++ src/functions/pregenerated/func_parse_fragment.cpp 2012-05-02 12:31:20 +0000
298@@ -38,7 +38,7 @@
299 std::vector<PlanIter_t>& argv,
300 expr& ann) const
301 {
302- return new FnParseXmlFragmentIterator(sctx, loc, argv);
303+ return new FnZorbaParseXmlFragmentIterator(sctx, loc, argv);
304 }
305
306 void populate_context_parse_fragment(static_context* sctx)
307
308=== modified file 'src/functions/pregenerated/function_enum.h'
309--- src/functions/pregenerated/function_enum.h 2012-04-26 13:25:13 +0000
310+++ src/functions/pregenerated/function_enum.h 2012-05-02 12:31:20 +0000
311@@ -22,6 +22,7 @@
312 // ******************************************
313 FN_NODE_NAME_0,
314 FN_NODE_NAME_1,
315+ FN_NILLED_0,
316 FN_NILLED_1,
317 FN_STRING_0,
318 FN_STRING_1,
319@@ -251,6 +252,7 @@
320 FN_LANG_2,
321 FN_NUMBER_0,
322 FN_NUMBER_1,
323+ FN_HAS_CHILDREN_0,
324 FN_HAS_CHILDREN_1,
325 FN_INNERMOST_1,
326 FN_OUTERMOST_1,
327@@ -266,6 +268,8 @@
328 FN_ZORBA_NODE_PRECEDING_SIBLING_OF_2,
329 FN_ZORBA_NODE_LEVEL_1,
330 FN_ZORBA_NODE_LEAST_COMMON_ANCESTOR_2,
331+ FN_PATH_0,
332+ FN_PATH_1,
333 FN_ABS_1,
334 FN_CEILING_1,
335 FN_FLOOR_1,
336
337=== modified file 'src/runtime/accessors/accessors_impl.cpp'
338--- src/runtime/accessors/accessors_impl.cpp 2012-04-24 12:39:38 +0000
339+++ src/runtime/accessors/accessors_impl.cpp 2012-05-02 12:31:20 +0000
340@@ -78,15 +78,23 @@
341
342 if (consumeNext(inNode, theChildren[0].getp(), planState))
343 {
344- if (inNode->isNode()) {
345+ if (inNode->isNode())
346+ {
347 result = inNode->getNilled();
348 STACK_PUSH(result != NULL, state);
349- } else
350+ }
351+ else
352+ {
353 throw XQUERY_EXCEPTION(
354 err::XPTY0004,
355 ERROR_PARAMS( ZED( FnNilledArgNotNode ) ),
356 ERROR_LOC( loc )
357 );
358+ }
359+ }
360+ else
361+ {
362+ STACK_PUSH(false, state);
363 }
364
365 STACK_END (state);
366
367=== modified file 'src/runtime/collections/collections_impl.cpp'
368--- src/runtime/collections/collections_impl.cpp 2012-04-24 12:39:38 +0000
369+++ src/runtime/collections/collections_impl.cpp 2012-05-02 12:31:20 +0000
370@@ -2504,122 +2504,122 @@
371 /*******************************************************************************
372 14.8.5 fn:uri-collection
373 ********************************************************************************/
374- FnURICollectionIteratorState::~FnURICollectionIteratorState()
375- {
376- if(theIterator != NULL)
377- {
378- if(theIteratorOpened)
379- {
380- theIterator->close();
381- theIteratorOpened = false;
382- }
383- theIterator = NULL;
384- }
385- }
386-
387- void FnURICollectionIteratorState::init(PlanState& planState)
388- {
389- PlanIteratorState::init(planState);
390- theIterator = NULL;
391- }
392-
393- void FnURICollectionIteratorState::reset(PlanState& planState)
394- {
395- PlanIteratorState::reset(planState);
396-
397- if(theIterator != NULL)
398- {
399- if(theIteratorOpened)
400- {
401- theIterator->close();
402- theIteratorOpened = false;
403- }
404- theIterator = NULL;
405- }
406- }
407-
408- bool FnURICollectionIterator::nextImpl(store::Item_t& result, PlanState& planState) const
409- {
410- store::Item_t lURI, resolvedURIItem, lIte;
411- store::Collection_t coll;
412- std::auto_ptr<internal::Resource> lResource;
413- internal::CollectionResource* lCollResource;
414- zstring resolvedURIString;
415- zstring lErrorMessage;
416- zstring docuri;
417-
418- FnURICollectionIteratorState* state;
419- DEFAULT_STACK_INIT(FnURICollectionIteratorState, state, planState);
420-
421- if(theChildren.size() == 1 &&
422- consumeNext(lURI, theChildren[0].getp(),planState))
423- {
424- try
425- {
426- resolvedURIString= theSctx->resolve_relative_uri(lURI->getStringValue());
427- }
428- catch (ZorbaException const&)
429- {
430- throw XQUERY_EXCEPTION(
431- err::FODC0004,
432- ERROR_PARAMS(lURI->getStringValue(), ZED( BadAnyURI ) ),
433- ERROR_LOC( loc )
434- );
435- }
436- }
437- else
438- {
439- resolvedURIItem = planState.theGlobalDynCtx->get_default_collection();
440-
441- if ( NULL == resolvedURIItem )
442- throw XQUERY_EXCEPTION(
443- err::FODC0002,
444- ERROR_PARAMS( ZED( DefaultCollection), ZED( NotDefInDynamicCtx ) ),
445- ERROR_LOC( loc )
446- );
447-
448- resolvedURIString = theSctx->resolve_relative_uri(resolvedURIItem->getStringValue());
449- }
450-
451- lResource = theSctx->resolve_uri(resolvedURIString,
452- internal::EntityData::COLLECTION,
453- lErrorMessage);
454-
455- lCollResource = dynamic_cast<internal::CollectionResource*>(lResource.get());
456-
457- if( lCollResource == 0 || !(coll = lCollResource->getCollection()) )
458- {
459- throw XQUERY_EXCEPTION(
460- err::FODC0002,
461- ERROR_PARAMS( resolvedURIString, lErrorMessage ),
462- ERROR_LOC( loc )
463- );
464- }
465-
466- // return collection nodes
467- state->theIterator = coll->getIterator();
468- ZORBA_ASSERT(state->theIterator != NULL);
469- state->theIterator->open();
470- state->theIteratorOpened = true;
471-
472- //return the DocumentURI of the Collection
473- while(state->theIterator->next(lIte))
474- {
475- lIte->getDocumentURI(docuri);
476- if(!docuri.empty())
477- {
478- STACK_PUSH(GENV_ITEMFACTORY->createAnyURI(result, docuri), state);
479- }
480- }
481-
482- //close iterator
483- state->theIterator->close();
484- state->theIteratorOpened = false;
485-
486- STACK_PUSH(false, state);
487- STACK_END(state);
488-
489- }
490+FnURICollectionIteratorState::~FnURICollectionIteratorState()
491+{
492+ if(theIterator != NULL)
493+ {
494+ if(theIteratorOpened)
495+ {
496+ theIterator->close();
497+ theIteratorOpened = false;
498+ }
499+ theIterator = NULL;
500+ }
501+}
502+
503+void FnURICollectionIteratorState::init(PlanState& planState)
504+{
505+ PlanIteratorState::init(planState);
506+ theIterator = NULL;
507+}
508+
509+void FnURICollectionIteratorState::reset(PlanState& planState)
510+{
511+ PlanIteratorState::reset(planState);
512+
513+ if(theIterator != NULL)
514+ {
515+ if(theIteratorOpened)
516+ {
517+ theIterator->close();
518+ theIteratorOpened = false;
519+ }
520+ theIterator = NULL;
521+ }
522+}
523+
524+bool FnURICollectionIterator::nextImpl(store::Item_t& result, PlanState& planState) const
525+{
526+ store::Item_t lURI, resolvedURIItem, lIte;
527+ store::Collection_t coll;
528+ std::auto_ptr<internal::Resource> lResource;
529+ internal::CollectionResource* lCollResource;
530+ zstring resolvedURIString;
531+ zstring lErrorMessage;
532+ zstring docuri;
533+
534+ FnURICollectionIteratorState* state;
535+ DEFAULT_STACK_INIT(FnURICollectionIteratorState, state, planState);
536+
537+ if(theChildren.size() == 1 &&
538+ consumeNext(lURI, theChildren[0].getp(),planState))
539+ {
540+ try
541+ {
542+ resolvedURIString= theSctx->resolve_relative_uri(lURI->getStringValue());
543+ }
544+ catch (ZorbaException const&)
545+ {
546+ throw XQUERY_EXCEPTION(
547+ err::FODC0004,
548+ ERROR_PARAMS(lURI->getStringValue(), ZED( BadAnyURI ) ),
549+ ERROR_LOC( loc )
550+ );
551+ }
552+ }
553+ else
554+ {
555+ resolvedURIItem = planState.theGlobalDynCtx->get_default_collection();
556+
557+ if ( NULL == resolvedURIItem )
558+ throw XQUERY_EXCEPTION(
559+ err::FODC0002,
560+ ERROR_PARAMS( ZED( DefaultCollection), ZED( NotDefInDynamicCtx ) ),
561+ ERROR_LOC( loc )
562+ );
563+
564+ resolvedURIString = theSctx->resolve_relative_uri(resolvedURIItem->getStringValue());
565+ }
566+
567+ lResource = theSctx->resolve_uri(resolvedURIString,
568+ internal::EntityData::COLLECTION,
569+ lErrorMessage);
570+
571+ lCollResource = dynamic_cast<internal::CollectionResource*>(lResource.get());
572+
573+ if( lCollResource == 0 || !(coll = lCollResource->getCollection()) )
574+ {
575+ throw XQUERY_EXCEPTION(
576+ err::FODC0002,
577+ ERROR_PARAMS( resolvedURIString, lErrorMessage ),
578+ ERROR_LOC( loc )
579+ );
580+ }
581+
582+ // return collection nodes
583+ state->theIterator = coll->getIterator();
584+ ZORBA_ASSERT(state->theIterator != NULL);
585+ state->theIterator->open();
586+ state->theIteratorOpened = true;
587+
588+ //return the DocumentURI of the Collection
589+ while(state->theIterator->next(lIte))
590+ {
591+ lIte->getDocumentURI(docuri);
592+ if(!docuri.empty())
593+ {
594+ STACK_PUSH(GENV_ITEMFACTORY->createAnyURI(result, docuri), state);
595+ }
596+ }
597+
598+ //close iterator
599+ state->theIterator->close();
600+ state->theIteratorOpened = false;
601+
602+ STACK_PUSH(false, state);
603+ STACK_END(state);
604+
605+}
606
607
608 } // namespace zorba
609
610=== modified file 'src/runtime/collections/pregenerated/collections.h'
611--- src/runtime/collections/pregenerated/collections.h 2012-04-24 12:39:38 +0000
612+++ src/runtime/collections/pregenerated/collections.h 2012-05-02 12:31:20 +0000
613@@ -1469,9 +1469,9 @@
614
615 /**
616 *
617- * Returns a sequence of xs:anyURI values representing the document URIs of the
618- * documents in a collection.
619- *
620+ * Returns a sequence of xs:anyURI values representing the document URIs of the
621+ * documents in a collection.
622+ *
623 * Author: Zorba Team
624 */
625 class FnURICollectionIteratorState : public PlanIteratorState
626
627=== modified file 'src/runtime/nodes/nodes_impl.cpp'
628--- src/runtime/nodes/nodes_impl.cpp 2012-04-24 12:39:38 +0000
629+++ src/runtime/nodes/nodes_impl.cpp 2012-05-02 12:31:20 +0000
630@@ -628,5 +628,122 @@
631 STACK_END (state);
632 }
633
634+/*******************************************************************************
635+********************************************************************************/
636+int getNodePosition(store::Item_t aNode)
637+{
638+ int count = 1;
639+ store::Iterator_t lIterator = aNode->getParent()->getChildren();
640+ store::Item_t lItem;
641+ lIterator->open();
642+ while(lIterator->next(lItem))
643+ {
644+ if(lItem->getNodeKind() == aNode->getNodeKind())
645+ if(lItem->equals(aNode))
646+ break;
647+ else
648+ count++;
649+ }
650+ lIterator->close();
651+ return count;
652+}
653+
654+bool FnPathIterator::nextImpl(store::Item_t& result, PlanState& planState) const
655+{
656+ store::Item_t inNode;
657+ store::Item_t nodeName;
658+ store::NsBindings nsBindings;
659+ zstring path;
660+ zstring temp;
661+ zstring zNamespace;
662+ zstring zLocalName;
663+ zstring zPosition;
664+ bool rootIsDocument = false;
665+
666+ PlanIteratorState* state;
667+ DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
668+
669+ if (consumeNext(inNode, theChildren[0], planState));
670+ {
671+ do
672+ {
673+ switch (inNode->getNodeKind())
674+ {
675+ case store::StoreConsts::documentNode:
676+ temp = path;
677+ path = "/";
678+ path += temp;
679+ rootIsDocument = true;
680+ break;
681+ case store::StoreConsts::elementNode:
682+ nodeName = inNode->getNodeName();
683+ zNamespace = nodeName->getNamespace();
684+ zLocalName = nodeName->getLocalName();
685+ zPosition = ztd::to_string(getNodePosition(inNode));
686+ temp = path;
687+ path = "\""+zNamespace+"\":"+zLocalName+"["+zPosition.c_str()+"]";
688+ path += temp;
689+ break;
690+ case store::StoreConsts::attributeNode:
691+ nodeName = inNode->getNodeName();
692+ zNamespace =nodeName->getNamespace();
693+ zLocalName = nodeName->getLocalName();
694+ if(zNamespace != "")
695+ {
696+ temp = path;
697+ path = "@\""+zNamespace+"\":"+zLocalName;
698+ path += temp;
699+ }
700+ else
701+ {
702+ temp = path;
703+ path = "@"+zLocalName;
704+ path += temp;
705+ }
706+ break;
707+ case store::StoreConsts::textNode:
708+ zPosition = ztd::to_string(getNodePosition(inNode));
709+ temp = path;
710+ path = "text()["+zPosition+"]";
711+ path += temp;
712+ break;
713+ case store::StoreConsts::commentNode:
714+ zPosition = ztd::to_string(getNodePosition(inNode));
715+ temp = path;
716+ path = "comment()["+zPosition+"]";
717+ path += temp;
718+ break;
719+ default:
720+ if(inNode->isProcessingInstruction())
721+ {
722+ nodeName = inNode->getNodeName();
723+ zLocalName = nodeName->getLocalName();
724+ zPosition = ztd::to_string(getNodePosition(inNode));
725+ temp = path;
726+ path = "processing-instruction("+zLocalName+")["+zPosition+"]";
727+ path += temp;
728+ }
729+ break;
730+ }
731+ inNode = inNode->getParent();
732+
733+ if(inNode && inNode->getNodeKind() != store::StoreConsts::documentNode)
734+ {
735+ temp = path;
736+ path = "/";
737+ path += temp;
738+ }
739+
740+ } while (inNode);
741+
742+ if(rootIsDocument)
743+ STACK_PUSH(GENV_ITEMFACTORY->createString(result, path), state);
744+ else
745+ throw XQUERY_EXCEPTION(err::FODC0001, ERROR_PARAMS("fn:path"), ERROR_LOC(loc));
746+ }
747+
748+ STACK_END (state);
749+}
750+
751 } // namespace zorba
752 /* vim:set et sw=2 ts=2: */
753
754=== modified file 'src/runtime/nodes/pregenerated/nodes.cpp'
755--- src/runtime/nodes/pregenerated/nodes.cpp 2012-04-24 12:39:38 +0000
756+++ src/runtime/nodes/pregenerated/nodes.cpp 2012-05-02 12:31:20 +0000
757@@ -474,6 +474,28 @@
758 // </LeastCommonAncestor>
759
760
761+// <FnPathIterator>
762+FnPathIterator::class_factory<FnPathIterator>
763+FnPathIterator::g_class_factory;
764+
765+
766+void FnPathIterator::accept(PlanIterVisitor& v) const {
767+ v.beginVisit(*this);
768+
769+ std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
770+ std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
771+ for ( ; lIter != lEnd; ++lIter ){
772+ (*lIter)->accept(v);
773+ }
774+
775+ v.endVisit(*this);
776+}
777+
778+FnPathIterator::~FnPathIterator() {}
779+
780+// </FnPathIterator>
781+
782+
783
784 }
785
786
787=== modified file 'src/runtime/nodes/pregenerated/nodes.h'
788--- src/runtime/nodes/pregenerated/nodes.h 2012-04-24 12:39:38 +0000
789+++ src/runtime/nodes/pregenerated/nodes.h 2012-05-02 12:31:20 +0000
790@@ -720,6 +720,40 @@
791 };
792
793
794+/**
795+ *
796+ * Author: Zorba Team
797+ */
798+class FnPathIterator : public NaryBaseIterator<FnPathIterator, PlanIteratorState>
799+{
800+public:
801+ SERIALIZABLE_CLASS(FnPathIterator);
802+
803+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnPathIterator,
804+ NaryBaseIterator<FnPathIterator, PlanIteratorState>);
805+
806+ void serialize( ::zorba::serialization::Archiver& ar)
807+ {
808+ serialize_baseclass(ar,
809+ (NaryBaseIterator<FnPathIterator, PlanIteratorState>*)this);
810+ }
811+
812+ FnPathIterator(
813+ static_context* sctx,
814+ const QueryLoc& loc,
815+ std::vector<PlanIter_t>& children)
816+ :
817+ NaryBaseIterator<FnPathIterator, PlanIteratorState>(sctx, loc, children)
818+ {}
819+
820+ virtual ~FnPathIterator();
821+
822+ void accept(PlanIterVisitor& v) const;
823+
824+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
825+};
826+
827+
828 }
829 #endif
830 /*
831
832=== modified file 'src/runtime/parsing_and_serializing/parse_fragment_impl.cpp'
833--- src/runtime/parsing_and_serializing/parse_fragment_impl.cpp 2012-04-24 12:39:38 +0000
834+++ src/runtime/parsing_and_serializing/parse_fragment_impl.cpp 2012-05-02 12:31:20 +0000
835@@ -170,11 +170,7 @@
836 }
837 }
838
839-/*******************************************************************************
840-
841-********************************************************************************/
842-
843-void FnParseXmlFragmentIteratorState::reset(PlanState& planState)
844+void FnZorbaParseXmlFragmentIteratorState::reset(PlanState& planState)
845 {
846 PlanIteratorState::reset(planState);
847 theFragmentStream.reset();
848@@ -184,20 +180,15 @@
849 docUri = "";
850 }
851
852-
853-/*******************************************************************************
854-
855-********************************************************************************/
856-
857-bool FnParseXmlFragmentIterator::nextImpl(store::Item_t& result, PlanState& planState) const
858+bool FnZorbaParseXmlFragmentIterator::nextImpl(store::Item_t& result, PlanState& planState) const
859 {
860 store::Store& lStore = GENV.getStore();
861 zstring docString;
862 store::Item_t tempItem;
863 bool validated = true;
864
865- FnParseXmlFragmentIteratorState* state;
866- DEFAULT_STACK_INIT(FnParseXmlFragmentIteratorState, state, planState);
867+ FnZorbaParseXmlFragmentIteratorState* state;
868+ DEFAULT_STACK_INIT(FnZorbaParseXmlFragmentIteratorState, state, planState);
869
870 if (consumeNext(result, theChildren[0].getp(), planState))
871 {
872@@ -311,5 +302,66 @@
873 }
874
875
876+/*******************************************************************************
877+ 14.9.2 fn:parse-xml-fragment
878+********************************************************************************/
879+/*
880+bool FnParseXmlFragmentIterator::nextImpl(store::Item_t& result, PlanState& planState) const
881+{
882+ zstring docString;
883+
884+ FnParseXmlFragmentIteratorState* state;
885+ DEFAULT_STACK_INIT(FnParseXmlFragmentIteratorState, state, planState);
886+
887+ if (consumeNext(result, theChildren[0].getp(), planState))
888+ {
889+ if (result->isStreamable())
890+ {
891+ state->theFragmentStream.theStream = &result->getStream();
892+ }
893+ else
894+ {
895+ result->getStringValue2(docString);
896+ state->theFragmentStream.theIss = new std::istringstream(docString.c_str());
897+ state->theFragmentStream.theStream = state->theFragmentStream.theIss;
898+ }
899+
900+ state->theProperties.setBaseUri(theSctx->get_base_uri());
901+ state->baseUri = state->theProperties.getBaseUri();
902+
903+ state->theProperties.setParseExternalParsedEntity(true);
904+
905+ while ( ! state->theFragmentStream.stream_is_consumed() )
906+ {
907+ try {
908+ state->theProperties.setStoreDocument(false);
909+ result = GENV.getStore().loadDocument(state->baseUri, state->docUri, state->theFragmentStream, state->theProperties);
910+ } catch (ZorbaException const& e) {
911+ if( ! state->theProperties.getNoError())
912+ throw XQUERY_EXCEPTION(err::FODC0006, ERROR_PARAMS("fn:parse-xml-fragment()", e.what() ), ERROR_LOC(loc));
913+ else
914+ result = NULL;
915+ }
916+
917+ if (result == NULL)
918+ continue;
919+
920+ STACK_PUSH(true, state);
921+ } // while
922+ } // if
923+
924+ STACK_END(state)
925+}
926+
927+void FnParseXmlFragmentIteratorState::reset(PlanState& planState)
928+{
929+ PlanIteratorState::reset(planState);
930+ theFragmentStream.reset();
931+ theProperties.reset();
932+ theProperties.setStoreDocument(false);
933+ baseUri = "";
934+ docUri = "";
935+}
936+*/
937
938 } /* namespace zorba */
939
940=== modified file 'src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp'
941--- src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp 2012-04-24 12:39:38 +0000
942+++ src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp 2012-05-02 12:31:20 +0000
943@@ -118,7 +118,6 @@
944 STACK_END (state);
945 }
946
947-
948 /*******************************************************************************
949 14.9.2 fn:serialize
950 ********************************************************************************/
951
952=== modified file 'src/runtime/parsing_and_serializing/pregenerated/parse_fragment.cpp'
953--- src/runtime/parsing_and_serializing/pregenerated/parse_fragment.cpp 2012-04-24 12:39:38 +0000
954+++ src/runtime/parsing_and_serializing/pregenerated/parse_fragment.cpp 2012-05-02 12:31:20 +0000
955@@ -32,12 +32,12 @@
956
957 namespace zorba {
958
959-// <FnParseXmlFragmentIterator>
960-FnParseXmlFragmentIterator::class_factory<FnParseXmlFragmentIterator>
961-FnParseXmlFragmentIterator::g_class_factory;
962-
963-
964-void FnParseXmlFragmentIterator::accept(PlanIterVisitor& v) const {
965+// <FnZorbaParseXmlFragmentIterator>
966+FnZorbaParseXmlFragmentIterator::class_factory<FnZorbaParseXmlFragmentIterator>
967+FnZorbaParseXmlFragmentIterator::g_class_factory;
968+
969+
970+void FnZorbaParseXmlFragmentIterator::accept(PlanIterVisitor& v) const {
971 v.beginVisit(*this);
972
973 std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
974@@ -49,17 +49,17 @@
975 v.endVisit(*this);
976 }
977
978-FnParseXmlFragmentIterator::~FnParseXmlFragmentIterator() {}
979-
980-FnParseXmlFragmentIteratorState::FnParseXmlFragmentIteratorState() {}
981-
982-FnParseXmlFragmentIteratorState::~FnParseXmlFragmentIteratorState() {}
983-
984-
985-void FnParseXmlFragmentIteratorState::init(PlanState& planState) {
986+FnZorbaParseXmlFragmentIterator::~FnZorbaParseXmlFragmentIterator() {}
987+
988+FnZorbaParseXmlFragmentIteratorState::FnZorbaParseXmlFragmentIteratorState() {}
989+
990+FnZorbaParseXmlFragmentIteratorState::~FnZorbaParseXmlFragmentIteratorState() {}
991+
992+
993+void FnZorbaParseXmlFragmentIteratorState::init(PlanState& planState) {
994 PlanIteratorState::init(planState);
995 }
996-// </FnParseXmlFragmentIterator>
997+// </FnZorbaParseXmlFragmentIterator>
998
999
1000
1001
1002=== modified file 'src/runtime/parsing_and_serializing/pregenerated/parse_fragment.h'
1003--- src/runtime/parsing_and_serializing/pregenerated/parse_fragment.h 2012-04-24 12:39:38 +0000
1004+++ src/runtime/parsing_and_serializing/pregenerated/parse_fragment.h 2012-05-02 12:31:20 +0000
1005@@ -39,7 +39,7 @@
1006 * fn-zorba-xml:parse
1007 * Author: Zorba Team
1008 */
1009-class FnParseXmlFragmentIteratorState : public PlanIteratorState
1010+class FnZorbaParseXmlFragmentIteratorState : public PlanIteratorState
1011 {
1012 public:
1013 FragmentIStream theFragmentStream; //the input fragment
1014@@ -47,37 +47,37 @@
1015 zstring baseUri; //
1016 zstring docUri; //
1017
1018- FnParseXmlFragmentIteratorState();
1019+ FnZorbaParseXmlFragmentIteratorState();
1020
1021- ~FnParseXmlFragmentIteratorState();
1022+ ~FnZorbaParseXmlFragmentIteratorState();
1023
1024 void init(PlanState&);
1025 void reset(PlanState&);
1026 };
1027
1028-class FnParseXmlFragmentIterator : public NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>
1029+class FnZorbaParseXmlFragmentIterator : public NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>
1030 {
1031 public:
1032- SERIALIZABLE_CLASS(FnParseXmlFragmentIterator);
1033+ SERIALIZABLE_CLASS(FnZorbaParseXmlFragmentIterator);
1034
1035- SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnParseXmlFragmentIterator,
1036- NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>);
1037+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnZorbaParseXmlFragmentIterator,
1038+ NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>);
1039
1040 void serialize( ::zorba::serialization::Archiver& ar)
1041 {
1042 serialize_baseclass(ar,
1043- (NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>*)this);
1044+ (NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>*)this);
1045 }
1046
1047- FnParseXmlFragmentIterator(
1048+ FnZorbaParseXmlFragmentIterator(
1049 static_context* sctx,
1050 const QueryLoc& loc,
1051 std::vector<PlanIter_t>& children)
1052 :
1053- NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>(sctx, loc, children)
1054+ NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>(sctx, loc, children)
1055 {}
1056
1057- virtual ~FnParseXmlFragmentIterator();
1058+ virtual ~FnZorbaParseXmlFragmentIterator();
1059
1060 void accept(PlanIterVisitor& v) const;
1061
1062
1063=== modified file 'src/runtime/spec/accessors/accessors.xml'
1064--- src/runtime/spec/accessors/accessors.xml 2012-04-24 12:39:38 +0000
1065+++ src/runtime/spec/accessors/accessors.xml 2012-05-02 12:31:20 +0000
1066@@ -62,13 +62,16 @@
1067
1068 <zorba:function>
1069
1070+ <zorba:signature localname="nilled" prefix="fn" version="3.0">
1071+ <zorba:output>xs:boolean</zorba:output>
1072+ </zorba:signature>
1073 <zorba:signature localname="nilled" prefix="fn">
1074 <zorba:param>node()?</zorba:param>
1075 <zorba:output>xs:boolean?</zorba:output>
1076 </zorba:signature>
1077-
1078+
1079 <zorba:methods>
1080- <zorba:mustCopyInputNodes value="false"/>
1081+ <zorba:mustCopyInputNodes value="true"/>
1082 </zorba:methods>
1083
1084 </zorba:function>
1085
1086=== modified file 'src/runtime/spec/collections/collections.xml'
1087--- src/runtime/spec/collections/collections.xml 2012-04-24 12:39:38 +0000
1088+++ src/runtime/spec/collections/collections.xml 2012-05-02 12:31:20 +0000
1089@@ -1324,32 +1324,32 @@
1090 14.8.5 fn:uri-collection
1091 ********************************************************************************/
1092 -->
1093- <zorba:iterator name="FnURICollectionIterator">
1094- <zorba:description author="Zorba Team">
1095- Returns a sequence of xs:anyURI values representing the document URIs of the
1096- documents in a collection.
1097- </zorba:description>
1098-
1099- <zorba:function>
1100-
1101- <zorba:signature localname="uri-collection" prefix="fn" version="3.0">
1102- <zorba:output>xs:anyURI*</zorba:output>
1103- </zorba:signature>
1104-
1105- <zorba:signature localname="uri-collection" prefix="fn" version="3.0">
1106- <zorba:param>xs:string?</zorba:param>
1107- <zorba:output>xs:anyURI*</zorba:output>
1108- </zorba:signature>
1109-
1110- </zorba:function>
1111-
1112- <zorba:state generateInit="false" generateReset="false" generateDestructor="false">
1113- <zorba:member type="store::Iterator_t" name="theIterator"
1114- brief="the current iterator"/>
1115- <zorba:member type="bool" name="theIteratorOpened" defaultValue="false"
1116- brief="flag indicating whether theIterator was opened"/>
1117- </zorba:state>
1118+<zorba:iterator name="FnURICollectionIterator">
1119+ <zorba:description author="Zorba Team">
1120+ Returns a sequence of xs:anyURI values representing the document URIs of the
1121+ documents in a collection.
1122+ </zorba:description>
1123+
1124+ <zorba:function>
1125+
1126+ <zorba:signature localname="uri-collection" prefix="fn" version="3.0">
1127+ <zorba:output>xs:anyURI*</zorba:output>
1128+ </zorba:signature>
1129+
1130+ <zorba:signature localname="uri-collection" prefix="fn" version="3.0">
1131+ <zorba:param>xs:string?</zorba:param>
1132+ <zorba:output>xs:anyURI*</zorba:output>
1133+ </zorba:signature>
1134
1135- </zorba:iterator>
1136+ </zorba:function>
1137+
1138+ <zorba:state generateInit="false" generateReset="false" generateDestructor="false">
1139+ <zorba:member type="store::Iterator_t" name="theIterator"
1140+ brief="the current iterator"/>
1141+ <zorba:member type="bool" name="theIteratorOpened" defaultValue="false"
1142+ brief="flag indicating whether theIterator was opened"/>
1143+ </zorba:state>
1144+
1145+</zorba:iterator>
1146
1147 </zorba:iterators>
1148
1149=== modified file 'src/runtime/spec/nodes/nodes.xml'
1150--- src/runtime/spec/nodes/nodes.xml 2012-04-24 12:39:38 +0000
1151+++ src/runtime/spec/nodes/nodes.xml 2012-05-02 12:31:20 +0000
1152@@ -186,6 +186,11 @@
1153 <zorba:description author="Zorba Team">fn:has-children</zorba:description>
1154
1155 <zorba:function>
1156+
1157+ <zorba:signature localname="has-children" prefix="fn" version="3.0">
1158+ <zorba:output>xs:boolean</zorba:output>
1159+ </zorba:signature>
1160+
1161 <zorba:signature localname="has-children" prefix="fn" version="3.0">
1162 <zorba:param>node()?</zorba:param>
1163 <zorba:output>xs:boolean</zorba:output>
1164@@ -515,4 +520,26 @@
1165
1166 </zorba:iterator>
1167
1168+<!--
1169+/*******************************************************************************
1170+********************************************************************************/
1171+-->
1172+<zorba:iterator name="FnPathIterator">
1173+
1174+ <zorba:description author="Zorba Team"></zorba:description>
1175+
1176+ <zorba:function>
1177+ <zorba:signature localname="path" prefix="fn" version="3.0">
1178+ <zorba:output>xs:string?</zorba:output>
1179+ </zorba:signature>
1180+
1181+ <zorba:signature localname="path" prefix="fn" version="3.0">
1182+ <zorba:param>node()?</zorba:param>
1183+ <zorba:output>xs:string?</zorba:output>
1184+ </zorba:signature>
1185+
1186+ </zorba:function>
1187+
1188+</zorba:iterator>
1189+
1190 </zorba:iterators>
1191
1192=== modified file 'src/runtime/spec/parsing_and_serializing/parse_fragment.xml'
1193--- src/runtime/spec/parsing_and_serializing/parse_fragment.xml 2012-04-24 12:39:38 +0000
1194+++ src/runtime/spec/parsing_and_serializing/parse_fragment.xml 2012-05-02 12:31:20 +0000
1195@@ -22,7 +22,7 @@
1196 * 14.9.1 parse-xml:parse
1197 ********************************************************************************/
1198 -->
1199- <zorba:iterator name="FnParseXmlFragmentIterator">
1200+ <zorba:iterator name="FnZorbaParseXmlFragmentIterator">
1201
1202 <zorba:description author="Zorba Team">fn-zorba-xml:parse</zorba:description>
1203
1204@@ -46,6 +46,35 @@
1205 </zorba:state>
1206
1207 </zorba:iterator>
1208-
1209-
1210+<!--
1211+/*******************************************************************************
1212+ * 14.9.2 fn:parse-xml-fragment
1213+********************************************************************************/
1214+-->
1215+
1216+<!--
1217+<zorba:iterator name="FnParseXmlFragmentIterator">
1218+
1219+ <zorba:description author="Zorba Team">fn:parse-xml-fragment</zorba:description>
1220+
1221+ <zorba:function>
1222+ <zorba:signature localname="parse-xml-fragment" prefix="fn">
1223+ <zorba:param>xs:string?</zorba:param>
1224+ <zorba:output>node()*</zorba:output>
1225+ </zorba:signature>
1226+
1227+ <zorba:methods>
1228+ <zorba:accessesDynCtx returnValue="true"/>
1229+ </zorba:methods>
1230+ </zorba:function>
1231+
1232+ <zorba:state generateReset="false">
1233+ <zorba:member type="FragmentIStream" name="theFragmentStream" brief="the input fragment"/>
1234+ <zorba:member type="store::LoadProperties" name="theProperties" brief="loader properties"/>
1235+ <zorba:member type="zstring" name="baseUri"/>
1236+ <zorba:member type="zstring" name="docUri"/>
1237+ </zorba:state>
1238+
1239+</zorba:iterator>
1240+-->
1241 </zorba:iterators>
1242
1243=== modified file 'src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml'
1244--- src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml 2012-04-24 12:39:38 +0000
1245+++ src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml 2012-05-02 12:31:20 +0000
1246@@ -43,10 +43,9 @@
1247
1248 </zorba:iterator>
1249
1250-
1251 <!--
1252 /*******************************************************************************
1253- * 14.9.2 fn:serialize
1254+ * 14.9.3 fn:serialize
1255 ********************************************************************************/
1256 -->
1257 <zorba:iterator name="FnSerializeIterator">
1258@@ -79,5 +78,6 @@
1259 </zorba:method>
1260
1261 </zorba:iterator>
1262-
1263+
1264+
1265 </zorba:iterators>
1266
1267=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
1268--- src/runtime/visitors/pregenerated/planiter_visitor.h 2012-04-27 01:23:43 +0000
1269+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2012-05-02 12:31:20 +0000
1270@@ -436,6 +436,8 @@
1271
1272 class LeastCommonAncestor;
1273
1274+ class FnPathIterator;
1275+
1276 class AbsIterator;
1277
1278 class CeilingIterator;
1279@@ -450,7 +452,7 @@
1280
1281 class FormatIntegerIterator;
1282
1283- class FnParseXmlFragmentIterator;
1284+ class FnZorbaParseXmlFragmentIterator;
1285
1286 class FnParseXmlIterator;
1287
1288@@ -1259,6 +1261,9 @@
1289 virtual void beginVisit ( const LeastCommonAncestor& ) = 0;
1290 virtual void endVisit ( const LeastCommonAncestor& ) = 0;
1291
1292+ virtual void beginVisit ( const FnPathIterator& ) = 0;
1293+ virtual void endVisit ( const FnPathIterator& ) = 0;
1294+
1295 virtual void beginVisit ( const AbsIterator& ) = 0;
1296 virtual void endVisit ( const AbsIterator& ) = 0;
1297
1298@@ -1280,8 +1285,8 @@
1299 virtual void beginVisit ( const FormatIntegerIterator& ) = 0;
1300 virtual void endVisit ( const FormatIntegerIterator& ) = 0;
1301
1302- virtual void beginVisit ( const FnParseXmlFragmentIterator& ) = 0;
1303- virtual void endVisit ( const FnParseXmlFragmentIterator& ) = 0;
1304+ virtual void beginVisit ( const FnZorbaParseXmlFragmentIterator& ) = 0;
1305+ virtual void endVisit ( const FnZorbaParseXmlFragmentIterator& ) = 0;
1306
1307 virtual void beginVisit ( const FnParseXmlIterator& ) = 0;
1308 virtual void endVisit ( const FnParseXmlIterator& ) = 0;
1309
1310=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
1311--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-04-24 18:22:23 +0000
1312+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-05-02 12:31:20 +0000
1313@@ -2870,6 +2870,20 @@
1314 // </LeastCommonAncestor>
1315
1316
1317+// <FnPathIterator>
1318+void PrinterVisitor::beginVisit ( const FnPathIterator& a) {
1319+ thePrinter.startBeginVisit("FnPathIterator", ++theId);
1320+ printCommons( &a, theId );
1321+ thePrinter.endBeginVisit( theId );
1322+}
1323+
1324+void PrinterVisitor::endVisit ( const FnPathIterator& ) {
1325+ thePrinter.startEndVisit();
1326+ thePrinter.endEndVisit();
1327+}
1328+// </FnPathIterator>
1329+
1330+
1331 // <AbsIterator>
1332 void PrinterVisitor::beginVisit ( const AbsIterator& a) {
1333 thePrinter.startBeginVisit("AbsIterator", ++theId);
1334@@ -2968,18 +2982,18 @@
1335 // </FormatIntegerIterator>
1336
1337
1338-// <FnParseXmlFragmentIterator>
1339-void PrinterVisitor::beginVisit ( const FnParseXmlFragmentIterator& a) {
1340- thePrinter.startBeginVisit("FnParseXmlFragmentIterator", ++theId);
1341+// <FnZorbaParseXmlFragmentIterator>
1342+void PrinterVisitor::beginVisit ( const FnZorbaParseXmlFragmentIterator& a) {
1343+ thePrinter.startBeginVisit("FnZorbaParseXmlFragmentIterator", ++theId);
1344 printCommons( &a, theId );
1345 thePrinter.endBeginVisit( theId );
1346 }
1347
1348-void PrinterVisitor::endVisit ( const FnParseXmlFragmentIterator& ) {
1349+void PrinterVisitor::endVisit ( const FnZorbaParseXmlFragmentIterator& ) {
1350 thePrinter.startEndVisit();
1351 thePrinter.endEndVisit();
1352 }
1353-// </FnParseXmlFragmentIterator>
1354+// </FnZorbaParseXmlFragmentIterator>
1355
1356
1357 // <FnParseXmlIterator>
1358
1359=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
1360--- src/runtime/visitors/pregenerated/printer_visitor.h 2012-04-24 18:22:23 +0000
1361+++ src/runtime/visitors/pregenerated/printer_visitor.h 2012-05-02 12:31:20 +0000
1362@@ -663,6 +663,9 @@
1363 void beginVisit( const LeastCommonAncestor& );
1364 void endVisit ( const LeastCommonAncestor& );
1365
1366+ void beginVisit( const FnPathIterator& );
1367+ void endVisit ( const FnPathIterator& );
1368+
1369 void beginVisit( const AbsIterator& );
1370 void endVisit ( const AbsIterator& );
1371
1372@@ -684,8 +687,8 @@
1373 void beginVisit( const FormatIntegerIterator& );
1374 void endVisit ( const FormatIntegerIterator& );
1375
1376- void beginVisit( const FnParseXmlFragmentIterator& );
1377- void endVisit ( const FnParseXmlFragmentIterator& );
1378+ void beginVisit( const FnZorbaParseXmlFragmentIterator& );
1379+ void endVisit ( const FnZorbaParseXmlFragmentIterator& );
1380
1381 void beginVisit( const FnParseXmlIterator& );
1382 void endVisit ( const FnParseXmlIterator& );
1383
1384=== modified file 'test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-7.xml.res'
1385--- test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-7.xml.res 2012-04-24 12:39:38 +0000
1386+++ test/rbkt/ExpQueryResults/zorba/introspection/introsp-fn-7.xml.res 2012-05-02 12:31:20 +0000
1387@@ -1,1 +1,1 @@
1388-QName abs adjust-date-to-timezone adjust-dateTime-to-timezone adjust-time-to-timezone analyze-string available-environment-variables avg base-uri boolean ceiling codepoint-equal codepoints-to-string collection compare concat contains count current-date current-dateTime current-time data dateTime day-from-date day-from-dateTime days-from-duration deep-equal default-collation distinct-values doc doc-available document-uri element-with-id empty encode-for-uri ends-with environment-variable error escape-html-uri exactly-one exists false floor format-date format-dateTime format-integer format-number format-time function-arity function-name generate-id has-children head hours-from-dateTime hours-from-duration hours-from-time id idref implicit-timezone in-scope-prefixes index-of innermost insert-before iri-to-uri lang last local-name local-name-from-QName lower-case matches max min minutes-from-dateTime minutes-from-duration minutes-from-time month-from-date month-from-dateTime months-from-duration name namespace-uri namespace-uri-for-prefix namespace-uri-from-QName nilled node-name normalize-space normalize-unicode not number one-or-more outermost parse-xml partial-apply position prefix-from-QName put remove replace resolve-QName resolve-uri reverse root round round-half-to-even seconds-from-dateTime seconds-from-duration seconds-from-time serialize starts-with static-base-uri string string-join string-length string-to-codepoints subsequence substring substring-after substring-before sum tail timezone-from-date timezone-from-dateTime timezone-from-time tokenize trace translate true unordered unparsed-text unparsed-text-available unparsed-text-lines upper-case uri-collection year-from-date year-from-dateTime years-from-duration zero-or-one acos asin atan atan2 cos exp exp10 log log10 pi pow sin sqrt tan base-uri boundary-space-policy construction-mode copy-namespaces-mode default-collation default-collection-type default-function-namespace default-order function-annotations function-arguments-count function-names in-scope-attribute-declarations in-scope-attribute-groups in-scope-element-declarations in-scope-element-groups in-scope-schema-types in-scope-variables option ordering-mode statically-known-collations statically-known-document-type statically-known-documents statically-known-namespace-binding statically-known-namespaces xpath10-compatibility-mode
1389+QName abs adjust-date-to-timezone adjust-dateTime-to-timezone adjust-time-to-timezone analyze-string available-environment-variables avg base-uri boolean ceiling codepoint-equal codepoints-to-string collection compare concat contains count current-date current-dateTime current-time data dateTime day-from-date day-from-dateTime days-from-duration deep-equal default-collation distinct-values doc doc-available document-uri element-with-id empty encode-for-uri ends-with environment-variable error escape-html-uri exactly-one exists false floor format-date format-dateTime format-integer format-number format-time function-arity function-name generate-id has-children head hours-from-dateTime hours-from-duration hours-from-time id idref implicit-timezone in-scope-prefixes index-of innermost insert-before iri-to-uri lang last local-name local-name-from-QName lower-case matches max min minutes-from-dateTime minutes-from-duration minutes-from-time month-from-date month-from-dateTime months-from-duration name namespace-uri namespace-uri-for-prefix namespace-uri-from-QName nilled node-name normalize-space normalize-unicode not number one-or-more outermost parse-xml partial-apply path position prefix-from-QName put remove replace resolve-QName resolve-uri reverse root round round-half-to-even seconds-from-dateTime seconds-from-duration seconds-from-time serialize starts-with static-base-uri string string-join string-length string-to-codepoints subsequence substring substring-after substring-before sum tail timezone-from-date timezone-from-dateTime timezone-from-time tokenize trace translate true unordered unparsed-text unparsed-text-available unparsed-text-lines upper-case uri-collection year-from-date year-from-dateTime years-from-duration zero-or-one acos asin atan atan2 cos exp exp10 log log10 pi pow sin sqrt tan base-uri boundary-space-policy construction-mode copy-namespaces-mode default-collation default-collection-type default-function-namespace default-order function-annotations function-arguments-count function-names in-scope-attribute-declarations in-scope-attribute-groups in-scope-element-declarations in-scope-element-groups in-scope-schema-types in-scope-variables option ordering-mode statically-known-collations statically-known-document-type statically-known-documents statically-known-namespace-binding statically-known-namespaces xpath10-compatibility-mode

Subscribers

People subscribed via source and target branches