You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(31) |
Nov
(25) |
Dec
(33) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(48) |
Feb
(62) |
Mar
(22) |
Apr
(29) |
May
(9) |
Jun
(45) |
Jul
(28) |
Aug
(41) |
Sep
(60) |
Oct
(96) |
Nov
(99) |
Dec
(70) |
2003 |
Jan
(98) |
Feb
(159) |
Mar
(164) |
Apr
(150) |
May
(143) |
Jun
(97) |
Jul
(184) |
Aug
(143) |
Sep
(207) |
Oct
(126) |
Nov
(159) |
Dec
(165) |
2004 |
Jan
(131) |
Feb
(229) |
Mar
(220) |
Apr
(212) |
May
(320) |
Jun
(223) |
Jul
(191) |
Aug
(390) |
Sep
(261) |
Oct
(229) |
Nov
(215) |
Dec
(184) |
2005 |
Jan
(221) |
Feb
(312) |
Mar
(336) |
Apr
(273) |
May
(359) |
Jun
(277) |
Jul
(303) |
Aug
(321) |
Sep
(256) |
Oct
(415) |
Nov
(428) |
Dec
(508) |
2006 |
Jan
(585) |
Feb
(419) |
Mar
(496) |
Apr
(296) |
May
(403) |
Jun
(404) |
Jul
(553) |
Aug
(296) |
Sep
(252) |
Oct
(416) |
Nov
(414) |
Dec
(245) |
2007 |
Jan
(354) |
Feb
(422) |
Mar
(389) |
Apr
(298) |
May
(397) |
Jun
(318) |
Jul
(315) |
Aug
(339) |
Sep
(253) |
Oct
(317) |
Nov
(350) |
Dec
(264) |
2008 |
Jan
(353) |
Feb
(313) |
Mar
(433) |
Apr
(383) |
May
(343) |
Jun
(355) |
Jul
(321) |
Aug
(338) |
Sep
(242) |
Oct
(206) |
Nov
(199) |
Dec
(279) |
2009 |
Jan
(327) |
Feb
(221) |
Mar
(280) |
Apr
(278) |
May
(237) |
Jun
(345) |
Jul
(322) |
Aug
(324) |
Sep
(676) |
Oct
(586) |
Nov
(735) |
Dec
(329) |
2010 |
Jan
(619) |
Feb
(424) |
Mar
(529) |
Apr
(241) |
May
(312) |
Jun
(554) |
Jul
(698) |
Aug
(576) |
Sep
(408) |
Oct
(268) |
Nov
(391) |
Dec
(426) |
2011 |
Jan
(629) |
Feb
(512) |
Mar
(465) |
Apr
(467) |
May
(475) |
Jun
(403) |
Jul
(426) |
Aug
(542) |
Sep
(418) |
Oct
(620) |
Nov
(614) |
Dec
(358) |
2012 |
Jan
(357) |
Feb
(466) |
Mar
(344) |
Apr
(215) |
May
(408) |
Jun
(375) |
Jul
(241) |
Aug
(260) |
Sep
(401) |
Oct
(461) |
Nov
(498) |
Dec
(294) |
2013 |
Jan
(453) |
Feb
(447) |
Mar
(434) |
Apr
(326) |
May
(295) |
Jun
(471) |
Jul
(463) |
Aug
(278) |
Sep
(525) |
Oct
(343) |
Nov
(389) |
Dec
(405) |
2014 |
Jan
(564) |
Feb
(324) |
Mar
(319) |
Apr
(319) |
May
(384) |
Jun
(259) |
Jul
(210) |
Aug
(219) |
Sep
(315) |
Oct
(478) |
Nov
(207) |
Dec
(316) |
2015 |
Jan
(222) |
Feb
(234) |
Mar
(201) |
Apr
(145) |
May
(367) |
Jun
(318) |
Jul
(195) |
Aug
(210) |
Sep
(234) |
Oct
(248) |
Nov
(217) |
Dec
(189) |
2016 |
Jan
(219) |
Feb
(177) |
Mar
(110) |
Apr
(91) |
May
(159) |
Jun
(124) |
Jul
(192) |
Aug
(119) |
Sep
(125) |
Oct
(64) |
Nov
(80) |
Dec
(68) |
2017 |
Jan
(156) |
Feb
(312) |
Mar
(386) |
Apr
(217) |
May
(89) |
Jun
(115) |
Jul
(79) |
Aug
(122) |
Sep
(100) |
Oct
(99) |
Nov
(129) |
Dec
(77) |
2018 |
Jan
(106) |
Feb
(78) |
Mar
(160) |
Apr
(73) |
May
(110) |
Jun
(160) |
Jul
(93) |
Aug
(92) |
Sep
(75) |
Oct
(147) |
Nov
(114) |
Dec
(97) |
2019 |
Jan
(141) |
Feb
(78) |
Mar
(158) |
Apr
(60) |
May
(123) |
Jun
(54) |
Jul
(44) |
Aug
(147) |
Sep
(117) |
Oct
(54) |
Nov
(74) |
Dec
(96) |
2020 |
Jan
(113) |
Feb
(125) |
Mar
(142) |
Apr
(57) |
May
(71) |
Jun
(99) |
Jul
(58) |
Aug
(81) |
Sep
(49) |
Oct
(50) |
Nov
(63) |
Dec
(37) |
2021 |
Jan
(37) |
Feb
(45) |
Mar
(39) |
Apr
(18) |
May
(14) |
Jun
(9) |
Jul
(44) |
Aug
(23) |
Sep
(13) |
Oct
(31) |
Nov
(13) |
Dec
(33) |
2022 |
Jan
(17) |
Feb
(8) |
Mar
(32) |
Apr
(7) |
May
(17) |
Jun
(7) |
Jul
(36) |
Aug
(29) |
Sep
(9) |
Oct
(20) |
Nov
(10) |
Dec
(1) |
2023 |
Jan
(30) |
Feb
(37) |
Mar
(23) |
Apr
(1) |
May
(14) |
Jun
(5) |
Jul
(3) |
Aug
(6) |
Sep
(5) |
Oct
(48) |
Nov
(4) |
Dec
(29) |
2024 |
Jan
(1) |
Feb
|
Mar
(21) |
Apr
(6) |
May
(16) |
Jun
(41) |
Jul
(11) |
Aug
(17) |
Sep
(16) |
Oct
(11) |
Nov
(3) |
Dec
(9) |
2025 |
Jan
(7) |
Feb
(7) |
Mar
(6) |
Apr
(6) |
May
(30) |
Jun
(8) |
Jul
(10) |
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Gus R. <gu...@gm...> - 2023-06-21 16:16:21
|
Hello, I am trying to create a query for the lucene index using an xml fragment as described here: https://exist-db.org/exist/apps/doc/lucene Let's say my query is something like this in the "normal" syntax: for $hit in collection($config:data-index)//tei:TEI[ft:query(., textcontent:$guess AND timemin:[0000 TO 1600], $query_options)] How would I write the query in XML? I have this for the first part: <query> <wildcard field="textcontent">{$guess}</wildcard> </query> But I have no idea which element to use for the ranged query ( timemin: [0000 TO 1600] ). The example in the documentation just says: Ranged queries using TO are also supported. Suppose you have marked dates and wish to return only results between 1600 and 1610. let $query := "date:[1600 TO 1610]" return ft:search($col, $query)//exist:match It does not say how to do it using the XML definition of the query. Non of the listed elements (wildcard, term, etc.) seems to work. I would really appreciate some help on this. Thanks a lot! Gustavo Fernández Riva Wissenschaftlicher Mitarbeiter Universität Heidelberg – Universitätsbibliothek Plöck 107-109, D-69117 Heidelberg Tel.: +49-(0)6221-54 2033 Mail: gus...@ub... <gus...@un...> |
From: Nicolas S. <sou...@gm...> - 2023-06-07 15:08:28
|
Dear Craig, Dear Joe, Thank you very much for your help. Craig's query actually didn't work when I first used it but I installed the "Shared Resources: jquery, dojo, ace, templating, utilities" package and everything works now. -- Best regards, Nicolas |
From: Joe W. <jo...@gm...> - 2023-06-07 14:23:55
|
Hi Nicolas, Craig's query will work if you have the shared-resources package installed, but if not (it is no longer included in eXist releases), you will receive an error: > Cannot compile xquery: err:XQST0059 error found while loading module dbutil: failed to load module: 'http://exist-db.org/xquery/dbutil' from: ' http://exist-db.org/xquery/dbutil', location: ' http://exist-db.org/xquery/dbutil'. Source not found. The solution is either to install the shared-resources package via Dashboard > Package Manager, or to use eXide's bundled version, by changing the module import declaration to: import module namespace dbutil="http://exist-db.org/xquery/dbutil" at "/db/apps/eXide/modules/dbutils.xqm"; Joe On Tue, Jun 6, 2023 at 3:42 PM Craig Berry via Exist-open < exi...@li...> wrote: > > > > On Jun 6, 2023, at 2:04 PM, Nicolas Souchon < > sou...@gm...> wrote: > > > > Dear All, > > > > I'm new to eXist-db and can't figure out how to change ownership of a > folder and all the folders and files it contains at once from eXide. > > > > I know how to change ownership of one folder or file at a time but how > can I change ownership of a large number of folders/files at once? Knowing > that changing the ownership of the folder does not change the ownership of > the items it contains. > > > > To be more clear, my application is owned by user A but one of the > folders composing it is owned by user B and user A cannot access the > contents of this folder, so I would like to change the ownership of the > folder and its content from user B to user A. > > > > Thank you in advance for your help. > > I had to do this the other day and couldn't find a straightforward way. I > ended up writing the following. Be sure to substitute your own root path > and the desired owner, group and permissions. > > xquery version "3.1"; > > import module namespace dbutil="http://exist-db.org/xquery/dbutil"; > import module namespace console="http://exist-db.org/xquery/console"; > > declare function local:setperm($path as xs:string) { > let $x := sm:chown($path, 'owner') > let $x := sm:chgrp($path, 'group') > let $x := sm:chmod($path, 'rwxrwxr--') > let $x := console:log('Ownership and permissions set on ' || $path) > return $x > }; > > let $root := '/db/apps/somepath' > return dbutil:scan(xs:anyURI($root), function($col, $path) { > let $x := local:setperm(($path, $col)[1]) > return $x > }) > > > > > > > > ________________________________________ > Craig A. Berry > > "... getting out of a sonnet is much more > difficult than getting in." > Brad Leithauser > > > > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open > |
From: Craig B. <cra...@ma...> - 2023-06-06 19:41:37
|
> On Jun 6, 2023, at 2:04 PM, Nicolas Souchon <sou...@gm...> wrote: > > Dear All, > > I'm new to eXist-db and can't figure out how to change ownership of a folder and all the folders and files it contains at once from eXide. > > I know how to change ownership of one folder or file at a time but how can I change ownership of a large number of folders/files at once? Knowing that changing the ownership of the folder does not change the ownership of the items it contains. > > To be more clear, my application is owned by user A but one of the folders composing it is owned by user B and user A cannot access the contents of this folder, so I would like to change the ownership of the folder and its content from user B to user A. > > Thank you in advance for your help. I had to do this the other day and couldn't find a straightforward way. I ended up writing the following. Be sure to substitute your own root path and the desired owner, group and permissions. xquery version "3.1"; import module namespace dbutil="http://exist-db.org/xquery/dbutil"; import module namespace console="http://exist-db.org/xquery/console"; declare function local:setperm($path as xs:string) { let $x := sm:chown($path, 'owner') let $x := sm:chgrp($path, 'group') let $x := sm:chmod($path, 'rwxrwxr--') let $x := console:log('Ownership and permissions set on ' || $path) return $x }; let $root := '/db/apps/somepath' return dbutil:scan(xs:anyURI($root), function($col, $path) { let $x := local:setperm(($path, $col)[1]) return $x }) ________________________________________ Craig A. Berry "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser |
From: Nicolas S. <sou...@gm...> - 2023-06-06 19:05:15
|
Dear All, I'm new to eXist-db and can't figure out how to change ownership of a folder and all the folders and files it contains at once from eXide. I know how to change ownership of one folder or file at a time but how can I change ownership of a large number of folders/files at once? Knowing that changing the ownership of the folder does not change the ownership of the items it contains. To be more clear, my application is owned by user A but one of the folders composing it is owned by user B and user A cannot access the contents of this folder, so I would like to change the ownership of the folder and its content from user B to user A. Thank you in advance for your help. -- Best regards, Nicolas |
From: Chris W. <kit...@gm...> - 2023-05-27 06:13:48
|
I'd like to pretty-print an xquery expression with a function along the lines of the marklogic xdmp:pretty-print. Background I'm working on a framework for executable Entity-Relationship models in which computations are expressed in XQuery. It's a eval-fest and may horrify purists . See https://kitwallace.tumblr.com/post/717562715197112320/a-model-for-biodiversity-net-gain-40 |
From: Joe W. <jo...@gm...> - 2023-05-24 13:00:40
|
Hi Kit, Sorry, I meant to reply earlier. The function that first came to mind was system:get-module-load-path(), but perhaps you're looking for the various request:get-* functions, one of which you already found. I agree, response:redirect-to() is cumbersome in its need for an absolute URL. But I think it literally dumps the URI you supply straight into the Location header in the HTTP 302 response, so from that perspective, its behavior makes sense. Joe On Wed, May 24, 2023 at 6:32 AM Chris Wallace <kit...@gm...> wrote: > Here is one way to get it: > > tokenize(request:get-effective-uri(),"/")[last()] > > By way of context, when executing a response:redirect-to() , the URI needs > the script name even if the redirect is to the current script. Scripts are > more maintainable when that name doesn't have to be hard-coded. > > > > On Fri, May 19, 2023 at 8:07 AM Chris Wallace <kit...@gm...> > wrote: > >> Help - I've forgotten how to get the name of the executing script. >> >> Chris >> > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open > |
From: Chris W. <kit...@gm...> - 2023-05-24 10:32:29
|
The link to Documentation on http://exist-db.org/exist/apps/fundocs/view.html is broken |
From: Chris W. <kit...@gm...> - 2023-05-24 10:31:48
|
Here is one way to get it: tokenize(request:get-effective-uri(),"/")[last()] By way of context, when executing a response:redirect-to() , the URI needs the script name even if the redirect is to the current script. Scripts are more maintainable when that name doesn't have to be hard-coded. On Fri, May 19, 2023 at 8:07 AM Chris Wallace <kit...@gm...> wrote: > Help - I've forgotten how to get the name of the executing script. > > Chris > |
From: Chris W. <kit...@gm...> - 2023-05-19 07:08:11
|
Help - I've forgotten how to get the name of the executing script. Chris |
From: Christian W. <cwi...@gm...> - 2023-05-17 01:09:29
|
Dear Gabriel, I had the same problem a while ago. It is caused by a library the db manager calls over a CDN becoming unavailable. The solution is to upgrade eXide to the latest version using the package manager. Hope this helps, Christian On 16/05/2023 18.39, Viehhauser, Gabriel wrote: > Hi, > > I upgraded to exist 6.2.0 recently and it appears that I have a > similar problem like it was described in this message: > https://sourceforge.net/p/exist/mailman/message/37316393/ a while ago: > The display of the db manager in the exide is overlapping and appears > in vertical order (see also the attached screenshot). > > I tried shift reload and clearing the cache, but it did not help. I am > working on macOS BigSur 11.3.1 and tried Firefox, Safari and Chrome > (which I installed completely from scratch). My Java verion ist > 1.8.0_361. Can you help me with this? > > Many thanks > Gabriel > > > > > > > > Institut für Literaturwissenschaft > Digital Humanities > Herdweg 51 > 70174 Stuttgart > Zi. 0.029 > Tel:(0711) 685-81280 > > > > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open |
From: Viehhauser, G. <gab...@il...> - 2023-05-16 09:56:22
|
Hi, I upgraded to exist 6.2.0 recently and it appears that I have a similar problem like it was described in this message: https://sourceforge.net/p/exist/mailman/message/37316393/ a while ago: The display of the db manager in the exide is overlapping and appears in vertical order (see also the attached screenshot). I tried shift reload and clearing the cache, but it did not help. I am working on macOS BigSur 11.3.1 and tried Firefox, Safari and Chrome (which I installed completely from scratch). My Java verion ist 1.8.0_361. Can you help me with this? Many thanks Gabriel [cid:A2850309-6E09-4FB9-9FD0-185E1FEA1898] Institut für Literaturwissenschaft Digital Humanities Herdweg 51 70174 Stuttgart Zi. 0.029 Tel:(0711) 685-81280 |
From: Chris W. <kit...@gm...> - 2023-05-12 05:24:46
|
Looking for a workaround I found this works - wrapping the sequence in an element declare function local:topological-sort($unordered, $ordered-graph) { if (empty($unordered)) then $ordered-graph/* else let $ordered := $ordered-graph/* let $nodes := $unordered [ every $id in ref/@id satisfies $id = $ordered/@id] return if ($nodes) then let $remainder := $unordered except $nodes let $ordered-graph := element graph {($ordered , $nodes)} return local:topological-sort($remainder, $ordered-graph) else () (: cycles so no order possible :) }; On Fri, May 12, 2023 at 4:47 AM Chris Wallace <kit...@gm...> wrote: > Hi Joe , fake news from me Im afraid - too quick and bad testing so my > larger graphs are in fact failing, as did a re-write avoiding the high > order constructs which I see you tried too. > > > Kit > > On Thu, 11 May 2023, 23:24 Joe Wicentowski, <jo...@gm...> wrote: > >> Hi Chris, >> >> Sure! Your post was really concerning, so I wanted to see if I could >> reproduce it and report it in the form of an XQSuite test ( >> https://exist-db.org/exist/apps/doc/xqsuite). This is the best way to >> demonstrate a bug to the core developers so they can begin analyzing it and >> test their own fixes. Also, they often incorporate the tests directly into >> the eXist CI test suite, to ensure the bug doesn't appear again. >> >> It's interesting to hear that you're not seeing the same problem with >> larger graphs. I just added a post to the issue, with a new variant of the >> simple (i.e., non-XQSuite) test, which lets you configure how large you >> want the graph to be. For me, eXist fails to sort any graphs with more than >> 2 nodes, whereas the same tests all pass in BaseX and Saxon. Here's the >> link to that variant: >> >> https://github.com/eXist-db/exist/issues/4918#issuecomment-1544753088 >> >> Joe >> >> On Thu, May 11, 2023 at 3:42 PM Chris Wallace <kit...@gm...> >> wrote: >> >>> Hi Joe, >>> Many thanks for looking at this - yes I was just about to confess that >>> I'd called the test function incorrectly and that it's fine >>> >>> My god, Joe, you are a hard worker ! That's quite some test you >>> constructed there! >>> >>> Ive just been running the same algorithm on a number of larger graphs >>> (the context is ordering the evaluation of computations in a >>> spreadsheety thing) >>> and all have been sorted correctly so it does seem to be just that case >>> of a sequence of 3 - weird. >>> >>> Awe and regards >>> >>> Kit >>> >>> >>> On Thu, May 11, 2023 at 7:28 PM Joe Wicentowski <jo...@gm...> >>> wrote: >>> >>>> Hi Kit, >>>> >>>> I can confirm that eXist returns incorrectly sorted results in 6.2.0, >>>> and BaseX and Saxon return the correct results. >>>> >>>> I did find one mistake in your query: your $issorted variable should be >>>> changed to check $sortedNodes/node instead of $sortedNodes. This shows that >>>> the local:topological-sorted function returns the expected results in >>>> eXist, and the problem is limited to the something that happens in the >>>> course of eXist's processing of local:topological-sort function. >>>> >>>> It's possible that the query once worked in eXist but a regression was >>>> introduced at some point. >>>> >>>> I've worked on refining your report into an XQSuite test, and I've >>>> posted an issue: >>>> >>>> https://github.com/eXist-db/exist/issues/4918 >>>> >>>> Joe >>>> >>>> On Wed, May 10, 2023 at 1:20 PM Chris Wallace <kit...@gm...> >>>> wrote: >>>> >>>>> Back in the day (2008) , I wrote an algorithm for a topological sort >>>>> and put it in the wikibook >>>>> >>>>> https://en.wikibooks.org/wiki/XQuery/Topological_Sort >>>>> >>>>> It's been there for 14 years and is unchanged but it doesn't now on >>>>> my 3.0 version nor on 5.3.1 >>>>> <sorted> <graph> <node id="b"> <ref id="c"/> </node> <node id="c"/> >>>>> <node id="a"> <ref id="b"/> <ref id="c"/> </node> </graph> </sorted> >>>>> >>>>> It returns all nodes but they are not in the right order and even more >>>>> puzzling the condition for the nodes to be in order evaluates true for both >>>>> the expected value and the erroneous result. >>>>> >>>>> Has it always been wrong - I'm sure it worked on the then current >>>>> version. It seems to be transparently correct or has something changed? >>>>> >>>>> The problem seems to be that in constructing the >>>>> expression ($ordered,$nodes), the ordering of of the $ordered nodes is lost >>>>> >>>>> Here is the test script >>>>> >>>>> declare function local:topological-sorted($nodes) as xs:boolean { >>>>> every $n in $nodes satisfies >>>>> every $id in $n/ref/@id >>>>> satisfies $id = $n/preceding::node/@id >>>>> }; >>>>> >>>>> declare function local:topological-sort($unordered, $ordered) { >>>>> if (empty($unordered)) >>>>> then $ordered >>>>> else >>>>> let $nodes := $unordered [ every $id in ref/@id satisfies $id >>>>> = $ordered/@id] >>>>> return >>>>> if ($nodes) >>>>> then local:topological-sort( $unordered except $nodes, >>>>> ($ordered, $nodes )) >>>>> else () (: cycles so no order possible :) >>>>> }; >>>>> >>>>> let $graph := >>>>> <graph> >>>>> <node id="a"> >>>>> <ref id="b"/> >>>>> <ref id="c"/> >>>>> </node> >>>>> <node id="b"> >>>>> <ref id="c"/> >>>>> </node> >>>>> <node id="c"/> >>>>> </graph> >>>>> >>>>> let $expected := >>>>> <graph> >>>>> <node id="c"/> >>>>> <node id="b"> >>>>> <ref id="c"/> >>>>> </node> >>>>> <node id="a"> >>>>> <ref id="b"/> >>>>> <ref id="c"/> >>>>> </node> >>>>> </graph> >>>>> >>>>> let $sortedNodes := >>>>> <graph>{local:topological-sort($graph/node,())}</graph> >>>>> let $issorted := local:topological-sorted($sortedNodes) >>>>> let $expectedsorted := local:topological-sorted($expected/node) >>>>> return >>>>> element result { >>>>> element input {$graph}, >>>>> element expected {$expected}, >>>>> element sorted {$sortedNodes}, >>>>> element issorted {$issorted}, >>>>> element expected-sorted {$expectedsorted} >>>>> } >>>>> >>>>> >>>>> _______________________________________________ >>>>> Exist-open mailing list >>>>> Exi...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/exist-open >>>>> >>>> |
From: Chris W. <kit...@gm...> - 2023-05-12 03:48:38
|
---------- Forwarded message --------- From: Chris Wallace <kit...@gm...> Date: Fri, 12 May 2023, 04:47 Subject: Re: [Exist-open] Topological sort code problem To: Joe Wicentowski <jo...@gm...> Hi Joe , fake news from me Im afraid - too quick and bad testing so my larger graphs are in fact failing, as did a re-write avoiding the high order constructs which I see you tried too. Kit On Thu, 11 May 2023, 23:24 Joe Wicentowski, <jo...@gm...> wrote: > Hi Chris, > > Sure! Your post was really concerning, so I wanted to see if I could > reproduce it and report it in the form of an XQSuite test ( > https://exist-db.org/exist/apps/doc/xqsuite). This is the best way to > demonstrate a bug to the core developers so they can begin analyzing it and > test their own fixes. Also, they often incorporate the tests directly into > the eXist CI test suite, to ensure the bug doesn't appear again. > > It's interesting to hear that you're not seeing the same problem with > larger graphs. I just added a post to the issue, with a new variant of the > simple (i.e., non-XQSuite) test, which lets you configure how large you > want the graph to be. For me, eXist fails to sort any graphs with more than > 2 nodes, whereas the same tests all pass in BaseX and Saxon. Here's the > link to that variant: > > https://github.com/eXist-db/exist/issues/4918#issuecomment-1544753088 > > Joe > > On Thu, May 11, 2023 at 3:42 PM Chris Wallace <kit...@gm...> > wrote: > >> Hi Joe, >> Many thanks for looking at this - yes I was just about to confess that >> I'd called the test function incorrectly and that it's fine >> >> My god, Joe, you are a hard worker ! That's quite some test you >> constructed there! >> >> Ive just been running the same algorithm on a number of larger graphs >> (the context is ordering the evaluation of computations in a >> spreadsheety thing) >> and all have been sorted correctly so it does seem to be just that case >> of a sequence of 3 - weird. >> >> Awe and regards >> >> Kit >> >> >> On Thu, May 11, 2023 at 7:28 PM Joe Wicentowski <jo...@gm...> wrote: >> >>> Hi Kit, >>> >>> I can confirm that eXist returns incorrectly sorted results in 6.2.0, >>> and BaseX and Saxon return the correct results. >>> >>> I did find one mistake in your query: your $issorted variable should be >>> changed to check $sortedNodes/node instead of $sortedNodes. This shows that >>> the local:topological-sorted function returns the expected results in >>> eXist, and the problem is limited to the something that happens in the >>> course of eXist's processing of local:topological-sort function. >>> >>> It's possible that the query once worked in eXist but a regression was >>> introduced at some point. >>> >>> I've worked on refining your report into an XQSuite test, and I've >>> posted an issue: >>> >>> https://github.com/eXist-db/exist/issues/4918 >>> >>> Joe >>> >>> On Wed, May 10, 2023 at 1:20 PM Chris Wallace <kit...@gm...> >>> wrote: >>> >>>> Back in the day (2008) , I wrote an algorithm for a topological sort >>>> and put it in the wikibook >>>> >>>> https://en.wikibooks.org/wiki/XQuery/Topological_Sort >>>> >>>> It's been there for 14 years and is unchanged but it doesn't now on my >>>> 3.0 version nor on 5.3.1 >>>> <sorted> <graph> <node id="b"> <ref id="c"/> </node> <node id="c"/> >>>> <node id="a"> <ref id="b"/> <ref id="c"/> </node> </graph> </sorted> >>>> >>>> It returns all nodes but they are not in the right order and even more >>>> puzzling the condition for the nodes to be in order evaluates true for both >>>> the expected value and the erroneous result. >>>> >>>> Has it always been wrong - I'm sure it worked on the then current >>>> version. It seems to be transparently correct or has something changed? >>>> >>>> The problem seems to be that in constructing the >>>> expression ($ordered,$nodes), the ordering of of the $ordered nodes is lost >>>> >>>> Here is the test script >>>> >>>> declare function local:topological-sorted($nodes) as xs:boolean { >>>> every $n in $nodes satisfies >>>> every $id in $n/ref/@id >>>> satisfies $id = $n/preceding::node/@id >>>> }; >>>> >>>> declare function local:topological-sort($unordered, $ordered) { >>>> if (empty($unordered)) >>>> then $ordered >>>> else >>>> let $nodes := $unordered [ every $id in ref/@id satisfies $id = >>>> $ordered/@id] >>>> return >>>> if ($nodes) >>>> then local:topological-sort( $unordered except $nodes, >>>> ($ordered, $nodes )) >>>> else () (: cycles so no order possible :) >>>> }; >>>> >>>> let $graph := >>>> <graph> >>>> <node id="a"> >>>> <ref id="b"/> >>>> <ref id="c"/> >>>> </node> >>>> <node id="b"> >>>> <ref id="c"/> >>>> </node> >>>> <node id="c"/> >>>> </graph> >>>> >>>> let $expected := >>>> <graph> >>>> <node id="c"/> >>>> <node id="b"> >>>> <ref id="c"/> >>>> </node> >>>> <node id="a"> >>>> <ref id="b"/> >>>> <ref id="c"/> >>>> </node> >>>> </graph> >>>> >>>> let $sortedNodes := >>>> <graph>{local:topological-sort($graph/node,())}</graph> >>>> let $issorted := local:topological-sorted($sortedNodes) >>>> let $expectedsorted := local:topological-sorted($expected/node) >>>> return >>>> element result { >>>> element input {$graph}, >>>> element expected {$expected}, >>>> element sorted {$sortedNodes}, >>>> element issorted {$issorted}, >>>> element expected-sorted {$expectedsorted} >>>> } >>>> >>>> >>>> _______________________________________________ >>>> Exist-open mailing list >>>> Exi...@li... >>>> https://lists.sourceforge.net/lists/listinfo/exist-open >>>> >>> |
From: Joe W. <jo...@gm...> - 2023-05-11 22:24:51
|
Hi Chris, Sure! Your post was really concerning, so I wanted to see if I could reproduce it and report it in the form of an XQSuite test ( https://exist-db.org/exist/apps/doc/xqsuite). This is the best way to demonstrate a bug to the core developers so they can begin analyzing it and test their own fixes. Also, they often incorporate the tests directly into the eXist CI test suite, to ensure the bug doesn't appear again. It's interesting to hear that you're not seeing the same problem with larger graphs. I just added a post to the issue, with a new variant of the simple (i.e., non-XQSuite) test, which lets you configure how large you want the graph to be. For me, eXist fails to sort any graphs with more than 2 nodes, whereas the same tests all pass in BaseX and Saxon. Here's the link to that variant: https://github.com/eXist-db/exist/issues/4918#issuecomment-1544753088 Joe On Thu, May 11, 2023 at 3:42 PM Chris Wallace <kit...@gm...> wrote: > Hi Joe, > Many thanks for looking at this - yes I was just about to confess that > I'd called the test function incorrectly and that it's fine > > My god, Joe, you are a hard worker ! That's quite some test you > constructed there! > > Ive just been running the same algorithm on a number of larger graphs > (the context is ordering the evaluation of computations in a > spreadsheety thing) > and all have been sorted correctly so it does seem to be just that case of > a sequence of 3 - weird. > > Awe and regards > > Kit > > > On Thu, May 11, 2023 at 7:28 PM Joe Wicentowski <jo...@gm...> wrote: > >> Hi Kit, >> >> I can confirm that eXist returns incorrectly sorted results in 6.2.0, and >> BaseX and Saxon return the correct results. >> >> I did find one mistake in your query: your $issorted variable should be >> changed to check $sortedNodes/node instead of $sortedNodes. This shows that >> the local:topological-sorted function returns the expected results in >> eXist, and the problem is limited to the something that happens in the >> course of eXist's processing of local:topological-sort function. >> >> It's possible that the query once worked in eXist but a regression was >> introduced at some point. >> >> I've worked on refining your report into an XQSuite test, and I've posted >> an issue: >> >> https://github.com/eXist-db/exist/issues/4918 >> >> Joe >> >> On Wed, May 10, 2023 at 1:20 PM Chris Wallace <kit...@gm...> >> wrote: >> >>> Back in the day (2008) , I wrote an algorithm for a topological sort and >>> put it in the wikibook >>> >>> https://en.wikibooks.org/wiki/XQuery/Topological_Sort >>> >>> It's been there for 14 years and is unchanged but it doesn't now on my >>> 3.0 version nor on 5.3.1 >>> <sorted> <graph> <node id="b"> <ref id="c"/> </node> <node id="c"/> >>> <node id="a"> <ref id="b"/> <ref id="c"/> </node> </graph> </sorted> >>> >>> It returns all nodes but they are not in the right order and even more >>> puzzling the condition for the nodes to be in order evaluates true for both >>> the expected value and the erroneous result. >>> >>> Has it always been wrong - I'm sure it worked on the then current >>> version. It seems to be transparently correct or has something changed? >>> >>> The problem seems to be that in constructing the >>> expression ($ordered,$nodes), the ordering of of the $ordered nodes is lost >>> >>> Here is the test script >>> >>> declare function local:topological-sorted($nodes) as xs:boolean { >>> every $n in $nodes satisfies >>> every $id in $n/ref/@id >>> satisfies $id = $n/preceding::node/@id >>> }; >>> >>> declare function local:topological-sort($unordered, $ordered) { >>> if (empty($unordered)) >>> then $ordered >>> else >>> let $nodes := $unordered [ every $id in ref/@id satisfies $id = >>> $ordered/@id] >>> return >>> if ($nodes) >>> then local:topological-sort( $unordered except $nodes, >>> ($ordered, $nodes )) >>> else () (: cycles so no order possible :) >>> }; >>> >>> let $graph := >>> <graph> >>> <node id="a"> >>> <ref id="b"/> >>> <ref id="c"/> >>> </node> >>> <node id="b"> >>> <ref id="c"/> >>> </node> >>> <node id="c"/> >>> </graph> >>> >>> let $expected := >>> <graph> >>> <node id="c"/> >>> <node id="b"> >>> <ref id="c"/> >>> </node> >>> <node id="a"> >>> <ref id="b"/> >>> <ref id="c"/> >>> </node> >>> </graph> >>> >>> let $sortedNodes := >>> <graph>{local:topological-sort($graph/node,())}</graph> >>> let $issorted := local:topological-sorted($sortedNodes) >>> let $expectedsorted := local:topological-sorted($expected/node) >>> return >>> element result { >>> element input {$graph}, >>> element expected {$expected}, >>> element sorted {$sortedNodes}, >>> element issorted {$issorted}, >>> element expected-sorted {$expectedsorted} >>> } >>> >>> >>> _______________________________________________ >>> Exist-open mailing list >>> Exi...@li... >>> https://lists.sourceforge.net/lists/listinfo/exist-open >>> >> |
From: Chris W. <kit...@gm...> - 2023-05-11 19:42:34
|
Hi Joe, Many thanks for looking at this - yes I was just about to confess that I'd called the test function incorrectly and that it's fine My god, Joe, you are a hard worker ! That's quite some test you constructed there! Ive just been running the same algorithm on a number of larger graphs (the context is ordering the evaluation of computations in a spreadsheety thing) and all have been sorted correctly so it does seem to be just that case of a sequence of 3 - weird. Awe and regards Kit On Thu, May 11, 2023 at 7:28 PM Joe Wicentowski <jo...@gm...> wrote: > Hi Kit, > > I can confirm that eXist returns incorrectly sorted results in 6.2.0, and > BaseX and Saxon return the correct results. > > I did find one mistake in your query: your $issorted variable should be > changed to check $sortedNodes/node instead of $sortedNodes. This shows that > the local:topological-sorted function returns the expected results in > eXist, and the problem is limited to the something that happens in the > course of eXist's processing of local:topological-sort function. > > It's possible that the query once worked in eXist but a regression was > introduced at some point. > > I've worked on refining your report into an XQSuite test, and I've posted > an issue: > > https://github.com/eXist-db/exist/issues/4918 > > Joe > > On Wed, May 10, 2023 at 1:20 PM Chris Wallace <kit...@gm...> > wrote: > >> Back in the day (2008) , I wrote an algorithm for a topological sort and >> put it in the wikibook >> >> https://en.wikibooks.org/wiki/XQuery/Topological_Sort >> >> It's been there for 14 years and is unchanged but it doesn't now on my >> 3.0 version nor on 5.3.1 >> <sorted> <graph> <node id="b"> <ref id="c"/> </node> <node id="c"/> <node >> id="a"> <ref id="b"/> <ref id="c"/> </node> </graph> </sorted> >> >> It returns all nodes but they are not in the right order and even more >> puzzling the condition for the nodes to be in order evaluates true for both >> the expected value and the erroneous result. >> >> Has it always been wrong - I'm sure it worked on the then current >> version. It seems to be transparently correct or has something changed? >> >> The problem seems to be that in constructing the >> expression ($ordered,$nodes), the ordering of of the $ordered nodes is lost >> >> Here is the test script >> >> declare function local:topological-sorted($nodes) as xs:boolean { >> every $n in $nodes satisfies >> every $id in $n/ref/@id >> satisfies $id = $n/preceding::node/@id >> }; >> >> declare function local:topological-sort($unordered, $ordered) { >> if (empty($unordered)) >> then $ordered >> else >> let $nodes := $unordered [ every $id in ref/@id satisfies $id = >> $ordered/@id] >> return >> if ($nodes) >> then local:topological-sort( $unordered except $nodes, >> ($ordered, $nodes )) >> else () (: cycles so no order possible :) >> }; >> >> let $graph := >> <graph> >> <node id="a"> >> <ref id="b"/> >> <ref id="c"/> >> </node> >> <node id="b"> >> <ref id="c"/> >> </node> >> <node id="c"/> >> </graph> >> >> let $expected := >> <graph> >> <node id="c"/> >> <node id="b"> >> <ref id="c"/> >> </node> >> <node id="a"> >> <ref id="b"/> >> <ref id="c"/> >> </node> >> </graph> >> >> let $sortedNodes := >> <graph>{local:topological-sort($graph/node,())}</graph> >> let $issorted := local:topological-sorted($sortedNodes) >> let $expectedsorted := local:topological-sorted($expected/node) >> return >> element result { >> element input {$graph}, >> element expected {$expected}, >> element sorted {$sortedNodes}, >> element issorted {$issorted}, >> element expected-sorted {$expectedsorted} >> } >> >> >> _______________________________________________ >> Exist-open mailing list >> Exi...@li... >> https://lists.sourceforge.net/lists/listinfo/exist-open >> > |
From: Joe W. <jo...@gm...> - 2023-05-11 18:29:01
|
Hi Kit, I can confirm that eXist returns incorrectly sorted results in 6.2.0, and BaseX and Saxon return the correct results. I did find one mistake in your query: your $issorted variable should be changed to check $sortedNodes/node instead of $sortedNodes. This shows that the local:topological-sorted function returns the expected results in eXist, and the problem is limited to the something that happens in the course of eXist's processing of local:topological-sort function. It's possible that the query once worked in eXist but a regression was introduced at some point. I've worked on refining your report into an XQSuite test, and I've posted an issue: https://github.com/eXist-db/exist/issues/4918 Joe On Wed, May 10, 2023 at 1:20 PM Chris Wallace <kit...@gm...> wrote: > Back in the day (2008) , I wrote an algorithm for a topological sort and > put it in the wikibook > > https://en.wikibooks.org/wiki/XQuery/Topological_Sort > > It's been there for 14 years and is unchanged but it doesn't now on my > 3.0 version nor on 5.3.1 > <sorted> <graph> <node id="b"> <ref id="c"/> </node> <node id="c"/> <node > id="a"> <ref id="b"/> <ref id="c"/> </node> </graph> </sorted> > > It returns all nodes but they are not in the right order and even more > puzzling the condition for the nodes to be in order evaluates true for both > the expected value and the erroneous result. > > Has it always been wrong - I'm sure it worked on the then current version. > It seems to be transparently correct or has something changed? > > The problem seems to be that in constructing the > expression ($ordered,$nodes), the ordering of of the $ordered nodes is lost > > Here is the test script > > declare function local:topological-sorted($nodes) as xs:boolean { > every $n in $nodes satisfies > every $id in $n/ref/@id > satisfies $id = $n/preceding::node/@id > }; > > declare function local:topological-sort($unordered, $ordered) { > if (empty($unordered)) > then $ordered > else > let $nodes := $unordered [ every $id in ref/@id satisfies $id = > $ordered/@id] > return > if ($nodes) > then local:topological-sort( $unordered except $nodes, > ($ordered, $nodes )) > else () (: cycles so no order possible :) > }; > > let $graph := > <graph> > <node id="a"> > <ref id="b"/> > <ref id="c"/> > </node> > <node id="b"> > <ref id="c"/> > </node> > <node id="c"/> > </graph> > > let $expected := > <graph> > <node id="c"/> > <node id="b"> > <ref id="c"/> > </node> > <node id="a"> > <ref id="b"/> > <ref id="c"/> > </node> > </graph> > > let $sortedNodes := <graph>{local:topological-sort($graph/node,())}</graph> > let $issorted := local:topological-sorted($sortedNodes) > let $expectedsorted := local:topological-sorted($expected/node) > return > element result { > element input {$graph}, > element expected {$expected}, > element sorted {$sortedNodes}, > element issorted {$issorted}, > element expected-sorted {$expectedsorted} > } > > > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open > |
From: Erik S. <er...@xa...> - 2023-05-11 11:17:20
|
The fifth edition of Declarative Amsterdam will take place on 2 and 3 November 2023 at the Science Park, Amsterdam. It will be a hybrid conference with the opportunity to attend live or online, for both attendees and presenters. The first day will feature tutorials, combining presentations and hands-on sessions to give an introduction to specific topics. The second day will be a symposium, with shorter presentations. Speakers can discuss new ideas, frameworks, applications of declarative methods, and best practices. Declarative techniques are a style of computing that expresses the purpose of computation without describing its control flow. It allows you to focus on the ‘what’, rather than the ‘how’. Declarative Amsterdam will have presentations on past experiences, current trends and future perspectives in fields such as functional programming, declarative data modelling, databases, XML and related technologies, JSON, CSS, semantic web, data science, data visualization, grammars, parsing, and domain-specific languages. Call for presentations We invite practitioners, software architects and engineers, academic researchers and others to submit a proposal for a tutorial or a presentation. Tutorials can be between 1.5 and 2.5 hours, and preferably include hands-on sessions for participants. Presentations on the second day can be between 20 and 45 minutes. Speakers can present in person, or prepare a video, and be available online for the question and answer session afterwards. Proposals should include a title, duration and summary (90 - 200 words), and may also include a full paper. Speakers have the option of submitting a full paper or slides, to be published on the Declarative Amsterdam website. For papers and topics from previous years, see the website: <https://declarative.amsterdam/> https://declarative.amsterdam/ Please submit proposals at <https://declarative.amsterdam/cfp> https://declarative.amsterdam/cfp Timeline Submission deadline: 31 July Acceptance: Beginning of September Videos: Beginning of October Conference: 2 and 3 November All the best, Declarative Amsterdam organizing committee |
From: Chris W. <kit...@gm...> - 2023-05-10 17:19:43
|
Back in the day (2008) , I wrote an algorithm for a topological sort and put it in the wikibook https://en.wikibooks.org/wiki/XQuery/Topological_Sort It's been there for 14 years and is unchanged but it doesn't now on my 3.0 version nor on 5.3.1 <sorted> <graph> <node id="b"> <ref id="c"/> </node> <node id="c"/> <node id="a"> <ref id="b"/> <ref id="c"/> </node> </graph> </sorted> It returns all nodes but they are not in the right order and even more puzzling the condition for the nodes to be in order evaluates true for both the expected value and the erroneous result. Has it always been wrong - I'm sure it worked on the then current version. It seems to be transparently correct or has something changed? The problem seems to be that in constructing the expression ($ordered,$nodes), the ordering of of the $ordered nodes is lost Here is the test script declare function local:topological-sorted($nodes) as xs:boolean { every $n in $nodes satisfies every $id in $n/ref/@id satisfies $id = $n/preceding::node/@id }; declare function local:topological-sort($unordered, $ordered) { if (empty($unordered)) then $ordered else let $nodes := $unordered [ every $id in ref/@id satisfies $id = $ordered/@id] return if ($nodes) then local:topological-sort( $unordered except $nodes, ($ordered, $nodes )) else () (: cycles so no order possible :) }; let $graph := <graph> <node id="a"> <ref id="b"/> <ref id="c"/> </node> <node id="b"> <ref id="c"/> </node> <node id="c"/> </graph> let $expected := <graph> <node id="c"/> <node id="b"> <ref id="c"/> </node> <node id="a"> <ref id="b"/> <ref id="c"/> </node> </graph> let $sortedNodes := <graph>{local:topological-sort($graph/node,())}</graph> let $issorted := local:topological-sorted($sortedNodes) let $expectedsorted := local:topological-sorted($expected/node) return element result { element input {$graph}, element expected {$expected}, element sorted {$sortedNodes}, element issorted {$issorted}, element expected-sorted {$expectedsorted} } |
From: 13519004 M. B. P. <135...@st...> - 2023-04-07 17:39:08
|
Hi, I'm new to eXist and now i am currently working on final project. i have some trouble using spatial module. i have this error when i import the module: 2023-04-07 23:24:49,981 [qtp1424043852-54] ERROR (XQueryServlet.java [process]:549) - Cannot compile xquery: err:XQST0034 Prolog has more than one imported module that defines the function: {http://exist-db.org/xquery/geospatial}getSRS#1 [at line 2, column 1] org.exist.EXistException: Cannot compile xquery: err:XQST0034 Prolog has more than one imported module that defines the function: {http://exist-db.org/xquery/geospatial}getSRS#1 [at line 2, column 1] at org.exist.http.servlets.XQueryServlet.process(XQueryServlet.java:442) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.http.servlets.XQueryServlet.doPost(XQueryServlet.java:181) ~[exist-core-6.0.1.jar:6.0.1] at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) ~[javax.servlet-api-3.1.0.jar:3.1.0] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0] at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1459) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:618) ~[jetty-security-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:167) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:81) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:50) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.http.urlrewrite.XQueryURLRewrite.doRewrite(XQueryURLRewrite.java:523) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.http.urlrewrite.XQueryURLRewrite.service(XQueryURLRewrite.java:340) ~[exist-core-6.0.1.jar:6.0.1] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0] at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:228) ~[websocket-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:571) ~[jetty-security-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) ~[jetty-servlet-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:713) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:400) ~[jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:645) [jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:392) [jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) [jetty-server-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) [jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) [jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) [jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) [jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927] at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927] at java.lang.Thread.run(Thread.java:832) [?:?] Caused by: org.exist.xquery.XPathException: err:XQST0034 Prolog has more than one imported module that defines the function: {http://exist-db.org/xquery/geospatial}getSRS#1 [at line 2, column 1] at org.exist.xquery.parser.XQueryTreeParser.importDecl(XQueryTreeParser.java:6293) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.xquery.parser.XQueryTreeParser.prolog(XQueryTreeParser.java:5291) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.xquery.parser.XQueryTreeParser.mainModule(XQueryTreeParser.java:3991) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.xquery.parser.XQueryTreeParser.module(XQueryTreeParser.java:3936) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.xquery.parser.XQueryTreeParser.xpath(XQueryTreeParser.java:3591) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.xquery.XQuery.compile(XQuery.java:238) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.xquery.XQuery.compile(XQuery.java:175) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.xquery.XQuery.compile(XQuery.java:133) ~[exist-core-6.0.1.jar:6.0.1] at org.exist.http.servlets.XQueryServlet.process(XQueryServlet.java:439) ~[exist-core-6.0.1.jar:6.0.1] ... 66 more the conclusion that i get about the error is the module contains duplicated function called "getSRS". i've tried to find the duplicated function but i have no clue where it is. the things that i found is there is no duplicated function on function called "getSRS" (note: i tried to decompile the java file containing the spatial repo). any help will very much appreciated. All the best Bintang |
From: Harris, B. T. (GSFC-5870) <ber...@na...> - 2023-03-16 10:44:24
|
Is it possible to pass a string value to %test:args() (or %test:arg()) that contains a comma? For example, declare %test:args("0.0.0.1, 0.0.0.2") %test:assertEquals("0.0.0.1") function spasexq:getHttpClient( $fwdForHdr as xs:string*) as xs:string { let $hops := if (count($fwdForHdr) > 0) then tokenize($fwdForHdr[1], ", ") else () return if ($hops) then $hops[1] else "unknown" }; The test case fails with <testcase name="getHttpClient" class="spasexq:getHttpClient"> <error type="err:FORG0006" message="Invalid argument type. effectiveBooleanValue: first item of '(0.0.0.1, 0.0.0.2)' is not a node, and sequence length > 1"/> </testcase> Is there an escape mechanism to prevent the interpretation of the comma character? All my attempts have failed. Thanks. Bernie Harris |
From: Harris, B. T. (GSFC-5870) <ber...@na...> - 2023-03-15 15:49:14
|
Yes, that works. I can probably work with that for now. Thanks. Bernie From: Joe Wicentowski <jo...@gm...> Date: Wednesday, March 15, 2023 at 11:45 AM To: "Harris, Bernard T. (GSFC-5870)" <ber...@na...> Cc: Juri Leino <ju...@ex...>, "exi...@li..." <exi...@li...> Subject: Re: [Exist-open] [EXTERNAL] Re: %test:assertXPath help Hi Bernie, No, I'm saying that %test:assertXPath("$result/self::*:html") should work. Joe On Wed, Mar 15, 2023 at 11:39 AM Harris, Bernard T. (GSFC-5870) <ber...@na...<mailto:ber...@na...>> wrote: Are you saying %test:assertXPath("$result//*:html") Should work now? It does not. Bernie From: Joe Wicentowski <jo...@gm...<mailto:jo...@gm...>> Date: Wednesday, March 15, 2023 at 11:33 AM To: "Harris, Bernard T. (GSFC-5870)" <ber...@na...<mailto:ber...@na...>> Cc: Juri Leino <ju...@ex...<mailto:ju...@ex...>>, "exi...@li...<mailto:exi...@li...>" <exi...@li...<mailto:exi...@li...>> Subject: Re: [Exist-open] [EXTERNAL] Re: %test:assertXPath help Hi Bernie, When I said: > Since your function's return value doesn't associate <html> with any namespace prefix - only a namespace URI - then you should construct your %assertXPath annotations with the expectation that elements have a default namespace of "http://www.w3.org/1999/xhtml<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303176058%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3JYhUEVjrLOFJhTJUTB9BzSHgk5reuIp%2F13u5vEHDnA%3D&reserved=0>". ... I was conveying how I expected XQSuite *should* work. But upon closer examination, I see that XQSuite does *not* provide %test:assertXPath annotation with any mechanism to address elements whose namespace is not bound to a namespace prefix. For situations such as the one you raised, you are currently limited to wildcards. I will submit a PR fixing this - adjusting XQSuite to work as I originally described. With the PR, you'll be able to use annotations like: %test:assertXPath("$result/self::html") %test:assertXPath("$result/head[title = 'Bad Request']") %test:assertXPath("$result/body/p[@class = 'ErrorMessage']") (Note here that $result is the <html> element, not a container around it. Thus, the expressions are slightly different from your originals.) Joe On Wed, Mar 15, 2023 at 9:23 AM Harris, Bernard T. (GSFC-5870) via Exist-open <exi...@li...<mailto:exi...@li...>> wrote: Thanks for the suggestions. If I replace the import statement with the declaration of the test namespace, I get Cannot compile xquery: err:XPST0017 Call to undeclared function: test:suite Your other suggestion to simplify the assertXPath expression might work on this simple case, but I actually want to get the assertXPath working for other, more complicated, functions. I was trying to get this simple case working before using assertXPath on other, more important and complex functions. Any other suggestions? Thanks. Bernie From: Juri Leino <ju...@ex...<mailto:ju...@ex...>> Date: Wednesday, March 15, 2023 at 8:58 AM To: "Harris, Bernard T. (GSFC-5870)" <ber...@na...<mailto:ber...@na...>> Cc: "exi...@li...<mailto:exi...@li...>" <exi...@li...<mailto:exi...@li...>> Subject: [EXTERNAL] Re: [Exist-open] %test:assertXPath help Hi Bernard! I would replace import module namespace test="http://exist-db.org/xquery/xqsuite"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=PGLKfl5MhRgq0e3%2BPzlkqlDTa0KiCuRZBcBrjcT74go%3D&reserved=0> at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; with declare namespace test="http://exist-db.org/xquery/xqsuite"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=PGLKfl5MhRgq0e3%2BPzlkqlDTa0KiCuRZBcBrjcT74go%3D&reserved=0>; Now to your actual problem: The namespace declared in the testsuite is very likely not seen by XQSuite. This is non-obvious. The reason for this is that test argument and assertion annotation values are string literals that get cast to the expected type in the context of the XQSuite module and not in the context of the testsuite. Many tests in exist-db core serialize XML an assert that the result string matches the expected value instead of which could be a workaround for your tests as well. In your case it might be easiest to just return the evaluated xpath from the testcase and to assert the strings equal declare %test:arg("error", "Bad Request") %test:arg("description", "Invalid ResourceID") %test:arg("extraHtml") %test:assertXPath("Bad Request") function local:errorHtml( $error as xs:string, $description as xs:string, $extraHtml as node()?) as node() { let $result := <html xmlns="http://www.w3.org/1999/xhtml"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qJDiW1%2BQVGKk9GgzY%2BY8TbD6eUhDG9NOH1XBmbj8m3k%3D&reserved=0> lang="en" xml:lang="en"> <head> <title>{$error}</title> </head> <body> <p class='ErrorMessage'><b>Message: </b>{$error}</p> <p class='ErrorDescription'><b>Description: </b>{$description}</p> {$extraHtml} </body> </html> return $result/xhtml:html/xhtml:body/xhtml:p[@class = 'ErrorMessage'] }; Harris, Bernard T. (GSFC-5870) via Exist-open wrote on 14.03.23 13:35: No matter what I do, I cannot get a useful (more than "$result") %:assertXPath to work in this case xquery version "3.1"; import module namespace inspect="http://exist-db.org/xquery/inspection"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Finspection&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OKFW7kMPLuHLSgshCgeYF8zT5VgAHGDZw3LU8h33M3g%3D&reserved=0>; import module namespace test="http://exist-db.org/xquery/xqsuite"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=PGLKfl5MhRgq0e3%2BPzlkqlDTa0KiCuRZBcBrjcT74go%3D&reserved=0> at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; declare namespace xhtml = "http://www.w3.org/1999/xhtml"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qJDiW1%2BQVGKk9GgzY%2BY8TbD6eUhDG9NOH1XBmbj8m3k%3D&reserved=0>; declare %test:arg("error", "Bad Request") %test:arg("description", "Invalid ResourceID") %test:arg("extraHtml") %test:assertXPath("$result//*:html") (: %test:assertXPath("$result//*:html/*:head[*:title = 'Bad Request']") %test:assertXPath("$result/xhtml:html/xhtml:body/xhtml:p[@class = 'ErrorMessage']") :) function local:errorHtml( $error as xs:string, $description as xs:string, $extraHtml as node()?) as node() { let $result := <html xmlns="http://www.w3.org/1999/xhtml"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qJDiW1%2BQVGKk9GgzY%2BY8TbD6eUhDG9NOH1XBmbj8m3k%3D&reserved=0> lang="en" xml:lang="en"> <head> <title>{$error}</title> </head> <body> <p class='ErrorMessage'><b>Message: </b>{$error}</p> <p class='ErrorDescription'><b>Description: </b>{$description}</p> {$extraHtml} </body> </html> return $result }; let $f := local:errorHtml#3 return test:suite($f) It always results in <testsuites> <testsuite package="http://www.w3.org/2005/xquery-local-functions"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2005%2Fxquery-local-functions&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=cXo9vtsTcRhFmg90NHaf4GmpAJwXs4w%2BVgbJ7J%2BG2Bw%3D&reserved=0> timestamp="2023-03-14T08:28:16.065-04:00" tests="1" failures="1" errors="0" pending="0" time="PT0.002S"> <testcase name="errorHtml" class="local:errorHtml"> <failure message="assertXPath failed." type="failure-error-code-1">$result//*:html</failure> <output> <html xmlns="http://www.w3.org/1999/xhtml"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qJDiW1%2BQVGKk9GgzY%2BY8TbD6eUhDG9NOH1XBmbj8m3k%3D&reserved=0> lang="en" xml:lang="en"> <head> <title>Bad Request</title> </head> <body> <p class="ErrorMessage"> <b>Message: </b>Bad Request</p> <p class="ErrorDescription"> <b>Description: </b>Invalid ResourceID</p> </body> </html> </output> </testcase> </testsuite> </testsuites> Or <testcase name="errorHtml" class="spasexq:errorHtml"> <error type="err:XPST0081" message="It is a static error if a QName used in an expression contains a namespace prefix that cannot be expanded into a namespace URI by using the statically known namespaces. Error while evaluating expression: $result//xhtml:html. No namespace defined for prefix xhtml:html"/> </testcase> If I use the xhtml namespace in the assertXPath annotation. I found someone report a similar problem on stackoverflow in 2016 but it is not clear to me how it was resolved. This is on exist-db 6.2.0 and Java 11. Does anyone know what I am doing wrong? Thanks. Bernie Harris _______________________________________________ Exist-open mailing list Exi...@li...<mailto:Exi...@li...> https://lists.sourceforge.net/lists/listinfo/exist-open<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fexist-open&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=E%2BIIi17GNe7CxJt407XlyRMtyKtJngCu8OIzZvqwl4Q%3D&reserved=0> _______________________________________________ Exist-open mailing list Exi...@li...<mailto:Exi...@li...> https://lists.sourceforge.net/lists/listinfo/exist-open<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fexist-open&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C959a63da3e464730ecfc08db256c4cef%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144919303332280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=E%2BIIi17GNe7CxJt407XlyRMtyKtJngCu8OIzZvqwl4Q%3D&reserved=0> |
From: Joe W. <jo...@gm...> - 2023-03-15 15:45:30
|
Hi Bernie, No, I'm saying that %test:assertXPath("$result/self::*:html") should work. Joe On Wed, Mar 15, 2023 at 11:39 AM Harris, Bernard T. (GSFC-5870) < ber...@na...> wrote: > Are you saying > > %test:assertXPath("$result//*:html") > > Should work now? It does not. > > > > Bernie > > > > *From: *Joe Wicentowski <jo...@gm...> > *Date: *Wednesday, March 15, 2023 at 11:33 AM > *To: *"Harris, Bernard T. (GSFC-5870)" <ber...@na...> > *Cc: *Juri Leino <ju...@ex...>, " > exi...@li..." <exi...@li...> > *Subject: *Re: [Exist-open] [EXTERNAL] Re: %test:assertXPath help > > > > Hi Bernie, > > > > When I said: > > > > > Since your function's return value doesn't associate <html> with any > namespace prefix - only a namespace URI - then you should construct your > %assertXPath annotations with the expectation that elements have a default > namespace of "http://www.w3.org/1999/xhtml > <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136503017%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5rvwzLyiQSblAo1v%2BVEHKiSawWHPuEPwXj002k7xyyw%3D&reserved=0> > ". > > > > ... I was conveying how I expected XQSuite *should* work. > > > > But upon closer examination, I see that XQSuite does *not* provide > %test:assertXPath annotation with any mechanism to address elements whose > namespace is not bound to a namespace prefix. > > > > For situations such as the one you raised, you are currently limited to > wildcards. > > > > I will submit a PR fixing this - adjusting XQSuite to work as I originally > described. With the PR, you'll be able to use annotations like: > > > > %test:assertXPath("$result/self::html") > > %test:assertXPath("$result/head[title = 'Bad Request']") > > %test:assertXPath("$result/body/p[@class = 'ErrorMessage']") > > > > (Note here that $result is the <html> element, not a container around it. > Thus, the expressions are slightly different from your originals.) > > > > Joe > > > > On Wed, Mar 15, 2023 at 9:23 AM Harris, Bernard T. (GSFC-5870) via > Exist-open <exi...@li...> wrote: > > Thanks for the suggestions. If I replace the import statement with the > declaration of the test namespace, I get > > > > Cannot compile xquery: err:XPST0017 Call to undeclared function: test:suite > > > > Your other suggestion to simplify the assertXPath expression might work on > this simple case, but I actually want to get the assertXPath working for > other, more complicated, functions. I was trying to get this simple case > working before using assertXPath on other, more important and complex > functions. Any other suggestions? Thanks. > > > > Bernie > > > > *From: *Juri Leino <ju...@ex...> > *Date: *Wednesday, March 15, 2023 at 8:58 AM > *To: *"Harris, Bernard T. (GSFC-5870)" <ber...@na...> > *Cc: *"exi...@li..." <exi...@li... > > > *Subject: *[EXTERNAL] Re: [Exist-open] %test:assertXPath help > > > > Hi Bernard! > > I would replace > > import module namespace test="http://exist-db.org/xquery/xqsuite" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7o6yO6gI6F8rbwboU5UwlPSWCko913IGZ0GBrOMde0o%3D&reserved=0> > > at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; > > > with > > declare namespace test="http://exist-db.org/xquery/xqsuite" > <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7o6yO6gI6F8rbwboU5UwlPSWCko913IGZ0GBrOMde0o%3D&reserved=0> > ; > > Now to your actual problem: > > The namespace declared in the testsuite is very likely not seen by > XQSuite. > This is non-obvious. The reason for this is that test argument and > assertion annotation values > are string literals that get cast to the expected type in the context of > the XQSuite module > *and not in the context of the testsuite*. > > Many tests in exist-db core serialize XML an assert that the result > *string* matches the expected > value instead of which could be a workaround for your tests as well. > > In your case it might be easiest to just return the evaluated xpath from > the testcase and to assert the strings equal > > declare > > %test:arg("error", "Bad Request") > > %test:arg("description", "Invalid ResourceID") > > %test:arg("extraHtml") > > %test:assertXPath("Bad Request") > > function local:errorHtml( > > $error as xs:string, > > $description as xs:string, > > $extraHtml as node()?) > > as node() > > { > > let $result := > > <html xmlns="http://www.w3.org/1999/xhtml" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OluYPpFs2N27fx966IHk2lBY8WrO4Y61ava08NlD7F8%3D&reserved=0> lang="en" xml:lang="en"> > > <head> > > <title>{$error}</title> > > </head> > > <body> > > <p class='ErrorMessage'><b>Message: </b>{$error}</p> > > <p class='ErrorDescription'><b>Description: </b>{$description}</p> > > {$extraHtml} > > </body> > > </html> > > return > > $result/xhtml:html/xhtml:body/xhtml:p[@class = 'ErrorMessage'] > > }; > > > > > > > > Harris, Bernard T. (GSFC-5870) via Exist-open wrote on 14.03.23 13:35: > > No matter what I do, I cannot get a useful (more than "$result") %:assertXPath to work in this case > > > > xquery version "3.1"; > > > > import module namespace inspect="http://exist-db.org/xquery/inspection" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Finspection&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=eglg7PwI1xpl0%2FIWlEwBa73FynyjKHfgjK6UnXogsQ0%3D&reserved=0>; > > import module namespace test="http://exist-db.org/xquery/xqsuite" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7o6yO6gI6F8rbwboU5UwlPSWCko913IGZ0GBrOMde0o%3D&reserved=0> > > at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; > > > > declare namespace xhtml = "http://www.w3.org/1999/xhtml" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OluYPpFs2N27fx966IHk2lBY8WrO4Y61ava08NlD7F8%3D&reserved=0>; > > > > declare > > %test:arg("error", "Bad Request") > > %test:arg("description", "Invalid ResourceID") > > %test:arg("extraHtml") > > %test:assertXPath("$result//*:html") > > (: > > %test:assertXPath("$result//*:html/*:head[*:title = 'Bad Request']") > > %test:assertXPath("$result/xhtml:html/xhtml:body/xhtml:p[@class = 'ErrorMessage']") > > :) > > function local:errorHtml( > > $error as xs:string, > > $description as xs:string, > > $extraHtml as node()?) > > as node() > > { > > let $result := > > <html xmlns="http://www.w3.org/1999/xhtml" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OluYPpFs2N27fx966IHk2lBY8WrO4Y61ava08NlD7F8%3D&reserved=0> lang="en" xml:lang="en"> > > <head> > > <title>{$error}</title> > > </head> > > <body> > > <p class='ErrorMessage'><b>Message: </b>{$error}</p> > > <p class='ErrorDescription'><b>Description: </b>{$description}</p> > > {$extraHtml} > > </body> > > </html> > > return > > $result > > }; > > > > let $f := local:errorHtml#3 > > return > > test:suite($f) > > > > > > It always results in > > > > <testsuites> > > <testsuite package="http://www.w3.org/2005/xquery-local-functions" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2005%2Fxquery-local-functions&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3qNMXxBWnpwoxkClwgryRh%2Bp73xprYL0HIrAXaTtAoA%3D&reserved=0> timestamp="2023-03-14T08:28:16.065-04:00" tests="1" failures="1" errors="0" pending="0" time="PT0.002S"> > > <testcase name="errorHtml" class="local:errorHtml"> > > <failure message="assertXPath failed." type="failure-error-code-1">$result//*:html</failure> > > <output> > > <html xmlns="http://www.w3.org/1999/xhtml" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OluYPpFs2N27fx966IHk2lBY8WrO4Y61ava08NlD7F8%3D&reserved=0> lang="en" xml:lang="en"> > > <head> > > <title>Bad Request</title> > > </head> > > <body> > > <p class="ErrorMessage"> > > <b>Message: </b>Bad Request</p> > > <p class="ErrorDescription"> > > <b>Description: </b>Invalid ResourceID</p> > > </body> > > </html> > > </output> > > </testcase> > > </testsuite> > > </testsuites> > > > > Or > > > > <testcase name="errorHtml" class="spasexq:errorHtml"> > > <error type="err:XPST0081" message="It is a static error if a QName used in an expression contains a namespace prefix that cannot be expanded into a namespace URI by using the statically known namespaces. Error while evaluating expression: $result//xhtml:html. No namespace defined for prefix xhtml:html"/> > > </testcase> > > > > If I use the xhtml namespace in the assertXPath annotation. I found someone report a similar problem on stackoverflow in 2016 but it is not clear to me how it was resolved. This is on exist-db 6.2.0 and Java 11. Does anyone know what I am doing wrong? Thanks. > > > > Bernie Harris > > > > > > > > > > _______________________________________________ > > Exist-open mailing list > > Exi...@li... > > https://lists.sourceforge.net/lists/listinfo/exist-open <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fexist-open&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=H1qtamN52Grn9BtR0kViVdnt5GZfcB3vkFKGpIlMGY8%3D&reserved=0> > > > > > > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open > <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fexist-open&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=H1qtamN52Grn9BtR0kViVdnt5GZfcB3vkFKGpIlMGY8%3D&reserved=0> > > |
From: Harris, B. T. (GSFC-5870) <ber...@na...> - 2023-03-15 15:39:50
|
Are you saying %test:assertXPath("$result//*:html") Should work now? It does not. Bernie From: Joe Wicentowski <jo...@gm...> Date: Wednesday, March 15, 2023 at 11:33 AM To: "Harris, Bernard T. (GSFC-5870)" <ber...@na...> Cc: Juri Leino <ju...@ex...>, "exi...@li..." <exi...@li...> Subject: Re: [Exist-open] [EXTERNAL] Re: %test:assertXPath help Hi Bernie, When I said: > Since your function's return value doesn't associate <html> with any namespace prefix - only a namespace URI - then you should construct your %assertXPath annotations with the expectation that elements have a default namespace of "http://www.w3.org/1999/xhtml<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136503017%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5rvwzLyiQSblAo1v%2BVEHKiSawWHPuEPwXj002k7xyyw%3D&reserved=0>". ... I was conveying how I expected XQSuite *should* work. But upon closer examination, I see that XQSuite does *not* provide %test:assertXPath annotation with any mechanism to address elements whose namespace is not bound to a namespace prefix. For situations such as the one you raised, you are currently limited to wildcards. I will submit a PR fixing this - adjusting XQSuite to work as I originally described. With the PR, you'll be able to use annotations like: %test:assertXPath("$result/self::html") %test:assertXPath("$result/head[title = 'Bad Request']") %test:assertXPath("$result/body/p[@class = 'ErrorMessage']") (Note here that $result is the <html> element, not a container around it. Thus, the expressions are slightly different from your originals.) Joe On Wed, Mar 15, 2023 at 9:23 AM Harris, Bernard T. (GSFC-5870) via Exist-open <exi...@li...<mailto:exi...@li...>> wrote: Thanks for the suggestions. If I replace the import statement with the declaration of the test namespace, I get Cannot compile xquery: err:XPST0017 Call to undeclared function: test:suite Your other suggestion to simplify the assertXPath expression might work on this simple case, but I actually want to get the assertXPath working for other, more complicated, functions. I was trying to get this simple case working before using assertXPath on other, more important and complex functions. Any other suggestions? Thanks. Bernie From: Juri Leino <ju...@ex...<mailto:ju...@ex...>> Date: Wednesday, March 15, 2023 at 8:58 AM To: "Harris, Bernard T. (GSFC-5870)" <ber...@na...<mailto:ber...@na...>> Cc: "exi...@li...<mailto:exi...@li...>" <exi...@li...<mailto:exi...@li...>> Subject: [EXTERNAL] Re: [Exist-open] %test:assertXPath help Hi Bernard! I would replace import module namespace test="http://exist-db.org/xquery/xqsuite"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7o6yO6gI6F8rbwboU5UwlPSWCko913IGZ0GBrOMde0o%3D&reserved=0> at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; with declare namespace test="http://exist-db.org/xquery/xqsuite"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7o6yO6gI6F8rbwboU5UwlPSWCko913IGZ0GBrOMde0o%3D&reserved=0>; Now to your actual problem: The namespace declared in the testsuite is very likely not seen by XQSuite. This is non-obvious. The reason for this is that test argument and assertion annotation values are string literals that get cast to the expected type in the context of the XQSuite module and not in the context of the testsuite. Many tests in exist-db core serialize XML an assert that the result string matches the expected value instead of which could be a workaround for your tests as well. In your case it might be easiest to just return the evaluated xpath from the testcase and to assert the strings equal declare %test:arg("error", "Bad Request") %test:arg("description", "Invalid ResourceID") %test:arg("extraHtml") %test:assertXPath("Bad Request") function local:errorHtml( $error as xs:string, $description as xs:string, $extraHtml as node()?) as node() { let $result := <html xmlns="http://www.w3.org/1999/xhtml"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OluYPpFs2N27fx966IHk2lBY8WrO4Y61ava08NlD7F8%3D&reserved=0> lang="en" xml:lang="en"> <head> <title>{$error}</title> </head> <body> <p class='ErrorMessage'><b>Message: </b>{$error}</p> <p class='ErrorDescription'><b>Description: </b>{$description}</p> {$extraHtml} </body> </html> return $result/xhtml:html/xhtml:body/xhtml:p[@class = 'ErrorMessage'] }; Harris, Bernard T. (GSFC-5870) via Exist-open wrote on 14.03.23 13:35: No matter what I do, I cannot get a useful (more than "$result") %:assertXPath to work in this case xquery version "3.1"; import module namespace inspect="http://exist-db.org/xquery/inspection"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Finspection&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=eglg7PwI1xpl0%2FIWlEwBa73FynyjKHfgjK6UnXogsQ0%3D&reserved=0>; import module namespace test="http://exist-db.org/xquery/xqsuite"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7o6yO6gI6F8rbwboU5UwlPSWCko913IGZ0GBrOMde0o%3D&reserved=0> at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; declare namespace xhtml = "http://www.w3.org/1999/xhtml"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OluYPpFs2N27fx966IHk2lBY8WrO4Y61ava08NlD7F8%3D&reserved=0>; declare %test:arg("error", "Bad Request") %test:arg("description", "Invalid ResourceID") %test:arg("extraHtml") %test:assertXPath("$result//*:html") (: %test:assertXPath("$result//*:html/*:head[*:title = 'Bad Request']") %test:assertXPath("$result/xhtml:html/xhtml:body/xhtml:p[@class = 'ErrorMessage']") :) function local:errorHtml( $error as xs:string, $description as xs:string, $extraHtml as node()?) as node() { let $result := <html xmlns="http://www.w3.org/1999/xhtml"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OluYPpFs2N27fx966IHk2lBY8WrO4Y61ava08NlD7F8%3D&reserved=0> lang="en" xml:lang="en"> <head> <title>{$error}</title> </head> <body> <p class='ErrorMessage'><b>Message: </b>{$error}</p> <p class='ErrorDescription'><b>Description: </b>{$description}</p> {$extraHtml} </body> </html> return $result }; let $f := local:errorHtml#3 return test:suite($f) It always results in <testsuites> <testsuite package="http://www.w3.org/2005/xquery-local-functions"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2005%2Fxquery-local-functions&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3qNMXxBWnpwoxkClwgryRh%2Bp73xprYL0HIrAXaTtAoA%3D&reserved=0> timestamp="2023-03-14T08:28:16.065-04:00" tests="1" failures="1" errors="0" pending="0" time="PT0.002S"> <testcase name="errorHtml" class="local:errorHtml"> <failure message="assertXPath failed." type="failure-error-code-1">$result//*:html</failure> <output> <html xmlns="http://www.w3.org/1999/xhtml"<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OluYPpFs2N27fx966IHk2lBY8WrO4Y61ava08NlD7F8%3D&reserved=0> lang="en" xml:lang="en"> <head> <title>Bad Request</title> </head> <body> <p class="ErrorMessage"> <b>Message: </b>Bad Request</p> <p class="ErrorDescription"> <b>Description: </b>Invalid ResourceID</p> </body> </html> </output> </testcase> </testsuite> </testsuites> Or <testcase name="errorHtml" class="spasexq:errorHtml"> <error type="err:XPST0081" message="It is a static error if a QName used in an expression contains a namespace prefix that cannot be expanded into a namespace URI by using the statically known namespaces. Error while evaluating expression: $result//xhtml:html. No namespace defined for prefix xhtml:html"/> </testcase> If I use the xhtml namespace in the assertXPath annotation. I found someone report a similar problem on stackoverflow in 2016 but it is not clear to me how it was resolved. This is on exist-db 6.2.0 and Java 11. Does anyone know what I am doing wrong? Thanks. Bernie Harris _______________________________________________ Exist-open mailing list Exi...@li...<mailto:Exi...@li...> https://lists.sourceforge.net/lists/listinfo/exist-open<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fexist-open&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=H1qtamN52Grn9BtR0kViVdnt5GZfcB3vkFKGpIlMGY8%3D&reserved=0> _______________________________________________ Exist-open mailing list Exi...@li...<mailto:Exi...@li...> https://lists.sourceforge.net/lists/listinfo/exist-open<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fexist-open&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7Cc9e07b1122764716731f08db256aa1c0%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144912136659229%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=H1qtamN52Grn9BtR0kViVdnt5GZfcB3vkFKGpIlMGY8%3D&reserved=0> |
From: Joe W. <jo...@gm...> - 2023-03-15 15:33:33
|
Hi Bernie, When I said: > Since your function's return value doesn't associate <html> with any namespace prefix - only a namespace URI - then you should construct your %assertXPath annotations with the expectation that elements have a default namespace of "http://www.w3.org/1999/xhtml". ... I was conveying how I expected XQSuite *should* work. But upon closer examination, I see that XQSuite does *not* provide %test:assertXPath annotation with any mechanism to address elements whose namespace is not bound to a namespace prefix. For situations such as the one you raised, you are currently limited to wildcards. I will submit a PR fixing this - adjusting XQSuite to work as I originally described. With the PR, you'll be able to use annotations like: %test:assertXPath("$result/self::html") %test:assertXPath("$result/head[title = 'Bad Request']") %test:assertXPath("$result/body/p[@class = 'ErrorMessage']") (Note here that $result is the <html> element, not a container around it. Thus, the expressions are slightly different from your originals.) Joe On Wed, Mar 15, 2023 at 9:23 AM Harris, Bernard T. (GSFC-5870) via Exist-open <exi...@li...> wrote: > Thanks for the suggestions. If I replace the import statement with the > declaration of the test namespace, I get > > > > Cannot compile xquery: err:XPST0017 Call to undeclared function: test:suite > > > > Your other suggestion to simplify the assertXPath expression might work on > this simple case, but I actually want to get the assertXPath working for > other, more complicated, functions. I was trying to get this simple case > working before using assertXPath on other, more important and complex > functions. Any other suggestions? Thanks. > > > > Bernie > > > > *From: *Juri Leino <ju...@ex...> > *Date: *Wednesday, March 15, 2023 at 8:58 AM > *To: *"Harris, Bernard T. (GSFC-5870)" <ber...@na...> > *Cc: *"exi...@li..." <exi...@li... > > > *Subject: *[EXTERNAL] Re: [Exist-open] %test:assertXPath help > > > > Hi Bernard! > > I would replace > > > import module namespace test="http://exist-db.org/xquery/xqsuite" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C9d7457058d8446cbad0408db2554e211%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144819057640707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=U5DOAQhB5y9KN7wqqPMM8RkiydlgrTZTdsggwc65fgU%3D&reserved=0> > > at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; > > > with > > declare namespace test="http://exist-db.org/xquery/xqsuite" > <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C9d7457058d8446cbad0408db2554e211%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144819057640707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=U5DOAQhB5y9KN7wqqPMM8RkiydlgrTZTdsggwc65fgU%3D&reserved=0> > ; > > Now to your actual problem: > > The namespace declared in the testsuite is very likely not seen by > XQSuite. > This is non-obvious. The reason for this is that test argument and > assertion annotation values > are string literals that get cast to the expected type in the context of > the XQSuite module > *and not in the context of the testsuite*. > > Many tests in exist-db core serialize XML an assert that the result > *string* matches the expected > value instead of which could be a workaround for your tests as well. > > In your case it might be easiest to just return the evaluated xpath from > the testcase and to assert the strings equal > > > declare > > %test:arg("error", "Bad Request") > > %test:arg("description", "Invalid ResourceID") > > %test:arg("extraHtml") > > %test:assertXPath("Bad Request") > > function local:errorHtml( > > $error as xs:string, > > $description as xs:string, > > $extraHtml as node()?) > > as node() > > { > > let $result := > > <html xmlns="http://www.w3.org/1999/xhtml" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C9d7457058d8446cbad0408db2554e211%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144819057640707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=5%2BmCXRysPA%2BvDWJjLhfFaP2WawF1h3bfLP3W3R5liZM%3D&reserved=0> lang="en" xml:lang="en"> > > <head> > > <title>{$error}</title> > > </head> > > <body> > > <p class='ErrorMessage'><b>Message: </b>{$error}</p> > > <p class='ErrorDescription'><b>Description: </b>{$description}</p> > > {$extraHtml} > > </body> > > </html> > > return > > $result/xhtml:html/xhtml:body/xhtml:p[@class = 'ErrorMessage'] > > }; > > > > > > > > Harris, Bernard T. (GSFC-5870) via Exist-open wrote on 14.03.23 13:35: > > No matter what I do, I cannot get a useful (more than "$result") %:assertXPath to work in this case > > > > xquery version "3.1"; > > > > import module namespace inspect="http://exist-db.org/xquery/inspection" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Finspection&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C9d7457058d8446cbad0408db2554e211%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144819057640707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=r2hdSedYSS7asVgMnvy7WmZpZlqk%2FpZv%2BPCBfr%2Fz1QQ%3D&reserved=0>; > > import module namespace test="http://exist-db.org/xquery/xqsuite" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fexist-db.org%2Fxquery%2Fxqsuite&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C9d7457058d8446cbad0408db2554e211%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144819057640707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=U5DOAQhB5y9KN7wqqPMM8RkiydlgrTZTdsggwc65fgU%3D&reserved=0> > > at "resource:org/exist/xquery/lib/xqsuite/xqsuite.xql"; > > > > declare namespace xhtml = "http://www.w3.org/1999/xhtml" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C9d7457058d8446cbad0408db2554e211%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144819057640707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=5%2BmCXRysPA%2BvDWJjLhfFaP2WawF1h3bfLP3W3R5liZM%3D&reserved=0>; > > > > declare > > %test:arg("error", "Bad Request") > > %test:arg("description", "Invalid ResourceID") > > %test:arg("extraHtml") > > %test:assertXPath("$result//*:html") > > (: > > %test:assertXPath("$result//*:html/*:head[*:title = 'Bad Request']") > > %test:assertXPath("$result/xhtml:html/xhtml:body/xhtml:p[@class = 'ErrorMessage']") > > :) > > function local:errorHtml( > > $error as xs:string, > > $description as xs:string, > > $extraHtml as node()?) > > as node() > > { > > let $result := > > <html xmlns="http://www.w3.org/1999/xhtml" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C9d7457058d8446cbad0408db2554e211%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144819057640707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=5%2BmCXRysPA%2BvDWJjLhfFaP2WawF1h3bfLP3W3R5liZM%3D&reserved=0> lang="en" xml:lang="en"> > > <head> > > <title>{$error}</title> > > </head> > > <body> > > <p class='ErrorMessage'><b>Message: </b>{$error}</p> > > <p class='ErrorDescription'><b>Description: </b>{$description}</p> > > {$extraHtml} > > </body> > > </html> > > return > > $result > > }; > > > > let $f := local:errorHtml#3 > > return > > test:suite($f) > > > > > > It always results in > > > > <testsuites> > > <testsuite package="http://www.w3.org/2005/xquery-local-functions" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F2005%2Fxquery-local-functions&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C9d7457058d8446cbad0408db2554e211%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144819057640707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=3cN4ZDb2Mnw9K0UQDfC3dGhbMg0hOVObes%2FzM4TSi9g%3D&reserved=0> timestamp="2023-03-14T08:28:16.065-04:00" tests="1" failures="1" errors="0" pending="0" time="PT0.002S"> > > <testcase name="errorHtml" class="local:errorHtml"> > > <failure message="assertXPath failed." type="failure-error-code-1">$result//*:html</failure> > > <output> > > <html xmlns="http://www.w3.org/1999/xhtml" <https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C9d7457058d8446cbad0408db2554e211%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144819057640707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=5%2BmCXRysPA%2BvDWJjLhfFaP2WawF1h3bfLP3W3R5liZM%3D&reserved=0> lang="en" xml:lang="en"> > > <head> > > <title>Bad Request</title> > > </head> > > <body> > > <p class="ErrorMessage"> > > <b>Message: </b>Bad Request</p> > > <p class="ErrorDescription"> > > <b>Description: </b>Invalid ResourceID</p> > > </body> > > </html> > > </output> > > </testcase> > > </testsuite> > > </testsuites> > > > > Or > > > > <testcase name="errorHtml" class="spasexq:errorHtml"> > > <error type="err:XPST0081" message="It is a static error if a QName used in an expression contains a namespace prefix that cannot be expanded into a namespace URI by using the statically known namespaces. Error while evaluating expression: $result//xhtml:html. No namespace defined for prefix xhtml:html"/> > > </testcase> > > > > If I use the xhtml namespace in the assertXPath annotation. I found someone report a similar problem on stackoverflow in 2016 but it is not clear to me how it was resolved. This is on exist-db 6.2.0 and Java 11. Does anyone know what I am doing wrong? Thanks. > > > > Bernie Harris > > > > > > > > > > _______________________________________________ > > Exist-open mailing list > > Exi...@li... > > https://lists.sourceforge.net/lists/listinfo/exist-open <https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Fexist-open&data=05%7C01%7Cbernard.t.harris%40nasa.gov%7C9d7457058d8446cbad0408db2554e211%7C7005d45845be48ae8140d43da96dd17b%7C0%7C0%7C638144819057640707%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=paJOZIeH9sx5l5MVB4KuF7WMNNfkAzJpqRd%2FLMmijbE%3D&reserved=0> > > > > > > _______________________________________________ > Exist-open mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-open > |