Hi Andy,
 
there are no reservations from my part about the namespace. But I would not overload a namespace with too much information. Feel free to have it refer to the package rather than to resources backing it.
 
Best regards
Gunther
 
 
Gesendet: Dienstag, 12. April 2016 um 00:21 Uhr
Von: "Andy Bunce" <bunce.andy@gmail.com>
An: "Gunther Rademacher" <grd@gmx.net>
Cc: "Christian Grün" <christian.gruen@gmail.com>, "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo
Hi Gunther,
 
Thanks for the 5.39 update.
It is not how to set the namespace but what would be the best choice of namespace here :)
 
I would like to make it clear that I am just packaging your good work here (almost 40 years from the copyright?).
I find choosing namespaces the hardest part of XQuery. I guess bottlecaps is about bottlecaps and not the right thing to use here.
 
Best regards
/Andy
 
 
On 11 April 2016 at 21:59, Gunther Rademacher <grd@gmx.net> wrote:
Hi Andy,
 
the default constructor for -basex has been added with REx v5.39.
 
For controlling the namespace, please use the "Name/Namespace" option at parser generation time. Its effect depends on the target:
  • for XQuery, it will be used as the module namespace. The output file name still depends on the input file name,
  • for Java, it will be used as the package- and class name, thus also affecting the output file name, and for -basex the external function/module namespace.
Best regards
Gunther
 
Gesendet: Sonntag, 10. April 2016 um 23:27 Uhr
Von: "Andy Bunce" <bunce.andy@gmail.com>
An: "Christian Grün" <christian.gruen@gmail.com>
Cc: "Gunther Rademacher" <grd@gmx.net>, "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from repo
Hi Gunther Christian,

>Will take care of this.
 
Thanks that's great. I have added the constructor by hand for a couple of examples and released a new ex-xparse version [1] based on this. I am very happy with the results - it is orders of magnitude faster and more functional than the previous version.
I would welcome any comments on this in general or on this issue [2]
 
 
On 8 April 2016 at 12:01, Christian Grün <christian.gruen@gmail.com> wrote:
+1 ;)


On Fri, Apr 8, 2016 at 12:45 PM, Gunther Rademacher <grd@gmx.net> wrote:
> Hi Andy,
>
> thanks for the hint, it helped me reproducing the problem.
>
> Well, if a BaseX repository module needs a zero argument constructor, it
> makes sense to have REx create one as an effect of the -basex option. Will
> take care of this.
>
> Best regards
> Gunther
>
> Gesendet: Freitag, 08. April 2016 um 11:34 Uhr
> Von: "Andy Bunce" <bunce.andy@gmail.com>
> An: "Gunther Rademacher" <grd@gmx.net>
> Cc: "Christian Grün" <christian.gruen@gmail.com>,
> "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
>
> Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo
> Hi,
> I want a solution that lives in the repository. This is to allow
> installation to be automated. That is not to require users to manually place
> jar files and/or edit classpaths. I think this requires the "import module"
> form.
>
> I am happy to go with Christian's Java extra class or maybe Ex-path xar
> packaging with a small XQuery module and the existing jar in order to
> achieve this.
>
> Thanks
> /Andy
>
>
> On 8 April 2016 at 10:30, Gunther Rademacher <grd@gmx.net> wrote:
>>
>> ...sorry, I mixed up "declare" and "import" in my previous post. It should
>> have been:
>>
>>
>> Hi Christian,
>>
>> but the instantiation occurs only when the calling code uses "import
>> module", right? I still can't see a problem when just declaring the
>> namespace properly.
>>
>> It remains unclear to me why "import module" would be necessary here. Is
>> that because the calling code should be the same, regardless of using an
>> XQuery module or a Java coded module? But isn't the Java variant supposed to
>> have a URI using the "java:" scheme? I noticed that this is not enforced,
>> though.
>>
>> Best regards
>> Gunther
>>
>>
>> Gesendet: Freitag, 08. April 2016 um 08:55 Uhr
>> Von: "Christian Grün" <christian.gruen@gmail.com>
>> An: "Gunther Rademacher" <grd@gmx.net>
>> Cc: "Andy Bunce" <bunce.andy@gmail.com>,
>> "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
>> Betreff: Re: Re: [basex-talk] Problem deleting jar packaged item from repo
>> Hi Gunther,
>>
>> I agree, it wouldn’t make too much sense to add a default constructor
>> to your code as long as there is the one-argument constructor that
>> will be called by the parseXQuery function.
>>
>> The reason why a default constructor is required in BaseX is because
>> "import module" will always create an instance of the imported Java
>> class, which can then be addressed in the XQuery code, using the
>> assigned prefix [1].
>>
>> @Andy: For creating a BaseX module, you could add another simple Java
>> class, which will then call the actual parser class:
>>
>> import org.basex.query.value.item.Str;
>> import org.basex.query.value.node.ANode;
>> public class XQuery31Parser {
>> public ANode parseXQuery(Str str) throws IOException {
>> return CR_xquery_31_20151217.parseXQuery(str);
>> }
>> }
>>
>> Hope this helps,
>> Christian
>>
>> [1] http://docs.basex.org/wiki/Java_Bindings#Module_Imports
>>
>>
>>
>> On Thu, Apr 7, 2016 at 11:54 PM, Gunther Rademacher <grd@gmx.net> wrote:
>> > Hi Andy, Christian,
>> >
>> > a default constructor is added implicitly, when a class does not provide
>> > any
>> > constructors itself. A REx-generated class however comes with a
>> > constructor.
>> > In that case any instantiation must provide arguments for some defined
>> > constructor.
>> >
>> > However I do not see a real reason for instantiating the class at load
>> > time.
>> > The generated parse function is static and it takes care of
>> > instantiating a
>> > parser object internally.
>> >
>> > I just did a quick test and found that I see this instantiating problem
>> > when
>> > using "import module namespace ...". No problem when using "declare
>> > namespace ...." or just an EQName literal instead. I have put my
>> > extension
>> > function class files into the classpath for checking this.
>> >
>> > Am I missing something here?
>> >
>> > Best regards
>> > Gunther
>> >
>> > Gesendet: Donnerstag, 07. April 2016 um 19:34 Uhr
>> > Von: "Christian Grün" <christian.gruen@gmail.com>
>> > An: "Andy Bunce" <bunce.andy@gmail.com>
>> > Cc: "Gunther Rademacher" <grd@gmx.net>,
>> > "basex-talk@mailman.uni-konstanz.de"
>> > <basex-talk@mailman.uni-konstanz.de>
>> > Betreff: Re: [basex-talk] Problem deleting jar packaged item from repo
>> >> I can't see why Java's Default Constructor [1] rule does not apply
>> >> here?
>> >
>> > Well, me neither ;) Maybe it’s got to do with the way we instantiate
>> > the class via reflection? I didn’t track this down yet (I should
>> > probably do so).
>> >
>> >
>> >> /Andy
>> >> http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.8.9
>> >>
>> >> On 7 April 2016 at 17:58, Christian Grün <christian.gruen@gmail.com>
>> >> wrote:
>> >>>
>> >>> > No constructor is the issue. Adding
>> >>> > public CR_xquery_31_20151217() {}
>> >>> > to java src fixes it.
>> >>>
>> >>> Thanks! @Gunther: Do you think such a dummy constructor could be added
>> >>> to the Java class?
>> >>>
>> >>>
>> >>>
>> >>> > On 7 April 2016 at 16:05, Andy Bunce <bunce.andy@gmail.com> wrote:
>> >>> >>
>> >>> >> C:\Program Files (x86)\BaseX\bin
>> >>> >> +>basex -d
>> >>> >> BaseX 8.4.3 beta d7bbbe7 [Standalone]
>> >>> >> Try 'help' to get more information.
>> >>> >> > xquery import module namespace
>> >>> >> > p="org.basex.modules.CR_xquery_31_20151217";2
>> >>> >> Creating Database...
>> >>> >> . 27.04 ms (25844 KB)
>> >>> >> Creating Database...
>> >>> >> . 4.83 ms (25844 KB)
>> >>> >> Creating Database...
>> >>> >> . 5.0 ms (25844 KB)
>> >>> >> Creating Database...
>> >>> >> . 3.52 ms (26509 KB)
>> >>> >> Creating Database...
>> >>> >> . 4.36 ms (26509 KB)
>> >>> >> Creating Database...
>> >>> >> . 8.26 ms (26509 KB)
>> >>> >> Creating Database...
>> >>> >> . 8.37 ms (26509 KB)
>> >>> >> Creating Database...
>> >>> >> . 4.32 ms (27175 KB)
>> >>> >> Creating Database...
>> >>> >> . 11.38 ms (27175 KB)
>> >>> >> java.lang.InstantiationException:
>> >>> >> org.basex.modules.CR_xquery_31_20151217
>> >>> >> at java.lang.Class.newInstance(Unknown Source)
>> >>> >> at
>> >>> >>
>> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124)
>> >>> >> at
>> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772)
>> >>> >> at
>> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758)
>> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172)
>> >>> >> at
>> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223)
>> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57)
>> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145)
>> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159)
>> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267)
>> >>> >> at org.basex.core.Command.execute(Command.java:94)
>> >>> >> at
>> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132)
>> >>> >> at org.basex.api.client.Session.execute(Session.java:36)
>> >>> >> at org.basex.core.CLI.execute(CLI.java:103)
>> >>> >> at org.basex.core.CLI.execute(CLI.java:87)
>> >>> >> at org.basex.BaseX.console(BaseX.java:191)
>> >>> >> at org.basex.BaseX.<init>(BaseX.java:166)
>> >>> >> at org.basex.BaseX.main(BaseX.java:42)
>> >>> >> Caused by: java.lang.NoSuchMethodException:
>> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>()
>> >>> >> at java.lang.Class.getConstructor0(Unknown Source)
>> >>> >> ... 18 more
>> >>> >> org.basex.query.QueryException: Could not instantiate
>> >>> >> org.basex.modules.CR_xquery_31_20151217:
>> >>> >> org.basex.modules.CR_xquery_31_20151217.
>> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343)
>> >>> >> at
>> >>> >>
>> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127)
>> >>> >> at
>> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772)
>> >>> >> at
>> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758)
>> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172)
>> >>> >> at
>> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223)
>> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57)
>> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145)
>> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159)
>> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267)
>> >>> >> at org.basex.core.Command.execute(Command.java:94)
>> >>> >> at
>> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132)
>> >>> >> at org.basex.api.client.Session.execute(Session.java:36)
>> >>> >> at org.basex.core.CLI.execute(CLI.java:103)
>> >>> >> at org.basex.core.CLI.execute(CLI.java:87)
>> >>> >> at org.basex.BaseX.console(BaseX.java:191)
>> >>> >> at org.basex.BaseX.<init>(BaseX.java:166)
>> >>> >> at org.basex.BaseX.main(BaseX.java:42)
>> >>> >> Caused by: java.lang.InstantiationException:
>> >>> >> org.basex.modules.CR_xquery_31_20151217
>> >>> >> at java.lang.Class.newInstance(Unknown Source)
>> >>> >> at
>> >>> >>
>> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124)
>> >>> >> ... 16 more
>> >>> >> Caused by: java.lang.NoSuchMethodException:
>> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>()
>> >>> >> at java.lang.Class.getConstructor0(Unknown Source)
>> >>> >> ... 18 more
>> >>> >> org.basex.query.QueryException: Could not instantiate
>> >>> >> org.basex.modules.CR_xquery_31_20151217:
>> >>> >> org.basex.modules.CR_xquery_31_20151217.
>> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343)
>> >>> >> at
>> >>> >>
>> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127)
>> >>> >> at
>> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772)
>> >>> >> at
>> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758)
>> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172)
>> >>> >> at
>> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223)
>> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57)
>> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145)
>> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159)
>> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267)
>> >>> >> at org.basex.core.Command.execute(Command.java:94)
>> >>> >> at
>> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132)
>> >>> >> at org.basex.api.client.Session.execute(Session.java:36)
>> >>> >> at org.basex.core.CLI.execute(CLI.java:103)
>> >>> >> at org.basex.core.CLI.execute(CLI.java:87)
>> >>> >> at org.basex.BaseX.console(BaseX.java:191)
>> >>> >> at org.basex.BaseX.<init>(BaseX.java:166)
>> >>> >> at org.basex.BaseX.main(BaseX.java:42)
>> >>> >> Caused by: java.lang.InstantiationException:
>> >>> >> org.basex.modules.CR_xquery_31_20151217
>> >>> >> at java.lang.Class.newInstance(Unknown Source)
>> >>> >> at
>> >>> >>
>> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124)
>> >>> >> ... 16 more
>> >>> >> Caused by: java.lang.NoSuchMethodException:
>> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>()
>> >>> >> at java.lang.Class.getConstructor0(Unknown Source)
>> >>> >> ... 18 more
>> >>> >> org.basex.core.BaseXException: Stopped at ., 1/68:
>> >>> >> [XQST0059] Could not instantiate
>> >>> >> org.basex.modules.CR_xquery_31_20151217:
>> >>> >> org.basex.modules.CR_xquery_31_20151217.
>> >>> >> at org.basex.core.Command.execute(Command.java:101)
>> >>> >> at
>> >>> >> org.basex.api.client.LocalSession.execute(LocalSession.java:132)
>> >>> >> at org.basex.api.client.Session.execute(Session.java:36)
>> >>> >> at org.basex.core.CLI.execute(CLI.java:103)
>> >>> >> at org.basex.core.CLI.execute(CLI.java:87)
>> >>> >> at org.basex.BaseX.console(BaseX.java:191)
>> >>> >> at org.basex.BaseX.<init>(BaseX.java:166)
>> >>> >> at org.basex.BaseX.main(BaseX.java:42)
>> >>> >> Caused by: org.basex.query.QueryException: Could not instantiate
>> >>> >> org.basex.modules.CR_xquery_31_20151217:
>> >>> >> org.basex.modules.CR_xquery_31_20151217.
>> >>> >> at org.basex.query.QueryError.get(QueryError.java:1343)
>> >>> >> at
>> >>> >>
>> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:127)
>> >>> >> at
>> >>> >> org.basex.query.QueryParser.importModule(QueryParser.java:772)
>> >>> >> at
>> >>> >> org.basex.query.QueryParser.importModules(QueryParser.java:758)
>> >>> >> at org.basex.query.QueryParser.parseMain(QueryParser.java:172)
>> >>> >> at
>> >>> >> org.basex.query.QueryContext.parseMain(QueryContext.java:223)
>> >>> >> at org.basex.query.QueryProcessor.parse(QueryProcessor.java:57)
>> >>> >> at org.basex.core.cmd.AQuery.parse(AQuery.java:145)
>> >>> >> at org.basex.core.cmd.AQuery.updates(AQuery.java:159)
>> >>> >> at org.basex.core.cmd.AQuery.updating(AQuery.java:267)
>> >>> >> at org.basex.core.Command.execute(Command.java:94)
>> >>> >> ... 7 more
>> >>> >> Caused by: java.lang.InstantiationException:
>> >>> >> org.basex.modules.CR_xquery_31_20151217
>> >>> >> at java.lang.Class.newInstance(Unknown Source)
>> >>> >> at
>> >>> >>
>> >>> >> org.basex.query.util.pkg.ModuleLoader.addImport(ModuleLoader.java:124)
>> >>> >> ... 16 more
>> >>> >> Caused by: java.lang.NoSuchMethodException:
>> >>> >> org.basex.modules.CR_xquery_31_20151217.<init>()
>> >>> >> at java.lang.Class.getConstructor0(Unknown Source)
>> >>> >> ... 18 more
>> >>> >> Stopped at ., 1/68:
>> >>> >> [XQST0059] Could not instantiate
>> >>> >> org.basex.modules.CR_xquery_31_20151217:
>> >>> >> org.basex.modules.CR_xquery_31_20151217.
>> >>> >> >
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >>
>> >>> >> On 7 April 2016 at 15:55, Christian Grün
>> >>> >> <christian.gruen@gmail.com>
>> >>> >> wrote:
>> >>> >>>
>> >>> >>> > If instead I install it to the repo. It appears as
>> >>> >>> > "org.basex.modules.CR_xquery_31_20151217"
>> >>> >>> > but
>> >>> >>> > import module namespace
>> >>> >>> > p="org.basex.modules.CR_xquery_31_20151217";
>> >>> >>> > Fails with
>> >>> >>> > Could not instantiate org.basex.modules.CR_xquery_31_20151217:
>> >>> >>> > org.basex.modules.CR_xquery_31_20151217
>> >>> >>> >
>> >>> >>> > Any ideas where the problem could be?
>> >>> >>>
>> >>> >>> It sounds as if it’s not possible to create an instance of this
>> >>> >>> class.
>> >>> >>> Could you possibly forward the stack trace (triggered by -d)?
>> >>> >>
>> >>> >>
>> >>> >
>> >>
>> >>