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

Proposed by Nicolae Brinza on 2013-07-04
Status: Rejected
Rejected by: Matthias Brantner on 2013-09-19
Proposed branch: lp:~zorba-coders/zorba/dataguide
Merge into: lp:zorba
Diff against target: 6599 lines (+2320/-394)
162 files modified
src/annotations/annotations.cpp (+9/-0)
src/annotations/annotations.h (+4/-1)
src/common/shared_types.h (+3/-0)
src/compiler/codegen/plan_visitor.cpp (+16/-1)
src/compiler/expression/CMakeLists.txt (+2/-1)
src/compiler/expression/expr_base.cpp (+109/-0)
src/compiler/expression/expr_base.h (+12/-0)
src/compiler/expression/expr_clone.cpp (+3/-0)
src/compiler/expression/expr_type.cpp (+4/-0)
src/compiler/expression/json_dataguide.cpp (+349/-0)
src/compiler/expression/json_dataguide.h (+153/-0)
src/compiler/expression/var_expr.cpp (+1/-0)
src/compiler/rewriter/framework/default_optimizer.cpp (+10/-1)
src/compiler/rewriter/rules/nodeid_rules.cpp (+289/-0)
src/compiler/rewriter/rules/rule_base.h (+2/-1)
src/compiler/rewriter/rules/ruleset.h (+25/-0)
src/functions/function.cpp (+24/-0)
src/functions/function.h (+4/-2)
src/functions/pregenerated/func_accessors.h (+3/-10)
src/functions/pregenerated/func_any_uri.h (+0/-1)
src/functions/pregenerated/func_base64.h (+0/-2)
src/functions/pregenerated/func_booleans.h (+0/-3)
src/functions/pregenerated/func_collections.h (+12/-34)
src/functions/pregenerated/func_context.h (+0/-8)
src/functions/pregenerated/func_datetime.h (+0/-9)
src/functions/pregenerated/func_documents.h (+0/-5)
src/functions/pregenerated/func_durations_dates_times.h (+0/-21)
src/functions/pregenerated/func_errors_and_diagnostics.h (+0/-2)
src/functions/pregenerated/func_fetch.h (+0/-3)
src/functions/pregenerated/func_fn_hof_functions.h (+7/-7)
src/functions/pregenerated/func_fnput.h (+0/-1)
src/functions/pregenerated/func_ft_module.h (+0/-15)
src/functions/pregenerated/func_ic_ddl.h (+0/-3)
src/functions/pregenerated/func_index_func.h (+0/-1)
src/functions/pregenerated/func_item.h (+0/-1)
src/functions/pregenerated/func_json.h (+0/-2)
src/functions/pregenerated/func_jsoniq_functions.h (+4/-23)
src/functions/pregenerated/func_maps.h (+0/-10)
src/functions/pregenerated/func_maths.h (+0/-26)
src/functions/pregenerated/func_node_position.h (+0/-24)
src/functions/pregenerated/func_nodes.h (+5/-20)
src/functions/pregenerated/func_numerics.h (+3/-8)
src/functions/pregenerated/func_other_diagnostics.h (+0/-2)
src/functions/pregenerated/func_parse_fragment.h (+1/-3)
src/functions/pregenerated/func_parsing_and_serializing.h (+3/-2)
src/functions/pregenerated/func_qnames.h (+0/-8)
src/functions/pregenerated/func_random.h (+0/-3)
src/functions/pregenerated/func_reference.h (+0/-4)
src/functions/pregenerated/func_schema.h (+0/-3)
src/functions/pregenerated/func_sctx.h (+0/-25)
src/functions/pregenerated/func_sequences.h (+5/-32)
src/functions/pregenerated/func_strings.h (+2/-30)
src/functions/pregenerated/func_uris.h (+0/-3)
src/functions/pregenerated/func_xqdoc.h (+0/-2)
src/runtime/collections/collections_impl.cpp (+5/-4)
src/runtime/collections/pregenerated/collections.cpp (+1/-0)
src/runtime/collections/pregenerated/collections.h (+5/-1)
src/runtime/json/json_loader.cpp (+3/-2)
src/runtime/json/json_loader.h (+5/-2)
src/runtime/json/jsoniq_functions_impl.cpp (+1/-1)
src/runtime/json/pregenerated/jsoniq_functions.cpp (+1/-0)
src/runtime/json/pregenerated/jsoniq_functions.h (+5/-1)
src/runtime/spec/codegen-h.xq (+12/-2)
src/runtime/spec/collections/collections.xml (+15/-3)
src/runtime/spec/json/jsoniq_functions.xml (+10/-0)
src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml (+1/-0)
src/store/api/store.h (+3/-1)
src/store/naive/json_items.cpp (+13/-2)
src/store/naive/store.cpp (+2/-1)
src/store/naive/store.h (+1/-1)
src/system/globalenv.cpp (+2/-2)
src/system/zorba_properties.h (+12/-2)
src/system/zorba_properties.txt (+1/-0)
test/driver/specification.h (+15/-2)
test/driver/testdriver.cpp (+23/-4)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-01.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-02.xml.res (+3/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-03.xml.res (+3/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-04.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-05.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-06.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-07.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-08.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-09.xml.res (+3/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-10.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-11.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-12.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-13.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-14.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-15.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-16.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-17.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-18.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-19.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-20.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-21.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-22.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-23.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-24.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-25.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-26.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-27.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-28.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/jsoniq/dataguide/dataguide-29.xml.res (+2/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-01.jq (+19/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-01.spec (+2/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-02.jq (+29/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-02.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-03.jq (+38/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-03.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-04.jq (+22/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-04.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-05.jq (+25/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-05.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-06.jq (+26/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-06.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-07.jq (+27/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-07.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-08.jq (+27/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-08.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-09.jq (+33/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-09.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-10.jq (+27/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-10.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-11.jq (+25/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-11.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-12.jq (+28/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-12.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-13.jq (+29/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-13.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-14.jq (+29/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-14.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-15.jq (+29/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-15.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-16.jq (+31/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-16.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-17.jq (+31/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-17.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-18.jq (+32/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-18.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-19.jq (+32/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-19.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-20.jq (+38/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-20.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-21.jq (+33/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-21.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-22.jq (+38/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-22.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-23.jq (+39/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-23.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-24.jq (+32/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-24.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-25.jq (+20/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-25.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-26.jq (+20/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-26.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-27.jq (+22/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-27.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-28.jq (+22/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-28.spec (+1/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-29.jq (+228/-0)
test/rbkt/Queries/zorba/jsoniq/dataguide/dataguide-29.spec (+1/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/dataguide
Reviewer Review Type Date Requested Status
Matthias Brantner 2013-07-17 Needs Fixing on 2013-07-17
Nicolae Brinza Approve on 2013-07-17
Markos Zaharioudakis 2013-07-17 Pending
Review via email: mp+173026@code.launchpad.net

Commit message

Dataguide implementation.

Description of the change

Dataguide implementation.

To post a comment you must log in.
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Stage "TestZorbaUbuntu" failed.
794 tests failed (8369 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/49/testReport/ to view the results.

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Stage "TestZorbaUbuntu" failed.
794 tests failed (8369 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/50/testReport/ to view the results.

lp:~zorba-coders/zorba/dataguide updated on 2013-07-04
11482. By Nicolae Brinza on 2013-07-04

Dataguide work in progress.

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Stage "TestZorbaUbuntu" failed.
794 tests failed (8373 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/51/testReport/ to view the results.

lp:~zorba-coders/zorba/dataguide updated on 2013-07-04
11483. By Nicolae Brinza on 2013-07-04

Merged with Zorba trunk

11484. By Nicolae Brinza on 2013-07-04

Disabled dataguide for testing

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Stage "TestZorbaUbuntu" failed.
26 tests failed (8373 total tests run).

Check test results at http://jenkins.lambda.nu/job/TestZorbaUbuntu/52/testReport/ to view the results.

lp:~zorba-coders/zorba/dataguide updated on 2013-07-05
11485. By Nicolae Brinza on 2013-07-05

Re-enabled the dataguide

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

lp:~zorba-coders/zorba/dataguide updated on 2013-07-08
11486. By Nicolae Brinza on 2013-07-08

Dataguide fixes for the remote queue; cleanup; documentation;

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Progress dashboard at http://jenkins.lambda.nu/view/ValidationQueue

Zorba Build Bot (zorba-buildbot) wrote :

Voting criteria failed for the following merge proposals:

https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026 :
Votes: {'Pending': 1}

Zorba Build Bot (zorba-buildbot) wrote :

Validation queue result for https://code.launchpad.net/~zorba-coders/zorba/dataguide/+merge/173026

Stage "CommitZorba" failed.

Check console output at http://jenkins.lambda.nu/job/CommitZorba/9/console to view the results.

lp:~zorba-coders/zorba/dataguide updated on 2013-07-08
11487. By Nicolae Brinza on 2013-07-08

Dataguide cleanup

Nicolae Brinza (nbrinza) :
review: Approve

- I find the name dataguide misleading because it's a guide on the query and not on the data. Maybe QueryPruneGuide would be more meaningful
- Can the user also use the zann_explores_json annotation?
- Why is the dataguide parameter on the Store's getCollection() function? Shouldn't it be on the function that returns the iterator? The problem is that a Collection object within the simplestore exists only once per collection. What's the semantics if multiple queries access the collection (possibly in parallel)?
- Did you measure the performance impact of the optimizer on some larger queries?

review: Needs Fixing
Nicolae Brinza (nbrinza) wrote :
Download full text (3.2 KiB)

> - I find the name dataguide misleading because it's a guide on the query and
> not on the data. Maybe QueryPruneGuide would be more meaningful

The query itself is not pruned, the data is. I think "dataguide" is the established term -- see for example this paper: http://ilpubs.stanford.edu:8090/264/1/1997-50.pdf .

> - Can the user also use the zann_explores_json annotation?

Yes, the users can use it as well. But does it make sense for them to use it? If they have an external function -- it is automatically handled as if it has the annotation. For a UDF it doesn't really make any sense to add it.

> - Why is the dataguide parameter on the Store's getCollection() function?
> Shouldn't it be on the function that returns the iterator? The problem is that
> a Collection object within the simplestore exists only once per collection.
> What's the semantics if multiple queries access the collection (possibly in
> parallel)?

It very much depends on how the collections are handled. Currently for Zorba collections it doesn't make sense to have any dataguides at all, because they're in-memory collections. I have not taken a look at the Sausalito code and have not seen how e.g. the MongoDB "collections" are managed. getCollection() seemed the most logical place where it should be passed, but the dataguide parameter could be easily propagated to any Store class, including the function that returns the iterator.

Currently each and every db:collection() call has its own dataguide, even if they might refer to the same collection. If the collection manager currently "caches" or reuses the collection iterators, then it might make sense to forbid that so that the dataguide for each individual db:collection call could be used.

Or alternatively, an "union" on the dataguides that refer to the same collection could be performed. But I think it is not always possible to determine if that is the case.

I think this could be investigated and decided upon when implementing the Dataguide push-down into MongoDB or when I would take a better look at the Sausalito's collection manager code.

> - Did you measure the performance impact of the optimizer on some larger
> queries?

The expression tree is traversed in its entirety once and only once, visiting each node, so the performance should not be very different from any other dataflow computation, e.g. ignores sorts/order/etc. If there are no "sources", i.e. db:collection() or jn:parse() calls, then the dataguide computation just propagates NULLs, doing no calculations and almost no memory allocations (at most one dataguide_cb allocation per fo_exprs and several others). If there are "sources" in the tree -- there will be some union operations being performed for some of the nodes.

I will check if any of our larger queries have longer compilation times, but because none of them have db:collection() or jn:parse() calls, I do not expect any differences.

It would make sense to have a specially constructed query that would do a stress-test of the dataguide code -- e.g. a db:collection().navigation.navigation. ... .navigation several thousand times or something similar. I will try that out and see if it manages...

Read more...

> > - I find the name dataguide misleading because it's a guide on the query and
> > not on the data. Maybe QueryPruneGuide would be more meaningful
>
> The query itself is not pruned, the data is. I think "dataguide" is the
> established term -- see for example this paper:
> http://ilpubs.stanford.edu:8090/264/1/1997-50.pdf .
"DataGuides serve as dynamic schemas, generated from the database." What we generate is a schema from the query.

> > - Why is the dataguide parameter on the Store's getCollection() function?
> > Shouldn't it be on the function that returns the iterator? The problem is
> that
> > a Collection object within the simplestore exists only once per collection.
> > What's the semantics if multiple queries access the collection (possibly in
> > parallel)?
>
> It very much depends on how the collections are handled. Currently for Zorba
> collections it doesn't make sense to have any dataguides at all, because
> they're in-memory collections. I have not taken a look at the Sausalito code
> and have not seen how e.g. the MongoDB "collections" are managed.
> getCollection() seemed the most logical place where it should be passed, but
> the dataguide parameter could be easily propagated to any Store class,
> including the function that returns the iterator.
>
> Currently each and every db:collection() call has its own dataguide, even if
> they might refer to the same collection. If the collection manager currently
> "caches" or reuses the collection iterators, then it might make sense to
> forbid that so that the dataguide for each individual db:collection call could
> be used.
>
> Or alternatively, an "union" on the dataguides that refer to the same
> collection could be performed. But I think it is not always possible to
> determine if that is the case.
>
> I think this could be investigated and decided upon when implementing the
> Dataguide push-down into MongoDB or when I would take a better look at the
> Sausalito's collection manager code.
I think we will run into a problem. 28msec has only one buffer that is accessed by all db:collection() calls in a query. Hence, the information needs to be the union.

Nicolae Brinza (nbrinza) wrote :

> "DataGuides serve as dynamic schemas, generated from the database." What we generate is a
> schema from the query.

Still, it is a data schema, not a query schema. The one in the paper would be a Database DataGuide and ours would be Query DataGuide. I would agree to change it to QueryDataguide but I don't think there would be any confusions if it was simply called Dataguide.

> I think we will run into a problem. 28msec has only one buffer that is
> accessed by all db:collection() calls in a query. Hence, the information
> needs to be the union.

If there is no way of removing that limitation then we can overcome this by doing an union on all db:collection() dataguides and this will ensure correctness. But it would be a pity to loose the individually computed dataguides for each separate call. Still, if the name of fields of different collections are mostly disjoint sets, then we won't loose much of the improvement.

Again I suggest leaving this until I start implementing the push-down of projection info into the db:collection() calls. It has no impact on jn:parse() -- these dataguides can still be computed and kept individually for each call even if we do an union on db:collection() calls.

--

Nicolae Brinza (nbrinza) wrote :

I've done some additional testing, and these are the results:

For the xray query, the largest that we have in the testsuite, compilation time with --compile-only is pretty much the same with and without the dataguide computaiton, at around ~0.08 sec.

With a specially constructed query that looks like this: (see dataguide-29.jq test)

let $col := dml:collection()
let $col2 := ($col.cat1, $col.cat2, ... , $col.cat10)
return $col2.category.category.category ... category (repeated ~2000 times)

the compilation time goes from ~0.7s without the dataguide to ~10s with the dataguide enabled, so it is significant. But this is a worst-case scenario. The resulting dataguide is an object 2000-levels deep.

The compilation can be improved significantly by:
- keeping track of the "leaves" nodes in the dataguide tree
- rewriting a bit the dataguide structure to store the trees incrementally instead of cloning them
- adding a depth cutoff

What do you think?

lp:~zorba-coders/zorba/dataguide updated on 2013-07-30
11488. By Nicolae Brinza on 2013-07-23

Added a stress-test for the dataguide computation

11489. By Nicolae Brinza on 2013-07-23

Merged with Zorba trunk

11490. By Nicolae Brinza on 2013-07-23

Fixed the build

11491. By Markos Zaharioudakis on 2013-07-30

cosmetic

11492. By Markos Zaharioudakis on 2013-07-30

merge from trunk

Superseded by use-dataguide merge proposal.

Unmerged revisions

11492. By Markos Zaharioudakis on 2013-07-30

merge from trunk

11491. By Markos Zaharioudakis on 2013-07-30

cosmetic

11490. By Nicolae Brinza on 2013-07-23

Fixed the build

11489. By Nicolae Brinza on 2013-07-23

Merged with Zorba trunk

11488. By Nicolae Brinza on 2013-07-23

Added a stress-test for the dataguide computation

11487. By Nicolae Brinza on 2013-07-08

Dataguide cleanup

11486. By Nicolae Brinza on 2013-07-08

Dataguide fixes for the remote queue; cleanup; documentation;

11485. By Nicolae Brinza on 2013-07-05

Re-enabled the dataguide

11484. By Nicolae Brinza on 2013-07-04

Disabled dataguide for testing

11483. By Nicolae Brinza on 2013-07-04

Merged with Zorba trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/annotations/annotations.cpp'
2--- src/annotations/annotations.cpp 2013-07-06 06:59:32 +0000
3+++ src/annotations/annotations.cpp 2013-07-30 11:18:26 +0000
4@@ -133,6 +133,8 @@
5 ZANN(read-only-nodes, read_only_nodes);
6 ZANN(mutable-nodes, mutable_nodes);
7
8+ ZANN(explores-json, explores_json);
9+
10 #undef ZANN
11
12 // create a set of rules to detect conflicts between annotations
13@@ -401,6 +403,13 @@
14 }
15
16
17+void AnnotationList::push_back(
18+ AnnotationInternal::AnnotationId id)
19+{
20+ theAnnotationList.push_back(new AnnotationInternal(AnnotationInternal::lookup(id)));
21+}
22+
23+
24 /*******************************************************************************
25 Called from translator to detect duplicates and conflicting declarations
26 ********************************************************************************/
27
28=== modified file 'src/annotations/annotations.h'
29--- src/annotations/annotations.h 2013-07-06 06:59:32 +0000
30+++ src/annotations/annotations.h 2013-07-30 11:18:26 +0000
31@@ -86,7 +86,8 @@
32 zann_ordered,
33 zann_unordered,
34 zann_read_only_nodes,
35- zann_mutable_nodes,
36+ zann_mutable_nodes,
37+ zann_explores_json,
38
39 // must be at the end
40 zann_end
41@@ -188,6 +189,8 @@
42 void push_back(
43 const store::Item_t& qname,
44 const std::vector<const_expr*>& literals);
45+
46+ void push_back(AnnotationInternal::AnnotationId id);
47
48 void checkConflictingDeclarations(DeclarationKind k, const QueryLoc& loc) const;
49 };
50
51=== modified file 'src/common/shared_types.h'
52--- src/common/shared_types.h 2013-07-06 06:59:32 +0000
53+++ src/common/shared_types.h 2013-07-30 11:18:26 +0000
54@@ -106,6 +106,9 @@
55
56 typedef rchandle<CompilerCB> CompilerCB_t;
57
58+// JSON dataguide
59+class dataguide_cb;
60+typedef rchandle<dataguide_cb> dataguide_cb_t;
61
62 /* datetime stuff */
63 class DateTime;
64
65=== modified file 'src/compiler/codegen/plan_visitor.cpp'
66--- src/compiler/codegen/plan_visitor.cpp 2013-07-01 18:59:06 +0000
67+++ src/compiler/codegen/plan_visitor.cpp 2013-07-30 11:18:26 +0000
68@@ -49,6 +49,8 @@
69 #include "compiler/expression/function_item_expr.h"
70 #include "compiler/expression/path_expr.h"
71 #include "compiler/expression/var_expr.h"
72+#include "compiler/expression/json_dataguide.h"
73+
74 #include "compiler/parser/parse_constants.h"
75
76 #include "context/namespace_context.h"
77@@ -98,6 +100,9 @@
78 #include "runtime/hof/dynamic_fncall_iterator.h"
79 #include "runtime/misc/materialize.h"
80
81+#include "runtime/collections/collections.h"
82+#include "runtime/json/jsoniq_functions.h"
83+
84 #ifdef ZORBA_WITH_DEBUGGER
85 #include "debugger/debugger_commons.h"
86 #endif
87@@ -2456,7 +2461,7 @@
88 if (is_enclosed_expr(&v))
89 theConstructorsStack.push(&v);
90
91- return true;
92+ return true;
93 }
94
95
96@@ -2514,6 +2519,16 @@
97 user_function* udf = static_cast<user_function*>(func);
98 udf->computeResultCaching(theCCB->theXQueryDiagnostics);
99 }
100+ else if (dataguide_cb::func_uses_dataguide(func->getKind()) && v.get_dataguide() != NULL)
101+ {
102+ ZorbaCollectionIterator* collIter;
103+ if ((collIter = dynamic_cast<ZorbaCollectionIterator*>(iter.getp())))
104+ collIter->setDataguide(v.get_dataguide()->get_as_json(&v));
105+
106+ JSONParseIterator* parseIter;
107+ if ((parseIter = dynamic_cast<JSONParseIterator*>(iter.getp())))
108+ parseIter->setDataguide(v.get_dataguide()->get_as_json(&v));
109+ }
110 }
111 else
112 {
113
114=== modified file 'src/compiler/expression/CMakeLists.txt'
115--- src/compiler/expression/CMakeLists.txt 2013-02-07 17:24:36 +0000
116+++ src/compiler/expression/CMakeLists.txt 2013-07-30 11:18:26 +0000
117@@ -30,7 +30,8 @@
118 function_item_expr.cpp
119 pragma.cpp
120 mem_manager.cpp
121- expr_manager.cpp)
122+ expr_manager.cpp
123+ json_dataguide.cpp)
124
125 IF (NOT ZORBA_NO_FULL_TEXT)
126 LIST(APPEND EXPRESSION_SRCS
127
128=== modified file 'src/compiler/expression/expr_base.cpp'
129--- src/compiler/expression/expr_base.cpp 2013-05-29 04:17:01 +0000
130+++ src/compiler/expression/expr_base.cpp 2013-07-30 11:18:26 +0000
131@@ -26,6 +26,8 @@
132 #include "compiler/expression/expr_visitor.h"
133 #include "compiler/expression/expr_manager.h"
134
135+#include "compiler/expression/json_dataguide.h"
136+
137 #include "compiler/api/compilercb.h"
138
139 #include "functions/function.h"
140@@ -1418,6 +1420,29 @@
141 }
142
143
144+/*******************************************************************************
145+
146+********************************************************************************/
147+dataguide_cb* expr::get_dataguide()
148+{
149+ return theJsonDataguide;
150+}
151+
152+
153+dataguide_cb* expr::get_dataguide_or_new()
154+{
155+ if (!theJsonDataguide.getp())
156+ theJsonDataguide = new dataguide_cb();
157+ return theJsonDataguide;
158+}
159+
160+
161+dataguide_cb* expr::set_dataguide(dataguide_cb* a_json_dataguide)
162+{
163+ theJsonDataguide = a_json_dataguide;
164+ return theJsonDataguide;
165+}
166+
167
168 /*******************************************************************************
169
170@@ -1440,6 +1465,90 @@
171 return cloneExpr->get_return_type();
172 }
173
174+/*******************************************************************************
175+
176+********************************************************************************/
177+std::string expr::get_expr_kind_string() const
178+{
179+ const char* result;
180+
181+ switch (get_expr_kind())
182+ {
183+ case const_expr_kind: result = "const_expr"; break;
184+
185+ case var_expr_kind: result = "var_expr"; break;
186+
187+ case doc_expr_kind: result = "doc_expr"; break;
188+ case elem_expr_kind: result = "elem_expr"; break;
189+ case attr_expr_kind: result = "attr_expr"; break;
190+ case namespace_expr_kind: result = "namespace_expr"; break;
191+ case text_expr_kind: result = "text_expr"; break;
192+ case pi_expr_kind: result = "pi_expr"; break;
193+
194+ case relpath_expr_kind: result = "relpath_expr"; break;
195+ case axis_step_expr_kind: result = "axis_step_expr"; break;
196+ case match_expr_kind: result = "match_expr"; break;
197+
198+ case flwor_expr_kind: result = "flwor_expr"; break;
199+ case if_expr_kind: result = "if_expr"; break;
200+ case trycatch_expr_kind: result = "trycatch_expr"; break;
201+
202+ case fo_expr_kind: result = "fo_expr"; break;
203+ case dynamic_function_invocation_expr_kind: result = "dynamic_function_invocation_expr"; break;
204+ case argument_placeholder_expr_kind: result = "argument_placeholder_expr"; break;
205+ case function_item_expr_kind: result = "function_item_expr"; break;
206+
207+ case castable_expr_kind: result = "castable_expr"; break;
208+ case cast_expr_kind: result = "cast_expr"; break;
209+ case instanceof_expr_kind: result = "instanceof_expr"; break;
210+ case treat_expr_kind: result = "treat_expr"; break;
211+ case promote_expr_kind: result = "promote_expr"; break;
212+ case name_cast_expr_kind: result = "name_cast_expr"; break;
213+
214+ case validate_expr_kind: result = "validate_expr"; break;
215+
216+ case extension_expr_kind: result = "extension_expr"; break;
217+
218+ case order_expr_kind: result = "order_expr"; break;
219+
220+#ifndef ZORBA_NO_FULL_TEXT
221+ case ft_expr_kind: result = "ft_expr"; break;
222+#endif /* ZORBA_NO_FULL_TEXT */
223+
224+ case delete_expr_kind: result = "delete_expr"; break;
225+ case insert_expr_kind: result = "insert_expr"; break;
226+ case rename_expr_kind: result = "rename_expr"; break;
227+ case replace_expr_kind: result = "replace_expr"; break;
228+ case transform_expr_kind: result = "transform_expr"; break;
229+
230+ case block_expr_kind: result = "block_expr"; break;
231+ case var_decl_expr_kind: result = "var_decl_expr"; break;
232+ case var_set_expr_kind: result = "var_set_expr"; break;
233+ case apply_expr_kind: result = "apply_expr"; break;
234+ case exit_expr_kind: result = "exit_expr"; break;
235+ case exit_catcher_expr_kind: result = "exit_catcher_expr"; break;
236+ case flowctl_expr_kind: result = "flowctl_expr"; break;
237+ case while_expr_kind: result = "while_expr"; break;
238+
239+ case eval_expr_kind: result = "eval_expr"; break;
240+ case debugger_expr_kind: result = "debugger_expr"; break;
241+ case wrapper_expr_kind: result = "wrapper_expr"; break;
242+ case function_trace_expr_kind: result = "function_trace_expr"; break;
243+
244+ case json_direct_object_expr_kind: result = "json_direct_object_expr"; break;
245+ case json_object_expr_kind: result = "json_object_expr"; break;
246+ case json_array_expr_kind: result = "json_array_expr"; break;
247+
248+ case unknown_expr_kind: result = "unknown_expr"; break;
249+
250+ default:
251+ result = "expr kind not in list. Add it to expr_base::get_expr_kind_string()";
252+ break;
253+ }
254+
255+ return std::string(result);
256+}
257+
258
259 } // namespace zorba
260 /* vim:set et sw=2 ts=2: */
261
262=== modified file 'src/compiler/expression/expr_base.h'
263--- src/compiler/expression/expr_base.h 2013-05-29 04:17:01 +0000
264+++ src/compiler/expression/expr_base.h 2013-07-30 11:18:26 +0000
265@@ -45,6 +45,7 @@
266
267 class CompilerCB;
268
269+
270 enum expr_kind_t
271 {
272 const_expr_kind,
273@@ -198,6 +199,8 @@
274 uint8_t theVisitId;
275
276 FreeVars theFreeVars;
277+
278+ dataguide_cb_t theJsonDataguide;
279
280 public:
281 static bool is_sequential(unsigned short theScriptingKind);
282@@ -223,6 +226,8 @@
283 user_function* get_udf() const { return theUDF; }
284
285 expr_kind_t get_expr_kind() const { return static_cast<expr_kind_t>(theKind); }
286+
287+ std::string get_expr_kind_string() const;
288
289 const QueryLoc& get_loc() const { return theLoc; }
290
291@@ -404,6 +409,13 @@
292 void clear_annotations();
293
294 xqtref_t get_return_type_with_empty_input(const expr* input) const;
295+
296+ dataguide_cb* get_dataguide();
297+
298+ // If the object's dataguide is NULL, will create a new one and return it
299+ dataguide_cb* get_dataguide_or_new();
300+
301+ dataguide_cb* set_dataguide(dataguide_cb* a_json_dataguide);
302
303 protected:
304 virtual void compute_scripting_kind() = 0;
305
306=== modified file 'src/compiler/expression/expr_clone.cpp'
307--- src/compiler/expression/expr_clone.cpp 2013-07-02 21:32:23 +0000
308+++ src/compiler/expression/expr_clone.cpp 2013-07-30 11:18:26 +0000
309@@ -27,6 +27,7 @@
310 #include "compiler/expression/ft_expr.h"
311 #include "compiler/expression/ftnode.h"
312 #include "compiler/expression/expr_manager.h"
313+#include "compiler/expression/json_dataguide.h"
314
315 #include "compiler/api/compilercb.h"
316
317@@ -337,6 +338,8 @@
318 cloneExpr->theArgs.push_back(e->theArgs[i]->clone(udf, subst));
319
320 cloneExpr->theScriptingKind = e->theScriptingKind;
321+
322+ cloneExpr->theJsonDataguide = e->theJsonDataguide;
323
324 newExpr = cloneExpr;
325 break;
326
327=== modified file 'src/compiler/expression/expr_type.cpp'
328--- src/compiler/expression/expr_type.cpp 2013-06-15 02:57:08 +0000
329+++ src/compiler/expression/expr_type.cpp 2013-07-30 11:18:26 +0000
330@@ -643,6 +643,10 @@
331 const FunctionXQType* funcType = static_cast<const FunctionXQType*>(fiType.getp());
332 newType = funcType->get_return_type();
333 }
334+ else if (fiType->type_kind() == XQType::STRUCTURED_ITEM_KIND && e->get_args().size() == 1)
335+ {
336+ newType = rtm.STRUCTURED_ITEM_TYPE_STAR;
337+ }
338 else
339 {
340 newType = rtm.ITEM_TYPE_STAR;
341
342=== added file 'src/compiler/expression/json_dataguide.cpp'
343--- src/compiler/expression/json_dataguide.cpp 1970-01-01 00:00:00 +0000
344+++ src/compiler/expression/json_dataguide.cpp 2013-07-30 11:18:26 +0000
345@@ -0,0 +1,349 @@
346+/*
347+ * Copyright 2006-2013 The FLWOR Foundation.
348+ *
349+ * Licensed under the Apache License, Version 2.0 (the "License");
350+ * you may not use this file except in compliance with the License.
351+ * You may obtain a copy of the License at
352+ *
353+ * http://www.apache.org/licenses/LICENSE-2.0
354+ *
355+ * Unless required by applicable law or agreed to in writing, software
356+ * distributed under the License is distributed on an "AS IS" BASIS,
357+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
358+ * See the License for the specific language governing permissions and
359+ * limitations under the License.
360+ */
361+#include "stdafx.h"
362+
363+#include "system/globalenv.h"
364+#include "store/api/item_factory.h"
365+
366+#include "compiler/expression/expr_base.h"
367+#include "compiler/expression/json_dataguide.h"
368+
369+
370+namespace zorba
371+{
372+
373+/*******************************************************************************
374+
375+********************************************************************************/
376+void dataguide_node::add_to_leaves(store::Item* key)
377+{
378+ if (is_star)
379+ return;
380+
381+ if (keys.size() == 0) // no children == leaf
382+ {
383+ keys.push_back(key);
384+ values.push_back(dataguide_node());
385+ return;
386+ }
387+
388+ for (csize i = 0; i != keys.size(); ++i)
389+ values[i].add_to_leaves(key);
390+}
391+
392+
393+void dataguide_node::add_to_leaves(const dataguide_node* other)
394+{
395+ if (is_star)
396+ return;
397+
398+ if (keys.size() == 0) // no children == leaf
399+ {
400+ clone(other);
401+ return;
402+ }
403+
404+ for (csize i = 0; i != keys.size(); ++i)
405+ values[i].add_to_leaves(other);
406+}
407+
408+
409+void dataguide_node::set_star()
410+{
411+ is_star = true;
412+ keys.clear();
413+ values.clear();
414+}
415+
416+
417+void dataguide_node::set_star_on_leaves()
418+{
419+ if (is_star)
420+ return;
421+
422+ if (keys.size() == 0)
423+ {
424+ set_star();
425+ return;
426+ }
427+
428+ for (csize i = 0; i != keys.size(); i++)
429+ values[i].set_star_on_leaves();
430+}
431+
432+
433+void dataguide_node::do_union(const dataguide_node* other)
434+{
435+ if (other->is_star)
436+ {
437+ set_star();
438+ return;
439+ }
440+
441+ for (unsigned int i=0; i<other->keys.size(); i++)
442+ {
443+ bool found = false;
444+ unsigned int j = 0;
445+ for ( ; j<keys.size(); j++)
446+ if (keys[j]->equals(other->keys[i]))
447+ {
448+ found = true;
449+ break;
450+ }
451+
452+ if (found)
453+ {
454+ values[i].do_union(&other->values[j]);
455+ }
456+ else
457+ {
458+ keys.push_back(other->keys[i]);
459+ values.push_back(dataguide_node());
460+ values.back().do_union(&other->values[i]);
461+ }
462+ }
463+}
464+
465+
466+void dataguide_node::clone(const dataguide_node* other)
467+{
468+ if (other->is_star)
469+ {
470+ set_star();
471+ return;
472+ }
473+
474+ for (csize i = 0; i < other->keys.size(); ++i)
475+ {
476+ keys.push_back(other->keys[i]);
477+ values.push_back(dataguide_node());
478+ values.back().clone(&other->values[i]);
479+ }
480+}
481+
482+
483+dataguide_node* dataguide_node::get(store::Item* key)
484+{
485+ for (csize i = 0; i < keys.size(); ++i)
486+ {
487+ if (keys[i]->equals(key))
488+ return &values[i];
489+ }
490+
491+ return NULL;
492+}
493+
494+
495+store::Item_t dataguide_node::get_as_json()
496+{
497+ std::vector<store::Item_t> vals;
498+ std::vector<store::Item_t> ks;
499+
500+ for (csize i = 0; i < values.size(); ++i)
501+ {
502+ if (values[i].is_star)
503+ {
504+ store::Item_t star_string;
505+ zstring star = zstring("*");
506+ GENV_ITEMFACTORY->createString(star_string, star);
507+ vals.push_back(star_string);
508+ }
509+ else
510+ {
511+ vals.push_back(values[i].get_as_json());
512+ }
513+
514+ ks.push_back(keys[i]);
515+ }
516+
517+ if (is_star && values.size() == 0)
518+ {
519+ store::Item_t star_string;
520+ zstring star = zstring("*");
521+ GENV_ITEMFACTORY->createString(star_string, star);
522+ ks.push_back(star_string);
523+
524+ star = "";
525+ GENV_ITEMFACTORY->createString(star_string, star);
526+ vals.push_back(star_string);
527+ }
528+
529+ store::Item_t result;
530+ GENV_ITEMFACTORY->createJSONObject(result, ks, vals);
531+
532+ return result;
533+}
534+
535+
536+zstring dataguide_node::toString()
537+{
538+ return get_as_json()->show();
539+}
540+
541+
542+/*******************************************************************************
543+
544+********************************************************************************/
545+dataguide_cb::dataguide_cb()
546+{
547+}
548+
549+
550+void dataguide_cb::add_to_leaves(store::Item* object_name)
551+{
552+ // Append the given object to each leaf node
553+ map_type::iterator i = theDataguideMap.begin();
554+ for ( ; i != theDataguideMap.end(); i++)
555+ {
556+ i->second.add_to_leaves(object_name);
557+ }
558+}
559+
560+
561+void dataguide_cb::add_to_leaves(dataguide_node* other)
562+{
563+ // Append the given object to each leaf node
564+ map_type::iterator i = theDataguideMap.begin();
565+ for ( ; i != theDataguideMap.end(); i++)
566+ {
567+ i->second.add_to_leaves(other);
568+ }
569+}
570+
571+
572+void dataguide_cb::set_star_on_leaves()
573+{
574+ map_type::iterator i = theDataguideMap.begin();
575+ for ( ; i != theDataguideMap.end(); i++)
576+ {
577+ i->second.set_star_on_leaves();
578+ }
579+}
580+
581+
582+void dataguide_cb::set_star_on_roots()
583+{
584+ map_type::iterator i = theDataguideMap.begin();
585+ for ( ; i != theDataguideMap.end(); i++)
586+ {
587+ i->second.set_star();
588+ }
589+}
590+
591+
592+dataguide_node* dataguide_cb::add_source(expr* e)
593+{
594+ theDataguideMap[e] = dataguide_node();
595+ return &theDataguideMap[e];
596+}
597+
598+
599+void dataguide_cb::do_union(const dataguide_cb *other)
600+{
601+ if (this == other || other == NULL)
602+ return;
603+
604+ map_type::const_iterator it = other->theDataguideMap.begin();
605+ for (; it != other->theDataguideMap.end(); ++it)
606+ {
607+ theDataguideMap[it->first].do_union(&it->second);
608+ }
609+}
610+
611+
612+void dataguide_cb::do_union(expr* other)
613+{
614+ if (other == NULL)
615+ return;
616+
617+ do_union(other->get_dataguide());
618+}
619+
620+
621+dataguide_cb_t dataguide_cb::clone()
622+{
623+ dataguide_cb_t new_dg = new dataguide_cb();
624+
625+ map_type::iterator it = theDataguideMap.begin();
626+ for (; it != theDataguideMap.end(); ++it)
627+ {
628+ dataguide_node* new_node = new_dg->add_source(it->first);
629+ new_node->clone(&it->second);
630+ }
631+
632+ return new_dg;
633+}
634+
635+
636+dataguide_node* dataguide_cb::get_dataguide_for_source(expr* e)
637+{
638+ map_type::iterator it = theDataguideMap.find(e);
639+
640+ if (it != theDataguideMap.end())
641+ return &it->second;
642+ else
643+ return NULL;
644+}
645+
646+
647+bool dataguide_cb::is_empty(expr* e)
648+{
649+ return theDataguideMap[e].keys.size() == 0 || theDataguideMap[e].is_star;
650+}
651+
652+
653+store::Item_t dataguide_cb::get_as_json(expr* e)
654+{
655+ if (theDataguideMap[e].is_star)
656+ return NULL;
657+ else
658+ return theDataguideMap[e].get_as_json();
659+}
660+
661+
662+zstring dataguide_cb::toString()
663+{
664+ std::stringstream str;
665+ str << this;
666+ str << " {";
667+
668+ map_type::iterator it = theDataguideMap.begin();
669+ for (; it != theDataguideMap.end(); ++it)
670+ {
671+ str << " " << it->first << ": " << it->second.toString();
672+ }
673+
674+ str << "}";
675+ return str.str();
676+}
677+
678+bool dataguide_cb::func_uses_dataguide(FunctionConsts::FunctionKind kind)
679+{
680+ if (kind == FunctionConsts::STATIC_COLLECTIONS_DML_COLLECTION_1 ||
681+ kind == FunctionConsts::STATIC_COLLECTIONS_DML_COLLECTION_2 ||
682+ kind == FunctionConsts::STATIC_COLLECTIONS_DML_COLLECTION_3 ||
683+ kind == FunctionConsts::DYNAMIC_COLLECTIONS_DML_COLLECTION_1 ||
684+ kind == FunctionConsts::DYNAMIC_COLLECTIONS_DML_COLLECTION_2 ||
685+ kind == FunctionConsts::DYNAMIC_COLLECTIONS_DML_COLLECTION_3 ||
686+ kind == FunctionConsts::FN_JSONIQ_PARSE_JSON_1 ||
687+ kind == FunctionConsts::FN_JSONIQ_PARSE_JSON_2)
688+ return true;
689+ else
690+ return false;
691+}
692+
693+}
694+/* vim:set et sw=2 ts=2: */
695
696=== added file 'src/compiler/expression/json_dataguide.h'
697--- src/compiler/expression/json_dataguide.h 1970-01-01 00:00:00 +0000
698+++ src/compiler/expression/json_dataguide.h 2013-07-30 11:18:26 +0000
699@@ -0,0 +1,153 @@
700+/*
701+ * Copyright 2006-2013 The FLWOR Foundation.
702+ *
703+ * Licensed under the Apache License, Version 2.0 (the "License");
704+ * you may not use this file except in compliance with the License.
705+ * You may obtain a copy of the License at
706+ *
707+ * http://www.apache.org/licenses/LICENSE-2.0
708+ *
709+ * Unless required by applicable law or agreed to in writing, software
710+ * distributed under the License is distributed on an "AS IS" BASIS,
711+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
712+ * See the License for the specific language governing permissions and
713+ * limitations under the License.
714+ */
715+#pragma once
716+#ifndef ZORBA_COMPILER_JSON_DATAGUIDE
717+#define ZORBA_COMPILER_JSON_DATAGUIDE
718+
719+#include "zorbautils/string_util.h"
720+#include "store/api/item.h"
721+#include "functions/function_consts.h"
722+
723+
724+namespace zorba
725+{
726+
727+class expr;
728+
729+
730+/******************************************************************************
731+ The node of a dataguide tree.
732+
733+ is_star:
734+ --------
735+ Set to true if all the key/value pairs of an object need to retrieved from
736+ the JSON store. This includes all child objects.
737+
738+ keys:
739+ values:
740+ -------
741+ Key=value pairs of the dataguide. If key X is contained in the keys vector,
742+ then the corresponding object must be retrieved from the store. The values
743+ is either:
744+ -- another list of key/value pairs denoting child objects that must be
745+ retreived
746+ -- star: all child objects beyond this point must be retrieved.
747+ -- empty: no projection information. All child nodes will be retrieved if
748+ the list remains empty at the end of the analysis.
749+*******************************************************************************/
750+class dataguide_node
751+{
752+public:
753+ bool is_star;
754+
755+ std::vector<store::Item_t> keys;
756+
757+ std::vector<dataguide_node> values;
758+
759+
760+public:
761+ dataguide_node() : is_star(false) { }
762+
763+ void add_to_leaves(store::Item* key);
764+
765+ void add_to_leaves(const dataguide_node* other);
766+
767+ void set_star();
768+
769+ void set_star_on_leaves();
770+
771+ void do_union(const dataguide_node* other);
772+
773+ // returns the child dataguide node associated with the given key,
774+ // or NULL if there is none
775+ dataguide_node* get(store::Item* key);
776+
777+ // recursively constructs "this" to be a clone of the other dataguide
778+ void clone(const dataguide_node* other);
779+
780+ store::Item_t get_as_json();
781+
782+ zstring toString();
783+};
784+
785+
786+/******************************************************************************
787+ The JSON dataguide control block
788+
789+ theDataguideMap:
790+ ----------------
791+ A mapping of expressions (keys) to dataguide trees that contain the projection
792+ information. Each key in the map is a source expression which currently
793+ include JSON database collection retrieval functions (db:collection) and
794+ JSON parse function.
795+ In a UDF, all formal parameters are added to the sources set in order to
796+ allow projection information to be "added" to the expressions that invoke
797+ the UDF.
798+*******************************************************************************/
799+class dataguide_cb : public SimpleRCObject
800+{
801+friend class JsonDataguide;
802+
803+public:
804+ typedef std::map<expr*, dataguide_node> map_type;
805+
806+protected:
807+ std::map<expr*, dataguide_node> theDataguideMap;
808+
809+
810+public:
811+ dataguide_cb();
812+
813+ dataguide_node* add_source(expr* e);
814+
815+ void add_to_leaves(store::Item* object_name);
816+
817+ void add_to_leaves(dataguide_node* other);
818+
819+ void set_star_on_leaves();
820+
821+ void set_star_on_roots();
822+
823+ void do_union(const dataguide_cb* other);
824+
825+ void do_union(expr *other);
826+
827+ dataguide_cb_t clone();
828+
829+ dataguide_node* get_dataguide_for_source(expr* e);
830+
831+ bool is_empty(expr *e);
832+
833+ store::Item_t get_as_json(expr *e);
834+
835+ zstring toString();
836+
837+public:
838+
839+ static bool func_uses_dataguide(FunctionConsts::FunctionKind kind);
840+};
841+
842+
843+}
844+
845+#endif // ZORBA_COMPILER_JSON_DATAGUIDE
846+
847+/*
848+ * Local variables:
849+ * mode: c++
850+ * End:
851+ */
852+/* vim:set et sw=2 ts=2: */
853
854=== modified file 'src/compiler/expression/var_expr.cpp'
855--- src/compiler/expression/var_expr.cpp 2013-04-24 01:35:58 +0000
856+++ src/compiler/expression/var_expr.cpp 2013-07-30 11:18:26 +0000
857@@ -23,6 +23,7 @@
858 #include "compiler/expression/flwor_expr.h"
859 #include "compiler/expression/expr_visitor.h"
860 #include "compiler/api/compilercb.h"
861+#include "compiler/expression/json_dataguide.h"
862
863 #include "types/typeops.h"
864
865
866=== modified file 'src/compiler/rewriter/framework/default_optimizer.cpp'
867--- src/compiler/rewriter/framework/default_optimizer.cpp 2013-05-15 10:27:06 +0000
868+++ src/compiler/rewriter/framework/default_optimizer.cpp 2013-07-30 11:18:26 +0000
869@@ -266,7 +266,16 @@
870 driverMarkNodeCopyProps.rewrite(rCtx);
871 }
872 }
873-
874+
875+ // Compute Json Dataguide
876+ RuleOnceDriver<JsonDataguide> driverJsonDataguide;
877+ driverJsonDataguide.rewrite(rCtx);
878+
879+ if (Properties::instance()->printDataguide())
880+ {
881+ driverJsonDataguide.getRule()->printDataguides(rCtx.getRoot());
882+ }
883+
884 return modified;
885 }
886
887
888=== modified file 'src/compiler/rewriter/rules/nodeid_rules.cpp'
889--- src/compiler/rewriter/rules/nodeid_rules.cpp 2013-06-15 02:57:08 +0000
890+++ src/compiler/rewriter/rules/nodeid_rules.cpp 2013-07-30 11:18:26 +0000
891@@ -36,6 +36,8 @@
892 #include "functions/func_node_sort_distinct.h"
893 #include "functions/udf.h"
894
895+#include "compiler/expression/json_dataguide.h"
896+
897 #include "diagnostics/assert.h"
898
899
900@@ -1538,5 +1540,292 @@
901 }
902
903
904+/*******************************************************************************
905+
906+********************************************************************************/
907+expr* JsonDataguide::apply(
908+ RewriterContext& rCtx,
909+ expr* node,
910+ bool& modified)
911+{
912+ process(node, true);
913+
914+ if (node->get_dataguide() != NULL)
915+ {
916+ std::map<expr*,dataguide_node>::iterator i = node->get_dataguide()->theDataguideMap.begin();
917+ for ( ; i != node->get_dataguide()->theDataguideMap.end(); ++i)
918+ {
919+ i->first->set_dataguide(node->get_dataguide());
920+ }
921+ }
922+
923+ return NULL;
924+}
925+
926+
927+void JsonDataguide::printDataguides(expr* root)
928+{
929+ dataguide_cb* dg = root->get_dataguide();
930+ if (dg == NULL)
931+ return;
932+
933+ std::map<expr*,dataguide_node>::iterator i = dg->theDataguideMap.begin();
934+ for ( ; i != dg->theDataguideMap.end(); ++i)
935+ {
936+ if (i->first->get_expr_kind() != fo_expr_kind)
937+ continue;
938+
939+ fo_expr* fo = static_cast<fo_expr*>(i->first);
940+ store::Item_t json_dg = dg->get_as_json(fo);
941+ if (json_dg.getp())
942+ std::cout << "Dataguide for function " << fo->get_func()->getName()->getStringValue() << "() at "
943+ << fo->get_loc().getLineBegin() << ":" << fo->get_loc().getColumnBegin() << ": "
944+ << json_dg->show() << std::endl;
945+ }
946+}
947+
948+
949+// For a given expression that is bound to a clause var (for/let/groupby), return the var_expr
950+// or NULL if expr is not bound to a clause var
951+var_expr* getClauseVar(flwor_expr* flwor, expr* node, bool& is_groupby)
952+{
953+ is_groupby = false;
954+
955+ for (unsigned int i=0; i < flwor->num_clauses(); i++)
956+ {
957+ flwor_clause* c = flwor->get_clause(i);
958+ if (c->get_kind() == flwor_clause::for_clause ||
959+ c->get_kind() == flwor_clause::let_clause)
960+ {
961+ forlet_clause* fc = static_cast<forlet_clause*>(c);
962+ if (fc->get_expr() == node)
963+ return fc->get_var();
964+ }
965+ else if (c->get_kind() == flwor_clause::groupby_clause)
966+ {
967+ groupby_clause* gc = static_cast<groupby_clause*>(c);
968+ flwor_clause::rebind_list_t::iterator it = gc->beginGroupVars();
969+ for ( ; it != gc->endGroupVars(); ++it)
970+ if (it->first == node)
971+ {
972+ is_groupby = true;
973+ return it->second;
974+ }
975+
976+ it = gc->beginNonGroupVars();
977+ for ( ; it != gc->endNonGroupVars(); ++it)
978+ if (it->first == node)
979+ {
980+ is_groupby = true;
981+ return it->second;
982+ }
983+ }
984+ }
985+
986+ return NULL;
987+}
988+
989+
990+// Propagates the dataguide from the child to the parent
991+void propagate_dg(expr* child, expr* node)
992+{
993+ if (child->get_dataguide() == NULL)
994+ return;
995+
996+ if (node->get_dataguide())
997+ {
998+ node->set_dataguide(node->get_dataguide()->clone());
999+ node->get_dataguide()->do_union(child);
1000+ }
1001+ else
1002+ {
1003+ node->set_dataguide(child->get_dataguide());
1004+ }
1005+}
1006+
1007+
1008+void JsonDataguide::iterateChildren(expr* node, bool propagates_to_output)
1009+{
1010+ flwor_expr* flwor = NULL;
1011+ bool is_groupby;
1012+ var_expr* clause_var;
1013+
1014+ // If we're in a UDF root expr, add all parameter variables to the sources set
1015+ if (node->get_udf() != NULL && node->get_udf()->getBody() == node)
1016+ {
1017+ for (unsigned int i=0; i<node->get_udf()->numArgs(); i++)
1018+ {
1019+ var_expr* v = node->get_udf()->getArgVar(i);
1020+ v->get_dataguide_or_new()->add_source(v);
1021+ }
1022+ }
1023+
1024+ if (node->get_expr_kind() == flwor_expr_kind)
1025+ {
1026+ flwor = static_cast<flwor_expr*>(node);
1027+ }
1028+
1029+ ExprIterator iter(node);
1030+ while (!iter.done())
1031+ {
1032+ expr* child = (**iter);
1033+ if (child == NULL)
1034+ continue;
1035+
1036+ bool child_propagates_to_output = propagates_to_output;
1037+
1038+ if (child->get_expr_kind() == var_decl_expr_kind ||
1039+ (node->get_expr_kind() == fo_expr_kind && static_cast<fo_expr*>(node)->get_func()->isUdf()) ||
1040+ (node->get_expr_kind() == if_expr_kind && static_cast<if_expr*>(node)->get_cond_expr() == child))
1041+ child_propagates_to_output = false;
1042+
1043+ if (flwor && (clause_var = getClauseVar(flwor, child, is_groupby)))
1044+ {
1045+ process(child, false);
1046+ clause_var->set_dataguide(child->get_dataguide());
1047+ if (is_groupby)
1048+ propagate_dg(child, node);
1049+ }
1050+ else
1051+ {
1052+ process(child, child_propagates_to_output);
1053+ propagate_dg(child, node);
1054+ }
1055+
1056+ iter.next();
1057+ } // while
1058+
1059+ // std::cerr << "--> " << node << " = " << node->get_expr_kind_string() << " propagates_to_output: " << propagates_to_output << " dataguide: " << (node->get_dataguide() ? node->get_dataguide()->toString() : "") << std::endl;
1060+}
1061+
1062+
1063+void JsonDataguide::process(expr* node, bool propagates_to_output)
1064+{
1065+ iterateChildren(node, propagates_to_output);
1066+
1067+ switch (node->get_expr_kind())
1068+ {
1069+ case dynamic_function_invocation_expr_kind:
1070+ {
1071+ dynamic_function_invocation_expr* fo = static_cast<dynamic_function_invocation_expr*>(node);
1072+ expr* sourceExpr = fo->get_function();
1073+ TypeManager* tm = sourceExpr->get_type_manager();
1074+ xqtref_t sourceType = sourceExpr->get_return_type();
1075+
1076+ if ((TypeOps::is_subtype(tm, *sourceType, *GENV_TYPESYSTEM.JSON_ITEM_TYPE_STAR)
1077+ || TypeOps::is_subtype(tm, *sourceType, *GENV_TYPESYSTEM.STRUCTURED_ITEM_TYPE_STAR))
1078+ && fo->get_args().size() == 1
1079+ && fo->get_args()[0]->get_expr_kind() == const_expr_kind)
1080+ {
1081+ dataguide_cb_t dg = fo->get_dataguide() ? fo->get_dataguide()->clone().getp() : new dataguide_cb();
1082+ dg->add_to_leaves(static_cast<const_expr*>(fo->get_args()[0])->get_val());
1083+ fo->set_dataguide(dg);
1084+ }
1085+
1086+ break;
1087+ }
1088+ case fo_expr_kind :
1089+ {
1090+ fo_expr* fo = static_cast<fo_expr*>(node);
1091+ function* f = fo->get_func();
1092+ if (fo->get_dataguide() && f->getKind() == FunctionConsts::FN_JSONIQ_VALUE_2)
1093+ {
1094+ if (fo->get_arg(1)->get_expr_kind() == const_expr_kind)
1095+ {
1096+ fo->set_dataguide(fo->get_dataguide()->clone());
1097+ fo->get_dataguide()->add_to_leaves(static_cast<const_expr*>(fo->get_arg(1))->get_val());
1098+ }
1099+ else
1100+ {
1101+ fo->get_dataguide()->set_star_on_leaves();
1102+ }
1103+ }
1104+ else if (dataguide_cb::func_uses_dataguide(f->getKind()))
1105+ {
1106+ fo->get_dataguide_or_new()->add_source(fo);
1107+ }
1108+ else if (f->isExternal()
1109+ ||
1110+ (f->getAnnotationList()
1111+ &&
1112+ f->getAnnotationList()->contains(AnnotationInternal::zann_explores_json)))
1113+ {
1114+ if (fo->get_dataguide())
1115+ fo->get_dataguide()->set_star_on_leaves();
1116+ }
1117+ else if (f->isUdf())
1118+ {
1119+ user_function* udf = static_cast<user_function*>(f);
1120+
1121+ // The body of a UDF will be NULL when compiling an eval expression and
1122+ // plan serialization has been used. Assume the function is recursive in this case.
1123+ if (udf->getBody() == NULL || udf->isRecursive())
1124+ {
1125+ if (fo->get_dataguide())
1126+ fo->get_dataguide()->set_star_on_leaves();
1127+ }
1128+ else
1129+ {
1130+ // Iterate through the effective parameters and prepend to them the function's formal parameter's dataguide
1131+ for (unsigned int i=0; i<udf->numArgs(); i++)
1132+ {
1133+ dataguide_cb_t new_dg;
1134+ dataguide_node* var_dg = NULL;
1135+
1136+ if (udf->getBody()->get_dataguide())
1137+ var_dg = udf->getBody()->get_dataguide()->get_dataguide_for_source(udf->getArgVar(i));
1138+
1139+ if (var_dg)
1140+ {
1141+ if (fo->get_arg(i)->get_dataguide())
1142+ new_dg = fo->get_arg(i)->get_dataguide()->clone();
1143+ else
1144+ new_dg = new dataguide_cb();
1145+
1146+ new_dg->add_to_leaves(var_dg);
1147+ }
1148+
1149+ if (fo->get_dataguide())
1150+ fo->get_dataguide()->do_union(new_dg);
1151+ else
1152+ fo->set_dataguide(new_dg);
1153+ } // for
1154+ }
1155+ }
1156+
1157+ break;
1158+ }
1159+ case var_decl_expr_kind:
1160+ {
1161+ var_decl_expr* vd = static_cast<var_decl_expr*>(node);
1162+ if (vd->get_expr() && vd->get_var_expr())
1163+ vd->get_var_expr()->set_dataguide(vd->get_expr()->get_dataguide());
1164+ break;
1165+ }
1166+ case eval_expr_kind:
1167+ {
1168+ // invalidate all dataguides
1169+ dataguide_cb* dg = node->get_dataguide_or_new();
1170+ dg->set_star_on_roots();
1171+ break;
1172+ }
1173+
1174+ case wrapper_expr_kind:
1175+ case var_expr_kind:
1176+ // skip setting star even if the result propagates to output
1177+ return;
1178+
1179+ default:
1180+ break;
1181+ } // switch
1182+
1183+ if (propagates_to_output && node->get_dataguide())
1184+ {
1185+ node->get_dataguide()->set_star_on_leaves();
1186+ }
1187+
1188+}
1189+
1190+
1191 }
1192 /* vim:set et sw=2 ts=2: */
1193
1194=== modified file 'src/compiler/rewriter/rules/rule_base.h'
1195--- src/compiler/rewriter/rules/rule_base.h 2013-02-07 17:24:36 +0000
1196+++ src/compiler/rewriter/rules/rule_base.h 2013-07-30 11:18:26 +0000
1197@@ -55,7 +55,8 @@
1198 InlineFunctions,
1199 PartialEval,
1200 EchoNodes,
1201- PlanPrinter
1202+ PlanPrinter,
1203+ JsonDataguide
1204 } RuleKind;
1205
1206 private:
1207
1208=== modified file 'src/compiler/rewriter/rules/ruleset.h'
1209--- src/compiler/rewriter/rules/ruleset.h 2013-05-13 10:10:08 +0000
1210+++ src/compiler/rewriter/rules/ruleset.h 2013-07-30 11:18:26 +0000
1211@@ -223,6 +223,31 @@
1212 };
1213
1214
1215+/*******************************************************************************
1216+
1217+********************************************************************************/
1218+class JsonDataguide : public RewriteRule
1219+{
1220+public:
1221+ JsonDataguide()
1222+ :
1223+ RewriteRule(RewriteRule::JsonDataguide, "JsonDataguide")
1224+ {
1225+ }
1226+
1227+ expr* apply(RewriterContext& rCtx, expr* node, bool& modified);
1228+
1229+public:
1230+ // used for automated testing
1231+ void printDataguides(expr* root);
1232+
1233+protected:
1234+ void iterateChildren(expr* node, bool propagates_to_output);
1235+
1236+ void process(expr* node, bool propagates_to_output);
1237+};
1238+
1239+
1240 }
1241
1242 #endif /* ZORBA_REWRITE_RULE_H */
1243
1244=== modified file 'src/functions/function.cpp'
1245--- src/functions/function.cpp 2013-07-06 06:59:32 +0000
1246+++ src/functions/function.cpp 2013-07-30 11:18:26 +0000
1247@@ -135,6 +135,30 @@
1248 }
1249
1250
1251+void function::addAnnotation(AnnotationInternal::AnnotationId id)
1252+{
1253+ if (theAnnotationList == NULL)
1254+ theAnnotationList = new AnnotationList();
1255+
1256+ if (theAnnotationList->contains(id))
1257+ return;
1258+
1259+ theAnnotationList->push_back(id);
1260+
1261+ if (theAnnotationList->contains(AnnotationInternal::zann_nondeterministic))
1262+ setDeterministic(false);
1263+
1264+ setPrivate(theAnnotationList->contains(AnnotationInternal::fn_private));
1265+
1266+ if (isUpdating() &&
1267+ theAnnotationList->contains(AnnotationInternal::zann_sequential))
1268+ {
1269+ throw XQUERY_EXCEPTION(zerr::XSST0001,
1270+ ERROR_PARAMS(getName()->getStringValue()));
1271+ }
1272+}
1273+
1274+
1275 /*******************************************************************************
1276 This is a virstual method. It is redefined by udf and external-function
1277 classes.
1278
1279=== modified file 'src/functions/function.h'
1280--- src/functions/function.h 2013-07-06 06:59:32 +0000
1281+++ src/functions/function.h 2013-07-30 11:18:26 +0000
1282@@ -51,7 +51,7 @@
1283 class function : public SimpleRCObject
1284 {
1285 protected:
1286- signature theSignature;
1287+ signature theSignature;
1288 FunctionConsts::FunctionKind theKind;
1289 uint32_t theFlags;
1290 AnnotationList * theAnnotationList;
1291@@ -163,8 +163,10 @@
1292 void setAnnotations(AnnotationList* annotations);
1293
1294 const AnnotationList* getAnnotationList() const { return theAnnotationList; }
1295+
1296+ void addAnnotation(AnnotationInternal::AnnotationId id);
1297
1298- bool validate_args(std::vector<PlanIter_t>& argv) const;
1299+ bool validate_args(std::vector<PlanIter_t>& argv) const;
1300
1301 bool isUpdating() const { return (getScriptingKind() & UPDATING_EXPR) != 0; }
1302
1303
1304=== modified file 'src/functions/pregenerated/func_accessors.h'
1305--- src/functions/pregenerated/func_accessors.h 2013-03-05 23:11:50 +0000
1306+++ src/functions/pregenerated/func_accessors.h 2013-07-30 11:18:26 +0000
1307@@ -46,7 +46,7 @@
1308 :
1309 function(sig, kind)
1310 {
1311-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
1312+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
1313 }
1314
1315 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
1316@@ -62,7 +62,6 @@
1317 :
1318 function(sig, kind)
1319 {
1320-
1321 }
1322
1323 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
1324@@ -79,7 +78,7 @@
1325 :
1326 function(sig, kind)
1327 {
1328-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
1329+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
1330 }
1331
1332 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
1333@@ -95,7 +94,6 @@
1334 :
1335 function(sig, kind)
1336 {
1337-
1338 }
1339
1340 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
1341@@ -112,7 +110,6 @@
1342 :
1343 function(sig, kind)
1344 {
1345-
1346 }
1347
1348 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
1349@@ -129,7 +126,6 @@
1350 :
1351 function(sig, kind)
1352 {
1353-
1354 }
1355
1356 xqtref_t getReturnType(const fo_expr* caller) const;
1357@@ -154,7 +150,6 @@
1358 :
1359 function(sig, kind)
1360 {
1361-
1362 }
1363
1364 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
1365@@ -171,7 +166,7 @@
1366 :
1367 function(sig, kind)
1368 {
1369-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
1370+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
1371 }
1372
1373 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
1374@@ -187,7 +182,6 @@
1375 :
1376 function(sig, kind)
1377 {
1378-
1379 }
1380
1381 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
1382@@ -204,7 +198,6 @@
1383 :
1384 function(sig, kind)
1385 {
1386-
1387 }
1388
1389 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
1390
1391=== modified file 'src/functions/pregenerated/func_any_uri.h'
1392--- src/functions/pregenerated/func_any_uri.h 2013-03-05 23:11:50 +0000
1393+++ src/functions/pregenerated/func_any_uri.h 2013-07-30 11:18:26 +0000
1394@@ -46,7 +46,6 @@
1395 :
1396 function(sig, kind)
1397 {
1398-
1399 }
1400
1401 bool accessesDynCtx() const { return true; }
1402
1403=== modified file 'src/functions/pregenerated/func_base64.h'
1404--- src/functions/pregenerated/func_base64.h 2013-03-05 23:11:50 +0000
1405+++ src/functions/pregenerated/func_base64.h 2013-07-30 11:18:26 +0000
1406@@ -46,7 +46,6 @@
1407 :
1408 function(sig, kind)
1409 {
1410-
1411 }
1412
1413 CODEGEN_DECL();
1414@@ -61,7 +60,6 @@
1415 :
1416 function(sig, kind)
1417 {
1418-
1419 }
1420
1421 CODEGEN_DECL();
1422
1423=== modified file 'src/functions/pregenerated/func_booleans.h'
1424--- src/functions/pregenerated/func_booleans.h 2013-03-05 23:11:50 +0000
1425+++ src/functions/pregenerated/func_booleans.h 2013-07-30 11:18:26 +0000
1426@@ -46,7 +46,6 @@
1427 :
1428 function(sig, kind)
1429 {
1430-
1431 }
1432
1433 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
1434@@ -63,7 +62,6 @@
1435 :
1436 function(sig, kind)
1437 {
1438-
1439 }
1440
1441 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
1442@@ -80,7 +78,6 @@
1443 :
1444 function(sig, kind)
1445 {
1446-
1447 }
1448
1449 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
1450
1451=== modified file 'src/functions/pregenerated/func_collections.h'
1452--- src/functions/pregenerated/func_collections.h 2013-03-05 23:11:50 +0000
1453+++ src/functions/pregenerated/func_collections.h 2013-07-30 11:18:26 +0000
1454@@ -46,7 +46,6 @@
1455 :
1456 function(sig, kind)
1457 {
1458-
1459 }
1460
1461 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1462@@ -67,7 +66,6 @@
1463 :
1464 function(sig, kind)
1465 {
1466-
1467 }
1468
1469 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1470@@ -88,7 +86,6 @@
1471 :
1472 function(sig, kind)
1473 {
1474-
1475 }
1476
1477 bool accessesDynCtx() const { return true; }
1478@@ -105,7 +102,6 @@
1479 :
1480 function(sig, kind)
1481 {
1482-
1483 }
1484
1485 bool accessesDynCtx() const { return true; }
1486@@ -122,7 +118,6 @@
1487 :
1488 function(sig, kind)
1489 {
1490-
1491 }
1492
1493 bool accessesDynCtx() const { return true; }
1494@@ -141,7 +136,6 @@
1495 :
1496 function(sig, kind)
1497 {
1498-
1499 }
1500
1501 bool accessesDynCtx() const { return true; }
1502@@ -172,7 +166,6 @@
1503 :
1504 function(sig, kind)
1505 {
1506-
1507 }
1508
1509 bool accessesDynCtx() const { return true; }
1510@@ -191,7 +184,6 @@
1511 :
1512 function(sig, kind)
1513 {
1514-
1515 }
1516
1517 bool accessesDynCtx() const { return true; }
1518@@ -210,7 +202,7 @@
1519 :
1520 function(sig, kind)
1521 {
1522-
1523+ addAnnotation(AnnotationInternal::zann_explores_json);
1524 }
1525
1526 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1527@@ -233,7 +225,7 @@
1528 :
1529 function(sig, kind)
1530 {
1531-
1532+ addAnnotation(AnnotationInternal::zann_explores_json);
1533 }
1534
1535 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1536@@ -256,7 +248,7 @@
1537 :
1538 function(sig, kind)
1539 {
1540-
1541+ addAnnotation(AnnotationInternal::zann_explores_json);
1542 }
1543
1544 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1545@@ -279,7 +271,7 @@
1546 :
1547 function(sig, kind)
1548 {
1549-
1550+ addAnnotation(AnnotationInternal::zann_explores_json);
1551 }
1552
1553 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1554@@ -302,7 +294,7 @@
1555 :
1556 function(sig, kind)
1557 {
1558-
1559+ addAnnotation(AnnotationInternal::zann_explores_json);
1560 }
1561
1562 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1563@@ -325,7 +317,7 @@
1564 :
1565 function(sig, kind)
1566 {
1567-
1568+ addAnnotation(AnnotationInternal::zann_explores_json);
1569 }
1570
1571 unsigned short getScriptingKind() const { return APPLYING_EXPR; }
1572@@ -350,7 +342,7 @@
1573 :
1574 function(sig, kind)
1575 {
1576-
1577+ addAnnotation(AnnotationInternal::zann_explores_json);
1578 }
1579
1580 unsigned short getScriptingKind() const { return APPLYING_EXPR; }
1581@@ -375,7 +367,7 @@
1582 :
1583 function(sig, kind)
1584 {
1585-
1586+ addAnnotation(AnnotationInternal::zann_explores_json);
1587 }
1588
1589 unsigned short getScriptingKind() const { return APPLYING_EXPR; }
1590@@ -400,7 +392,7 @@
1591 :
1592 function(sig, kind)
1593 {
1594-
1595+ addAnnotation(AnnotationInternal::zann_explores_json);
1596 }
1597
1598 unsigned short getScriptingKind() const { return APPLYING_EXPR; }
1599@@ -425,7 +417,7 @@
1600 :
1601 function(sig, kind)
1602 {
1603-
1604+ addAnnotation(AnnotationInternal::zann_explores_json);
1605 }
1606
1607 unsigned short getScriptingKind() const { return APPLYING_EXPR; }
1608@@ -450,7 +442,6 @@
1609 :
1610 function(sig, kind)
1611 {
1612-
1613 }
1614
1615 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1616@@ -475,7 +466,6 @@
1617 :
1618 function(sig, kind)
1619 {
1620-
1621 }
1622
1623 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1624@@ -496,7 +486,6 @@
1625 :
1626 function(sig, kind)
1627 {
1628-
1629 }
1630
1631 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1632@@ -517,7 +506,7 @@
1633 :
1634 function(sig, kind)
1635 {
1636-
1637+ addAnnotation(AnnotationInternal::zann_explores_json);
1638 }
1639
1640 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1641@@ -540,7 +529,6 @@
1642 :
1643 function(sig, kind)
1644 {
1645-
1646 }
1647
1648 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1649@@ -559,7 +547,6 @@
1650 :
1651 function(sig, kind)
1652 {
1653-
1654 }
1655
1656 bool accessesDynCtx() const { return true; }
1657@@ -576,7 +563,6 @@
1658 :
1659 function(sig, kind)
1660 {
1661-
1662 }
1663
1664 bool accessesDynCtx() const { return true; }
1665@@ -593,7 +579,6 @@
1666 :
1667 function(sig, kind)
1668 {
1669-
1670 }
1671
1672 bool accessesDynCtx() const { return true; }
1673@@ -610,7 +595,6 @@
1674 :
1675 function(sig, kind)
1676 {
1677-
1678 }
1679
1680 bool accessesDynCtx() const { return true; }
1681@@ -627,7 +611,6 @@
1682 :
1683 function(sig, kind)
1684 {
1685-
1686 }
1687
1688 CODEGEN_DECL();
1689@@ -642,7 +625,6 @@
1690 :
1691 function(sig, kind)
1692 {
1693-
1694 }
1695
1696 CODEGEN_DECL();
1697@@ -657,7 +639,6 @@
1698 :
1699 function(sig, kind)
1700 {
1701-
1702 }
1703
1704 CODEGEN_DECL();
1705@@ -672,7 +653,6 @@
1706 :
1707 function(sig, kind)
1708 {
1709-
1710 }
1711
1712 CODEGEN_DECL();
1713@@ -687,7 +667,6 @@
1714 :
1715 function(sig, kind)
1716 {
1717-
1718 }
1719
1720 CODEGEN_DECL();
1721@@ -702,7 +681,6 @@
1722 :
1723 function(sig, kind)
1724 {
1725-
1726 }
1727
1728 CODEGEN_DECL();
1729@@ -717,7 +695,7 @@
1730 :
1731 function(sig, kind)
1732 {
1733-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
1734+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
1735 }
1736
1737 CODEGEN_DECL();
1738
1739=== modified file 'src/functions/pregenerated/func_context.h'
1740--- src/functions/pregenerated/func_context.h 2013-03-05 23:11:50 +0000
1741+++ src/functions/pregenerated/func_context.h 2013-07-30 11:18:26 +0000
1742@@ -46,7 +46,6 @@
1743 :
1744 function(sig, kind)
1745 {
1746-
1747 }
1748
1749 bool accessesDynCtx() const { return true; }
1750@@ -63,7 +62,6 @@
1751 :
1752 function(sig, kind)
1753 {
1754-
1755 }
1756
1757 bool accessesDynCtx() const { return true; }
1758@@ -80,7 +78,6 @@
1759 :
1760 function(sig, kind)
1761 {
1762-
1763 }
1764
1765 bool accessesDynCtx() const { return true; }
1766@@ -97,7 +94,6 @@
1767 :
1768 function(sig, kind)
1769 {
1770-
1771 }
1772
1773 bool accessesDynCtx() const { return true; }
1774@@ -114,7 +110,6 @@
1775 :
1776 function(sig, kind)
1777 {
1778-
1779 }
1780
1781 bool accessesDynCtx() const { return true; }
1782@@ -131,7 +126,6 @@
1783 :
1784 function(sig, kind)
1785 {
1786-
1787 }
1788
1789 CODEGEN_DECL();
1790@@ -146,7 +140,6 @@
1791 :
1792 function(sig, kind)
1793 {
1794-
1795 }
1796
1797 CODEGEN_DECL();
1798@@ -161,7 +154,6 @@
1799 :
1800 function(sig, kind)
1801 {
1802-
1803 }
1804
1805 CODEGEN_DECL();
1806
1807=== modified file 'src/functions/pregenerated/func_datetime.h'
1808--- src/functions/pregenerated/func_datetime.h 2013-03-05 23:11:50 +0000
1809+++ src/functions/pregenerated/func_datetime.h 2013-07-30 11:18:26 +0000
1810@@ -46,7 +46,6 @@
1811 :
1812 function(sig, kind)
1813 {
1814-
1815 }
1816
1817 CODEGEN_DECL();
1818@@ -61,7 +60,6 @@
1819 :
1820 function(sig, kind)
1821 {
1822-
1823 }
1824
1825 CODEGEN_DECL();
1826@@ -76,7 +74,6 @@
1827 :
1828 function(sig, kind)
1829 {
1830-
1831 }
1832
1833 CODEGEN_DECL();
1834@@ -91,7 +88,6 @@
1835 :
1836 function(sig, kind)
1837 {
1838-
1839 }
1840
1841 CODEGEN_DECL();
1842@@ -106,7 +102,6 @@
1843 :
1844 function(sig, kind)
1845 {
1846-
1847 }
1848
1849 CODEGEN_DECL();
1850@@ -121,7 +116,6 @@
1851 :
1852 function(sig, kind)
1853 {
1854-
1855 }
1856
1857 CODEGEN_DECL();
1858@@ -136,7 +130,6 @@
1859 :
1860 function(sig, kind)
1861 {
1862-
1863 }
1864
1865 CODEGEN_DECL();
1866@@ -151,7 +144,6 @@
1867 :
1868 function(sig, kind)
1869 {
1870-
1871 }
1872
1873 CODEGEN_DECL();
1874@@ -166,7 +158,6 @@
1875 :
1876 function(sig, kind)
1877 {
1878-
1879 }
1880
1881 CODEGEN_DECL();
1882
1883=== modified file 'src/functions/pregenerated/func_documents.h'
1884--- src/functions/pregenerated/func_documents.h 2013-03-05 23:11:50 +0000
1885+++ src/functions/pregenerated/func_documents.h 2013-07-30 11:18:26 +0000
1886@@ -46,7 +46,6 @@
1887 :
1888 function(sig, kind)
1889 {
1890-
1891 }
1892
1893 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1894@@ -67,7 +66,6 @@
1895 :
1896 function(sig, kind)
1897 {
1898-
1899 }
1900
1901 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
1902@@ -86,7 +84,6 @@
1903 :
1904 function(sig, kind)
1905 {
1906-
1907 }
1908
1909 bool accessesDynCtx() const { return true; }
1910@@ -103,7 +100,6 @@
1911 :
1912 function(sig, kind)
1913 {
1914-
1915 }
1916
1917 bool accessesDynCtx() const { return true; }
1918@@ -120,7 +116,6 @@
1919 :
1920 function(sig, kind)
1921 {
1922-
1923 }
1924
1925 bool accessesDynCtx() const { return true; }
1926
1927=== modified file 'src/functions/pregenerated/func_durations_dates_times.h'
1928--- src/functions/pregenerated/func_durations_dates_times.h 2013-03-05 23:11:50 +0000
1929+++ src/functions/pregenerated/func_durations_dates_times.h 2013-07-30 11:18:26 +0000
1930@@ -46,7 +46,6 @@
1931 :
1932 function(sig, kind)
1933 {
1934-
1935 }
1936
1937 CODEGEN_DECL();
1938@@ -61,7 +60,6 @@
1939 :
1940 function(sig, kind)
1941 {
1942-
1943 }
1944
1945 CODEGEN_DECL();
1946@@ -76,7 +74,6 @@
1947 :
1948 function(sig, kind)
1949 {
1950-
1951 }
1952
1953 CODEGEN_DECL();
1954@@ -91,7 +88,6 @@
1955 :
1956 function(sig, kind)
1957 {
1958-
1959 }
1960
1961 CODEGEN_DECL();
1962@@ -106,7 +102,6 @@
1963 :
1964 function(sig, kind)
1965 {
1966-
1967 }
1968
1969 CODEGEN_DECL();
1970@@ -121,7 +116,6 @@
1971 :
1972 function(sig, kind)
1973 {
1974-
1975 }
1976
1977 CODEGEN_DECL();
1978@@ -136,7 +130,6 @@
1979 :
1980 function(sig, kind)
1981 {
1982-
1983 }
1984
1985 CODEGEN_DECL();
1986@@ -151,7 +144,6 @@
1987 :
1988 function(sig, kind)
1989 {
1990-
1991 }
1992
1993 CODEGEN_DECL();
1994@@ -166,7 +158,6 @@
1995 :
1996 function(sig, kind)
1997 {
1998-
1999 }
2000
2001 CODEGEN_DECL();
2002@@ -181,7 +172,6 @@
2003 :
2004 function(sig, kind)
2005 {
2006-
2007 }
2008
2009 CODEGEN_DECL();
2010@@ -196,7 +186,6 @@
2011 :
2012 function(sig, kind)
2013 {
2014-
2015 }
2016
2017 CODEGEN_DECL();
2018@@ -211,7 +200,6 @@
2019 :
2020 function(sig, kind)
2021 {
2022-
2023 }
2024
2025 CODEGEN_DECL();
2026@@ -226,7 +214,6 @@
2027 :
2028 function(sig, kind)
2029 {
2030-
2031 }
2032
2033 CODEGEN_DECL();
2034@@ -241,7 +228,6 @@
2035 :
2036 function(sig, kind)
2037 {
2038-
2039 }
2040
2041 CODEGEN_DECL();
2042@@ -256,7 +242,6 @@
2043 :
2044 function(sig, kind)
2045 {
2046-
2047 }
2048
2049 CODEGEN_DECL();
2050@@ -271,7 +256,6 @@
2051 :
2052 function(sig, kind)
2053 {
2054-
2055 }
2056
2057 CODEGEN_DECL();
2058@@ -286,7 +270,6 @@
2059 :
2060 function(sig, kind)
2061 {
2062-
2063 }
2064
2065 CODEGEN_DECL();
2066@@ -301,7 +284,6 @@
2067 :
2068 function(sig, kind)
2069 {
2070-
2071 }
2072
2073 CODEGEN_DECL();
2074@@ -316,7 +298,6 @@
2075 :
2076 function(sig, kind)
2077 {
2078-
2079 }
2080
2081 CODEGEN_DECL();
2082@@ -331,7 +312,6 @@
2083 :
2084 function(sig, kind)
2085 {
2086-
2087 }
2088
2089 CODEGEN_DECL();
2090@@ -346,7 +326,6 @@
2091 :
2092 function(sig, kind)
2093 {
2094-
2095 }
2096
2097 CODEGEN_DECL();
2098
2099=== modified file 'src/functions/pregenerated/func_errors_and_diagnostics.h'
2100--- src/functions/pregenerated/func_errors_and_diagnostics.h 2013-03-05 23:11:50 +0000
2101+++ src/functions/pregenerated/func_errors_and_diagnostics.h 2013-07-30 11:18:26 +0000
2102@@ -46,7 +46,6 @@
2103 :
2104 function(sig, kind)
2105 {
2106-
2107 }
2108
2109 unsigned short getScriptingKind() const { return VACUOUS_EXPR; }
2110@@ -65,7 +64,6 @@
2111 :
2112 function(sig, kind)
2113 {
2114-
2115 }
2116
2117 bool isMap(csize producer) const { return producer == 0; }
2118
2119=== modified file 'src/functions/pregenerated/func_fetch.h'
2120--- src/functions/pregenerated/func_fetch.h 2013-03-05 23:11:50 +0000
2121+++ src/functions/pregenerated/func_fetch.h 2013-07-30 11:18:26 +0000
2122@@ -46,7 +46,6 @@
2123 :
2124 function(sig, kind)
2125 {
2126-
2127 }
2128
2129 bool accessesDynCtx() const { return true; }
2130@@ -63,7 +62,6 @@
2131 :
2132 function(sig, kind)
2133 {
2134-
2135 }
2136
2137 bool accessesDynCtx() const { return true; }
2138@@ -80,7 +78,6 @@
2139 :
2140 function(sig, kind)
2141 {
2142-
2143 }
2144
2145 bool accessesDynCtx() const { return true; }
2146
2147=== modified file 'src/functions/pregenerated/func_fn_hof_functions.h'
2148--- src/functions/pregenerated/func_fn_hof_functions.h 2013-06-04 21:47:40 +0000
2149+++ src/functions/pregenerated/func_fn_hof_functions.h 2013-07-30 11:18:26 +0000
2150@@ -46,7 +46,7 @@
2151 :
2152 function(sig, kind)
2153 {
2154-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2155+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2156 }
2157
2158 CODEGEN_DECL();
2159@@ -61,7 +61,7 @@
2160 :
2161 function(sig, kind)
2162 {
2163-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2164+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2165 }
2166
2167 CODEGEN_DECL();
2168@@ -76,7 +76,7 @@
2169 :
2170 function(sig, kind)
2171 {
2172-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2173+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2174 }
2175
2176 CODEGEN_DECL();
2177@@ -91,7 +91,7 @@
2178 :
2179 function(sig, kind)
2180 {
2181-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2182+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2183 }
2184
2185 CODEGEN_DECL();
2186@@ -106,7 +106,7 @@
2187 :
2188 function(sig, kind)
2189 {
2190-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2191+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2192 }
2193
2194 CODEGEN_DECL();
2195@@ -121,7 +121,7 @@
2196 :
2197 function(sig, kind)
2198 {
2199-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2200+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2201 }
2202
2203 CODEGEN_DECL();
2204@@ -136,7 +136,7 @@
2205 :
2206 function(sig, kind)
2207 {
2208-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2209+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
2210 }
2211
2212 CODEGEN_DECL();
2213
2214=== modified file 'src/functions/pregenerated/func_fnput.h'
2215--- src/functions/pregenerated/func_fnput.h 2013-03-05 23:11:50 +0000
2216+++ src/functions/pregenerated/func_fnput.h 2013-07-30 11:18:26 +0000
2217@@ -46,7 +46,6 @@
2218 :
2219 function(sig, kind)
2220 {
2221-
2222 }
2223
2224 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
2225
2226=== modified file 'src/functions/pregenerated/func_ft_module.h'
2227--- src/functions/pregenerated/func_ft_module.h 2013-06-26 00:10:23 +0000
2228+++ src/functions/pregenerated/func_ft_module.h 2013-07-30 11:18:26 +0000
2229@@ -46,7 +46,6 @@
2230 :
2231 function(sig, kind)
2232 {
2233-
2234 }
2235
2236 CODEGEN_DECL();
2237@@ -62,7 +61,6 @@
2238 :
2239 function(sig, kind)
2240 {
2241-
2242 }
2243
2244 CODEGEN_DECL();
2245@@ -78,7 +76,6 @@
2246 :
2247 function(sig, kind)
2248 {
2249-
2250 }
2251
2252 CODEGEN_DECL();
2253@@ -94,7 +91,6 @@
2254 :
2255 function(sig, kind)
2256 {
2257-
2258 }
2259
2260 CODEGEN_DECL();
2261@@ -110,7 +106,6 @@
2262 :
2263 function(sig, kind)
2264 {
2265-
2266 }
2267
2268 CODEGEN_DECL();
2269@@ -126,7 +121,6 @@
2270 :
2271 function(sig, kind)
2272 {
2273-
2274 }
2275
2276 CODEGEN_DECL();
2277@@ -142,7 +136,6 @@
2278 :
2279 function(sig, kind)
2280 {
2281-
2282 }
2283
2284 CODEGEN_DECL();
2285@@ -158,7 +151,6 @@
2286 :
2287 function(sig, kind)
2288 {
2289-
2290 }
2291
2292 CODEGEN_DECL();
2293@@ -174,7 +166,6 @@
2294 :
2295 function(sig, kind)
2296 {
2297-
2298 }
2299
2300 CODEGEN_DECL();
2301@@ -190,7 +181,6 @@
2302 :
2303 function(sig, kind)
2304 {
2305-
2306 }
2307
2308 CODEGEN_DECL();
2309@@ -206,7 +196,6 @@
2310 :
2311 function(sig, kind)
2312 {
2313-
2314 }
2315
2316 CODEGEN_DECL();
2317@@ -222,7 +211,6 @@
2318 :
2319 function(sig, kind)
2320 {
2321-
2322 }
2323
2324 CODEGEN_DECL();
2325@@ -238,7 +226,6 @@
2326 :
2327 function(sig, kind)
2328 {
2329-
2330 }
2331
2332 CODEGEN_DECL();
2333@@ -254,7 +241,6 @@
2334 :
2335 function(sig, kind)
2336 {
2337-
2338 }
2339
2340 CODEGEN_DECL();
2341@@ -270,7 +256,6 @@
2342 :
2343 function(sig, kind)
2344 {
2345-
2346 }
2347
2348 CODEGEN_DECL();
2349
2350=== modified file 'src/functions/pregenerated/func_ic_ddl.h'
2351--- src/functions/pregenerated/func_ic_ddl.h 2013-03-05 23:11:50 +0000
2352+++ src/functions/pregenerated/func_ic_ddl.h 2013-07-30 11:18:26 +0000
2353@@ -46,7 +46,6 @@
2354 :
2355 function(sig, kind)
2356 {
2357-
2358 }
2359
2360 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
2361@@ -65,7 +64,6 @@
2362 :
2363 function(sig, kind)
2364 {
2365-
2366 }
2367
2368 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
2369@@ -84,7 +82,6 @@
2370 :
2371 function(sig, kind)
2372 {
2373-
2374 }
2375
2376 bool accessesDynCtx() const { return true; }
2377
2378=== modified file 'src/functions/pregenerated/func_index_func.h'
2379--- src/functions/pregenerated/func_index_func.h 2013-03-05 23:11:50 +0000
2380+++ src/functions/pregenerated/func_index_func.h 2013-07-30 11:18:26 +0000
2381@@ -46,7 +46,6 @@
2382 :
2383 function(sig, kind)
2384 {
2385-
2386 }
2387
2388 bool accessesDynCtx() const { return true; }
2389
2390=== modified file 'src/functions/pregenerated/func_item.h'
2391--- src/functions/pregenerated/func_item.h 2013-03-05 23:11:50 +0000
2392+++ src/functions/pregenerated/func_item.h 2013-07-30 11:18:26 +0000
2393@@ -46,7 +46,6 @@
2394 :
2395 function(sig, kind)
2396 {
2397-
2398 }
2399
2400 CODEGEN_DECL();
2401
2402=== modified file 'src/functions/pregenerated/func_json.h'
2403--- src/functions/pregenerated/func_json.h 2013-07-11 00:46:02 +0000
2404+++ src/functions/pregenerated/func_json.h 2013-07-30 11:18:26 +0000
2405@@ -46,7 +46,6 @@
2406 :
2407 function(sig, kind)
2408 {
2409-
2410 }
2411
2412 CODEGEN_DECL();
2413@@ -61,7 +60,6 @@
2414 :
2415 function(sig, kind)
2416 {
2417-
2418 }
2419
2420 CODEGEN_DECL();
2421
2422=== modified file 'src/functions/pregenerated/func_jsoniq_functions.h'
2423--- src/functions/pregenerated/func_jsoniq_functions.h 2013-06-08 05:33:57 +0000
2424+++ src/functions/pregenerated/func_jsoniq_functions.h 2013-07-30 11:18:26 +0000
2425@@ -46,7 +46,6 @@
2426 :
2427 function(sig, kind)
2428 {
2429-
2430 }
2431
2432 bool propagatesInputNodes(expr* fo, csize producer) const { return false; }
2433@@ -65,7 +64,7 @@
2434 :
2435 function(sig, kind)
2436 {
2437-
2438+ addAnnotation(AnnotationInternal::zann_explores_json);
2439 }
2440
2441 bool propagatesInputNodes(expr* fo, csize producer) const { return false; }
2442@@ -84,7 +83,6 @@
2443 :
2444 function(sig, kind)
2445 {
2446-
2447 }
2448
2449 bool accessesDynCtx() const { return true; }
2450@@ -103,7 +101,6 @@
2451 :
2452 function(sig, kind)
2453 {
2454-
2455 }
2456
2457 bool accessesDynCtx() const { return true; }
2458@@ -122,7 +119,6 @@
2459 :
2460 function(sig, kind)
2461 {
2462-
2463 }
2464
2465 bool propagatesInputNodes(expr* fo, csize producer) const { return producer == 0; }
2466@@ -141,7 +137,7 @@
2467 :
2468 function(sig, kind)
2469 {
2470-
2471+ addAnnotation(AnnotationInternal::zann_explores_json);
2472 }
2473
2474 bool propagatesInputNodes(expr* fo, csize producer) const { return false; }
2475@@ -162,7 +158,6 @@
2476 :
2477 function(sig, kind)
2478 {
2479-
2480 }
2481
2482 bool propagatesInputNodes(expr* fo, csize producer) const { return false; }
2483@@ -181,7 +176,6 @@
2484 :
2485 function(sig, kind)
2486 {
2487-
2488 }
2489
2490 bool propagatesInputNodes(expr* fo, csize producer) const { return producer == 0; }
2491@@ -200,7 +194,7 @@
2492 :
2493 function(sig, kind)
2494 {
2495-
2496+ addAnnotation(AnnotationInternal::zann_explores_json);
2497 }
2498
2499 bool propagatesInputNodes(expr* fo, csize producer) const { return producer == 0; }
2500@@ -219,7 +213,6 @@
2501 :
2502 function(sig, kind)
2503 {
2504-
2505 }
2506
2507 bool propagatesInputNodes(expr* fo, csize producer) const { return producer == 0; }
2508@@ -238,7 +231,6 @@
2509 :
2510 function(sig, kind)
2511 {
2512-
2513 }
2514
2515 bool propagatesInputNodes(expr* fo, csize producer) const { return producer == 0; }
2516@@ -259,7 +251,6 @@
2517 :
2518 function(sig, kind)
2519 {
2520-
2521 }
2522
2523 bool propagatesInputNodes(expr* fo, csize producer) const { return producer == 0; }
2524@@ -278,7 +269,7 @@
2525 :
2526 function(sig, kind)
2527 {
2528-
2529+ addAnnotation(AnnotationInternal::zann_explores_json);
2530 }
2531
2532 bool propagatesInputNodes(expr* fo, csize producer) const { return false; }
2533@@ -297,7 +288,6 @@
2534 :
2535 function(sig, kind)
2536 {
2537-
2538 }
2539
2540 bool propagatesInputNodes(expr* fo, csize producer) const { return true; }
2541@@ -316,7 +306,6 @@
2542 :
2543 function(sig, kind)
2544 {
2545-
2546 }
2547
2548 CODEGEN_DECL();
2549@@ -331,7 +320,6 @@
2550 :
2551 function(sig, kind)
2552 {
2553-
2554 }
2555
2556 CODEGEN_DECL();
2557@@ -346,7 +334,6 @@
2558 :
2559 function(sig, kind)
2560 {
2561-
2562 }
2563
2564 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
2565@@ -367,7 +354,6 @@
2566 :
2567 function(sig, kind)
2568 {
2569-
2570 }
2571
2572 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
2573@@ -388,7 +374,6 @@
2574 :
2575 function(sig, kind)
2576 {
2577-
2578 }
2579
2580 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
2581@@ -407,7 +392,6 @@
2582 :
2583 function(sig, kind)
2584 {
2585-
2586 }
2587
2588 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
2589@@ -428,7 +412,6 @@
2590 :
2591 function(sig, kind)
2592 {
2593-
2594 }
2595
2596 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
2597@@ -447,7 +430,6 @@
2598 :
2599 function(sig, kind)
2600 {
2601-
2602 }
2603
2604 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
2605@@ -468,7 +450,6 @@
2606 :
2607 function(sig, kind)
2608 {
2609-
2610 }
2611
2612 xqtref_t getReturnType(const fo_expr* caller) const;
2613
2614=== modified file 'src/functions/pregenerated/func_maps.h'
2615--- src/functions/pregenerated/func_maps.h 2013-03-05 23:11:50 +0000
2616+++ src/functions/pregenerated/func_maps.h 2013-07-30 11:18:26 +0000
2617@@ -46,7 +46,6 @@
2618 :
2619 function(sig, kind)
2620 {
2621-
2622 }
2623
2624 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
2625@@ -65,7 +64,6 @@
2626 :
2627 function(sig, kind)
2628 {
2629-
2630 }
2631
2632 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
2633@@ -84,7 +82,6 @@
2634 :
2635 function(sig, kind)
2636 {
2637-
2638 }
2639
2640 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
2641@@ -103,7 +100,6 @@
2642 :
2643 function(sig, kind)
2644 {
2645-
2646 }
2647
2648 bool accessesDynCtx() const { return true; }
2649@@ -120,7 +116,6 @@
2650 :
2651 function(sig, kind)
2652 {
2653-
2654 }
2655
2656 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
2657@@ -141,7 +136,6 @@
2658 :
2659 function(sig, kind)
2660 {
2661-
2662 }
2663
2664 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
2665@@ -160,7 +154,6 @@
2666 :
2667 function(sig, kind)
2668 {
2669-
2670 }
2671
2672 bool accessesDynCtx() const { return true; }
2673@@ -177,7 +170,6 @@
2674 :
2675 function(sig, kind)
2676 {
2677-
2678 }
2679
2680 bool accessesDynCtx() const { return true; }
2681@@ -194,7 +186,6 @@
2682 :
2683 function(sig, kind)
2684 {
2685-
2686 }
2687
2688 bool accessesDynCtx() const { return true; }
2689@@ -211,7 +202,6 @@
2690 :
2691 function(sig, kind)
2692 {
2693-
2694 }
2695
2696 bool accessesDynCtx() const { return true; }
2697
2698=== modified file 'src/functions/pregenerated/func_maths.h'
2699--- src/functions/pregenerated/func_maths.h 2013-03-05 23:11:50 +0000
2700+++ src/functions/pregenerated/func_maths.h 2013-07-30 11:18:26 +0000
2701@@ -46,7 +46,6 @@
2702 :
2703 function(sig, kind)
2704 {
2705-
2706 }
2707
2708 CODEGEN_DECL();
2709@@ -61,7 +60,6 @@
2710 :
2711 function(sig, kind)
2712 {
2713-
2714 }
2715
2716 CODEGEN_DECL();
2717@@ -76,7 +74,6 @@
2718 :
2719 function(sig, kind)
2720 {
2721-
2722 }
2723
2724 CODEGEN_DECL();
2725@@ -91,7 +88,6 @@
2726 :
2727 function(sig, kind)
2728 {
2729-
2730 }
2731
2732 CODEGEN_DECL();
2733@@ -106,7 +102,6 @@
2734 :
2735 function(sig, kind)
2736 {
2737-
2738 }
2739
2740 CODEGEN_DECL();
2741@@ -121,7 +116,6 @@
2742 :
2743 function(sig, kind)
2744 {
2745-
2746 }
2747
2748 CODEGEN_DECL();
2749@@ -136,7 +130,6 @@
2750 :
2751 function(sig, kind)
2752 {
2753-
2754 }
2755
2756 CODEGEN_DECL();
2757@@ -151,7 +144,6 @@
2758 :
2759 function(sig, kind)
2760 {
2761-
2762 }
2763
2764 CODEGEN_DECL();
2765@@ -166,7 +158,6 @@
2766 :
2767 function(sig, kind)
2768 {
2769-
2770 }
2771
2772 CODEGEN_DECL();
2773@@ -181,7 +172,6 @@
2774 :
2775 function(sig, kind)
2776 {
2777-
2778 }
2779
2780 CODEGEN_DECL();
2781@@ -196,7 +186,6 @@
2782 :
2783 function(sig, kind)
2784 {
2785-
2786 }
2787
2788 CODEGEN_DECL();
2789@@ -211,7 +200,6 @@
2790 :
2791 function(sig, kind)
2792 {
2793-
2794 }
2795
2796 CODEGEN_DECL();
2797@@ -226,7 +214,6 @@
2798 :
2799 function(sig, kind)
2800 {
2801-
2802 }
2803
2804 CODEGEN_DECL();
2805@@ -241,7 +228,6 @@
2806 :
2807 function(sig, kind)
2808 {
2809-
2810 }
2811
2812 CODEGEN_DECL();
2813@@ -256,7 +242,6 @@
2814 :
2815 function(sig, kind)
2816 {
2817-
2818 }
2819
2820 CODEGEN_DECL();
2821@@ -271,7 +256,6 @@
2822 :
2823 function(sig, kind)
2824 {
2825-
2826 }
2827
2828 CODEGEN_DECL();
2829@@ -286,7 +270,6 @@
2830 :
2831 function(sig, kind)
2832 {
2833-
2834 }
2835
2836 CODEGEN_DECL();
2837@@ -301,7 +284,6 @@
2838 :
2839 function(sig, kind)
2840 {
2841-
2842 }
2843
2844 CODEGEN_DECL();
2845@@ -316,7 +298,6 @@
2846 :
2847 function(sig, kind)
2848 {
2849-
2850 }
2851
2852 CODEGEN_DECL();
2853@@ -331,7 +312,6 @@
2854 :
2855 function(sig, kind)
2856 {
2857-
2858 }
2859
2860 CODEGEN_DECL();
2861@@ -346,7 +326,6 @@
2862 :
2863 function(sig, kind)
2864 {
2865-
2866 }
2867
2868 CODEGEN_DECL();
2869@@ -361,7 +340,6 @@
2870 :
2871 function(sig, kind)
2872 {
2873-
2874 }
2875
2876 CODEGEN_DECL();
2877@@ -376,7 +354,6 @@
2878 :
2879 function(sig, kind)
2880 {
2881-
2882 }
2883
2884 CODEGEN_DECL();
2885@@ -391,7 +368,6 @@
2886 :
2887 function(sig, kind)
2888 {
2889-
2890 }
2891
2892 CODEGEN_DECL();
2893@@ -406,7 +382,6 @@
2894 :
2895 function(sig, kind)
2896 {
2897-
2898 }
2899
2900 CODEGEN_DECL();
2901@@ -421,7 +396,6 @@
2902 :
2903 function(sig, kind)
2904 {
2905-
2906 }
2907
2908 CODEGEN_DECL();
2909
2910=== modified file 'src/functions/pregenerated/func_node_position.h'
2911--- src/functions/pregenerated/func_node_position.h 2013-03-05 23:11:50 +0000
2912+++ src/functions/pregenerated/func_node_position.h 2013-07-30 11:18:26 +0000
2913@@ -46,7 +46,6 @@
2914 :
2915 function(sig, kind)
2916 {
2917-
2918 }
2919
2920 CODEGEN_DECL();
2921@@ -61,7 +60,6 @@
2922 :
2923 function(sig, kind)
2924 {
2925-
2926 }
2927
2928 CODEGEN_DECL();
2929@@ -76,7 +74,6 @@
2930 :
2931 function(sig, kind)
2932 {
2933-
2934 }
2935
2936 CODEGEN_DECL();
2937@@ -91,7 +88,6 @@
2938 :
2939 function(sig, kind)
2940 {
2941-
2942 }
2943
2944 CODEGEN_DECL();
2945@@ -106,7 +102,6 @@
2946 :
2947 function(sig, kind)
2948 {
2949-
2950 }
2951
2952 CODEGEN_DECL();
2953@@ -121,7 +116,6 @@
2954 :
2955 function(sig, kind)
2956 {
2957-
2958 }
2959
2960 CODEGEN_DECL();
2961@@ -136,7 +130,6 @@
2962 :
2963 function(sig, kind)
2964 {
2965-
2966 }
2967
2968 CODEGEN_DECL();
2969@@ -151,7 +144,6 @@
2970 :
2971 function(sig, kind)
2972 {
2973-
2974 }
2975
2976 CODEGEN_DECL();
2977@@ -166,7 +158,6 @@
2978 :
2979 function(sig, kind)
2980 {
2981-
2982 }
2983
2984 CODEGEN_DECL();
2985@@ -181,7 +172,6 @@
2986 :
2987 function(sig, kind)
2988 {
2989-
2990 }
2991
2992 CODEGEN_DECL();
2993@@ -196,7 +186,6 @@
2994 :
2995 function(sig, kind)
2996 {
2997-
2998 }
2999
3000 CODEGEN_DECL();
3001@@ -211,7 +200,6 @@
3002 :
3003 function(sig, kind)
3004 {
3005-
3006 }
3007
3008 CODEGEN_DECL();
3009@@ -226,7 +214,6 @@
3010 :
3011 function(sig, kind)
3012 {
3013-
3014 }
3015
3016 CODEGEN_DECL();
3017@@ -241,7 +228,6 @@
3018 :
3019 function(sig, kind)
3020 {
3021-
3022 }
3023
3024 CODEGEN_DECL();
3025@@ -256,7 +242,6 @@
3026 :
3027 function(sig, kind)
3028 {
3029-
3030 }
3031
3032 CODEGEN_DECL();
3033@@ -271,7 +256,6 @@
3034 :
3035 function(sig, kind)
3036 {
3037-
3038 }
3039
3040 CODEGEN_DECL();
3041@@ -286,7 +270,6 @@
3042 :
3043 function(sig, kind)
3044 {
3045-
3046 }
3047
3048 CODEGEN_DECL();
3049@@ -301,7 +284,6 @@
3050 :
3051 function(sig, kind)
3052 {
3053-
3054 }
3055
3056 CODEGEN_DECL();
3057@@ -316,7 +298,6 @@
3058 :
3059 function(sig, kind)
3060 {
3061-
3062 }
3063
3064 CODEGEN_DECL();
3065@@ -331,7 +312,6 @@
3066 :
3067 function(sig, kind)
3068 {
3069-
3070 }
3071
3072 CODEGEN_DECL();
3073@@ -346,7 +326,6 @@
3074 :
3075 function(sig, kind)
3076 {
3077-
3078 }
3079
3080 CODEGEN_DECL();
3081@@ -361,7 +340,6 @@
3082 :
3083 function(sig, kind)
3084 {
3085-
3086 }
3087
3088 CODEGEN_DECL();
3089@@ -376,7 +354,6 @@
3090 :
3091 function(sig, kind)
3092 {
3093-
3094 }
3095
3096 CODEGEN_DECL();
3097@@ -391,7 +368,6 @@
3098 :
3099 function(sig, kind)
3100 {
3101-
3102 }
3103
3104 CODEGEN_DECL();
3105
3106=== modified file 'src/functions/pregenerated/func_nodes.h'
3107--- src/functions/pregenerated/func_nodes.h 2013-07-24 08:12:12 +0000
3108+++ src/functions/pregenerated/func_nodes.h 2013-07-30 11:18:26 +0000
3109@@ -46,7 +46,6 @@
3110 :
3111 function(sig, kind)
3112 {
3113-
3114 }
3115
3116 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
3117@@ -63,7 +62,6 @@
3118 :
3119 function(sig, kind)
3120 {
3121-
3122 }
3123
3124 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
3125@@ -80,7 +78,6 @@
3126 :
3127 function(sig, kind)
3128 {
3129-
3130 }
3131
3132 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
3133@@ -97,7 +94,6 @@
3134 :
3135 function(sig, kind)
3136 {
3137-
3138 }
3139
3140 CODEGEN_DECL();
3141@@ -112,7 +108,7 @@
3142 :
3143 function(sig, kind)
3144 {
3145-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3146+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3147 }
3148
3149 bool mustCopyInputNodes(expr* fo, csize producer) const { return false; }
3150@@ -129,7 +125,7 @@
3151 :
3152 function(sig, kind)
3153 {
3154-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3155+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3156 }
3157
3158 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3159@@ -146,7 +142,7 @@
3160 :
3161 function(sig, kind)
3162 {
3163-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3164+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3165 }
3166
3167 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3168@@ -163,7 +159,7 @@
3169 :
3170 function(sig, kind)
3171 {
3172-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3173+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3174 }
3175
3176 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3177@@ -180,7 +176,6 @@
3178 :
3179 function(sig, kind)
3180 {
3181-
3182 }
3183
3184 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3185@@ -197,7 +192,6 @@
3186 :
3187 function(sig, kind)
3188 {
3189-
3190 }
3191
3192 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3193@@ -214,7 +208,6 @@
3194 :
3195 function(sig, kind)
3196 {
3197-
3198 }
3199
3200 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3201@@ -231,7 +224,6 @@
3202 :
3203 function(sig, kind)
3204 {
3205-
3206 }
3207
3208 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3209@@ -248,7 +240,6 @@
3210 :
3211 function(sig, kind)
3212 {
3213-
3214 }
3215
3216 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3217@@ -265,7 +256,6 @@
3218 :
3219 function(sig, kind)
3220 {
3221-
3222 }
3223
3224 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3225@@ -282,7 +272,6 @@
3226 :
3227 function(sig, kind)
3228 {
3229-
3230 }
3231
3232 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3233@@ -299,7 +288,6 @@
3234 :
3235 function(sig, kind)
3236 {
3237-
3238 }
3239
3240 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3241@@ -316,7 +304,6 @@
3242 :
3243 function(sig, kind)
3244 {
3245-
3246 }
3247
3248 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3249@@ -333,7 +320,6 @@
3250 :
3251 function(sig, kind)
3252 {
3253-
3254 }
3255
3256 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3257@@ -350,7 +336,7 @@
3258 :
3259 function(sig, kind)
3260 {
3261-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3262+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3263 }
3264
3265 CODEGEN_DECL();
3266@@ -365,7 +351,6 @@
3267 :
3268 function(sig, kind)
3269 {
3270-
3271 }
3272
3273 bool mustCopyInputNodes(expr* fo, csize producer) const;
3274
3275=== modified file 'src/functions/pregenerated/func_numerics.h'
3276--- src/functions/pregenerated/func_numerics.h 2013-03-05 23:11:50 +0000
3277+++ src/functions/pregenerated/func_numerics.h 2013-07-30 11:18:26 +0000
3278@@ -46,7 +46,6 @@
3279 :
3280 function(sig, kind)
3281 {
3282-
3283 }
3284
3285 CODEGEN_DECL();
3286@@ -61,7 +60,6 @@
3287 :
3288 function(sig, kind)
3289 {
3290-
3291 }
3292
3293 CODEGEN_DECL();
3294@@ -76,7 +74,6 @@
3295 :
3296 function(sig, kind)
3297 {
3298-
3299 }
3300
3301 xqtref_t getReturnType(const fo_expr* caller) const;
3302@@ -93,7 +90,7 @@
3303 :
3304 function(sig, kind)
3305 {
3306-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3307+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3308 }
3309
3310 CODEGEN_DECL();
3311@@ -107,7 +104,6 @@
3312 :
3313 function(sig, kind)
3314 {
3315-
3316 }
3317
3318 CODEGEN_DECL();
3319@@ -122,7 +118,6 @@
3320 :
3321 function(sig, kind)
3322 {
3323-
3324 }
3325
3326 CODEGEN_DECL();
3327@@ -137,7 +132,7 @@
3328 :
3329 function(sig, kind)
3330 {
3331-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3332+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3333 }
3334
3335 CODEGEN_DECL();
3336@@ -152,7 +147,7 @@
3337 :
3338 function(sig, kind)
3339 {
3340-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3341+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3342 }
3343
3344 CODEGEN_DECL();
3345
3346=== modified file 'src/functions/pregenerated/func_other_diagnostics.h'
3347--- src/functions/pregenerated/func_other_diagnostics.h 2013-03-05 23:11:50 +0000
3348+++ src/functions/pregenerated/func_other_diagnostics.h 2013-07-30 11:18:26 +0000
3349@@ -46,7 +46,6 @@
3350 :
3351 function(sig, kind)
3352 {
3353-
3354 }
3355
3356 bool accessesDynCtx() const { return true; }
3357@@ -63,7 +62,6 @@
3358 :
3359 function(sig, kind)
3360 {
3361-
3362 }
3363
3364 bool accessesDynCtx() const { return true; }
3365
3366=== modified file 'src/functions/pregenerated/func_parse_fragment.h'
3367--- src/functions/pregenerated/func_parse_fragment.h 2013-03-06 07:39:18 +0000
3368+++ src/functions/pregenerated/func_parse_fragment.h 2013-07-30 11:18:26 +0000
3369@@ -46,7 +46,6 @@
3370 :
3371 function(sig, kind)
3372 {
3373-
3374 }
3375
3376 bool accessesDynCtx() const { return true; }
3377@@ -63,7 +62,6 @@
3378 :
3379 function(sig, kind)
3380 {
3381-
3382 }
3383
3384 CODEGEN_DECL();
3385@@ -78,7 +76,7 @@
3386 :
3387 function(sig, kind)
3388 {
3389-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3390+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3391 }
3392
3393 bool accessesDynCtx() const { return true; }
3394
3395=== modified file 'src/functions/pregenerated/func_parsing_and_serializing.h'
3396--- src/functions/pregenerated/func_parsing_and_serializing.h 2013-03-05 23:11:50 +0000
3397+++ src/functions/pregenerated/func_parsing_and_serializing.h 2013-07-30 11:18:26 +0000
3398@@ -46,7 +46,7 @@
3399 :
3400 function(sig, kind)
3401 {
3402-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3403+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3404 }
3405
3406 bool accessesDynCtx() const { return true; }
3407@@ -65,7 +65,8 @@
3408 :
3409 function(sig, kind)
3410 {
3411-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3412+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
3413+ addAnnotation(AnnotationInternal::zann_explores_json);
3414 }
3415
3416 bool accessesDynCtx() const { return true; }
3417
3418=== modified file 'src/functions/pregenerated/func_qnames.h'
3419--- src/functions/pregenerated/func_qnames.h 2013-03-05 23:11:50 +0000
3420+++ src/functions/pregenerated/func_qnames.h 2013-07-30 11:18:26 +0000
3421@@ -46,7 +46,6 @@
3422 :
3423 function(sig, kind)
3424 {
3425-
3426 }
3427
3428 bool mustCopyInputNodes(expr* fo, csize producer) const { return producer == 1; }
3429@@ -63,7 +62,6 @@
3430 :
3431 function(sig, kind)
3432 {
3433-
3434 }
3435
3436 CODEGEN_DECL();
3437@@ -78,7 +76,6 @@
3438 :
3439 function(sig, kind)
3440 {
3441-
3442 }
3443
3444 CODEGEN_DECL();
3445@@ -93,7 +90,6 @@
3446 :
3447 function(sig, kind)
3448 {
3449-
3450 }
3451
3452 CODEGEN_DECL();
3453@@ -108,7 +104,6 @@
3454 :
3455 function(sig, kind)
3456 {
3457-
3458 }
3459
3460 CODEGEN_DECL();
3461@@ -123,7 +118,6 @@
3462 :
3463 function(sig, kind)
3464 {
3465-
3466 }
3467
3468 CODEGEN_DECL();
3469@@ -138,7 +132,6 @@
3470 :
3471 function(sig, kind)
3472 {
3473-
3474 }
3475
3476 bool mustCopyInputNodes(expr* fo, csize producer) const { return producer == 1; }
3477@@ -155,7 +148,6 @@
3478 :
3479 function(sig, kind)
3480 {
3481-
3482 }
3483
3484 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3485
3486=== modified file 'src/functions/pregenerated/func_random.h'
3487--- src/functions/pregenerated/func_random.h 2013-03-05 23:11:50 +0000
3488+++ src/functions/pregenerated/func_random.h 2013-07-30 11:18:26 +0000
3489@@ -46,7 +46,6 @@
3490 :
3491 function(sig, kind)
3492 {
3493-
3494 }
3495
3496 CODEGEN_DECL();
3497@@ -61,7 +60,6 @@
3498 :
3499 function(sig, kind)
3500 {
3501-
3502 }
3503
3504 CODEGEN_DECL();
3505@@ -77,7 +75,6 @@
3506 function(sig, kind)
3507 {
3508 setDeterministic(false);
3509-
3510 }
3511
3512 CODEGEN_DECL();
3513
3514=== modified file 'src/functions/pregenerated/func_reference.h'
3515--- src/functions/pregenerated/func_reference.h 2013-03-05 23:11:50 +0000
3516+++ src/functions/pregenerated/func_reference.h 2013-07-30 11:18:26 +0000
3517@@ -46,7 +46,6 @@
3518 :
3519 function(sig, kind)
3520 {
3521-
3522 }
3523
3524 bool mustCopyInputNodes(expr* fo, csize producer) const { return true; }
3525@@ -63,7 +62,6 @@
3526 :
3527 function(sig, kind)
3528 {
3529-
3530 }
3531
3532 CODEGEN_DECL();
3533@@ -78,7 +76,6 @@
3534 :
3535 function(sig, kind)
3536 {
3537-
3538 }
3539
3540 unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; }
3541@@ -95,7 +92,6 @@
3542 :
3543 function(sig, kind)
3544 {
3545-
3546 }
3547
3548 CODEGEN_DECL();
3549
3550=== modified file 'src/functions/pregenerated/func_schema.h'
3551--- src/functions/pregenerated/func_schema.h 2013-03-05 23:11:50 +0000
3552+++ src/functions/pregenerated/func_schema.h 2013-07-30 11:18:26 +0000
3553@@ -46,7 +46,6 @@
3554 :
3555 function(sig, kind)
3556 {
3557-
3558 }
3559
3560 unsigned short getScriptingKind() const { return UPDATING_EXPR; }
3561@@ -67,7 +66,6 @@
3562 :
3563 function(sig, kind)
3564 {
3565-
3566 }
3567
3568 bool mustCopyInputNodes(expr* fo, csize producer) const;
3569@@ -84,7 +82,6 @@
3570 :
3571 function(sig, kind)
3572 {
3573-
3574 }
3575
3576 bool mustCopyInputNodes(expr* fo, csize producer) const;
3577
3578=== modified file 'src/functions/pregenerated/func_sctx.h'
3579--- src/functions/pregenerated/func_sctx.h 2013-03-05 23:11:50 +0000
3580+++ src/functions/pregenerated/func_sctx.h 2013-07-30 11:18:26 +0000
3581@@ -46,7 +46,6 @@
3582 :
3583 function(sig, kind)
3584 {
3585-
3586 }
3587
3588 CODEGEN_DECL();
3589@@ -61,7 +60,6 @@
3590 :
3591 function(sig, kind)
3592 {
3593-
3594 }
3595
3596 CODEGEN_DECL();
3597@@ -76,7 +74,6 @@
3598 :
3599 function(sig, kind)
3600 {
3601-
3602 }
3603
3604 CODEGEN_DECL();
3605@@ -91,7 +88,6 @@
3606 :
3607 function(sig, kind)
3608 {
3609-
3610 }
3611
3612 CODEGEN_DECL();
3613@@ -106,7 +102,6 @@
3614 :
3615 function(sig, kind)
3616 {
3617-
3618 }
3619
3620 CODEGEN_DECL();
3621@@ -121,7 +116,6 @@
3622 :
3623 function(sig, kind)
3624 {
3625-
3626 }
3627
3628 CODEGEN_DECL();
3629@@ -136,7 +130,6 @@
3630 :
3631 function(sig, kind)
3632 {
3633-
3634 }
3635
3636 CODEGEN_DECL();
3637@@ -151,7 +144,6 @@
3638 :
3639 function(sig, kind)
3640 {
3641-
3642 }
3643
3644 CODEGEN_DECL();
3645@@ -166,7 +158,6 @@
3646 :
3647 function(sig, kind)
3648 {
3649-
3650 }
3651
3652 CODEGEN_DECL();
3653@@ -181,7 +172,6 @@
3654 :
3655 function(sig, kind)
3656 {
3657-
3658 }
3659
3660 CODEGEN_DECL();
3661@@ -196,7 +186,6 @@
3662 :
3663 function(sig, kind)
3664 {
3665-
3666 }
3667
3668 CODEGEN_DECL();
3669@@ -211,7 +200,6 @@
3670 :
3671 function(sig, kind)
3672 {
3673-
3674 }
3675
3676 CODEGEN_DECL();
3677@@ -226,7 +214,6 @@
3678 :
3679 function(sig, kind)
3680 {
3681-
3682 }
3683
3684 CODEGEN_DECL();
3685@@ -241,7 +228,6 @@
3686 :
3687 function(sig, kind)
3688 {
3689-
3690 }
3691
3692 CODEGEN_DECL();
3693@@ -256,7 +242,6 @@
3694 :
3695 function(sig, kind)
3696 {
3697-
3698 }
3699
3700 CODEGEN_DECL();
3701@@ -271,7 +256,6 @@
3702 :
3703 function(sig, kind)
3704 {
3705-
3706 }
3707
3708 CODEGEN_DECL();
3709@@ -286,7 +270,6 @@
3710 :
3711 function(sig, kind)
3712 {
3713-
3714 }
3715
3716 CODEGEN_DECL();
3717@@ -301,7 +284,6 @@
3718 :
3719 function(sig, kind)
3720 {
3721-
3722 }
3723
3724 CODEGEN_DECL();
3725@@ -316,7 +298,6 @@
3726 :
3727 function(sig, kind)
3728 {
3729-
3730 }
3731
3732 CODEGEN_DECL();
3733@@ -331,7 +312,6 @@
3734 :
3735 function(sig, kind)
3736 {
3737-
3738 }
3739
3740 CODEGEN_DECL();
3741@@ -346,7 +326,6 @@
3742 :
3743 function(sig, kind)
3744 {
3745-
3746 }
3747
3748 CODEGEN_DECL();
3749@@ -361,7 +340,6 @@
3750 :
3751 function(sig, kind)
3752 {
3753-
3754 }
3755
3756 CODEGEN_DECL();
3757@@ -376,7 +354,6 @@
3758 :
3759 function(sig, kind)
3760 {
3761-
3762 }
3763
3764 CODEGEN_DECL();
3765@@ -391,7 +368,6 @@
3766 :
3767 function(sig, kind)
3768 {
3769-
3770 }
3771
3772 CODEGEN_DECL();
3773@@ -406,7 +382,6 @@
3774 :
3775 function(sig, kind)
3776 {
3777-
3778 }
3779
3780 CODEGEN_DECL();
3781
3782=== modified file 'src/functions/pregenerated/func_sequences.h'
3783--- src/functions/pregenerated/func_sequences.h 2013-03-05 23:11:50 +0000
3784+++ src/functions/pregenerated/func_sequences.h 2013-07-30 11:18:26 +0000
3785@@ -46,7 +46,6 @@
3786 :
3787 function(sig, kind)
3788 {
3789-
3790 }
3791
3792 xqtref_t getReturnType(const fo_expr* caller) const;
3793@@ -69,7 +68,6 @@
3794 :
3795 function(sig, kind)
3796 {
3797-
3798 }
3799
3800 CODEGEN_DECL();
3801@@ -84,7 +82,6 @@
3802 :
3803 function(sig, kind)
3804 {
3805-
3806 }
3807
3808 BoolAnnotationValue ignoresSortedNodes(expr* fo, csize producer) const;
3809@@ -105,7 +102,6 @@
3810 :
3811 function(sig, kind)
3812 {
3813-
3814 }
3815
3816 BoolAnnotationValue ignoresSortedNodes(expr* fo, csize producer) const;
3817@@ -126,7 +122,6 @@
3818 :
3819 function(sig, kind)
3820 {
3821-
3822 }
3823
3824 xqtref_t getReturnType(const fo_expr* caller) const;
3825@@ -147,7 +142,6 @@
3826 :
3827 function(sig, kind)
3828 {
3829-
3830 }
3831
3832 xqtref_t getReturnType(const fo_expr* caller) const;
3833@@ -170,7 +164,6 @@
3834 :
3835 function(sig, kind)
3836 {
3837-
3838 }
3839
3840 xqtref_t getReturnType(const fo_expr* caller) const;
3841@@ -197,7 +190,6 @@
3842 :
3843 function(sig, kind)
3844 {
3845-
3846 }
3847
3848 xqtref_t getReturnType(const fo_expr* caller) const;
3849@@ -222,7 +214,6 @@
3850 :
3851 function(sig, kind)
3852 {
3853-
3854 }
3855
3856 xqtref_t getReturnType(const fo_expr* caller) const;
3857@@ -247,7 +238,6 @@
3858 :
3859 function(sig, kind)
3860 {
3861-
3862 }
3863
3864 xqtref_t getReturnType(const fo_expr* caller) const;
3865@@ -270,7 +260,6 @@
3866 :
3867 function(sig, kind)
3868 {
3869-
3870 }
3871
3872 xqtref_t getReturnType(const fo_expr* caller) const;
3873@@ -293,7 +282,6 @@
3874 :
3875 function(sig, kind)
3876 {
3877-
3878 }
3879
3880 xqtref_t getReturnType(const fo_expr* caller) const;
3881@@ -314,7 +302,6 @@
3882 :
3883 function(sig, kind)
3884 {
3885-
3886 }
3887
3888 xqtref_t getReturnType(const fo_expr* caller) const;
3889@@ -343,7 +330,6 @@
3890 :
3891 function(sig, kind)
3892 {
3893-
3894 }
3895
3896 bool accessesDynCtx() const { return true; }
3897@@ -362,7 +348,6 @@
3898 :
3899 function(sig, kind)
3900 {
3901-
3902 }
3903
3904 BoolAnnotationValue ignoresSortedNodes(expr* fo, csize producer) const;
3905@@ -381,7 +366,6 @@
3906 :
3907 function(sig, kind)
3908 {
3909-
3910 }
3911
3912 BoolAnnotationValue ignoresSortedNodes(expr* fo, csize producer) const;
3913@@ -398,7 +382,6 @@
3914 :
3915 function(sig, kind)
3916 {
3917-
3918 }
3919
3920 bool specializable() const { return true; }
3921@@ -420,7 +403,6 @@
3922 :
3923 function(sig, kind)
3924 {
3925-
3926 }
3927
3928 BoolAnnotationValue ignoresSortedNodes(expr* fo, csize producer) const;
3929@@ -437,7 +419,6 @@
3930 :
3931 function(sig, kind)
3932 {
3933-
3934 }
3935
3936 BoolAnnotationValue ignoresSortedNodes(expr* fo, csize producer) const;
3937@@ -454,7 +435,6 @@
3938 :
3939 function(sig, kind)
3940 {
3941-
3942 }
3943
3944 BoolAnnotationValue ignoresSortedNodes(expr* fo, csize producer) const;
3945@@ -471,7 +451,6 @@
3946 :
3947 function(sig, kind)
3948 {
3949-
3950 }
3951
3952 BoolAnnotationValue ignoresSortedNodes(expr* fo, csize producer) const;
3953@@ -488,7 +467,6 @@
3954 :
3955 function(sig, kind)
3956 {
3957-
3958 }
3959
3960 CODEGEN_DECL();
3961@@ -503,7 +481,6 @@
3962 :
3963 function(sig, kind)
3964 {
3965-
3966 }
3967
3968 FunctionConsts::AnnotationValue producesDistinctNodes() const
3969@@ -534,7 +511,6 @@
3970 :
3971 function(sig, kind)
3972 {
3973-
3974 }
3975
3976 FunctionConsts::AnnotationValue producesDistinctNodes() const
3977@@ -565,7 +541,6 @@
3978 :
3979 function(sig, kind)
3980 {
3981-
3982 }
3983
3984 FunctionConsts::AnnotationValue producesDistinctNodes() const
3985@@ -596,7 +571,6 @@
3986 :
3987 function(sig, kind)
3988 {
3989-
3990 }
3991
3992 bool accessesDynCtx() const { return true; }
3993@@ -615,7 +589,6 @@
3994 :
3995 function(sig, kind)
3996 {
3997-
3998 }
3999
4000 CODEGEN_DECL();
4001@@ -630,7 +603,7 @@
4002 :
4003 function(sig, kind)
4004 {
4005-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4006+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4007 }
4008
4009 CODEGEN_DECL();
4010@@ -645,7 +618,7 @@
4011 :
4012 function(sig, kind)
4013 {
4014-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4015+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4016 }
4017
4018 CODEGEN_DECL();
4019@@ -660,7 +633,7 @@
4020 :
4021 function(sig, kind)
4022 {
4023-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4024+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4025 }
4026
4027 CODEGEN_DECL();
4028@@ -675,7 +648,7 @@
4029 :
4030 function(sig, kind)
4031 {
4032-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4033+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4034 }
4035
4036 CODEGEN_DECL();
4037@@ -690,7 +663,7 @@
4038 :
4039 function(sig, kind)
4040 {
4041-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4042+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4043 }
4044
4045 CODEGEN_DECL();
4046
4047=== modified file 'src/functions/pregenerated/func_strings.h'
4048--- src/functions/pregenerated/func_strings.h 2013-07-11 22:08:29 +0000
4049+++ src/functions/pregenerated/func_strings.h 2013-07-30 11:18:26 +0000
4050@@ -46,7 +46,6 @@
4051 :
4052 function(sig, kind)
4053 {
4054-
4055 }
4056
4057 CODEGEN_DECL();
4058@@ -61,7 +60,6 @@
4059 :
4060 function(sig, kind)
4061 {
4062-
4063 }
4064
4065 CODEGEN_DECL();
4066@@ -76,7 +74,6 @@
4067 :
4068 function(sig, kind)
4069 {
4070-
4071 }
4072
4073 CODEGEN_DECL();
4074@@ -91,7 +88,6 @@
4075 :
4076 function(sig, kind)
4077 {
4078-
4079 }
4080
4081 CODEGEN_DECL();
4082@@ -106,7 +102,6 @@
4083 :
4084 function(sig, kind)
4085 {
4086-
4087 }
4088
4089 BoolAnnotationValue ignoresSortedNodes(expr* fo, csize producer) const;
4090@@ -125,7 +120,7 @@
4091 :
4092 function(sig, kind)
4093 {
4094-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4095+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4096 }
4097
4098 CODEGEN_DECL();
4099@@ -139,7 +134,6 @@
4100 :
4101 function(sig, kind)
4102 {
4103-
4104 }
4105
4106 CODEGEN_DECL();
4107@@ -154,7 +148,6 @@
4108 :
4109 function(sig, kind)
4110 {
4111-
4112 }
4113
4114 bool specializable() const { return true; }
4115@@ -174,7 +167,6 @@
4116 :
4117 function(sig, kind)
4118 {
4119-
4120 }
4121
4122 CODEGEN_DECL();
4123@@ -189,7 +181,6 @@
4124 :
4125 function(sig, kind)
4126 {
4127-
4128 }
4129
4130 CODEGEN_DECL();
4131@@ -204,7 +195,6 @@
4132 :
4133 function(sig, kind)
4134 {
4135-
4136 }
4137
4138 CODEGEN_DECL();
4139@@ -219,7 +209,6 @@
4140 :
4141 function(sig, kind)
4142 {
4143-
4144 }
4145
4146 CODEGEN_DECL();
4147@@ -234,7 +223,6 @@
4148 :
4149 function(sig, kind)
4150 {
4151-
4152 }
4153
4154 CODEGEN_DECL();
4155@@ -249,7 +237,6 @@
4156 :
4157 function(sig, kind)
4158 {
4159-
4160 }
4161
4162 CODEGEN_DECL();
4163@@ -264,7 +251,6 @@
4164 :
4165 function(sig, kind)
4166 {
4167-
4168 }
4169
4170 CODEGEN_DECL();
4171@@ -279,7 +265,6 @@
4172 :
4173 function(sig, kind)
4174 {
4175-
4176 }
4177
4178 CODEGEN_DECL();
4179@@ -294,7 +279,6 @@
4180 :
4181 function(sig, kind)
4182 {
4183-
4184 }
4185
4186 CODEGEN_DECL();
4187@@ -309,7 +293,6 @@
4188 :
4189 function(sig, kind)
4190 {
4191-
4192 }
4193
4194 CODEGEN_DECL();
4195@@ -324,7 +307,6 @@
4196 :
4197 function(sig, kind)
4198 {
4199-
4200 }
4201
4202 CODEGEN_DECL();
4203@@ -339,7 +321,6 @@
4204 :
4205 function(sig, kind)
4206 {
4207-
4208 }
4209
4210 CODEGEN_DECL();
4211@@ -354,7 +335,6 @@
4212 :
4213 function(sig, kind)
4214 {
4215-
4216 }
4217
4218 CODEGEN_DECL();
4219@@ -369,7 +349,6 @@
4220 :
4221 function(sig, kind)
4222 {
4223-
4224 }
4225
4226 CODEGEN_DECL();
4227@@ -384,7 +363,6 @@
4228 :
4229 function(sig, kind)
4230 {
4231-
4232 }
4233
4234 CODEGEN_DECL();
4235@@ -399,7 +377,6 @@
4236 :
4237 function(sig, kind)
4238 {
4239-
4240 }
4241
4242 CODEGEN_DECL();
4243@@ -414,7 +391,6 @@
4244 :
4245 function(sig, kind)
4246 {
4247-
4248 }
4249
4250 CODEGEN_DECL();
4251@@ -429,7 +405,6 @@
4252 :
4253 function(sig, kind)
4254 {
4255-
4256 }
4257
4258 CODEGEN_DECL();
4259@@ -444,7 +419,7 @@
4260 :
4261 function(sig, kind)
4262 {
4263-theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4264+ theXQueryVersion = StaticContextConsts::xquery_version_3_0;
4265 }
4266
4267 CODEGEN_DECL();
4268@@ -459,7 +434,6 @@
4269 :
4270 function(sig, kind)
4271 {
4272-
4273 }
4274
4275 CODEGEN_DECL();
4276@@ -474,7 +448,6 @@
4277 :
4278 function(sig, kind)
4279 {
4280-
4281 }
4282
4283 CODEGEN_DECL();
4284@@ -504,7 +477,6 @@
4285 :
4286 function(sig, kind)
4287 {
4288-
4289 }
4290
4291 CODEGEN_DECL();
4292
4293=== modified file 'src/functions/pregenerated/func_uris.h'
4294--- src/functions/pregenerated/func_uris.h 2013-04-12 21:25:35 +0000
4295+++ src/functions/pregenerated/func_uris.h 2013-07-30 11:18:26 +0000
4296@@ -46,7 +46,6 @@
4297 :
4298 function(sig, kind)
4299 {
4300-
4301 }
4302
4303 CODEGEN_DECL();
4304@@ -61,7 +60,6 @@
4305 :
4306 function(sig, kind)
4307 {
4308-
4309 }
4310
4311 CODEGEN_DECL();
4312@@ -76,7 +74,6 @@
4313 :
4314 function(sig, kind)
4315 {
4316-
4317 }
4318
4319 CODEGEN_DECL();
4320
4321=== modified file 'src/functions/pregenerated/func_xqdoc.h'
4322--- src/functions/pregenerated/func_xqdoc.h 2013-03-05 23:11:50 +0000
4323+++ src/functions/pregenerated/func_xqdoc.h 2013-07-30 11:18:26 +0000
4324@@ -46,7 +46,6 @@
4325 :
4326 function(sig, kind)
4327 {
4328-
4329 }
4330
4331 CODEGEN_DECL();
4332@@ -61,7 +60,6 @@
4333 :
4334 function(sig, kind)
4335 {
4336-
4337 }
4338
4339 CODEGEN_DECL();
4340
4341=== modified file 'src/runtime/collections/collections_impl.cpp'
4342--- src/runtime/collections/collections_impl.cpp 2013-07-25 14:09:47 +0000
4343+++ src/runtime/collections/collections_impl.cpp 2013-07-30 11:18:26 +0000
4344@@ -61,8 +61,9 @@
4345 const static_context* sctx,
4346 const store::Item_t& name,
4347 const QueryLoc& loc,
4348- bool dynamic,
4349- store::Collection_t& coll)
4350+ bool dynamic,
4351+ store::Collection_t& coll,
4352+ store::Item_t dataguide = NULL)
4353 {
4354 const StaticallyKnownCollection* collectionDecl = sctx->lookup_collection(name);
4355
4356@@ -72,7 +73,7 @@
4357 ERROR_PARAMS(name->getStringValue()));
4358 }
4359
4360- coll = GENV_STORE.getCollection(name, dynamic);
4361+ coll = GENV_STORE.getCollection(name, dynamic, dataguide);
4362
4363 if (coll == NULL)
4364 {
4365@@ -287,7 +288,7 @@
4366
4367 consumeNext(name, theChildren[0].getp(), planState);
4368
4369- (void)getCollection(theSctx, name, loc, theIsDynamic, collection);
4370+ (void)getCollection(theSctx, name, loc, theIsDynamic, collection, theDataguide);
4371
4372 if (theChildren.size() == 1)
4373 {
4374
4375=== modified file 'src/runtime/collections/pregenerated/collections.cpp'
4376--- src/runtime/collections/pregenerated/collections.cpp 2013-03-05 23:11:50 +0000
4377+++ src/runtime/collections/pregenerated/collections.cpp 2013-07-30 11:18:26 +0000
4378@@ -194,6 +194,7 @@
4379 (NaryBaseIterator<ZorbaCollectionIterator, ZorbaCollectionIteratorState>*)this);
4380
4381 ar & theIsDynamic;
4382+ ar & theDataguide;
4383 }
4384
4385
4386
4387=== modified file 'src/runtime/collections/pregenerated/collections.h'
4388--- src/runtime/collections/pregenerated/collections.h 2013-07-15 10:32:25 +0000
4389+++ src/runtime/collections/pregenerated/collections.h 2013-07-30 11:18:26 +0000
4390@@ -266,6 +266,7 @@
4391 {
4392 protected:
4393 bool theIsDynamic; //
4394+ store::Item_t theDataguide; //
4395 public:
4396 SERIALIZABLE_CLASS(ZorbaCollectionIterator);
4397
4398@@ -281,13 +282,16 @@
4399 bool isDynamic)
4400 :
4401 NaryBaseIterator<ZorbaCollectionIterator, ZorbaCollectionIteratorState>(sctx, loc, children),
4402- theIsDynamic(isDynamic)
4403+ theIsDynamic(isDynamic),
4404+ theDataguide()
4405 {}
4406
4407 virtual ~ZorbaCollectionIterator();
4408
4409 bool isDynamic() const { return theIsDynamic; }
4410
4411+ void setDataguide(store::Item_t aValue) { theDataguide= aValue; }
4412+
4413 public:
4414 bool isCountOptimizable() const;
4415 bool count(store::Item_t& result, PlanState& planState) const;
4416
4417=== modified file 'src/runtime/json/json_loader.cpp'
4418--- src/runtime/json/json_loader.cpp 2013-06-19 15:35:24 +0000
4419+++ src/runtime/json/json_loader.cpp 2013-07-30 11:18:26 +0000
4420@@ -80,10 +80,11 @@
4421
4422 ///////////////////////////////////////////////////////////////////////////////
4423
4424-loader::loader( istream &is, bool allow_multiple, bool strip_top_level_array ) :
4425+loader::loader( istream &is, bool allow_multiple, bool strip_top_level_array, const store::Item *aDataguide) :
4426 parser_( is, allow_multiple ),
4427 strip_top_level_array_( strip_top_level_array ),
4428- stripped_top_level_array_( false )
4429+ stripped_top_level_array_( false ),
4430+ dataguide(aDataguide)
4431 {
4432 }
4433
4434
4435=== modified file 'src/runtime/json/json_loader.h'
4436--- src/runtime/json/json_loader.h 2012-12-03 18:29:05 +0000
4437+++ src/runtime/json/json_loader.h 2013-07-30 11:18:26 +0000
4438@@ -47,8 +47,10 @@
4439 * @param strip_top_level_array If \c true, strips the top-level array, if
4440 * any.
4441 */
4442- loader( std::istream &is, bool allow_multiple = false,
4443- bool strip_top_level_array = false );
4444+ loader( std::istream &is,
4445+ bool allow_multiple = false,
4446+ bool strip_top_level_array = false,
4447+ const store::Item* aDataguide = NULL);
4448
4449 /**
4450 * Destroys this %loader.
4451@@ -123,6 +125,7 @@
4452 parser parser_;
4453 bool const strip_top_level_array_;
4454 bool stripped_top_level_array_;
4455+ const store::Item* dataguide;
4456 };
4457
4458 ///////////////////////////////////////////////////////////////////////////////
4459
4460=== modified file 'src/runtime/json/jsoniq_functions_impl.cpp'
4461--- src/runtime/json/jsoniq_functions_impl.cpp 2013-06-18 18:55:33 +0000
4462+++ src/runtime/json/jsoniq_functions_impl.cpp 2013-07-30 11:18:26 +0000
4463@@ -863,7 +863,7 @@
4464 }
4465
4466 state->loader_ = new json::loader(
4467- *state->theInputStream, true, lStripTopLevelArray
4468+ *state->theInputStream, true, lStripTopLevelArray, theDataguide
4469 );
4470
4471 if ( state->theInput == NULL && theRelativeLocation ) {
4472
4473=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.cpp'
4474--- src/runtime/json/pregenerated/jsoniq_functions.cpp 2013-06-18 18:55:33 +0000
4475+++ src/runtime/json/pregenerated/jsoniq_functions.cpp 2013-07-30 11:18:26 +0000
4476@@ -121,6 +121,7 @@
4477 (NaryBaseIterator<JSONParseIterator, JSONParseIteratorState>*)this);
4478
4479 ar & theRelativeLocation;
4480+ ar & theDataguide;
4481 }
4482
4483
4484
4485=== modified file 'src/runtime/json/pregenerated/jsoniq_functions.h'
4486--- src/runtime/json/pregenerated/jsoniq_functions.h 2013-06-18 18:55:33 +0000
4487+++ src/runtime/json/pregenerated/jsoniq_functions.h 2013-07-30 11:18:26 +0000
4488@@ -163,6 +163,7 @@
4489 {
4490 protected:
4491 QueryLoc theRelativeLocation; //
4492+ store::Item_t theDataguide; //
4493 public:
4494 SERIALIZABLE_CLASS(JSONParseIterator);
4495
4496@@ -178,11 +179,14 @@
4497 QueryLoc aRelativeLocation)
4498 :
4499 NaryBaseIterator<JSONParseIterator, JSONParseIteratorState>(sctx, loc, children),
4500- theRelativeLocation(aRelativeLocation)
4501+ theRelativeLocation(aRelativeLocation),
4502+ theDataguide()
4503 {}
4504
4505 virtual ~JSONParseIterator();
4506
4507+ void setDataguide(store::Item_t aValue) { theDataguide= aValue; }
4508+
4509 public:
4510 bool processBooleanOption(const store::Item_t& options, char const* option_name, bool* option_value) const;
4511 void accept(PlanIterVisitor& v) const;
4512
4513=== modified file 'src/runtime/spec/codegen-h.xq'
4514--- src/runtime/spec/codegen-h.xq 2013-02-07 17:24:36 +0000
4515+++ src/runtime/spec/codegen-h.xq 2013-07-30 11:18:26 +0000
4516@@ -89,6 +89,12 @@
4517 then
4518 "setDeterministic(false);&#xA;"
4519 else ""
4520+ let $annotations := string-join(
4521+ for $a in $function//zorba:annotation
4522+ return concat($gen:indent, $gen:indent, "addAnnotation(AnnotationInternal::", $a, ");", $gen:newline),
4523+ '')
4524+ let $funcVersionStr := if ($funcVersion eq "") then ""
4525+ else concat($gen:indent, $gen:indent, $funcVersion, $gen:newline)
4526 return
4527 concat($name, '(const signature&amp; sig, FunctionConsts::FunctionKind kind)',
4528 $gen:newline, $gen:indent,
4529@@ -96,8 +102,12 @@
4530 $gen:newline, $gen:indent, $gen:indent,
4531 local:base-class($function),
4532 '(sig, kind)',
4533- $gen:newline, $gen:indent,
4534- '{&#xA;', $setNoneDeterministic, $funcVersion, '&#xA;', $gen:indent, '}'),
4535+ $gen:newline,
4536+ $gen:indent, '{', $gen:newline,
4537+ $setNoneDeterministic,
4538+ $funcVersionStr,
4539+ $annotations,
4540+ $gen:indent, '}'),
4541
4542 $gen:newline,
4543
4544
4545=== modified file 'src/runtime/spec/collections/collections.xml'
4546--- src/runtime/spec/collections/collections.xml 2013-07-15 10:32:25 +0000
4547+++ src/runtime/spec/collections/collections.xml 2013-07-30 11:18:26 +0000
4548@@ -12,7 +12,7 @@
4549 xsi:schemaLocation="http://www.zorba-xquery.com ../runtime.xsd">
4550
4551 <zorba:source>
4552- <zorba:include form="Quoted">store/api/iterator.h</zorba:include>
4553+ <zorba:include form="Quoted">store/api/iterator.h</zorba:include>
4554 </zorba:source>
4555
4556 <zorba:header>
4557@@ -306,6 +306,7 @@
4558 </zorba:constructor>
4559
4560 <zorba:member type="bool" name="theIsDynamic" getterName="isDynamic"/>
4561+ <zorba:member type="store::Item_t" name="theDataguide" setterName="setDataguide"/>
4562
4563 <zorba:method const="true" name="isCountOptimizable" return="bool" />
4564
4565@@ -415,6 +416,7 @@
4566 </zorba:description>
4567
4568 <zorba:function generateCodegen="false">
4569+ <zorba:annotation>zann_explores_json</zorba:annotation>
4570
4571 <zorba:signature localname="insert-nodes" prefix="static-collections-dml">
4572 <zorba:param>xs:QName</zorba:param>
4573@@ -471,7 +473,8 @@
4574 </zorba:description>
4575
4576 <zorba:function generateCodegen="false">
4577-
4578+ <zorba:annotation>zann_explores_json</zorba:annotation>
4579+
4580 <zorba:signature localname="insert-nodes-first" prefix="static-collections-dml">
4581 <zorba:param>xs:QName</zorba:param>
4582 <zorba:param>node()*</zorba:param>
4583@@ -532,6 +535,7 @@
4584 </zorba:description>
4585
4586 <zorba:function generateCodegen="false">
4587+ <zorba:annotation>zann_explores_json</zorba:annotation>
4588
4589 <zorba:signature localname="insert-nodes-last" prefix="static-collections-dml">
4590 <zorba:param>xs:QName</zorba:param>
4591@@ -592,6 +596,7 @@
4592 </zorba:description>
4593
4594 <zorba:function generateCodegen="false">
4595+ <zorba:annotation>zann_explores_json</zorba:annotation>
4596
4597 <zorba:signature localname="insert-nodes-before" prefix="static-collections-dml">
4598 <zorba:param>xs:QName</zorba:param>
4599@@ -656,7 +661,8 @@
4600 </zorba:description>
4601
4602 <zorba:function generateCodegen="false">
4603-
4604+ <zorba:annotation>zann_explores_json</zorba:annotation>
4605+
4606 <zorba:signature localname="insert-nodes-after" prefix="static-collections-dml">
4607 <zorba:param>xs:QName</zorba:param>
4608 <zorba:param>node()</zorba:param>
4609@@ -722,6 +728,7 @@
4610 </zorba:description>
4611
4612 <zorba:function generateCodegen="false">
4613+ <zorba:annotation>zann_explores_json</zorba:annotation>
4614
4615 <zorba:signature localname="apply-insert-nodes" prefix="static-collections-dml">
4616 <zorba:param>xs:QName</zorba:param>
4617@@ -786,6 +793,7 @@
4618 </zorba:description>
4619
4620 <zorba:function generateCodegen="false">
4621+ <zorba:annotation>zann_explores_json</zorba:annotation>
4622
4623 <zorba:signature localname="apply-insert-nodes-first"
4624 prefix="static-collections-dml">
4625@@ -856,6 +864,7 @@
4626 </zorba:description>
4627
4628 <zorba:function generateCodegen="false">
4629+ <zorba:annotation>zann_explores_json</zorba:annotation>
4630
4631 <zorba:signature localname="apply-insert-nodes-last"
4632 prefix="static-collections-dml">
4633@@ -926,6 +935,7 @@
4634 </zorba:description>
4635
4636 <zorba:function generateCodegen="false">
4637+ <zorba:annotation>zann_explores_json</zorba:annotation>
4638
4639 <zorba:signature localname="apply-insert-nodes-before"
4640 prefix="static-collections-dml">
4641@@ -1000,6 +1010,7 @@
4642 </zorba:description>
4643
4644 <zorba:function generateCodegen="false">
4645+ <zorba:annotation>zann_explores_json</zorba:annotation>
4646
4647 <zorba:signature localname="apply-insert-nodes-after"
4648 prefix="static-collections-dml">
4649@@ -1281,6 +1292,7 @@
4650 </zorba:description>
4651
4652 <zorba:function generateCodegen="false">
4653+ <zorba:annotation>zann_explores_json</zorba:annotation>
4654
4655 <zorba:signature localname="edit" prefix="static-collections-dml">
4656 <zorba:param>structured-item()</zorba:param>
4657
4658=== modified file 'src/runtime/spec/json/jsoniq_functions.xml'
4659--- src/runtime/spec/json/jsoniq_functions.xml 2013-06-18 18:55:33 +0000
4660+++ src/runtime/spec/json/jsoniq_functions.xml 2013-07-30 11:18:26 +0000
4661@@ -92,6 +92,7 @@
4662 <zorba:iterator name="JSONEncodeForRoundtripIterator">
4663
4664 <zorba:function isDeterministic="true">
4665+ <zorba:annotation>zann_explores_json</zorba:annotation>
4666
4667 <zorba:signature localname="encode-for-roundtrip" prefix="fn-jsoniq">
4668 <zorba:param>item()*</zorba:param>
4669@@ -188,6 +189,7 @@
4670 </zorba:constructor>
4671
4672 <zorba:member type="QueryLoc" name="theRelativeLocation" />
4673+ <zorba:member type="store::Item_t" name="theDataguide" setterName="setDataguide"/>
4674
4675 <zorba:method return="bool" name="processBooleanOption" const="true">
4676 <zorba:param type="const store::Item_t&amp;" name="options"/>
4677@@ -273,6 +275,8 @@
4678
4679 <zorba:function isDeterministic="true"
4680 generateCodegen="false">
4681+
4682+ <zorba:annotation>zann_explores_json</zorba:annotation>
4683
4684 <zorba:signature localname="keys" prefix="fn-jsoniq">
4685 <zorba:param>item()*</zorba:param>
4686@@ -361,6 +365,10 @@
4687 <zorba:iterator name="JSONObjectProjectIterator" arity="binary">
4688
4689 <zorba:function isDeterministic="true">
4690+ <!-- TODO: project() could be used for document projection if the second
4691+ parameter is all consts. If this is done, this annotation should be
4692+ removed -->
4693+ <zorba:annotation>zann_explores_json</zorba:annotation>
4694
4695 <zorba:signature localname="project" prefix="fn-jsoniq">
4696 <zorba:param>object()</zorba:param>
4697@@ -475,6 +483,8 @@
4698 <zorba:iterator name="JSONArraySizeIterator" arity="unary">
4699
4700 <zorba:function isDeterministic="true">
4701+ <zorba:annotation>zann_explores_json</zorba:annotation>
4702+
4703 <zorba:signature localname="size" prefix="fn-jsoniq">
4704 <zorba:param>array()</zorba:param>
4705 <zorba:output>xs:integer</zorba:output>
4706
4707=== modified file 'src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml'
4708--- src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml 2013-02-07 17:24:36 +0000
4709+++ src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml 2013-07-30 11:18:26 +0000
4710@@ -47,6 +47,7 @@
4711 <zorba:description author="Zorba Team">fn:serialize</zorba:description>
4712
4713 <zorba:function>
4714+ <zorba:annotation>zann_explores_json</zorba:annotation>
4715
4716 <zorba:signature localname="serialize" prefix="fn" version="3.0">
4717 <zorba:param>item()*</zorba:param>
4718
4719=== modified file 'src/store/api/store.h'
4720--- src/store/api/store.h 2013-02-07 17:24:36 +0000
4721+++ src/store/api/store.h 2013-07-30 11:18:26 +0000
4722@@ -259,10 +259,12 @@
4723 *
4724 * @param QName the name of the collection
4725 * @param bool whether the collection searched is a dynamic or static collection
4726+ * @param dataguide the dataguie to be used for document projection and query
4727+ * push-down. Pass NULL if no dataguide is available
4728 * @return handle object of the collection. Returns NULL if the collection
4729 * does not exist
4730 */
4731- virtual Collection_t getCollection(const Item* name, bool isDynamic) = 0;
4732+ virtual Collection_t getCollection(const Item* name, bool isDynamic, const Item* dataguide = NULL) = 0;
4733
4734 /**
4735 * Returns an iterator that lists the names of all the available collections.
4736
4737=== modified file 'src/store/naive/json_items.cpp'
4738--- src/store/naive/json_items.cpp 2013-06-05 00:37:35 +0000
4739+++ src/store/naive/json_items.cpp 2013-07-30 11:18:26 +0000
4740@@ -696,8 +696,19 @@
4741 zstring SimpleJSONObject::show() const
4742 {
4743 std::stringstream str;
4744- str << "{ }";
4745-
4746+ str << "{";
4747+
4748+ for (unsigned int i=0; i<thePairs.size(); i++)
4749+ {
4750+ str << thePairs[i].first->getStringValue() << ": " ;
4751+ if (thePairs[i].second->isAtomic())
4752+ str << "\"" << thePairs[i].second->getStringValue() << "\"";
4753+ else
4754+ str << thePairs[i].second->show();
4755+ str << (i<thePairs.size()-1 ? ", " : "");
4756+ }
4757+
4758+ str << "}";
4759 return str.str();
4760 }
4761
4762
4763=== modified file 'src/store/naive/store.cpp'
4764--- src/store/naive/store.cpp 2013-07-02 21:32:23 +0000
4765+++ src/store/naive/store.cpp 2013-07-30 11:18:26 +0000
4766@@ -441,7 +441,8 @@
4767 ********************************************************************************/
4768 store::Collection_t Store::getCollection(
4769 const store::Item* name,
4770- bool isDynamic)
4771+ bool isDynamic,
4772+ const store::Item *dataguide)
4773 {
4774 if (name == NULL)
4775 return NULL;
4776
4777=== modified file 'src/store/naive/store.h'
4778--- src/store/naive/store.h 2013-06-15 02:57:08 +0000
4779+++ src/store/naive/store.h 2013-07-30 11:18:26 +0000
4780@@ -279,7 +279,7 @@
4781
4782 virtual void deleteCollection(const store::Item* name, bool isDynamic);
4783
4784- virtual store::Collection_t getCollection(const store::Item* name, bool isDynamic);
4785+ virtual store::Collection_t getCollection(const store::Item* name, bool isDynamic, const store::Item* dataguide = NULL);
4786
4787 virtual store::Iterator_t listCollectionNames(bool dynamic);
4788
4789
4790=== modified file 'src/system/globalenv.cpp'
4791--- src/system/globalenv.cpp 2013-07-02 21:32:23 +0000
4792+++ src/system/globalenv.cpp 2013-07-30 11:18:26 +0000
4793@@ -88,12 +88,12 @@
4794 m_globalEnv->theRootStaticContext = new root_static_context();
4795 m_globalEnv->theRootStaticContext->init();
4796
4797+ AnnotationInternal::createBuiltIn();
4798+
4799 m_globalEnv->theFunctionLib = new BuiltinFunctionLibrary();
4800
4801 m_globalEnv->theFunctionLib->populate(m_globalEnv->theRootStaticContext);
4802
4803- AnnotationInternal::createBuiltIn();
4804-
4805 #ifdef ZORBA_XQUERYX
4806 //libxml2 and libxslt are needed
4807 xmlInitMemory();
4808
4809=== modified file 'src/system/zorba_properties.h'
4810--- src/system/zorba_properties.h 2013-03-22 05:41:14 +0000
4811+++ src/system/zorba_properties.h 2013-07-30 11:18:26 +0000
4812@@ -38,12 +38,12 @@
4813 "--print-normalized", "--print-optimized", "--print-iterator-tree",
4814 "--print-item-flow", "--print-static-types", "--dump-lib",
4815 "--stable-iterator-ids", "--no-tree-ids", "--print-intermediate-opt",
4816- "--print-locations", "--force-gflwor", "--reorder-globals",
4817+ "--print-locations", "--print-dataguide", "--force-gflwor", "--reorder-globals",
4818 "--specialize-num", "--specialize-cmp", "--inline-udf", "--loop-hoisting",
4819 "--infer-joins", "--no-copy-optim", "--serialize-only-query",
4820 "--trace-translator", "--trace-codegen", "--trace-fulltext", "--debug",
4821 "--compile-only", "--lib-module", "--tz", "--external-var", "--serializer-param",
4822- "--iter-plan-test", "--dot-plan-file", "--plan", "jsoniq", "--max-udf-call-depth",
4823+ "--iter-plan-test", "--dot-plan-file", "--plan", "--jsoniq", "--max-udf-call-depth",
4824 "--CLASSPATH", NULL };
4825
4826 return result;
4827@@ -72,6 +72,7 @@
4828 bool theNoTreeIds;
4829 bool thePrintIntermediateOpt;
4830 bool thePrintLocations;
4831+ bool thePrintDataguide;
4832 bool theForceGflwor;
4833 bool theReorderGlobals;
4834 bool theSpecializeNum;
4835@@ -120,6 +121,7 @@
4836 theNoTreeIds = false;
4837 thePrintIntermediateOpt = false;
4838 thePrintLocations = false;
4839+ thePrintDataguide = false;
4840 theForceGflwor = false;
4841 theReorderGlobals = true;
4842 theSpecializeNum = true;
4843@@ -166,6 +168,7 @@
4844 const bool &noTreeIds () const { return theNoTreeIds; }
4845 const bool &printIntermediateOpt () const { return thePrintIntermediateOpt; }
4846 const bool &printLocations () const { return thePrintLocations; }
4847+ const bool &printDataguide () const { return thePrintDataguide; }
4848 const bool &forceGflwor () const { return theForceGflwor; }
4849 const bool &reorderGlobals () const { return theReorderGlobals; }
4850 const bool &specializeNum () const { return theSpecializeNum; }
4851@@ -191,6 +194,8 @@
4852 const bool& jsoniqParser() const { return theJsoniqParser; }
4853 const uint32_t &maxUdfCallDepth () const { return theMaxUdfCallDepth; }
4854 const std::string &CLASSPATH () const { return theCLASSPATH; }
4855+
4856+ void setPrintDataguide() { thePrintDataguide = true; }
4857
4858 std::string load_argv (int argc, const char **argv)
4859 {
4860@@ -289,6 +294,9 @@
4861 else if (strcmp (*argv, "--print-locations") == 0) {
4862 thePrintLocations = true;
4863 }
4864+ else if (strcmp (*argv, "--print-dataguide") == 0) {
4865+ thePrintDataguide = true;
4866+ }
4867 else if (strcmp (*argv, "--force-gflwor") == 0) {
4868 theForceGflwor = true;
4869 }
4870@@ -479,6 +487,7 @@
4871 "--no-tree-ids\nsuppress ids and locations from compiler tree dumps\n\n"
4872 "--print-intermediate-opt\nprint intermediate optimizations\n\n"
4873 "--print-locations\nprint parser locations for compiler expressions\n\n"
4874+"--print-dataguide\nprint the JSON dataguides\n\n"
4875 "--force-gflwor\nforce compiler to generate GFLWOR iterators\n\n"
4876 "--reorder-globals\nreorder global variables (1=enabled (default), 0=off)\n\n"
4877 "--specialize-num\nspecialize numerics (1=enabled (default), 0=off)\n\n"
4878@@ -501,6 +510,7 @@
4879 "--iter-plan-test\nrun as iterator plan test\n\n"
4880 "--dot-plan-file\ngenerate the dot iterator plan\n\n"
4881 "--plan\ntest plan serialization, i.e. save the plan, load it back and then execute it\n\n"
4882+"--jsoniq, -j\nuse the JSONiq grammar to parse the query\n\n"
4883 "--max-udf-call-depth\nmaximum stack depth of udf function calls\n\n"
4884 "--CLASSPATH\nJVM classpath to be used by modules using Java implementations\n\n"
4885 ;
4886
4887=== modified file 'src/system/zorba_properties.txt'
4888--- src/system/zorba_properties.txt 2013-03-22 05:41:14 +0000
4889+++ src/system/zorba_properties.txt 2013-07-30 11:18:26 +0000
4890@@ -16,6 +16,7 @@
4891 ("print-iterator-tree,i", "print the iterator tree")
4892 ("print-item-flow,f", "show items produced by all iterators")
4893 ("print-static-types", po::value<bool> ()->default_value (true), "print static type inference")
4894+ ("print-dataguide", "print JSON dataguides")
4895 ("dump-lib", "dump function library")
4896 ("stable-iterator-ids", "print the iterator plan with stable ids")
4897 ("no-tree-ids", "suppress ids and locations from compiler tree dumps")
4898
4899=== modified file 'test/driver/specification.h'
4900--- test/driver/specification.h 2013-05-16 08:22:46 +0000
4901+++ test/driver/specification.h 2013-07-30 11:18:26 +0000
4902@@ -55,7 +55,8 @@
4903 theInline(false),
4904 theComparisonMethod("Fragment"),
4905 theEnableDtd(false),
4906- theEnableUriTestResolver(false)
4907+ theEnableUriTestResolver(false),
4908+ thePrintDataguide(false)
4909 #ifndef ZORBA_NO_FULL_TEXT
4910 ,
4911 theStopWordsMapper(zorba::EntityData::STOP_WORDS),
4912@@ -81,6 +82,7 @@
4913 bool theUseIndent;
4914 bool theEnableDtd;
4915 bool theEnableUriTestResolver;
4916+ bool thePrintDataguide;
4917 #ifndef ZORBA_NO_FULL_TEXT
4918 zorba::OneToOneURIMapper theStopWordsMapper;
4919 zorba::OneToOneURIMapper theThesaurusMapper;
4920@@ -229,6 +231,10 @@
4921 bool getEnableUriTestResolver() const {
4922 return theEnableUriTestResolver;
4923 }
4924+
4925+ bool getPrintDataguide() const {
4926+ return thePrintDataguide;
4927+ }
4928
4929 void tokenize(const std::string& str,
4930 std::vector<std::string>& tokens,
4931@@ -305,7 +311,8 @@
4932 (str.find("DefaultCollection:")!=std::string::npos) ||
4933 (str.find("Error:")!=std::string::npos) ||
4934 (str.find("Date:")!=std::string::npos) ||
4935- (str.find("Timezone:")!=std::string::npos));
4936+ (str.find("Timezone:")!=std::string::npos) ||
4937+ (str.find("Dataguide:")!=std::string::npos));
4938 return c;
4939 }
4940
4941@@ -491,6 +498,12 @@
4942 if(lIter == tokens.end() ) { return false; }
4943 setTimezone(lIter->begin(), lIter->end());
4944 }
4945+ else if ( *lIter == "Dataguide:" )
4946+ {
4947+ ++lIter;
4948+ if(lIter == tokens.end() ) { return false; }
4949+ thePrintDataguide = true;
4950+ }
4951 else
4952 {
4953 break;
4954
4955=== modified file 'test/driver/testdriver.cpp'
4956--- test/driver/testdriver.cpp 2013-06-15 02:57:08 +0000
4957+++ test/driver/testdriver.cpp 2013-07-30 11:18:26 +0000
4958@@ -248,6 +248,10 @@
4959 // If command-line argument --module-path passed, set up module paths.
4960 setModulePaths(lModulePath, lContext);
4961
4962+ // If dataguide printing is requested, enable it in the properties
4963+ if (lSpec.getPrintDataguide())
4964+ zorba::Properties::instance()->setPrintDataguide();
4965+
4966 // Get the pathnames of the reference-result files found in the .spec
4967 // file (if any).
4968 std::vector<std::string> lRefFiles;
4969@@ -325,8 +329,22 @@
4970 bool lJSONiqMode =
4971 (lQueryFile.rfind(".jq") == lQueryFile.size() - 3);
4972
4973- if (lJSONiqMode) lContext->setJSONiqVersion(zorba::jsoniq_version_1_0);
4974- lQuery->compile(lQueryString.c_str(), lContext, getCompilerHints());
4975+ if (lJSONiqMode)
4976+ lContext->setJSONiqVersion(zorba::jsoniq_version_1_0);
4977+
4978+ // Create and open the results file here so that the dataguide tests can use it to output projection information
4979+ std::ofstream lResFileStream(lResultFile.c_str());
4980+ assert (lResFileStream.good());
4981+ std::streambuf *coutbuf = std::cout.rdbuf(); //save old buf
4982+
4983+ if (lSpec.getPrintDataguide())
4984+ std::cout.rdbuf(lResFileStream.rdbuf());
4985+
4986+ lQuery->compile(lQueryString.c_str(), lContext, getCompilerHints());
4987+
4988+ // reset cout to standard output
4989+ if (lSpec.getPrintDataguide())
4990+ std::cout.rdbuf(coutbuf);
4991
4992 errors = -1;
4993 if ( errHandler.errors() )
4994@@ -422,8 +440,7 @@
4995 errors = -1;
4996 {
4997 // serialize xml/txt
4998- std::ofstream lResFileStream(lResultFile.c_str());
4999- assert (lResFileStream.good());
5000+
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches