If polling a url n times and breaking if response is 'completed', is the best to approach to use try catch and error() to get around immutability? I need the full response on complete so I redo the last http get. It is not a biggie requesting twice. Adam
Send BaseX-Talk mailing list submissions to
basex-talk@mailman.uni-konstanz.de
To subscribe or unsubscribe via the World Wide Web, visit
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
or, via email, send a message with subject or body 'help' to
basex-talk-request@mailman.uni-konstanz.de
You can reach the person managing the list at
basex-talk-owner@mailman.uni-konstanz.de
When replying, please edit your Subject line so it is more specific
than "Re: Contents of BaseX-Talk digest..."
Today's Topics:
1. XProc? (Jonathan Robie)
2. Re: XProc? (Martin Honnen)
3. Pretty-print the -V optimized query? See what indexes are
used? (Jonathan Robie)
4. Re: XProc? (Imsieke, Gerrit, le-tex)
5. org.basex.core.BaseXException with no error message
(Matthew Dziuban)
6. Re: org.basex.core.BaseXException with no error message
(Christian Gr?n)
7. Re: Pretty-print the -V optimized query? See what indexes are
used? (Christian Gr?n)
8. Can XQuery return unique values present across multiple
databases? (Tamara Marnell)
9. Re: Can XQuery return unique values present across multiple
databases? (Martin Honnen)
----------------------------------------------------------------------
Message: 1
Date: Thu, 12 Aug 2021 07:58:04 -0400
From: Jonathan Robie <jonathan.robie@gmail.com>
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] XProc?
Message-ID:
<CAOkFc+vMLcdXFUZBUvZZVLF8Wc3nKSLASpPKFWV_WPh7hRnEFw@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
What hooks does BaseX provide for XProc? Where can I find examples of
BaseX use in an XProc pipeline?
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uni-konstanz.de/pipermail/basex-talk/attachments/20210812/6bda64ce/attachment-0001.htm>
------------------------------
Message: 2
Date: Thu, 12 Aug 2021 14:06:07 +0200
From: Martin Honnen <martin.honnen@gmx.de>
To: basex-talk@mailman.uni-konstanz.de
Subject: Re: [basex-talk] XProc?
Message-ID: <f4151d94-d191-a28e-5ac9-b960bd9562fa@gmx.de>
Content-Type: text/plain; charset=utf-8; format=flowed
Am 12.08.2021 um 13:58 schrieb Jonathan Robie:
> What hooks does BaseX provide for XProc?? Where can I find examples of
> BaseX use in an XProc pipeline?
>
Morgana XProc for XProc 1 has support for using BaseX for the p:xquery
step:
https://www.xml-project.com/documentation/morgana-userguide/morganaxproc_enhance/#xquery
------------------------------
Message: 3
Date: Thu, 12 Aug 2021 08:14:19 -0400
From: Jonathan Robie <jonathan.robie@gmail.com>
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] Pretty-print the -V optimized query? See what
indexes are used?
Message-ID:
<CAOkFc+v55p2tC8qfPSoGtezGOn-3zwEyRLpQQ2d1U6pCAY+G+w@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Is there a way to pretty-print the optimized query from the -V option?
What is the best way to see which indexes are being used?
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uni-konstanz.de/pipermail/basex-talk/attachments/20210812/1198b13f/attachment-0001.htm>
------------------------------
Message: 4
Date: Thu, 12 Aug 2021 14:33:53 +0200
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@le-tex.de>
To: basex-talk@mailman.uni-konstanz.de
Subject: Re: [basex-talk] XProc?
Message-ID: <81ee8ed9-5f2b-9792-b449-269c2e888a06@le-tex.de>
Content-Type: text/plain; charset=utf-8; format=flowed
We couple it more loosely using RESTXQ endpoints and HTTP requests.
On 12.08.2021 13:58, Jonathan Robie wrote:
> What hooks does BaseX provide for XProc?? Where can I find examples of
> BaseX use in an XProc pipeline?
>
> Jonathan
------------------------------
Message: 5
Date: Thu, 12 Aug 2021 09:00:42 -0400
From: Matthew Dziuban <mrdziuban@gmail.com>
To: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: [basex-talk] org.basex.core.BaseXException with no error
message
Message-ID:
<CANsD0+8mdZNdSr58n==U=eZOt0ESWBO4kmgpi2yqC-SDBnMKzw@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi all,
I'm using the java ClientSession class defined in the basex-api module and
I'm seeing intermittent org.basex.core.BaseXException errors with an empty
error message when executing long-running read queries or CREATE DB
commands. The stack trace of the most recent error points to
ClientSession.receive (
https://github.com/BaseXdb/basex/blob/9.5.2/basex-core/src/main/java/org/basex/api/client/ClientSession.java#L190
)
org.basex.core.BaseXException:
org.basex.api.client.ClientSession.receive(ClientSession.java:190)
org.basex.api.client.ClientSession.send(ClientSession.java:178)
org.basex.api.client.ClientSession.send(ClientSession.java:215)
org.basex.api.client.ClientSession.create(ClientSession.java:128)
...
Unfortunately since the message is empty it's difficult to debug what's
going wrong. I've checked the log files in basex/data/.logs but haven't
found any information about the failure. Is there another place I can look?
Or do you have any other recommendations for debugging the errors?
Thanks in advance,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uni-konstanz.de/pipermail/basex-talk/attachments/20210812/3cd0750f/attachment-0001.htm>
------------------------------
Message: 6
Date: Thu, 12 Aug 2021 19:59:23 +0200
From: Christian Gr?n <christian.gruen@gmail.com>
To: Matthew Dziuban <mrdziuban@gmail.com>
Cc: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] org.basex.core.BaseXException with no error
message
Message-ID:
<CAP94bnMdFThzOZB3n=qdW--ZcfFVm0YNQwHsXzmq1msb-dVT1A@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"
Hi Matt,
It?s difficult to give a general answer. Do you think you can share a
reproducible test case with us?
Thanks in advance
Christian
On Thu, Aug 12, 2021 at 3:01 PM Matthew Dziuban <mrdziuban@gmail.com> wrote:
>
> Hi all,
>
> I'm using the java ClientSession class defined in the basex-api module and I'm seeing intermittent org.basex.core.BaseXException errors with an empty error message when executing long-running read queries or CREATE DB commands. The stack trace of the most recent error points to ClientSession.receive (https://github.com/BaseXdb/basex/blob/9.5.2/basex-core/src/main/java/org/basex/api/client/ClientSession.java#L190)
>
> org.basex.core.BaseXException:
> org.basex.api.client.ClientSession.receive(ClientSession.java:190)
> org.basex.api.client.ClientSession.send(ClientSession.java:178)
> org.basex.api.client.ClientSession.send(ClientSession.java:215)
> org.basex.api.client.ClientSession.create(ClientSession.java:128)
> ...
>
> Unfortunately since the message is empty it's difficult to debug what's going wrong. I've checked the log files in basex/data/.logs but haven't found any information about the failure. Is there another place I can look? Or do you have any other recommendations for debugging the errors?
>
> Thanks in advance,
> Matt
------------------------------
Message: 7
Date: Thu, 12 Aug 2021 20:04:13 +0200
From: Christian Gr?n <christian.gruen@gmail.com>
To: Jonathan Robie <jonathan.robie@gmail.com>
Cc: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Pretty-print the -V optimized query? See
what indexes are used?
Message-ID:
<CAP94bnPW5A89S=ZLq8xKZVf67Rd93C_ePJhNczaK7fSWo9esHA@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"
Hi Jonathan,
> Is there a way to pretty-print the optimized query from the -V option?
Currently no. Personally, I?m not aware of any XQuery code formatter
that works really well. Maybe anyone else on the list does?
> What is the best way to see which indexes are being used?
The usual way is to parse the compilation output for "apply ... index"
entries. Our documentation might give you some more hints [1].
Cheers,
Christian
[1] https://docs.basex.org/wiki/Indexes
------------------------------
Message: 8
Date: Thu, 12 Aug 2021 15:12:42 -0700
From: Tamara Marnell <tmarnell@orbiscascade.org>
To: basex-talk@mailman.uni-konstanz.de
Subject: [basex-talk] Can XQuery return unique values present across
multiple databases?
Message-ID:
<CA+nihtSU=rM7NbMp9T5NPKQKaPxtz1Rwpw1dwEKcp_KNV+_BpA@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Short question: Is it possible to write an XQuery FLWOR statement that can
return a set of unique values present across multiple databases?
Long question: Our new website in development displays EAD finding aids
stored across 45 databases in BaseX. I've built "facet" databases that
index terms in the EADs from controlled vocabularies like subjects, places,
personal names, etc. The indexes follow this structure, where each EAD node
contains a unique identifier:
<terms type="subject">
<term text="Literature" db="1">
<ead>12345</ead>
<ead>67890</ead>
</term>
<term text="Poetry" db="1">
<ead>abcde</ead>
</term>
{etc.}
</terms>
In the search interface, users can select multiple facets to apply to one
search. For example, they could browse database 12 for EADs with the
subject "Literature" *and* the place "Oregon," etc.
I currently use the REST server to run an XQuery file that loops through
each selected facet and prints *all* EAD IDs for each submitted term and
database. Then after results are returned, I use PHP to count occurences of
each EAD and print them only if the total count matches the count of facets
used.
declare variable $d as xs:string external;
declare variable $f as xs:string external;
let $db_ids := tokenize($d, '\|')
return <facets>{
for $facet in tokenize($f, '\|')
let $split := tokenize($facet, ':')
let $facet_type := $split[1]
let $facet_term := $split[2]
let $facet_db := 'facet-' || $facet_type
return <facet type="{$facet_type}" term="{$facet_term}">{
for $ead in db:open($facet_db)/terms/term[@text=$facet_term and
@db=$db_ids]/ead
return $ead
}</facet>
}</facets>
So in the hypothetical example above, I'd pass "12" as d (or multiple
selected databases separated by bars) and
"subject:Literature|geogname:Oregon" as f, and I'd get back a document like:
<facets>
<facet type="subject" term="Literature">
<ead>12345</ead>
<ead>67890</ead>
</facet>
<facet type="geogname" term="Oregon">
<ead>12345</ead>
</facet>
</facets>
The count of "12345" will equal the count of the user's selected facets, so
that result will be printed, but 67890 will not.
Is there a more efficient way to do this? I'd prefer the XQuery to return
only the EADs that meet all criteria, so only 12345 would be returned
because it's in facet-subject under Literature *and* in facet-geogname
under "Oregon," and then I don't have to do any post-processing.
-Tamara
--
Tamara Marnell
IT Manager
Orbis Cascade Alliance (orbiscascade.org <https://www.orbiscascade.org/>)
Pronouns: she/her/hers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uni-konstanz.de/pipermail/basex-talk/attachments/20210812/7bd4d00f/attachment-0001.htm>
------------------------------
Message: 9
Date: Fri, 13 Aug 2021 08:26:12 +0200
From: Martin Honnen <martin.honnen@gmx.de>
To: basex-talk@mailman.uni-konstanz.de
Subject: Re: [basex-talk] Can XQuery return unique values present
across multiple databases?
Message-ID: <16ad6d5e-0df4-208c-cc35-b1c82d508518@gmx.de>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Am 13.08.2021 um 00:12 schrieb Tamara Marnell:
> Short question: Is it possible to write an XQuery FLWOR statement that
> can return a set of unique values present across multiple databases?
>
> Long question: Our new website in development displays EAD finding
> aids stored across 45 databases in BaseX. I've built "facet" databases
> that index terms in the EADs from controlled vocabularies like
> subjects, places, personal names, etc. The indexes follow this
> structure, where each EAD node contains a unique identifier:
>
> <terms type="subject">
> ? <term text="Literature" db="1">
> ??? <ead>12345</ead>
> ??? <ead>67890</ead>
> ? </term>
> ? <term text="Poetry" db="1">
> ??? <ead>abcde</ead>
> ? </term>
> ? {etc.}
> </terms>
>
> In the search interface, users can select multiple facets to apply to
> one search. For example, they could browse database 12 for EADs with
> the subject "Literature" /and/ the place "Oregon," etc.
>
> I currently use the REST server to run an XQuery file that loops
> through each selected facet and prints /all/ EAD IDs for each
> submitted term and database. Then after results are returned, I use
> PHP to count occurences of each EAD and print them only if the total
> count matches the count of facets used.
>
> declare variable $d as xs:string external;
> declare variable $f as xs:string external;
> let $db_ids := tokenize($d, '\|')
> return <facets>{
> for $facet in tokenize($f, '\|')
> ? let $split := tokenize($facet, ':')
> ? let $facet_type := $split[1]
> ? let $facet_term := $split[2]
> ? let $facet_db := 'facet-' || $facet_type
> ? return <facet type="{$facet_type}" term="{$facet_term}">{
> ? ? for $ead in db:open($facet_db)/terms/term[@text=$facet_term and
> @db=$db_ids]/ead
> ? ? ? return $ead
> ? }</facet>
> }</facets>
>
> So in the hypothetical example above, I'd pass "12" as d (or multiple
> selected databases separated by bars) and
> "subject:Literature|geogname:Oregon" as f, and I'd get back a document
> like:
>
> <facets>
> ? <facet type="subject" term="Literature">
> ??? <ead>12345</ead>
> ??? <ead>67890</ead>
> ? </facet>
> ? <facet type="geogname" term="Oregon">
> ??? <ead>12345</ead>
> ? </facet>
> </facets>
>
> The count of "12345" will equal the count of the user's selected
> facets, so that result will be printed, but 67890 will not.
>
> Is there a more efficient way to do this? I'd prefer the XQuery to
> return only the EADs that meet all criteria, so only 12345 would be
> returned because it's in facet-subject under Literature /and/ in
> facet-geogname under "Oregon," and then I don't have to do any
> post-processing.
>
I think you can use fold-left to reduce the found eas while selecting them:
let $db_ids := tokenize($d, '\|')
return
??? <facets>{
??????? let $facet-maps :=
????????? fold-left(
??????????? for $facet in tokenize($f, '\|')
????????????? let $split := tokenize($facet, ':')
????????????? let $facet_type := $split[1]
????????????? let $facet_term := $split[2]
????????????? let $facet_db := 'facet-' || $facet_type
??????????? return
????????????? map:merge(
????????????????? for $ead in
db:open($facet_db)/terms/term[@text=$facet_term and @db=$db_ids]/ead
????????????????? return map:entry(string($ead), map { 'node' : $ead,
'type' : $facet_type, 'term' : $facet_term })
????????????????? ,
????????????????? map { 'duplicates' : 'combine' }
????????????? )
?????????? ,
?????????? map{},
?????????? function($ams, $m) {
?????????????? for $m1 in $ams
?????????????? return map:remove($m1, map:keys($m1)[not(. =
map:keys($m))]),
?????????????? $m
?????????? }
????????? )
??????? return
??????????? for $m in $facet-maps[exists(map:keys(.))]
??????????? let $ead1 := $m?*[1]
??????????? return
??????????????? <facet type="{$ead1?type}" term="{$ead1?term}">
??????????????? {
??????????????????? $m?*?node
??????????????? }
??????????????? </facet>
??? }</facets>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uni-konstanz.de/pipermail/basex-talk/attachments/20210813/e0633543/attachment-0001.htm>
End of BaseX-Talk Digest, Vol 140, Issue 2
******************************************