Re: [basex-talk] querying database
Thank you it works.Just a last question please.i need to write a query which means: return titles of all docs in database where the item/qcode ="tx"and where one of the subject name contains any one of those string: "FH" or "HG" let $db := db:open('mybase')for $x in $db//item[@qcode="tx"]where $db//subject/name[text() contains text{ "FH","HG"}any]return{$db//title} I think this query is wrong De : Maximilian GärberÀ : Mohamed kharrat Cc : BaseX Talk Envoyé le : Mardi 19 juillet 2016 17h44 Objet : Re: [basex-talk] querying database Hi, you do not need to use doc() or collection() if your documents are stored in a database. The documents are just nodes as well, so doing something like: let $db := db:open('some-db') for $d in $db//item/@qcode="tx" return $d would return the items from all nodes (all files) BTW: I guess you want: $db// item[@qcode="tx"] Regards, Max 2016-07-19 18:33 GMT+02:00 Mohamed kharrat : > Hi, > i have created a database in BaseX GUI but i did not understand how to use > it inside FLWR query. > So since i would like to create one FLWR query to query all my files in the > database not only one file with doc() > i have tried collection() is that right? (i have putted all my xml files > inside path/ directory) > This is my query: > > let $d:= collection ("path/") > let $r:= doc("myfile1.xml") > for $d in $d// item/@qcode="tx" > where $d//subj[text() contains text { 'Hal', 'Fade' } any] and $r/subj > ="Berlin" > return > $d/tit > > > it shows me error: [XPTY0019] descendant::subj: node expected, xs:boolean > found: false(). > > what is that error about? > > Thank you > Best regards
Re: [basex-talk] querying database
ok i understand now. In fact i am looking for results which have this condition of qcode=tx . I do not want to know if it's true or false. On Tue, Jul 19, 2016 at 6:23 PM +0100, "Christian Grün"wrote: $d// item/@qcode="tx" …returns a boolean value (true or false). Hence, for $d in $d// item/@qcode="tx" is the same as for $d in true() or for $d in false() As a result, $d//subj will give you an error (node expected, boolean found). On Tue, Jul 19, 2016 at 7:16 PM, Mohamed kharrat wrote: > Thank you, it works :) > What about the error? error: [XPTY0019] descendant::subj: node expected, > xs:boolean found: false(). > Any idea please? > > > > De : Maximilian Gärber > À : Mohamed kharrat > Cc : BaseX Talk > Envoyé le : Mardi 19 juillet 2016 17h44 > Objet : Re: [basex-talk] querying database > > Hi, > > you do not need to use doc() or collection() if your documents are > stored in a database. > > The documents are just nodes as well, so doing something like: > > let $db := db:open('some-db') > for $d in $db//item/@qcode="tx" > return $d > > would return the items from all nodes (all files) > > BTW: I guess you want: $db// item[@qcode="tx"] > > Regards, > Max > > 2016-07-19 18:33 GMT+02:00 Mohamed kharrat : >> Hi, >> i have created a database in BaseX GUI but i did not understand how to use >> it inside FLWR query. >> So since i would like to create one FLWR query to query all my files in >> the >> database not only one file with doc() >> i have tried collection() is that right? (i have putted all my xml files >> inside path/ directory) >> This is my query: >> >> let $d:= collection ("path/") >> let $r:= doc("myfile1.xml") >> for $d in $d// item/@qcode="tx" >> where $d//subj[text() contains text { 'Hal', 'Fade' } any] and $r/subj >> ="Berlin" >> return >> $d/tit >> >> >> it shows me error: [XPTY0019] descendant::subj: node expected, xs:boolean >> found: false(). >> >> what is that error about? >> >> Thank you >> Best regards > >
Re: [basex-talk] querying database
$d// item/@qcode="tx" …returns a boolean value (true or false). Hence, for $d in $d// item/@qcode="tx" is the same as for $d in true() or for $d in false() As a result, $d//subj will give you an error (node expected, boolean found). On Tue, Jul 19, 2016 at 7:16 PM, Mohamed kharratwrote: > Thank you, it works :) > What about the error? error: [XPTY0019] descendant::subj: node expected, > xs:boolean found: false(). > Any idea please? > > > > De : Maximilian Gärber > À : Mohamed kharrat > Cc : BaseX Talk > Envoyé le : Mardi 19 juillet 2016 17h44 > Objet : Re: [basex-talk] querying database > > Hi, > > you do not need to use doc() or collection() if your documents are > stored in a database. > > The documents are just nodes as well, so doing something like: > > let $db := db:open('some-db') > for $d in $db//item/@qcode="tx" > return $d > > would return the items from all nodes (all files) > > BTW: I guess you want: $db// item[@qcode="tx"] > > Regards, > Max > > 2016-07-19 18:33 GMT+02:00 Mohamed kharrat : >> Hi, >> i have created a database in BaseX GUI but i did not understand how to use >> it inside FLWR query. >> So since i would like to create one FLWR query to query all my files in >> the >> database not only one file with doc() >> i have tried collection() is that right? (i have putted all my xml files >> inside path/ directory) >> This is my query: >> >> let $d:= collection ("path/") >> let $r:= doc("myfile1.xml") >> for $d in $d// item/@qcode="tx" >> where $d//subj[text() contains text { 'Hal', 'Fade' } any] and $r/subj >> ="Berlin" >> return >> $d/tit >> >> >> it shows me error: [XPTY0019] descendant::subj: node expected, xs:boolean >> found: false(). >> >> what is that error about? >> >> Thank you >> Best regards > >
Re: [basex-talk] querying database
Thank you, it works :)What about the error? error: [XPTY0019] descendant::subj: node expected, xs:boolean found: false().Any idea please? De : Maximilian GärberÀ : Mohamed kharrat Cc : BaseX Talk Envoyé le : Mardi 19 juillet 2016 17h44 Objet : Re: [basex-talk] querying database Hi, you do not need to use doc() or collection() if your documents are stored in a database. The documents are just nodes as well, so doing something like: let $db := db:open('some-db') for $d in $db//item/@qcode="tx" return $d would return the items from all nodes (all files) BTW: I guess you want: $db// item[@qcode="tx"] Regards, Max 2016-07-19 18:33 GMT+02:00 Mohamed kharrat : > Hi, > i have created a database in BaseX GUI but i did not understand how to use > it inside FLWR query. > So since i would like to create one FLWR query to query all my files in the > database not only one file with doc() > i have tried collection() is that right? (i have putted all my xml files > inside path/ directory) > This is my query: > > let $d:= collection ("path/") > let $r:= doc("myfile1.xml") > for $d in $d// item/@qcode="tx" > where $d//subj[text() contains text { 'Hal', 'Fade' } any] and $r/subj > ="Berlin" > return > $d/tit > > > it shows me error: [XPTY0019] descendant::subj: node expected, xs:boolean > found: false(). > > what is that error about? > > Thank you > Best regards
Re: [basex-talk] restxq multipart/mixed application/octet-stream
Hi Jiri, Quite some time has passed, and it may well be that you don’t remember your question on the list… But I wanted to report that BaseX should now be capable of sending and receiving multipart data with binary contents [1]: Multipart data will now be transfered as Base64 if it contains non-ASCII characters. A new snapshot is available [2]; BaseX 8.5.2 will be released around end of July. Cheers Christian [1] https://github.com/BaseXdb/basex/issues/1203 [2] http://files.basex.org/releases/latest On Tue, Oct 20, 2015 at 9:39 AM, Christian Grünwrote: > Thanks for the helpful example. I have added a GitHub issue [1], and > we'll try to fix it soon. > Christian > > [1] https://github.com/BaseXdb/basex/issues/1203 > > > > On Tue, Oct 20, 2015 at 9:25 AM, Dolejsi Jiri wrote: >> First I will try to send simple Binary document with 2 bytes(0xff0xff): >> let $req := >> >> >> >> return http:send-request($req,"http://127.0.0.1:8984/insert-doc;, >> bin:hex("")) >> >> into restxq method: >> >> declare %rest:path("insert-doc") %rest:POST("{$doc}") function >> nib:insert-doc($doc as xs:base64Binary) as item() >> { >>{$doc} >> }; >> >> Response is: //8= >> Thi is correct: bin:to-octets(xs:base64Binary("//8=")) => 255 255 >> (NOTE: if I embed document inside body { >> bin:hex("")}, it will return Ly84PQ==) >> >> >> Then try to send multipart/mixed, first document xml, second binary: >> let $req := >> >> >> >> >> >> >> return http:send-request($req,"http://127.0.0.1:8984/insert-doc-m;, >> (info about audio,bin:hex(""))) >> >> into restxq method: >> declare %rest:path("insert-doc-m") %rest:POST("{$doc}") function >> nib:insert-doc-m($doc as item()+) as item() >> { >>let $xml := $doc[1] >>let $bin := $doc[2] >>return {$bin} >> }; >> Response is: ? >> >> >> (NOTE: when I do not specify attribute boundary, then it will provoke java >> exception) >> >> >> -Original Message- >> From: Christian Grün [mailto:christian.gr...@gmail.com] >> Sent: Monday, October 19, 2015 2:32 PM >> To: Dolejsi Jiri >> Subject: Re: [basex-talk] restxq multipart/mixed application/octet-stream >> >>> So I used multipart/mixed type. But mp3 part is damaged, after received by >>> restxq function. >> >> Ok; so it doesn't matter if you use file:write-text or file:write-binary? >> >> Could you please provide us with a little example request that we can use >> for debugging? >> >> >> >>> -Original Message- >>> From: Christian Grün [mailto:christian.gr...@gmail.com] >>> Sent: Monday, October 19, 2015 2:27 PM >>> To: Dolejsi Jiri >>> Subject: Re: [basex-talk] restxq multipart/mixed >>> application/octet-stream >>> When I send this same value as application/octet-stream document into restxq method declare %rest:path("test2") %rest:PUT("{$mrs-doc}") function nib:insert-doc2($doc as item()) as empty-sequence() { file:write-binary("d:\abc.bin", $doc) }; It functions ok. >>> >>> So I assume you already found the answer? >>> >>> >>> Odesílatel tohoto e-mailu informuje adresáta, že ČTK vyžaduje k platnosti >>> právního jednání písemnou formu s výjimkou jednání realizovaného >>> prostřednictvím elektronických systémů ČTK (Fotobanka, Videobanka, Protext, >>> NewsMarket, Infobanka). >>> >>> Dále informuje adresáta, že smlouva s ČTK nemůže být uzavřena, pokud není >>> výslovná shoda o všech jejích náležitostech. ČTK si vyhrazuje právo ukončit >>> jednání o uzavření smlouvy kdykoli, a to z jakéhokoliv důvodu nebo i bez >>> uvedení důvodu. Obsahuje-li tento e-mail nabídku, ČTK vylučuje přijetí >>> nabídky s dodatkem či odchylkou. >>> >>> Pokud je tento mail kvitancí ve smyslu § 1949, odst. 1 zák. č. 89/2012 Sb., >>> ČTK výslovně sděluje, že kvitance o zaplacení jakékoliv splátky dluhu >>> neznamená, že byla současně zaplacena jakákoliv část téhož dluhu splatná >>> dříve, a kvitance o splátce jistiny neznamená, že bylo zaplaceno také >>> příslušenství pohledávky.
Re: [basex-talk] Selective Indexing: Do I need to make sure queries only use the indexed elements?
Hi Max, > especially with the FTINDEX, say I indexed all elements with a > fulltext query that asks for any elments, e.g. > > //*[text() contains text { 'bar', 'baz' } any] Queries of this type will be evaluated by sequential scans, because all nodes need to be accessed anyway. You can check the query info to see if the index will be utilized. > How about ft:search("DB", "bar") - would this behave differently? This one will only give you results from the index (The documentation says: »Returns all text nodes from the full-text index of the database $db that contain the specified $terms.«). Hope this helps Christian
[basex-talk] Selective Indexing: Do I need to make sure queries only use the indexed elements?
Hi, especially with the FTINDEX, say I indexed all elements with a fulltext query that asks for any elments, e.g. //*[text() contains text { 'bar', 'baz' } any] would this only use the elements or traverse all other elments (without index) as well? How about ft:search("DB", "bar") - would this behave differently? Regards, Max
Re: [basex-talk] querying database
Hi, you do not need to use doc() or collection() if your documents are stored in a database. The documents are just nodes as well, so doing something like: let $db := db:open('some-db') for $d in $db//item/@qcode="tx" return $d would return the items from all nodes (all files) BTW: I guess you want: $db// item[@qcode="tx"] Regards, Max 2016-07-19 18:33 GMT+02:00 Mohamed kharrat: > Hi, > i have created a database in BaseX GUI but i did not understand how to use > it inside FLWR query. > So since i would like to create one FLWR query to query all my files in the > database not only one file with doc() > i have tried collection() is that right? (i have putted all my xml files > inside path/ directory) > This is my query: > > let $d:= collection ("path/") > let $r:= doc("myfile1.xml") > for $d in $d// item/@qcode="tx" > where $d//subj[text() contains text { 'Hal', 'Fade' } any] and $r/subj > ="Berlin" > return > $d/tit > > > it shows me error: [XPTY0019] descendant::subj: node expected, xs:boolean > found: false(). > > what is that error about? > > Thank you > Best regards
[basex-talk] querying database
Hi,i have created a database in BaseX GUI but i did not understand how to use it inside FLWR query.So since i would like to create one FLWR query to query all my files in the database not only one file with doc()i have tried collection() is that right? (i have putted all my xml files inside path/ directory)This is my query: let $d:=collection ("path/") let $r:=doc("myfile1.xml") for $d in$d// item/@qcode="tx" where $d//subj[text() contains text { 'Hal', 'Fade' } any] and$r/subj ="Berlin "return $d/tit it shows me error: [XPTY0019] descendant::subj: node expected, xs:boolean found: false(). what is that error about?Thank youBest regards
Re: [basex-talk] Schema validation
Indeed, looking at the code seems it's already using it. I wonder what creates that delay though. I will have to investigate it a bit, probably by debugging BaseX, unless someone already knows. Could a SaxSource vs StreamSource be the issue? Or that doesn't affect performance? If my question is stupid, just ignore ;) Thanks, George On 7/19/2016 4:40 PM, Andy Bunce wrote: Looks like it wants to use it [1]. You could try running below in the GUI: Q{java:org.basex.util.Reflect}find("org.apache.xerces.jaxp.validation.XMLSchemaFactory") /Andy [1] https://github.com/BaseXdb/basex/blob/b8c1ae7738664aa3912ade783b8a01a0a2285d25/basex-core/src/main/java/org/basex/query/func/validate/ValidateXsd.java#L65
Re: [basex-talk] Schema validation
Looks like it wants to use it [1]. You could try running below in the GUI: Q{java:org.basex.util.Reflect}find("org.apache.xerces.jaxp.validation.XMLSchemaFactory") /Andy [1] https://github.com/BaseXdb/basex/blob/b8c1ae7738664aa3912ade783b8a01a0a2285d25/basex-core/src/main/java/org/basex/query/func/validate/ValidateXsd.java#L65 On 19 July 2016 at 13:10, George Sofianoswrote: > Thanks, it looks like it's in the classpath. But is it actually used? I > can't be sure. I have seen some strange things happening with Xerces > versions in the past with Saxon. > > Anyway, it would be great if BaseX can have a feature to change the > validation options. Should I open a BaseX ticket about it? or is there > already a way to set these. > > https://xerces.apache.org/xerces2-j/features.html > > > > On 7/19/2016 3:05 PM, Andy Bunce wrote: > >> Hi George, >> >> Just on point #1 >> I think BaseX does not install Xerces. Entering the line below in the GUI >> will tell you the version from the JDK >> >> Q{java:com.sun.org.apache.xerces.internal.impl.Version}getVersion() >> >> For me this returns: >> Xerces-J 2.7.1 >> >> If you have manually added Xerces to the classpath, then you can get the >> version by: >> Q{java:org.apache.xerces.impl.Version}getVersion() >> >> /Andy >> >> >
Re: [basex-talk] Schema validation
Thanks, it looks like it's in the classpath. But is it actually used? I can't be sure. I have seen some strange things happening with Xerces versions in the past with Saxon. Anyway, it would be great if BaseX can have a feature to change the validation options. Should I open a BaseX ticket about it? or is there already a way to set these. https://xerces.apache.org/xerces2-j/features.html On 7/19/2016 3:05 PM, Andy Bunce wrote: Hi George, Just on point #1 I think BaseX does not install Xerces. Entering the line below in the GUI will tell you the version from the JDK Q{java:com.sun.org.apache.xerces.internal.impl.Version}getVersion() For me this returns: Xerces-J 2.7.1 If you have manually added Xerces to the classpath, then you can get the version by: Q{java:org.apache.xerces.impl.Version}getVersion() /Andy
Re: [basex-talk] Schema validation
Hi George, Just on point #1 I think BaseX does not install Xerces. Entering the line below in the GUI will tell you the version from the JDK Q{java:com.sun.org.apache.xerces.internal.impl.Version}getVersion() For me this returns: Xerces-J 2.7.1 If you have manually added Xerces to the classpath, then you can get the version by: Q{java:org.apache.xerces.impl.Version}getVersion() /Andy On 19 July 2016 at 12:46, George Sofianoswrote: > Hi, I wonder what is the status of schema validation in BaseX? I have a > Java web service that is used to validate some schemas, which is using > xerces2 to validate XML files. I want to transfer some of this work to my > XQuery scripts in BaseX, so I can minimize the bandwidth on large files > (the XML files are being retrieved from a remote repository). I did try to > put xercesImpl.java on the lib directory, the validation does run, but I'm > not sure about these two things > > 1) Is the new version of xerces being used, or is the Java default one > being used? Maybe it's possible to add a function to return the library > being used? > > 2) My Java service (which is using xerces2) is running the validation in > about 5 seconds, the same validation takes 32 seconds in BaseX 8.5.1 > > > Any ideas, tips etc are welcome > > Thanks, George. > >
[basex-talk] Schema validation
Hi, I wonder what is the status of schema validation in BaseX? I have a Java web service that is used to validate some schemas, which is using xerces2 to validate XML files. I want to transfer some of this work to my XQuery scripts in BaseX, so I can minimize the bandwidth on large files (the XML files are being retrieved from a remote repository). I did try to put xercesImpl.java on the lib directory, the validation does run, but I'm not sure about these two things 1) Is the new version of xerces being used, or is the Java default one being used? Maybe it's possible to add a function to return the library being used? 2) My Java service (which is using xerces2) is running the validation in about 5 seconds, the same validation takes 32 seconds in BaseX 8.5.1 Any ideas, tips etc are welcome Thanks, George.
Re: [basex-talk] Timeout 30 seconds exceeded
Reading through the list from the hot shores of Italy! This *is* a PHP error. PHP has an execution time limit, most probably defined in an ini-file. However, an "easy way out" is setting the limit for the current script separately. However, I advise you to only do this for testing purposes, this is not the best work-around in production environments because other (possibly malicious) processes are given all the time they need. At the top of your PHP script, put this line: set_time_limit(0); -Oorspronkelijk bericht- Van: basex-talk-boun...@mailman.uni-konstanz.de [mailto:basex-talk-boun...@mailman.uni-konstanz.de] Namens Maximilian Gärber Verzonden: dinsdag 19 juli 2016 8:45 Aan: Mohamed kharratCC: ba...@inf.uni-konstanz.de; BaseX Talk Onderwerp: Re: [basex-talk] Timeout 30 seconds exceeded Hi, if you are connecting as admin user, there is no timeout in BaseX. Neither if you are sending an updating query. Maybe this is a network/php timeout? Regards, Max 2016-07-19 0:57 GMT+02:00 Mohamed kharrat : > Hi, > i have got the error > > Fatal error: Maximum execution time of 30 seconds exceeded in > E:\EasyPHP-DevServer-14.1VC9\data\...\BaseXClient.php on line 99 > > i'm working on Windows. > I have changed the 30 by 300 in the .basex configuration file but i > still get same error of 30 seconds. > Is there any other option i have to set? > > Thank you
Re: [basex-talk] Timeout 30 seconds exceeded
Hi, if you are connecting as admin user, there is no timeout in BaseX. Neither if you are sending an updating query. Maybe this is a network/php timeout? Regards, Max 2016-07-19 0:57 GMT+02:00 Mohamed kharrat: > Hi, > i have got the error > > Fatal error: Maximum execution time of 30 seconds exceeded in > E:\EasyPHP-DevServer-14.1VC9\data\...\BaseXClient.php on line 99 > > i'm working on Windows. > I have changed the 30 by 300 in the .basex configuration file > but i still get same error of 30 seconds. > Is there any other option i have to set? > > Thank you