Hi list,
since my XQuery's share some common utility functions, I created a "global.xq" file to contain those functions, and the actual scripts import that file using
import module namespace red-db="red-db" at "global.xq";
However, BaseX then looks for that file in the working directory where it was started. Is there any way to configure that behaviour, e.g. to look into the HTTPPATH folder the script is located in, or maybe to make the lookup relative to the script that contains this command? Currently I always have to cd to the HTTPPATH folder before starting BaseX.
I am using the current git master version.
Kind regards, Ralf
Hi Ralf,
well, I guess, this is the default Java behavior, and AFAIK BaseX does not provide such an option (but I need to check).
However, you may find that using the packaging API [1] is a much more convenient way of managing XQuery module libraries.
Greetings, Dimitar
[1] http://docs.basex.org/wiki/Packaging
Am Donnerstag, 22. September 2011, 13:19:47 schrieb Ralf Jung:
Hi list,
since my XQuery's share some common utility functions, I created a "global.xq" file to contain those functions, and the actual scripts import that file using
import module namespace red-db="red-db" at "global.xq";
However, BaseX then looks for that file in the working directory where it was started. Is there any way to configure that behaviour, e.g. to look into the HTTPPATH folder the script is located in, or maybe to make the lookup relative to the script that contains this command? Currently I always have to cd to the HTTPPATH folder before starting BaseX.
I am using the current git master version.
Kind regards, Ralf _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hi Dimitar,
However, you may find that using the packaging API [1] is a much more convenient way of managing XQuery module libraries.
This is just a simple xq file with four functions, me being the only user. I don't really want to learn a whole new API and whatnot to get it imported.
The relevant code seems to be in QueryParser.io: IO fl = IO.get(fn); // if file does not exist, try base uri if(!fl.exists()) { final IO base = ctx.base(); if(base != null) fl = base.merge(fn); } // if file does not exist, try query directory if(!fl.exists() && file != null) fl = file.merge(fn); However, both ctx.base() and file are null for the query run though /rest?run=name.xq, so it does not find the other file.
Kind regards, Ralf
Ralf,
thanks for the observation. I've got some ideas how to fix it properly.
Getting back to you, Christian ________________________
On Thu, Sep 22, 2011 at 1:19 PM, Ralf Jung ralfjung-e@gmx.de wrote:
Hi list,
since my XQuery's share some common utility functions, I created a "global.xq" file to contain those functions, and the actual scripts import that file using
import module namespace red-db="red-db" at "global.xq";
However, BaseX then looks for that file in the working directory where it was started. Is there any way to configure that behaviour, e.g. to look into the HTTPPATH folder the script is located in, or maybe to make the lookup relative to the script that contains this command? Currently I always have to cd to the HTTPPATH folder before starting BaseX.
I am using the current git master version.
Kind regards, Ralf _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
since my XQuery's share some common utility functions, I created a "global.xq" file to contain those functions, and the actual scripts import that file using
import module namespace red-db="red-db" at "global.xq";
However, BaseX then looks for that file in the working directory where it was started.
..should be fixed; please check out the latest sources.
Hi Christian,
thanks a lot, it's working :)
Kind regards, Ralf
On Thursday 22 September 2011 15:04:16 Christian Grün wrote:
since my XQuery's share some common utility functions, I created a "global.xq" file to contain those functions, and the actual scripts import that file using
import module namespace red-db="red-db" at "global.xq";
However, BaseX then looks for that file in the working directory where it was started.
..should be fixed; please check out the latest sources.
basex-talk@mailman.uni-konstanz.de