The java binding explained under http://www.inf.uni-konstanz.de/dbis/basex/xqjb is working but i can't get it to work with a simple test class. where can i find some sample code ?
Hi stefan, I'm on my phone so I'll keep or brief: http://www.inf.uni-konstanz.de/dbis/basex/code/XQJQuery Might point you in the right direction. You could as well check out other examples that explain our own API. Kind regards Michael -- Mit freundlichen Grüßen Michael Seiferle Am 19.12.2010 um 18:07 schrieb stefan coremans <stefan.coremans@gmail.com>:
The java binding explained under
http://www.inf.uni-konstanz.de/dbis/basex/xqjb
is working but i can't get it to work with a simple test class. where can i find some sample code ? _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hi Stefan, for example you can create a class like the following (i did create it in the org.basex package): package org.basex; public class Test { public Test() { } public static int calc(final int t) { return t * t; } } and run a query like the following: declare namespace test = "java:org.basex.Test"; for $i in 1 to 10 return test:calc(xs:int($i)) so the results are: 1 4 9 16 25 36 49 64 81 100 I hope this helps, kind regards, Andreas Am 19.12.10 18:07, schrieb stefan coremans:
The java binding explained under
http://www.inf.uni-konstanz.de/dbis/basex/xqjb
is working but i can't get it to work with a simple test class. where can i find some sample code ? _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
If you want to avoid static methods you can do it as follows: class: package org.basex; public class Test { public Test() { } public int calc(final int t) { return t * t; } } query: declare namespace test = "java:org.basex.Test"; for $i in 1 to 10 let $t := test:new() return test:calc($t, xs:int($i)) note you have to pass a created test-object to the calc-method then... Andreas Am 19.12.10 18:31, schrieb Andreas Weiler:
Hi Stefan,
for example you can create a class like the following (i did create it in the org.basex package):
package org.basex;
public class Test { public Test() { } public static int calc(final int t) { return t * t; } } and run a query like the following:
declare namespace test = "java:org.basex.Test"; for $i in 1 to 10 return test:calc(xs:int($i))
so the results are: 1 4 9 16 25 36 49 64 81 100
I hope this helps, kind regards, Andreas
Am 19.12.10 18:07, schrieb stefan coremans:
The java binding explained under
http://www.inf.uni-konstanz.de/dbis/basex/xqjb
is working but i can't get it to work with a simple test class. where can i find some sample code ? _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
_______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
...sorry Stefan I just realized I replied a little too fast... Thanks Andreas! Best Michael Am 19.12.2010 um 18:31 schrieb Andreas Weiler <andreas.weiler@uni-konstanz.de>:
Hi Stefan,
for example you can create a class like the following (i did create it in the org.basex package):
package org.basex;
public class Test { public Test() { } public static int calc(final int t) { return t * t; } } and run a query like the following:
declare namespace test = "java:org.basex.Test"; for $i in 1 to 10 return test:calc(xs:int($i))
so the results are: 1 4 9 16 25 36 49 64 81 100
I hope this helps, kind regards, Andreas
Am 19.12.10 18:07, schrieb stefan coremans:
The java binding explained under
http://www.inf.uni-konstanz.de/dbis/basex/xqjb
is working but i can't get it to work with a simple test class. where can i find some sample code ? _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
_______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
participants (3)
-
Andreas Weiler -
Michael Seiferle -
stefan coremans