(no subject)
Sunday, 19 December 2010 · 5 messages
SC
stefan coremans19 Dec 2010 18:07 #
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 ?
MS
Michael Seiferle19 Dec 2010 18:15 #
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
Quoted text · stefan coremans · 12 lines
Am 19.12.2010 um 18:07 schrieb stefan coremans <stefan.coremans at 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 at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
AW
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
Quoted text · stefan coremans · 13 lines
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 at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
AW
Andreas Weiler19 Dec 2010 18:57 #
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
Quoted text · Andreas Weiler · 44 lines
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 at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
MS
...sorry Stefan I just realized I replied a little too fast... Thanks Andreas!
Best
Michael
Quoted text · Andreas Weiler · 42 lines
Am 19.12.2010 um 18:31 schrieb Andreas Weiler <andreas.weiler at 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 at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery