[basex-talk] inspect functions and %private
Hi, To report a small issue in the inspect functions module with %private declaration. The following code runs perfectly : declare %private function local:test(){()}; for $fun in inspect:functions() return gotcha However, If the function test is located in another module, say test, then the following code import module namespace test=http://www.example.com/test; at test.xq; for $fun in inspect:functions() return gotcha raise an exception. Cheers, Jean-Marc ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
[basex-talk] Full text queries ok :)
Hello everybody Thanks to your help Christian, our full text queries yet work fine. I still don't understand exactly what the problem was and why we got 500 internal errors. Maybe a too heavy query and thus a memory problem ? Anyway now with this kind of writing, the queries are completed : declare function desanti:display-tags($collection, $dataType, $mode){ let $label := if($dataType = subject) then concepts else personnes return div class={ $mode } h6{ $label }/h6 span{ for $term in $collection group by $term order by $term collation ?lang=fr let $occurrences := count( ft:search('Desanti', $term)/..[local-name() = $dataType][ parent::*:controlaccess/ parent::*:c/ ancestor::*:dsc/ parent::*:archdesc/ parent::*:ead/ parent::document-node() ] ) return if($mode = cloud) then ( spana style=font-size:{ $occurrences idiv 10 + 1 }em;padding:{ $occurrences idiv 10 }px; title={ $occurrences } href=/restxq/desanti/{$label}/{$term}{$term}/a/span ) else ( span class={ $occurrences }a href=/restxq/desanti/{$label}/{$term}{ $term }/a ({ $occurrences }) /span ) }/span /div }; Thanks a lot !!! Maud -- _« Ne travaillez jamais »_ MAUD INGARAO IHPC (UMR 5037) Institut d'histoire de la pensée classique, de l'Humanisme aux Lumières Ecole Normale Supérieure de Lyon - Site Descartes - Bureau R322 15 Parvis René Descartes - BP7000 - 69342 Lyon CEDEX 07 +33 4 37 37 65 79 - maud.inga...@ens-lyon.fr _Je suis absente le vendredi | Out of office on Fridays_ http://pensee-classique.ens-lyon.fr [1] http://institutdesanti.ens-lyon.fr [2] http://ahn.ens-lyon.fr [3] http://www.mutec-shs.fr [4] http://www.projet-plume.org [5] http://www.cahier.paris-sorbonne.fr/ [6] Links: -- [1] http://pensee-classique.ens-lyon.fr [2] http://institutdesanti.ens-lyon.fr [3] http://ahn.ens-lyon.fr [4] http://www.mutec-shs.fr [5] http://www.projet-plume.org [6] http://www.cahier.paris-sorbonne.fr/ ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] Decoupling custom code with restxq
Hi Sebastian, BTW: I unfortunately missed your and Alexanders presentation at the MarkUp Forum: are there any slides available? The slides should soon be available here: http://www.markupforum.de/archiv.html This is similar to imported modules in XSLT: If you import template rules, which are more specific, they will be applied first. Could this be applied to XQuery as well? (But in XSLT you would have to import the custom code and hence change your code. We can do that in XQuery as well, but it is not completely decoupled, is it?) As Jean-Marc pointed out, the Inspection Module may help out. The module is fairly new, so we are interested in your (and everyone’s) feedback if you would like to have some functions added.. Christian ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] inspect functions and %private
However, If the function test is located in another module, say test, then the following code import module namespace test=http://www.example.com/test; at test.xq; for $fun in inspect:functions() return gotcha raise an exception. If you mean the exception Function 'test:test' is not visible from this module., that’s how it should be. If you mean another exception, could you please provide us with an SSCCE? Christian ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
[basex-talk] XQUERY command and PHP
Hi Basex, My question is about the command XQUERY [query]. Does it work with any XQuery queries or only with XPath? I tried the following: ?php include(BaseXClient.php); // create session $session = new Session(localhost, 1984, admin, admin); $session-execute(open myfirstdatabase); echo $session-execute(xquery for $n in //country[name = 'Switzerland'] return $n) ; // close session $session-close(); ? This example causes the error: [XPST0003] Incomplete 'window' expression.' But the following example: ?php include(BaseXClient.php); // create session $session = new Session(localhost, 1984, admin, admin); $session-execute(open myfirstdatabase); echo $session-execute(xquery //country[name = 'Switzerland']) ; // close session $session-close(); ? is executed without error. The difference between the two examples is that one uses XQuery and another - XPath expression. Please, tell me whether the command XQUERY can be used with any XQuery queries and how exactly? Thanks regards, Tsvetanka___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] inspect functions and %private
Hi christian, yes this is the point : Stopped at C:/Jiheme/informatique/workspace/Graph DataBase/module/common.xq, 31/89: [XPST0017] Function 'local:test' is not visible from this module. If this is desired, it means that we can not use the inspection module as soon as there is %private annotation in any imported module. Maybe an alternative behavior for the inspection module could be to ignore %private functions ? 2013/12/2 Christian Grün christian.gr...@gmail.com However, If the function test is located in another module, say test, then the following code import module namespace test=http://www.example.com/test; at test.xq; for $fun in inspect:functions() return gotcha raise an exception. If you mean the exception Function 'test:test' is not visible from this module., that’s how it should be. If you mean another exception, could you please provide us with an SSCCE? Christian ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] office paper
Dear Sir, It's a nice day! I’m NIKI. We are a company mainly in export paper products. We have been in this field for many years. Our paper products contains copy paper, newsprint paper, offset paper, NCR paper etc. Should any of the item be of interest to you, please let me know. We shall be glad to give you our the most favorable price upon receipt of your detailed requirements. May be now you have regular partner. If So, please leave my message in your email box, maybe someday it will be useful. Best Wishes! Enjoy your work! Regards, Niki Skype:xinyangpaper Xinyang Paper Add:28 xincheng industry zone,chengyang district, qingdao city,shandong province Email:xinyan...@xy-sy.net Web:www.xinyangpapers.com Mobile:86 15833992251___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
[basex-talk] Results from ft:extract()
Hello all When using ft:extract() on nodes, it seems to clip into the match itself too often. Is it possible to have ft:extract() leave as much before the match as after? For example, here are two results for spise lunsj (= eat lunch (language is Norwegian)) the first is as it should be, while the second have half of the matched string clipped . The result is obtained first as a set of hits using fulltext search [text() contains text {$terms} all], then each hit is processed through ft:extract($hit, $terms): ... gjerne komme for å spise lunsj med meg på Harrods. Da skal jeg servere hjortetestikler fra eiendommen min i Skottland. Vi trenger nemlig alle store... ... de franske VM-spillerne hjem til Paris. Der ble de mottatt av fans både på Charles de Gaulle-flyplassen og da de ankom Elysee-palasset for å spise ... Regards, Lars G Johnsen National Library of Norway ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
[basex-talk] CDATA in xquery
I would like to generate CDATA of one xmk construct like this. This does not calculate $1,$f2 and $f3 and insert their serialized version into features tag Can we do this in xquery? let $allfs := record name{$name}/name features ![CDATA[ h3Features:/h3 br/ ul li{$f1}/li li{$f2}/li li{$f3}/li /ul ]] /features /record Erol Akarsu ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] CDATA in xquery
On Mon, 2013-12-02 at 15:29 -0500, Erol Akarsu wrote: I would like to generate CDATA of one xmk construct like this. [...] let $allfs := record name{$name}/name features ![CDATA[ h3Features:/h3 br/ ul li{$f1}/li li{$f2}/li li{$f3}/li /ul ]] /features /record Watch out that if $f1 (say) contains the string ]] you'd be liable to a cdata injection attack. Having said that, no, I'd probably write an e() function, declare function my:e($name as xs:string, $content as xs:string) as xs:string { return concat(, $name, , $content, /, $name, ) } and use my:e(ul, concat(my:e(li, $f1), my:e(li, $f2), my:e(li, $f3)) and so on. Which gives you slightly more checking. The implementation will probably generate lt; and gt; rather than CDATA; XML says they're equivalent. In XQuery 3 there's a per-element serialization option for CDATA sections, http://www.w3.org/TR/xslt-xquery-serialization-30/#XML_CDATA-SECTION-ELEMENTS so if BaseX implements that you have a way to get closer to what you want, perhaps, e.g. for generating RSS. However, you'd still need to construct a string containing h1 etc. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] CDATA in xquery
Liam, Thanks for help, Basex implements serialize function. This can do: let $params := output:serialization-parameters xmlns:output= http://www.w3.org/2010/xslt-xquery-serialization; output:omit-xml-declaration value=yes/ /output:serialization-parameters let $sf := fn:concat(fn:serialize(h3Features:/h3,$params), fn:serialize(br/,$params), fn:serialize( ul li{$f1}/li li{$f2}/li li{$f3}/li /ul, $params)) On Mon, Dec 2, 2013 at 3:44 PM, Liam R E Quin l...@w3.org wrote: On Mon, 2013-12-02 at 15:29 -0500, Erol Akarsu wrote: I would like to generate CDATA of one xmk construct like this. [...] let $allfs := record name{$name}/name features ![CDATA[ h3Features:/h3 br/ ul li{$f1}/li li{$f2}/li li{$f3}/li /ul ]] /features /record Watch out that if $f1 (say) contains the string ]] you'd be liable to a cdata injection attack. Having said that, no, I'd probably write an e() function, declare function my:e($name as xs:string, $content as xs:string) as xs:string { return concat(, $name, , $content, /, $name, ) } and use my:e(ul, concat(my:e(li, $f1), my:e(li, $f2), my:e(li, $f3)) and so on. Which gives you slightly more checking. The implementation will probably generate lt; and gt; rather than CDATA; XML says they're equivalent. In XQuery 3 there's a per-element serialization option for CDATA sections, http://www.w3.org/TR/xslt-xquery-serialization-30/#XML_CDATA-SECTION-ELEMENTS so if BaseX implements that you have a way to get closer to what you want, perhaps, e.g. for generating RSS. However, you'd still need to construct a string containing h1 etc. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] Results from ft:extract()
Hi Lars, When using ft:extract() on nodes, it seems to clip into the match itself too often. Is it possible to have ft:extract() leave as much before the match as after? the ft:extract algorithm is an intricate one [1], as the inputs to be processed can be very manifold, but we can try to tweak it a little. Could you please provide us with a little sample XML and query? Best, Christian PS: if you, or someone else, want to tweak the extract code.. We are always glad to receive patches! [1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/basex/query/util/DataFTBuilder.java For example, here are two results for spise lunsj (= eat lunch (language is Norwegian)) the first is as it should be, while the second have half of the matched string clipped . The result is obtained first as a set of hits using fulltext search [text() contains text {$terms} all], then each hit is processed through ft:extract($hit, $terms): ... gjerne komme for å spise lunsj med meg på Harrods. Da skal jeg servere hjortetestikler fra eiendommen min i Skottland. Vi trenger nemlig alle store... ... de franske VM-spillerne hjem til Paris. Der ble de mottatt av fans både på Charles de Gaulle-flyplassen og da de ankom Elysee-palasset for å spise... Regards, Lars G Johnsen National Library of Norway ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk