Hi All,
I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?
I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Thank you very much for your work!
Joseph
Hi Joseph,
I guess you are referring to the automatical insertion of closing brackets and similar stuff to "autocomplete" (we don't have a true autocomplete for more complex stuff). I am not aware that there is a way to disable this.
You can prettify your code with Ctrl+Shift+F, see http://docs.basex.org/wiki/Shortcuts for more magic shortcuts. I don't think there is currently any way to visualize the whitespaces.
Cheers Dirk
On 10/17/2015 07:21 PM, meumapple wrote:
Hi All,
I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?
I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Thank you very much for your work!
Joseph
Hi Joseph,
I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?
You can disable "Automatically add characters" in the Preferences dialog. Could you please detail which autocompletions are particularly confusing for you?
I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Tabs and non-breaking spaces are visualized when activating "Show invisible characters" in that same dialog.
Hi Christian,
I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear. Then whatever button I use the other quote appears. And there are other strange behaviors which are difficult to detail (eg the cursor is moved outside adjacent quotes if the option "automatically add characters" is on).
Whitespaces cannot be shown, only new line character (this happens also on a windows machine).
Joseph
ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?
Il giorno 19/ott/2015, alle ore 14:02, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Joseph,
I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?
You can disable "Automatically add characters" in the Preferences dialog. Could you please detail which autocompletions are particularly confusing for you?
I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Tabs and non-breaking spaces are visualized when activating "Show invisible characters" in that same dialog.
Hi Jopseph,
Thanks for the details.
I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear.
One more question: What 'button' do you mean here?
Whitespaces cannot be shown, only new line character (this happens also on a windows machine).
Exactly, we are only visualizing "non-breaking whitespaces" at the moment (\u00A0). This may be changed in future.
ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?
If you directly run the JAR file, no other libraries will be embedded in the classpath. This is why we also provide the start scripts. You can adjust the maximum amount of assigned memory in the scripts files; look for the -Xmx flag.
Hope this helps, Christian
I mean the double or single quotes button. I need to press it twice to see the first quotes appear. Then I can press a character button and the other quotes will show up. Thanks!
J.
Il giorno 20/ott/2015, alle ore 09:25, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Jopseph,
Thanks for the details.
I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear.
One more question: What 'button' do you mean here?
Whitespaces cannot be shown, only new line character (this happens also on a windows machine).
Exactly, we are only visualizing "non-breaking whitespaces" at the moment (\u00A0). This may be changed in future.
ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?
If you directly run the JAR file, no other libraries will be embedded in the classpath. This is why we also provide the start scripts. You can adjust the maximum amount of assigned memory in the scripts files; look for the -Xmx flag.
Hope this helps, Christian
Hi Christian,
Is there a way to generate consecutive numbers in a for loop in BaseX? I am iterating over a collection of XML files from clinicaltrials.gov and need to tag each output record with a unique ID starting at 1. I have seen many discussions of this (some involving incrementing a counter in a dummy node) but have not found a clean solution that actually works. For example, I tried to adapt the code snippet you provided in https://mailman.uni-konstanz.de/pipermail/basex-talk/2010-May/000259.html%C2... create a function that accomplishes this without referencing an auxiliary file (see below) but cannot get past the perplexing syntax error ([XQST0049] Duplicate declaration of static variable $root.).
Thanks, Ron
declare variable $root := <root count="0"/>;
declare function local:getuid () as xs:integer { let $count := $root/@count return ( insert node <node id='{ $count }'/> into $root, replace value of node $count with $count + 1 ) };
On October 19, 2015 at 5:12:19 PM, meumapple (meumapple@gmail.com) wrote:
Hi Christian,
I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear. Then whatever button I use the other quote appears. And there are other strange behaviors which are difficult to detail (eg the cursor is moved outside adjacent quotes if the option "automatically add characters" is on).
Whitespaces cannot be shown, only new line character (this happens also on a windows machine).
Joseph
ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?
Il giorno 19/ott/2015, alle ore 14:02, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Joseph,
I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?
You can disable "Automatically add characters" in the Preferences dialog. Could you please detail which autocompletions are particularly confusing for you?
I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Tabs and non-breaking spaces are visualized when activating "Show invisible characters" in that same dialog.
Hello Ron,
not Christian, but I try anyway to help you :)
If you say yout want a "generate consecutive numbers in a for loop" are you aware of the "at" construct for flwor expression, e.g.
for $x at $pos in 10 to 19 return $pos
will return the numbers 1 to 10, i.e. is a consecutive counter.
Cheers Dirk
On 10/20/2015 03:23 PM, Ron Katriel wrote:
Hi Christian,
Is there a way to generate consecutive numbers in a for loop in BaseX? I am iterating over a collection of XML files from clinicaltrials.gov and need to tag each output record with a unique ID starting at 1. I have seen many discussions of this (some involving incrementing a counter in a dummy node) but have not found a clean solution that actually works. For example, I tried to adapt the code snippet you provided in https://mailman.uni-konstanz.de/pipermail/basex-talk/2010-May/000259.html to create a function that accomplishes this without referencing an auxiliary file (see below) but cannot get past the perplexing syntax error ([XQST0049] Duplicate declaration of static variable $root.).
Thanks, Ron
declare variable $root := <root count="0"/>;
declare function local:getuid () as xs:integer { let $count := $root/@count return ( insert node <node id='{ $count }'/> into $root, replace value of node $count with $count + 1 ) };
On October 19, 2015 at 5:12:19 PM, meumapple (meumapple@gmail.com mailto:meumapple@gmail.com) wrote:
Hi Christian,
I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear. Then whatever button I use the other quote appears. And there are other strange behaviors which are difficult to detail (eg the cursor is moved outside adjacent quotes if the option "automatically add characters" is on).
Whitespaces cannot be shown, only new line character (this happens also on a windows machine).
Joseph
ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?
Il giorno 19/ott/2015, alle ore 14:02, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Joseph,
I love using the gui but I have a hard time dealing with
autocomplete: is there a way to disable it in the txt editor?
You can disable "Automatically add characters" in the Preferences dialog. Could you please detail which autocompletions are particularly confusing for you?
I think that it would also be very useful to allow view of
whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Tabs and non-breaking spaces are visualized when activating "Show invisible characters" in that same dialog.
Hi Dirk,
Yes, I am aware of that. The for loop in question looks like this
for $article in db:open('CTGov')/clinical_study return file:append('conditions.xml', for $condition in $article/condition return <record> { <condition_id> { local:getuid() } </condition_id>, <nct_id> { normalize-space($article/id_info/nct_id/text()) } </nct_id>, <condition> { normalize-space($condition/text()) } </condition> } </record> )
Adding a for loop as you suggested below will not produce the desired output (the generation has to be implicit, in lock step with the second for loop).
Thanks, Ron
On October 20, 2015 at 9:26:52 AM, Dirk Kirsten (dk@basex.org) wrote:
Hello Ron,
not Christian, but I try anyway to help you :)
If you say yout want a "generate consecutive numbers in a for loop" are you aware of the "at" construct for flwor expression, e.g.
for $x at $pos in 10 to 19 return $pos
will return the numbers 1 to 10, i.e. is a consecutive counter.
Cheers Dirk
On 10/20/2015 03:23 PM, Ron Katriel wrote: Hi Christian,
Is there a way to generate consecutive numbers in a for loop in BaseX? I am iterating over a collection of XML files from clinicaltrials.gov and need to tag each output record with a unique ID starting at 1. I have seen many discussions of this (some involving incrementing a counter in a dummy node) but have not found a clean solution that actually works. For example, I tried to adapt the code snippet you provided in https://mailman.uni-konstanz.de/pipermail/basex-talk/2010-May/000259.html%C2... create a function that accomplishes this without referencing an auxiliary file (see below) but cannot get past the perplexing syntax error ([XQST0049] Duplicate declaration of static variable $root.).
Thanks, Ron
declare variable $root := <root count="0"/>;
declare function local:getuid () as xs:integer { let $count := $root/@count return ( insert node <node id='{ $count }'/> into $root, replace value of node $count with $count + 1 ) };
On October 19, 2015 at 5:12:19 PM, meumapple (meumapple@gmail.com) wrote:
Hi Christian,
I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear. Then whatever button I use the other quote appears. And there are other strange behaviors which are difficult to detail (eg the cursor is moved outside adjacent quotes if the option "automatically add characters" is on).
Whitespaces cannot be shown, only new line character (this happens also on a windows machine).
Joseph
ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?
Il giorno 19/ott/2015, alle ore 14:02, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Joseph,
I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?
You can disable "Automatically add characters" in the Preferences dialog. Could you please detail which autocompletions are particularly confusing for you?
I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Tabs and non-breaking spaces are visualized when activating "Show invisible characters" in that same dialog.
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Hi Ron,
This may help:
for $doc at $pos in db:open('clinicaltrials') return insert node attribute id { $pos } into $doc/*
([XQST0049] Duplicate declaration of static variable $root.).
This may be due to a minor GUI error in the 8.3 release; it was already fixed in the latest snapshot [2].
Hope this helps, Christian
[1] https://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg06960.htm... [2] http://files.basex.org/releases/latest
Thanks, Ron
declare variable $root := <root count="0"/>;
declare function local:getuid () as xs:integer { let $count := $root/@count return ( insert node <node id='{ $count }'/> into $root, replace value of node $count with $count + 1 ) };
On October 19, 2015 at 5:12:19 PM, meumapple (meumapple@gmail.com) wrote:
Hi Christian,
I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear. Then whatever button I use the other quote appears. And there are other strange behaviors which are difficult to detail (eg the cursor is moved outside adjacent quotes if the option "automatically add characters" is on).
Whitespaces cannot be shown, only new line character (this happens also on a windows machine).
Joseph
ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?
Il giorno 19/ott/2015, alle ore 14:02, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Joseph,
I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?
You can disable "Automatically add characters" in the Preferences dialog. Could you please detail which autocompletions are particularly confusing for you?
I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Tabs and non-breaking spaces are visualized when activating "Show invisible characters" in that same dialog.
Thanks, Christian. I will give it a try.
With regards to the GUI, is there a .dmg for the Mac? The BaseX website directs to brew but it appears this implies using the GUI that comes in the jar. I tried it recently but it did not work properly (was unable to type into it).
Thanks, Ron
On Oct 20, 2015, at 9:33 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Ron,
This may help:
for $doc at $pos in db:open('clinicaltrials') return insert node attribute id { $pos } into $doc/*
([XQST0049] Duplicate declaration of static variable $root.).
This may be due to a minor GUI error in the 8.3 release; it was already fixed in the latest snapshot [2].
Hope this helps, Christian
[1] https://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg06960.htm... [2] http://files.basex.org/releases/latest
Thanks, Ron
declare variable $root := <root count="0"/>;
declare function local:getuid () as xs:integer { let $count := $root/@count return ( insert node <node id='{ $count }'/> into $root, replace value of node $count with $count + 1 ) };
On October 19, 2015 at 5:12:19 PM, meumapple (meumapple@gmail.com) wrote:
Hi Christian,
I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear. Then whatever button I use the other quote appears. And there are other strange behaviors which are difficult to detail (eg the cursor is moved outside adjacent quotes if the option "automatically add characters" is on).
Whitespaces cannot be shown, only new line character (this happens also on a windows machine).
Joseph
ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?
Il giorno 19/ott/2015, alle ore 14:02, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Joseph,
I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?
You can disable "Automatically add characters" in the Preferences dialog. Could you please detail which autocompletions are particularly confusing for you?
I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Tabs and non-breaking spaces are visualized when activating "Show invisible characters" in that same dialog.
Some time ago, we provided .dmg/.app distributions. As Apple expects those files to be decorated with a signature, and as we have to pay for those signatures (whereas we don't charge for BaseX at all), we stopped providing those distributions. However, we may introduce them some time in future, let's see.
You can find .app.tar.bz2 bundles of the latest official and snapshot release in our BaseX here [1].
Christian
[1] http://files.basex.org/releases/
On Tue, Oct 20, 2015 at 3:43 PM, Ron Katriel rkatriel@mdsol.com wrote:
Thanks, Christian. I will give it a try.
With regards to the GUI, is there a .dmg for the Mac? The BaseX website directs to brew but it appears this implies using the GUI that comes in the jar. I tried it recently but it did not work properly (was unable to type into it).
Thanks, Ron
On Oct 20, 2015, at 9:33 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Ron,
This may help:
for $doc at $pos in db:open('clinicaltrials') return insert node attribute id { $pos } into $doc/*
([XQST0049] Duplicate declaration of static variable $root.).
This may be due to a minor GUI error in the 8.3 release; it was already fixed in the latest snapshot [2].
Hope this helps, Christian
[1] https://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg06960.htm... [2] http://files.basex.org/releases/latest
Thanks, Ron
declare variable $root := <root count="0"/>;
declare function local:getuid () as xs:integer { let $count := $root/@count return ( insert node <node id='{ $count }'/> into $root, replace value of node $count with $count + 1 ) };
On October 19, 2015 at 5:12:19 PM, meumapple (meumapple@gmail.com) wrote:
Hi Christian,
I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear. Then whatever button I use the other quote appears. And there are other strange behaviors which are difficult to detail (eg the cursor is moved outside adjacent quotes if the option "automatically add characters" is on).
Whitespaces cannot be shown, only new line character (this happens also on a windows machine).
Joseph
ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?
Il giorno 19/ott/2015, alle ore 14:02, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Joseph,
I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?
You can disable "Automatically add characters" in the Preferences dialog. Could you please detail which autocompletions are particularly confusing for you?
I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Tabs and non-breaking spaces are visualized when activating "Show invisible characters" in that same dialog.
Hi Ron,
Maybe the attached codes-nippet is useful to you. It is an example of stateful programming, which isn't compliant with the functional programming concept but, in some cases, can be very useful.
Hopes it helps, Rob Stapper
PS. put the module-file in a subdirectory: "counter", in your basex-repo-directory.
-----Oorspronkelijk bericht----- Van: basex-talk-bounces@mailman.uni-konstanz.de [mailto:basex-talk-bounces@mailman.uni-konstanz.de] Namens Ron Katriel Verzonden: dinsdag 20 oktober 2015 15:43 Aan: Christian Grün CC: BaseX Onderwerp: Re: [basex-talk] Generating consecutive integers in a for loop
Thanks, Christian. I will give it a try.
With regards to the GUI, is there a .dmg for the Mac? The BaseX website directs to brew but it appears this implies using the GUI that comes in the jar. I tried it recently but it did not work properly (was unable to type into it).
Thanks, Ron
On Oct 20, 2015, at 9:33 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Ron,
This may help:
for $doc at $pos in db:open('clinicaltrials') return insert node attribute id { $pos } into $doc/*
([XQST0049] Duplicate declaration of static variable $root.).
This may be due to a minor GUI error in the 8.3 release; it was already fixed in the latest snapshot [2].
Hope this helps, Christian
[1] https://www.mail-archive.com/basex-talk@mailman.uni-konstanz.de/msg069 60.html [2] http://files.basex.org/releases/latest
Thanks, Ron
declare variable $root := <root count="0"/>;
declare function local:getuid () as xs:integer { let $count := $root/@count return ( insert node <node id='{ $count }'/> into $root, replace value of node $count with $count + 1 ) };
On October 19, 2015 at 5:12:19 PM, meumapple (meumapple@gmail.com) wrote:
Hi Christian,
I think there is a bug for Mac (10.x). Those options do no work and typing quotes is really difficult. First I need to press the button twice in order for one quote to appear. Then whatever button I use the other quote appears. And there are other strange behaviors which are difficult to detail (eg the cursor is moved outside adjacent quotes if the option "automatically add characters" is on).
Whitespaces cannot be shown, only new line character (this happens also on a windows machine).
Joseph
ps I also notice that running basexgui and basex.jar are different. I added saxon9he.jar in the lib folder and it is read by basexgui but not by basex.jar. Moreover basexgui sometimes runs out of memory when basex.jar does not. Does this make sense?
Il giorno 19/ott/2015, alle ore 14:02, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Joseph,
I love using the gui but I have a hard time dealing with autocomplete: is there a way to disable it in the txt editor?
You can disable "Automatically add characters" in the Preferences dialog. Could you please detail which autocompletions are particularly confusing for you?
I think that it would also be very useful to allow view of whitespaces and tabs and have a function to prettify the code itself (do you know any for xquery?)
Tabs and non-breaking spaces are visualized when activating "Show invisible characters" in that same dialog.
--- Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. https://www.avast.com/antivirus
Hi Rob,
A short variant of your approach could look like this:
import module namespace counter = 'java.util.concurrent.atomic.AtomicInteger'; for $i in 1 to 10 return counter:incrementAndGet()
As you already indicated, it violates the functional programming design, so I would surely recommend everyone to use the GFLWOR "at" or "count" clause (or possibly fold-left, etc.)
And hi Ron,
Do you need to start with an existing counter when running your query, or is it sufficient to start with 1?
Christian
On Thu, Oct 22, 2015 at 9:07 AM, Rob Stapper r.stapper@lijbrandt.nl wrote:
Hi Ron,
Maybe the attached codes-nippet is useful to you. It is an example of stateful programming, which isn't compliant with the functional programming concept but, in some cases, can be very useful.
Hopes it helps, Rob Stapper
PS. put the module-file in a subdirectory: "counter", in your basex-repo-directory.
Hi,
Wouldn't clj-ds [1] be of any help in this? It has support for transients.I believe that Exist uses this somewhere in their code not sure where. I think it makes use of these Atomic* objects under the hood but providing a "functional" facade. btw I'm not speaking from experience with this library but I do have it on my longlist.
[1]: https://github.com/krukow/clj-ds
On Thu, Oct 22, 2015 at 9:38 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Rob,
A short variant of your approach could look like this:
import module namespace counter = 'java.util.concurrent.atomic.AtomicInteger'; for $i in 1 to 10 return counter:incrementAndGet()
As you already indicated, it violates the functional programming design, so I would surely recommend everyone to use the GFLWOR "at" or "count" clause (or possibly fold-left, etc.)
And hi Ron,
Do you need to start with an existing counter when running your query, or is it sufficient to start with 1?
Christian
On Thu, Oct 22, 2015 at 9:07 AM, Rob Stapper r.stapper@lijbrandt.nl wrote:
Hi Ron,
Maybe the attached codes-nippet is useful to you. It is an example of stateful programming, which isn't compliant with the functional programming concept but, in some cases, can be very useful.
Hopes it helps, Rob Stapper
PS. put the module-file in a subdirectory: "counter", in your basex-repo-directory.
Thanks all!
I went with the solution suggested by Christian. It is simple, efficient, and solves my problem (starting at 1 is fine). The GFLWOR approach is nice, except that I have two nested for loops so it produces two counts instead of one (and there is no straightforward way to combine them into a single monotonically increasing number).
Best, Ron
On October 22, 2015 at 5:47:53 AM, Marc van Grootel (marc.van.grootel@gmail.com) wrote:
Hi,
Wouldn't clj-ds [1] be of any help in this? It has support for transients.I believe that Exist uses this somewhere in their code not sure where. I think it makes use of these Atomic* objects under the hood but providing a "functional" facade. btw I'm not speaking from experience with this library but I do have it on my longlist.
[1]: https://github.com/krukow/clj-ds
On Thu, Oct 22, 2015 at 9:38 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Rob,
A short variant of your approach could look like this:
import module namespace counter = 'java.util.concurrent.atomic.AtomicInteger'; for $i in 1 to 10 return counter:incrementAndGet()
As you already indicated, it violates the functional programming design, so I would surely recommend everyone to use the GFLWOR "at" or "count" clause (or possibly fold-left, etc.)
And hi Ron,
Do you need to start with an existing counter when running your query, or is it sufficient to start with 1?
Christian
On Thu, Oct 22, 2015 at 9:07 AM, Rob Stapper r.stapper@lijbrandt.nl wrote:
Hi Ron,
Maybe the attached codes-nippet is useful to you. It is an example of stateful programming, which isn't compliant with the functional programming concept but, in some cases, can be very useful.
Hopes it helps, Rob Stapper
PS. put the module-file in a subdirectory: "counter", in your basex-repo-directory.
-- --Marc
Hi Ron,
Out of interest: did you have a look at the "count" clause [1]?
Christian
[1] http://docs.basex.org/wiki/XQuery_3.0#Enhanced_FLWOR_Expressions
On Fri, Oct 23, 2015 at 12:02 AM, Ron Katriel rkatriel@mdsol.com wrote:
Thanks all!
I went with the solution suggested by Christian. It is simple, efficient, and solves my problem (starting at 1 is fine). The GFLWOR approach is nice, except that I have two nested for loops so it produces two counts instead of one (and there is no straightforward way to combine them into a single monotonically increasing number).
Best, Ron
On October 22, 2015 at 5:47:53 AM, Marc van Grootel (marc.van.grootel@gmail.com) wrote:
Hi,
Wouldn't clj-ds [1] be of any help in this? It has support for transients.I believe that Exist uses this somewhere in their code not sure where. I think it makes use of these Atomic* objects under the hood but providing a "functional" facade. btw I'm not speaking from experience with this library but I do have it on my longlist.
On Thu, Oct 22, 2015 at 9:38 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Rob,
A short variant of your approach could look like this:
import module namespace counter = 'java.util.concurrent.atomic.AtomicInteger'; for $i in 1 to 10 return counter:incrementAndGet()
As you already indicated, it violates the functional programming design, so I would surely recommend everyone to use the GFLWOR "at" or "count" clause (or possibly fold-left, etc.)
And hi Ron,
Do you need to start with an existing counter when running your query, or is it sufficient to start with 1?
Christian
On Thu, Oct 22, 2015 at 9:07 AM, Rob Stapper r.stapper@lijbrandt.nl wrote:
Hi Ron,
Maybe the attached codes-nippet is useful to you. It is an example of stateful programming, which isn't compliant with the functional programming concept but, in some cases, can be very useful.
Hopes it helps, Rob Stapper
PS. put the module-file in a subdirectory: "counter", in your basex-repo-directory.
-- --Marc
Hi Cristian,
I tried the nested for loops below and it performed as expected (monotonically increasing count).
There are a a lot of great enhancements in XQuery 3.0. Thanks for pointing that out!
Thanks, Ron
for $n in (1 to 10)[. mod 2 = 1] for $m in (1 to 10)[. mod 2 = 0] count $c return <number count="{ $c }" odd="{ $n }" even="{ $m }"/>
On October 23, 2015 at 9:36:35 AM, Christian Grün (christian.gruen@gmail.com) wrote:
Hi Ron,
Out of interest: did you have a look at the "count" clause [1]?
Christian
[1] http://docs.basex.org/wiki/XQuery_3.0#Enhanced_FLWOR_Expressions
On Fri, Oct 23, 2015 at 12:02 AM, Ron Katriel rkatriel@mdsol.com wrote:
Thanks all!
I went with the solution suggested by Christian. It is simple, efficient, and solves my problem (starting at 1 is fine). The GFLWOR approach is nice, except that I have two nested for loops so it produces two counts instead of one (and there is no straightforward way to combine them into a single monotonically increasing number).
Best, Ron
On October 22, 2015 at 5:47:53 AM, Marc van Grootel (marc.van.grootel@gmail.com) wrote:
Hi,
Wouldn't clj-ds [1] be of any help in this? It has support for transients.I believe that Exist uses this somewhere in their code not sure where. I think it makes use of these Atomic* objects under the hood but providing a "functional" facade. btw I'm not speaking from experience with this library but I do have it on my longlist.
On Thu, Oct 22, 2015 at 9:38 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Rob,
A short variant of your approach could look like this:
import module namespace counter = 'java.util.concurrent.atomic.AtomicInteger'; for $i in 1 to 10 return counter:incrementAndGet()
As you already indicated, it violates the functional programming design, so I would surely recommend everyone to use the GFLWOR "at" or "count" clause (or possibly fold-left, etc.)
And hi Ron,
Do you need to start with an existing counter when running your query, or is it sufficient to start with 1?
Christian
On Thu, Oct 22, 2015 at 9:07 AM, Rob Stapper r.stapper@lijbrandt.nl wrote:
Hi Ron,
Maybe the attached codes-nippet is useful to you. It is an example of stateful programming, which isn't compliant with the functional programming concept but, in some cases, can be very useful.
Hopes it helps, Rob Stapper
PS. put the module-file in a subdirectory: "counter", in your basex-repo-directory.
-- --Marc
Perfect. Feel free to check out XQuery 3.1 as well:
http://docs.basex.org/wiki/XQuery_3.1
On Fri, Oct 23, 2015 at 3:53 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi Cristian,
I tried the nested for loops below and it performed as expected (monotonically increasing count).
There are a a lot of great enhancements in XQuery 3.0. Thanks for pointing that out!
Thanks, Ron
for $n in (1 to 10)[. mod 2 = 1] for $m in (1 to 10)[. mod 2 = 0] count $c return <number count="{ $c }" odd="{ $n }" even="{ $m }"/>
On October 23, 2015 at 9:36:35 AM, Christian Grün (christian.gruen@gmail.com) wrote:
Hi Ron,
Out of interest: did you have a look at the "count" clause [1]?
Christian
[1] http://docs.basex.org/wiki/XQuery_3.0#Enhanced_FLWOR_Expressions
On Fri, Oct 23, 2015 at 12:02 AM, Ron Katriel rkatriel@mdsol.com wrote:
Thanks all!
I went with the solution suggested by Christian. It is simple, efficient, and solves my problem (starting at 1 is fine). The GFLWOR approach is nice, except that I have two nested for loops so it produces two counts instead of one (and there is no straightforward way to combine them into a single monotonically increasing number).
Best, Ron
On October 22, 2015 at 5:47:53 AM, Marc van Grootel (marc.van.grootel@gmail.com) wrote:
Hi,
Wouldn't clj-ds [1] be of any help in this? It has support for transients.I believe that Exist uses this somewhere in their code not sure where. I think it makes use of these Atomic* objects under the hood but providing a "functional" facade. btw I'm not speaking from experience with this library but I do have it on my longlist.
On Thu, Oct 22, 2015 at 9:38 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Rob,
A short variant of your approach could look like this:
import module namespace counter = 'java.util.concurrent.atomic.AtomicInteger'; for $i in 1 to 10 return counter:incrementAndGet()
As you already indicated, it violates the functional programming design, so I would surely recommend everyone to use the GFLWOR "at" or "count" clause (or possibly fold-left, etc.)
And hi Ron,
Do you need to start with an existing counter when running your query, or is it sufficient to start with 1?
Christian
On Thu, Oct 22, 2015 at 9:07 AM, Rob Stapper r.stapper@lijbrandt.nl wrote:
Hi Ron,
Maybe the attached codes-nippet is useful to you. It is an example of stateful programming, which isn't compliant with the functional programming concept but, in some cases, can be very useful.
Hopes it helps, Rob Stapper
PS. put the module-file in a subdirectory: "counter", in your basex-repo-directory.
-- --Marc
Thanks, Christian. I am already using maps. Nice to see that the language is actively evolving.
Your excellent support is much appreciated!
Best, Ron
On October 23, 2015 at 9:52:34 AM, Christian Grün (christian.gruen@gmail.com) wrote:
Perfect. Feel free to check out XQuery 3.1 as well:
http://docs.basex.org/wiki/XQuery_3.1
On Fri, Oct 23, 2015 at 3:53 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi Cristian,
I tried the nested for loops below and it performed as expected (monotonically increasing count).
There are a a lot of great enhancements in XQuery 3.0. Thanks for pointing that out!
Thanks, Ron
for $n in (1 to 10)[. mod 2 = 1] for $m in (1 to 10)[. mod 2 = 0] count $c return <number count="{ $c }" odd="{ $n }" even="{ $m }"/>
On October 23, 2015 at 9:36:35 AM, Christian Grün (christian.gruen@gmail.com) wrote:
Hi Ron,
Out of interest: did you have a look at the "count" clause [1]?
Christian
[1] http://docs.basex.org/wiki/XQuery_3.0#Enhanced_FLWOR_Expressions
On Fri, Oct 23, 2015 at 12:02 AM, Ron Katriel rkatriel@mdsol.com wrote:
Thanks all!
I went with the solution suggested by Christian. It is simple, efficient, and solves my problem (starting at 1 is fine). The GFLWOR approach is nice, except that I have two nested for loops so it produces two counts instead of one (and there is no straightforward way to combine them into a single monotonically increasing number).
Best, Ron
On October 22, 2015 at 5:47:53 AM, Marc van Grootel (marc.van.grootel@gmail.com) wrote:
Hi,
Wouldn't clj-ds [1] be of any help in this? It has support for transients.I believe that Exist uses this somewhere in their code not sure where. I think it makes use of these Atomic* objects under the hood but providing a "functional" facade. btw I'm not speaking from experience with this library but I do have it on my longlist.
On Thu, Oct 22, 2015 at 9:38 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Rob,
A short variant of your approach could look like this:
import module namespace counter = 'java.util.concurrent.atomic.AtomicInteger'; for $i in 1 to 10 return counter:incrementAndGet()
As you already indicated, it violates the functional programming design, so I would surely recommend everyone to use the GFLWOR "at" or "count" clause (or possibly fold-left, etc.)
And hi Ron,
Do you need to start with an existing counter when running your query, or is it sufficient to start with 1?
Christian
On Thu, Oct 22, 2015 at 9:07 AM, Rob Stapper r.stapper@lijbrandt.nl wrote:
Hi Ron,
Maybe the attached codes-nippet is useful to you. It is an example of stateful programming, which isn't compliant with the functional programming concept but, in some cases, can be very useful.
Hopes it helps, Rob Stapper
PS. put the module-file in a subdirectory: "counter", in your basex-repo-directory.
-- --Marc
Hi,
When serializing XML to CSV, special characters (e.g., &) are not converted to their textual representations (e.g., ‘&’).
For example, the code below outputs
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
vs. the expected
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
This seems like a bug. Am I missing an option? I did not see anything related in the documentation.
Thanks, Ron
let $options := map { 'lax': false(), 'quotes' : false(), 'separator' : 'tab', 'header' : true() }
return file:write('conditions.tsv', csv:serialize( <matches> { for $article in db:open('CTGov')/clinical_study where $article//nct_id = 'NCT00130377' for $condition in $article/condition count $c return <match> <conditionid> { $c } </conditionid>, <nctid> { normalize-space($article/id_info/nct_id/text()) } </nctid>, <condition> { normalize-space($condition/text()) } </condition> </match> } </matches>, $options) )
Hi Ron,
I don't have the CTGov database on my machine… Could you build us a little self-contained example?
Thanks in advance, Christian
On Wed, Oct 28, 2015 at 5:31 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi,
When serializing XML to CSV, special characters (e.g., &) are not converted to their textual representations (e.g., ‘&’).
For example, the code below outputs
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
vs. the expected
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
This seems like a bug. Am I missing an option? I did not see anything related in the documentation.
Thanks, Ron
let $options := map { 'lax': false(), 'quotes' : false(), 'separator' : 'tab', 'header' : true() }
return file:write('conditions.tsv', csv:serialize( <matches> { for $article in db:open('CTGov')/clinical_study where $article//nct_id = 'NCT00130377' for $condition in $article/condition count $c return <match> <conditionid> { $c } </conditionid>, <nctid> { normalize-space($article/id_info/nct_id/text()) } </nctid>, <condition> { normalize-space($condition/text()) } </condition> </match> } </matches>, $options) )
Hi Christian,
You can use the attached XML file to populate a database. I verified that it is sufficient to replicate the issue.
Thanks, Ron
On October 28, 2015 at 12:33:14 PM, Christian Grün (christian.gruen@gmail.com) wrote:
Hi Ron,
I don't have the CTGov database on my machine… Could you build us a little self-contained example?
Thanks in advance, Christian
On Wed, Oct 28, 2015 at 5:31 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi,
When serializing XML to CSV, special characters (e.g., &) are not converted to their textual representations (e.g., ‘&’).
For example, the code below outputs
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
vs. the expected
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
This seems like a bug. Am I missing an option? I did not see anything related in the documentation.
Thanks, Ron
let $options := map { 'lax': false(), 'quotes' : false(), 'separator' : 'tab', 'header' : true() }
return file:write('conditions.tsv', csv:serialize( <matches> { for $article in db:open('CTGov')/clinical_study where $article//nct_id = 'NCT00130377' for $condition in $article/condition count $c return
<match> <conditionid> { $c } </conditionid>, <nctid> { normalize-space($article/id_info/nct_id/text()) } </nctid>, <condition> { normalize-space($condition/text()) } </condition> </match> } </matches>, $options) )
I guess you'll simply have to use file:write-text instead of file:write (which serializes texts with the default XML output method [1]).
[1] http://www.w3.org/TR/xslt-xquery-serialization-31/
On Wed, Oct 28, 2015 at 5:42 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi Christian,
You can use the attached XML file to populate a database. I verified that it is sufficient to replicate the issue.
Thanks, Ron
On October 28, 2015 at 12:33:14 PM, Christian Grün (christian.gruen@gmail.com) wrote:
Hi Ron,
I don't have the CTGov database on my machine… Could you build us a little self-contained example?
Thanks in advance, Christian
On Wed, Oct 28, 2015 at 5:31 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi,
When serializing XML to CSV, special characters (e.g., &) are not converted to their textual representations (e.g., ‘&’).
For example, the code below outputs
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
vs. the expected
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
This seems like a bug. Am I missing an option? I did not see anything related in the documentation.
Thanks, Ron
let $options := map { 'lax': false(), 'quotes' : false(), 'separator' : 'tab', 'header' : true() }
return file:write('conditions.tsv', csv:serialize( <matches> { for $article in db:open('CTGov')/clinical_study where $article//nct_id = 'NCT00130377' for $condition in $article/condition count $c return
<match> <conditionid> { $c } </conditionid>, <nctid> { normalize-space($article/id_info/nct_id/text()) } </nctid>, <condition> { normalize-space($condition/text()) } </condition> </match> } </matches>, $options) )
Christian,
That works. Thanks!
Ron
On October 28, 2015 at 12:49:06 PM, Christian Grün (christian.gruen@gmail.com) wrote:
I guess you'll simply have to use file:write-text instead of file:write (which serializes texts with the default XML output method [1]).
[1] http://www.w3.org/TR/xslt-xquery-serialization-31/
On Wed, Oct 28, 2015 at 5:42 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi Christian,
You can use the attached XML file to populate a database. I verified that it is sufficient to replicate the issue.
Thanks, Ron
On October 28, 2015 at 12:33:14 PM, Christian Grün (christian.gruen@gmail.com) wrote:
Hi Ron,
I don't have the CTGov database on my machine… Could you build us a little self-contained example?
Thanks in advance, Christian
On Wed, Oct 28, 2015 at 5:31 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi,
When serializing XML to CSV, special characters (e.g., &) are not converted to their textual representations (e.g., ‘&’).
For example, the code below outputs
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
vs. the expected
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
This seems like a bug. Am I missing an option? I did not see anything related in the documentation.
Thanks, Ron
let $options := map { 'lax': false(), 'quotes' : false(), 'separator' : 'tab', 'header' : true() }
return file:write('conditions.tsv', csv:serialize( <matches> { for $article in db:open('CTGov')/clinical_study where $article//nct_id = 'NCT00130377' for $condition in $article/condition count $c return
<match> <conditionid> { $c } </conditionid>, <nctid> { normalize-space($article/id_info/nct_id/text()) } </nctid>, <condition> { normalize-space($condition/text()) } </condition> </match> } </matches>, $options) )
One last question. The serializer has trouble with tags that contain underscores. For example, I get the following error:
[bxerr:BXCS0002] CSV serializer: Invalid element name <study_id>.
When I remove the underscore the error goes away (I inject these tags in the result clause).
Underscores should be fine in XML node names (e.g., clinicaltrials.gov uses them extensively).
Is this issue related to the XQuery specification or unique to BaseX?
Thanks, Ron
On October 28, 2015 at 12:59:57 PM, Ron Katriel (rkatriel@mdsol.com) wrote:
Christian,
That works. Thanks!
Ron
On October 28, 2015 at 12:49:06 PM, Christian Grün (christian.gruen@gmail.com) wrote:
I guess you'll simply have to use file:write-text instead of file:write (which serializes texts with the default XML output method [1]).
[1] http://www.w3.org/TR/xslt-xquery-serialization-31/
On Wed, Oct 28, 2015 at 5:42 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi Christian,
You can use the attached XML file to populate a database. I verified that it is sufficient to replicate the issue.
Thanks, Ron
On October 28, 2015 at 12:33:14 PM, Christian Grün (christian.gruen@gmail.com) wrote:
Hi Ron,
I don't have the CTGov database on my machine… Could you build us a little self-contained example?
Thanks in advance, Christian
On Wed, Oct 28, 2015 at 5:31 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi,
When serializing XML to CSV, special characters (e.g., &) are not converted to their textual representations (e.g., ‘&’).
For example, the code below outputs
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
vs. the expected
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
This seems like a bug. Am I missing an option? I did not see anything related in the documentation.
Thanks, Ron
let $options := map { 'lax': false(), 'quotes' : false(), 'separator' : 'tab', 'header' : true() }
return file:write('conditions.tsv', csv:serialize( <matches> { for $article in db:open('CTGov')/clinical_study where $article//nct_id = 'NCT00130377' for $condition in $article/condition count $c return
<match> <conditionid> { $c } </conditionid>, <nctid> { normalize-space($article/id_info/nct_id/text()) } </nctid>, <condition> { normalize-space($condition/text()) } </condition> </match> } </matches>, $options) )
[bxerr:BXCS0002] CSV serializer: Invalid element name <study_id>.
Is there any particular reason why you setting 'lax' to false() [1]?
[1] http://docs.basex.org/wiki/CSV_Module
When I remove the underscore the error goes away (I inject these tags in
the result clause).
Underscores should be fine in XML node names (e.g., clinicaltrials.gov
uses them extensively).
Is this issue related to the XQuery specification or unique to BaseX?
Thanks, Ron
On October 28, 2015 at 12:59:57 PM, Ron Katriel (rkatriel@mdsol.com)
wrote:
Christian,
That works. Thanks!
Ron
On October 28, 2015 at 12:49:06 PM, Christian Grün (
christian.gruen@gmail.com) wrote:
I guess you'll simply have to use file:write-text instead of file:write (which serializes texts with the default XML output method [1]).
[1] http://www.w3.org/TR/xslt-xquery-serialization-31/
On Wed, Oct 28, 2015 at 5:42 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi Christian,
You can use the attached XML file to populate a database. I verified
that it
is sufficient to replicate the issue.
Thanks, Ron
On October 28, 2015 at 12:33:14 PM, Christian Grün (christian.gruen@gmail.com) wrote:
Hi Ron,
I don't have the CTGov database on my machine… Could you build us a little self-contained example?
Thanks in advance, Christian
On Wed, Oct 28, 2015 at 5:31 PM, Ron Katriel rkatriel@mdsol.com
wrote:
Hi,
When serializing XML to CSV, special characters (e.g., &) are not converted to their textual representations (e.g., ‘&’).
For example, the code below outputs
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
vs. the expected
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
This seems like a bug. Am I missing an option? I did not see anything related in the documentation.
Thanks, Ron
let $options := map { 'lax': false(), 'quotes' : false(),
'separator' :
'tab', 'header' : true() }
return file:write('conditions.tsv', csv:serialize( <matches> { for $article in db:open('CTGov')/clinical_study where $article//nct_id = 'NCT00130377' for $condition in $article/condition count $c return
<match> <conditionid> { $c } </conditionid>, <nctid> { normalize-space($article/id_info/nct_id/text()) } </nctid>, <condition> { normalize-space($condition/text()) } </condition> </match> } </matches>, $options) )
My bad. It was borrowed from an inappropriate example. Removing it eliminates the error. Thanks!
On October 28, 2015 at 3:15:33 PM, Christian Grün (christian.gruen@gmail.com) wrote:
[bxerr:BXCS0002] CSV serializer: Invalid element name <study_id>.
Is there any particular reason why you setting 'lax' to false() [1]?
[1] http://docs.basex.org/wiki/CSV_Module
When I remove the underscore the error goes away (I inject these tags in the result clause).
Underscores should be fine in XML node names (e.g., clinicaltrials.gov uses them extensively).
Is this issue related to the XQuery specification or unique to BaseX?
Thanks, Ron
On October 28, 2015 at 12:59:57 PM, Ron Katriel (rkatriel@mdsol.com) wrote:
Christian,
That works. Thanks!
Ron
On October 28, 2015 at 12:49:06 PM, Christian Grün (christian.gruen@gmail.com) wrote:
I guess you'll simply have to use file:write-text instead of file:write (which serializes texts with the default XML output method [1]).
[1] http://www.w3.org/TR/xslt-xquery-serialization-31/
On Wed, Oct 28, 2015 at 5:42 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi Christian,
You can use the attached XML file to populate a database. I verified that it is sufficient to replicate the issue.
Thanks, Ron
On October 28, 2015 at 12:33:14 PM, Christian Grün (christian.gruen@gmail.com) wrote:
Hi Ron,
I don't have the CTGov database on my machine… Could you build us a little self-contained example?
Thanks in advance, Christian
On Wed, Oct 28, 2015 at 5:31 PM, Ron Katriel rkatriel@mdsol.com wrote:
Hi,
When serializing XML to CSV, special characters (e.g., &) are not converted to their textual representations (e.g., ‘&’).
For example, the code below outputs
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
vs. the expected
conditionid nctid condition 1 NCT00130377 Cardiovascular System Diseases (& [Cardiac])
This seems like a bug. Am I missing an option? I did not see anything related in the documentation.
Thanks, Ron
let $options := map { 'lax': false(), 'quotes' : false(), 'separator' : 'tab', 'header' : true() }
return file:write('conditions.tsv', csv:serialize( <matches> { for $article in db:open('CTGov')/clinical_study where $article//nct_id = 'NCT00130377' for $condition in $article/condition count $c return
<match> <conditionid> { $c } </conditionid>, <nctid> { normalize-space($article/id_info/nct_id/text()) } </nctid>, <condition> { normalize-space($condition/text()) } </condition> </match> } </matches>, $options) )
basex-talk@mailman.uni-konstanz.de