Support #6039
closedQuestions regarding QueryLibrary feature
0%
Description
We have multiple xquery files used in our product, each of which have nested imports. We are trying to build a solution to optimize compilation of these xquery modules using the QueryLibrary feature provided in saxon ee . There are some errors we face, can you let us know your recommendation for solving the below issues:
Problem
There are some xqueries XQ1, XQ2 which have a set of nested imports as shown below
XQ1
/
A D
/
B C
/
C
/
B
XQ2 - B - C - B
Preferable Solution: Separate QueryLibrary for each of A, B, C, D, XQ1 and XQ2. Steps to be followed:
- Maintain a cache of QueryLibrary
- When any import is encountered during compilation, check the cache - if present link it, if not compile into a QueryLibrary and then link, so that it can be used in subsequent imports.
Issues: - Repeated imports - C is imported from both A and D. When A and D are imported into XQ1, the functions of C get added twice and result in "Function already present" error. This happens as the functions from C don’t get recognized as duplicate in the QueryLibraryImpl - link function. - Question: Is it ok to override the link function to allow proper checking of this duplicate function, so that it works in our case? Would there be any risks to doing this? If so, any other workaround recommended?
- **Cyclic imports** - Trying to create QueryLibrary for modules that have cyclic dependencies leads to infinite import loop, or function not found error if empty modules are attached to get over the infinite loop.
Question: Is this by design(the cyclic imports should be packaged together in a single QueryLIbrary), or is there a way to create separate QueryLibraries for each of the imports in this case?
Files
Please register to edit this issue