BaseX for noobs : how to add user module ?
Monday, 30 December 2013 · 4 messages
JM
jean-marc Mercier30 Dec 2013 12:03 #
Hello,
I am trying to add some external features to BaseX, and would like to use them into a BaseX client XQUERY module. I can't see any simple way to do it, is there any ?
Here is the scenario : suppose that you want to add a super-mega map module to BaseX, let us call it supermegamap, that is a collection of functions : supermegamap:new, supermegamap:contains, supermegamap:get.
I would like to use my supermegamap through BaseX via a xquery module : let $my_supermegamp := supermegamap:new().
I see only two quite not very handy ways to do this :
1) The first one is to use JAVA bindings. Ok, it will work, but is not really elegant.
2) The second one is to fork BaseX code : adding the JAVA code to BaseX, modifying the file Function.JAVA. That might work, should be efficient, but it is quite heavy, and overall, will be most probably a dead-code the next time I will have to upgrade BaseX.
Is there any alternative way ?
Thx
Jean-Marc
FG
Florent Georges30 Dec 2013 13:02 #
Quoted text · jean-marc Mercier · 1 line
On 30 December 2013 12:03, jean-marc Mercier wrote:
Hi Jean-Marc,
Quoted text · jean-marc Mercier · 8 lines
> I see only two quite not very handy ways to do this : > 1) The first one is to use JAVA bindings. Ok, it will work, but is > not really elegant. > 2) The second one is to fork BaseX code : adding the JAVA code to > BaseX, modifying the file Function.JAVA. That might work, should be > efficient, but it is quite heavy, and overall, will be most probably > a dead-code the next time I will have to upgrade BaseX. > Is there any alternative way ?
If I understand correctly, you want to use an extension library module, written in Java, from another XQuery module. The following page on BaseX wiki document how to do it with a package:
http://docs.basex.org/wiki/Repository#EXPath_Packaging
Regards,
--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
AB
Hi Jean-marc,
Have you looked at using the repository? [1] There is a more complex example at [2]
Regards
/Andy
[1] http://docs.basex.org/wiki/Repository#Java
[2] http://files.basex.org/modules/org/basex/modules/StringSimilarity/
Quoted text · jean-marc Mercier · 42 lines
On Mon, Dec 30, 2013 at 11:03 AM, jean-marc Mercier < jeanmarc.mercier at gmail.com> wrote: > Hello, > > I am trying to add some external features to BaseX, and would like to use > them into a BaseX client XQUERY module. I can't see any simple way to do > it, is there any ? > > Here is the scenario : suppose that you want to add a super-mega map > module to BaseX, let us call it supermegamap, that is a collection of > functions : supermegamap:new, supermegamap:contains, supermegamap:get. > > I would like to use my supermegamap through BaseX via a xquery module : > let $my_supermegamp := supermegamap:new(). > > I see only two quite not very handy ways to do this : > > 1) The first one is to use JAVA bindings. Ok, it will work, but is not > really elegant. > 2) The second one is to fork BaseX code : adding the JAVA code to BaseX, > modifying the file Function.JAVA. That might work, should be efficient, but > it is quite heavy, and overall, will be most probably a dead-code the next > time I will have to upgrade BaseX. > > Is there any alternative way ? > > Thx > > Jean-Marc > > > > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
JM
jean-marc Mercier30 Dec 2013 13:36 #
Hi,
@Andy, @Florent,
Thx for answering !
@Andy. I know a little bit the repository. Indeed, I am using it to add Java bindings to BaseX. However, I am looking to an alternative solution. @Florent. Thanx for pointing me this link, it seems to be exactly what I am looking for.
Cheers,
Jean-Marc
2013/12/30 Andy Bunce <bunce.andy at gmail.com>
Quoted text · Andy Bunce · 56 lines
> Hi Jean-marc, > > Have you looked at using the repository? [1] There is a more complex > example at [2] > > Regards > /Andy > > [1] http://docs.basex.org/wiki/Repository#Java > [2] http://files.basex.org/modules/org/basex/modules/StringSimilarity/ > > > On Mon, Dec 30, 2013 at 11:03 AM, jean-marc Mercier < > jeanmarc.mercier at gmail.com> wrote: > >> Hello, >> >> I am trying to add some external features to BaseX, and would like to use >> them into a BaseX client XQUERY module. I can't see any simple way to do >> it, is there any ? >> >> Here is the scenario : suppose that you want to add a super-mega map >> module to BaseX, let us call it supermegamap, that is a collection of >> functions : supermegamap:new, supermegamap:contains, supermegamap:get. >> >> I would like to use my supermegamap through BaseX via a xquery module : >> let $my_supermegamp := supermegamap:new(). >> >> I see only two quite not very handy ways to do this : >> >> 1) The first one is to use JAVA bindings. Ok, it will work, but is not >> really elegant. >> 2) The second one is to fork BaseX code : adding the JAVA code to BaseX, >> modifying the file Function.JAVA. That might work, should be efficient, but >> it is quite heavy, and overall, will be most probably a dead-code the next >> time I will have to upgrade BaseX. >> >> Is there any alternative way ? >> >> Thx >> >> Jean-Marc >> >> >> >> >> >> >> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> >
Written for BaseX 7.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery