database modules

View: New views
6 Messages — Rating Filter:   Alert me  

database modules

by Michael Sokolov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When loading an xquery module from the database, you can do something like:

import module namespace
rc="http://www.ifactory.com/press/result-context" at
"xmldb:exist:///db/lrgdev/lib/result-context.xqy";


Now if result-context.xqy depends on another module (say kwic.xql),
which is also loaded in the database, in the same collection, the
relative import:

import module namespace kwic="http://exist-db.org/xquery/kwic" at
"kwic.xql";

should work, I think, but it attempts to load the module from the
filesystem and fails with an error like:

...
cannot read module source from file at kwic.xqy. Tried
/proj/exist/eXist/./kwic.xqy and /proj/exist/eXist/kwic.xqy
 ...
)

doesn't it seem as if the path ought to be relative to the including
module's path?

But whether that's true or not, is there any way to specify the include
without using an absolute path in the database (I want to be able to
have my code relocated to a new collection)?

Thanks

-Mike

------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: database modules

by Dannes Wessels-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 25 Jun 2009, at 20:27 , Mike Sokolov wrote:

But whether that's true or not, is there any way to specify the include 
without using an absolute path in the database (I want to be able to 
have my code relocated to a new collection)?

There is already a bug report for this, I tried to solve it but was not successful that time. Relative resolving of imports of xq modules...... would make apps better  "portable" ....

Maybe I should try again....

Kind regards

Dannes

--
eXist-db Native XML Database - http://exist-db.org










------------------------------------------------------------------------------

_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

smime.p7s (2K) Download Attachment

Re: database modules

by Michael Sokolov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I went a bit further, trying:

import module namespace kwic="http://exist-db.org/xquery/kwic" at "xmldb:exist:kwic.xqy";

and it appears there was an attempt to look for the file in the db, but it wasn't found (not sure what path was tried, the error just said "not found in database").

if you send me a pointer I wouldn't mind having a go at the source, although I'd be thrilled if you would take care of it :)

-Mike

Dannes Wessels wrote:

On 25 Jun 2009, at 20:27 , Mike Sokolov wrote:

But whether that's true or not, is there any way to specify the include 
without using an absolute path in the database (I want to be able to 
have my code relocated to a new collection)?

There is already a bug report for this, I tried to solve it but was not successful that time. Relative resolving of imports of xq modules...... would make apps better  "portable" ....

Maybe I should try again....

Kind regards

Dannes

--
eXist-db Native XML Database - http://exist-db.org









------------------------------------------------------------------------------

_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: database modules

by Wolfgang Meier-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> There is already a bug report for this, I tried to solve it but was
>> not successful that time. Relative resolving of imports of xq
>> modules...... would make apps better  "portable" ....

I think what we need to do is to overwrite "moduleLoadPath" in class
ModuleContext to contain the path to the module, not to the main query.
Right now, moduleLoadPath is set to the path of the parent context.

Wolfgang

------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

PATCH posted (was Re: database modules)

by Michael Sokolov-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I posted a patch here that addresses this issue (1688224 in the bug
tracker).  It includes a test of nested relative module include that
failed before and now works.

https://sourceforge.net/tracker/?func=detail&aid=2812962&group_id=17691&atid=317691

-Mike

Wolfgang wrote:

>>> There is already a bug report for this, I tried to solve it but was
>>> not successful that time. Relative resolving of imports of xq
>>> modules...... would make apps better  "portable" ....
>
> I think what we need to do is to overwrite "moduleLoadPath" in class
> ModuleContext to contain the path to the module, not to the main
> query. Right now, moduleLoadPath is set to the path of the parent
> context.
>
> Wolfgang

------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open

Re: PATCH posted (was Re: database modules)

by thomas.0007 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have been waiting for this feature. Good job!

Wolfgang, are we going to include this patch in the trunk?


Thomas


"Mike Sokolov" <sokolov@...> wrote in message
news:4A452F88.7090000@......

>I posted a patch here that addresses this issue (1688224 in the bug
> tracker).  It includes a test of nested relative module include that
> failed before and now works.
>
> https://sourceforge.net/tracker/?func=detail&aid=2812962&group_id=17691&atid=317691
>
> -Mike
>
> Wolfgang wrote:
>>>> There is already a bug report for this, I tried to solve it but was
>>>> not successful that time. Relative resolving of imports of xq
>>>> modules...... would make apps better  "portable" ....
>>
>> I think what we need to do is to overwrite "moduleLoadPath" in class
>> ModuleContext to contain the path to the module, not to the main
>> query. Right now, moduleLoadPath is set to the path of the parent
>> context.
>>
>> Wolfgang
>
> ------------------------------------------------------------------------------



------------------------------------------------------------------------------
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open