Re: [basex-talk] Fwd: FW: java binding passing variables

2023-04-11 Thread Andy Bunce
Hi Burkhard,

The thing about the warn argument is that it can be updated by the Java
call. So I think you will need to pass in a suitable Java object.
For this case I tried an  ArrayList

import module namespace bdrc = "io.bdrc.ewtsconverter.EwtsConverter";
let $warn:=Q{java.util.ArrayList}new()
let $roman := "bk ra shise bde legs"
let $result:=bdrc:toUnicode($roman,$warn,true(),false())
return map{"result": $result,
   "warn": Q{java.util.ArrayList}toString($warn)
 }

Results in
map {
  "warn": "[line 1: ""bk"": Expected vowel after ""k"".]",
  "result": "བཀ་ར་ཤིསེ་བདེ་ལེགས"
}

I don't know if this is right or not. There are better ways to pick apart
$warn.

/Andy




On Tue, 11 Apr 2023 at 13:16, Burkhard Quessel  wrote:

> *Subject:* java binding passing variables
>
>
>
> I am trying to use xquery to transform Tibetan which is presented in Roman
> script to Unicode, i.e. into original Tibetan script. For this I use
> existing java code from here:
>
>
> https://github.com/buda-base/ewts-converter/blob/master/src/main/java/io/bdrc/ewtsconverter/EwtsConverter.java
>
>
>
> I add the jar of this code (
> https://jar-download.com/artifact-search/ewts-converter)  to my basex
> library and import like this:
>
> import module namespace bdrc = "io.bdrc.ewtsconverter.EwtsConverter";
>
> I can then use a java method to convert my Romanised Tibetan text to
> Unicode Original Tibetan script like so:
>
>
>
> let $roman := "bkra shis bde legs"
>
> return
>
> bdrc:toUnicode($roman)
>
>
>
> so far it works perfectly:
>
> བཀྲ་ཤིས་བདེ་ལེགས
>
>
>
> My  problems begin when I try to add additional parameters to the
> conversion.
>
>
>
>  The java documentation lists a number of possible parameters:
>
> *toUnicode(String str, List warns, boolean sloppy, boolean
> lenient)*
>
> (I want the “warns” one) but I am just too stupid to figure out how
> exactly to include this in in my  xquery code. Can anyone help out?
>
>
>
>  Thanks Burkhard
>
>
>


[basex-talk] Fwd: FW: java binding passing variables

2023-04-11 Thread Burkhard Quessel
*Subject:* java binding passing variables



I am trying to use xquery to transform Tibetan which is presented in Roman
script to Unicode, i.e. into original Tibetan script. For this I use
existing java code from here:

https://github.com/buda-base/ewts-converter/blob/master/src/main/java/io/bdrc/ewtsconverter/EwtsConverter.java



I add the jar of this code (
https://jar-download.com/artifact-search/ewts-converter)  to my basex
library and import like this:

import module namespace bdrc = "io.bdrc.ewtsconverter.EwtsConverter";

I can then use a java method to convert my Romanised Tibetan text to
Unicode Original Tibetan script like so:



let $roman := "bkra shis bde legs"

return

bdrc:toUnicode($roman)



so far it works perfectly:

བཀྲ་ཤིས་བདེ་ལེགས



My  problems begin when I try to add additional parameters to the
conversion.



 The java documentation lists a number of possible parameters:

*toUnicode(String str, List warns, boolean sloppy, boolean lenient)*

(I want the “warns” one) but I am just too stupid to figure out how exactly
to include this in in my  xquery code. Can anyone help out?



 Thanks Burkhard
<>


Re: [basex-talk] Queuing order for db:add

2023-04-11 Thread Christian Grün
> I was just wondering whether I can rely on insertion order being kept
> when I perform a corresponding db:get("db", "a.xml").

Thanks. Yes, you can!


Re: [basex-talk] Queuing order for db:add

2023-04-11 Thread Marco Lettere

Hi Christian,

sorry for not being clear enough.

I was just wondering whether I can rely on insertion order being kept 
when I perform a corresponding db:get("db", "a.xml"). In other words 
given your slightly modified example:


for $i in 1 to 100
return db:add('db', , 'a.xml')

Will

db:get('db','a.xml')

always return

(, , ...)

M.

On 11/04/23 09:03, Christian Grün wrote:

Hi Marco,


Does db:add multiple resources to the same path guarantee sorting based
on insertion time?

Sorry for the late reply, but I’m not sure if I understand your
question. It’s correct, it’s possible to add multiple resources to the
same path, e.g. as follows:

for $i in 1 to 100
return db:add('db', , 'a.xml')

There’s no need to do any sorts, as the target path is identical. All
resources will simply be attached to the database storage.

Or did you question yourself if sorting is some necessary when
resources are requested in a later step?

Ciao,
Christian


Re: [basex-talk] Queuing order for db:add

2023-04-11 Thread Christian Grün
Hi Marco,

> Does db:add multiple resources to the same path guarantee sorting based
> on insertion time?

Sorry for the late reply, but I’m not sure if I understand your
question. It’s correct, it’s possible to add multiple resources to the
same path, e.g. as follows:

for $i in 1 to 100
return db:add('db', , 'a.xml')

There’s no need to do any sorts, as the target path is identical. All
resources will simply be attached to the database storage.

Or did you question yourself if sorting is some necessary when
resources are requested in a later step?

Ciao,
Christian