Dear BaseX team, the query plans produced by xquery:parse-uri represent the state reached after resolving all imports. In particular, if module A imports module B and B contains a function F called by A, then function F is contained in the plan of module A, although the definition of function F is contained by module B, not by module A. And I think there is not way of finding out that fact.
I understand that the behaviour is exactly what is required for compiling and executing the plans, but for purposes of analysis it would be great if it were possible to determine whether module A CONTAINS OR IMPORTS the definition of function F. A boolean flag (e.g. "<StaticFunc imported='true' ...") would suffice! Then, given a pool of modules, one could determine where to find what. As a hilarious fact, this feature (those boolean flags) would be very helpful in order to repair applications run with (or also with) the Saxon processor and "broken" by recent changes of Saxon: formerly, Saxon was tolerant about calling functions contained by *indirectly* imported modules (e.g. module A imports B, B imports C, A was allowed to call functions in C). This is now changed (A must import C explicitly), and repair of large-scale application would be greatly facilitated if the query plans could be evaluated as sketched. In fact, one could easily produce a report telling exactly which imports to add to which modules. So BaseX could lend a helping hand to Saxon users. Apart from that, of course, the feature would generally be great for supporting applications of code analysis. Cheers,Hans-Jürgen