Open cmsmcq opened 2 years ago
Hi Michael, when you say "create a file" could you provide more detail about the steps you're taking? Are you saving the file or running it in an unsaved state? If the former, are you saving it to disk or to the database?
Hi Michael, when you say "create a file" could you provide more detail about the steps you're taking? Are you saving the file or running it in an unsaved state? If the former, are you saving it to disk or to the database?
Sure; sorry to have been vague.
I did not experiment with saving the query to the eXist database from Oxygen.
When I now use the Data Source Explorer in Oxygen to retrieve the version of the query I saved from exide in the eXist database, evaluating the query with eXist shows the static base URI as /db
. (And, for comparison, evaluating it with Saxon PE shows it as oxygen:/eXist-db%20localhost$eXist-db%20localhost/db/tmp/uri-testing.xq
).
Describe the bug When an XQuery module evaluated within Oxygen calls the static-base-uri() function, the value returned ("/db") is not the URI of the query module and is not an absolute URI.
When the same module (or at least, as close to "the same" as cut and paste can manage) is evaluated within exide, no value is returned.
Expected behavior The expected behavior of static-base-uri() is to return the base URI in the static context. This is defined by XPath 3.1, sec. 2.1.1 as "an absolute URI, used to resolve relative URI references".
XQuery sec. 4.5 explains that the static base URI can be set by the user and that if not set by the user it defaults (to put it informally) to the location of the query module:
To Reproduce In Oxygen, after setting things up as described in the eXist-db documentation, create an XQuery file with the following content:
On my system, this returns
As a side note: in exide, this returns an error report:
If the two
rel
elements are commented out, it returnsDiscussion
There are several distinct problems in the current behavior:
/db
), which is by definition not an absolute URI and thus does not match the description in the spec.N.B. It is not, strictly speaking, non-conforming for the static base URI property to be unset, or to be set to a value that is not the URI of the query module; both the XQuery spec and the relevant RFCs foresee the possibility of resources (here query modules) for which no URI is available. But all the relevant specs seem to be clear that this is an undesirable situation, and I think they make clear that a good-faith effort to identify the appropriate base URI is required for conformance. Since when running the query from exide, eXist clearly does have a path for the query and so can construct a URI for it, I think the failure to set the static base URI property is a bug. I don't know what information passes between Oxygen and eXist, so I do not know for a fact that in that case eXist has access to the URI for the query module -- but other query processors appear to have access to it, so I expect eXist can get access to it.
The failure to set the static base URI property properly is currently troubling me because it is making it harder for me to make a set of library modules work in eXist.
Context (please always complete the following information):
java -version
returnsAdditional context
conf.xml
? No.