Project

Profile

Help

Support #6039

closed

Questions regarding QueryLibrary feature

Added by Jai Mashalkar 11 months ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2023-05-15
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Java

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

TestXQueryCompiler.java (28.7 KB) TestXQueryCompiler.java Saxonica unit tests for XQueryCompiler Michael Kay, 2023-05-15 16:24

Please register to edit this issue

Also available in: Atom PDF