Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-23 Thread Ron Katriel
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.gr...@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  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   
>  
>  
> On October 23, 2015 at 9:36:35 AM, Christian Grün  
> (christian.gr...@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  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.groo...@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  
>>  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   
>>> 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  


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-23 Thread Christian Grün
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  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 
>
>
> On October 23, 2015 at 9:36:35 AM, Christian Grün
> (christian.gr...@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  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.groo...@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
>>  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 
>>> 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


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-23 Thread Ron Katriel
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 


On October 23, 2015 at 9:36:35 AM, Christian Grün (christian.gr...@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  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.groo...@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  
>  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   
>> 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  


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-23 Thread Christian Grün
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  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.groo...@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
>  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 
>> 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


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-22 Thread Ron Katriel
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.groo...@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  
 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  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  


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-22 Thread Marc van Grootel
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
 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  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


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-22 Thread Christian Grün
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  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.


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-22 Thread Rob Stapper
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-boun...@mailman.uni-konstanz.de 
[mailto:basex-talk-boun...@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  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 := ;
>>
>> declare function local:getuid () as xs:integer {  let $count :=
>> $root/@count  return (
>>insert node  into $root,
>>replace value of node $count with $count + 1
>>  )
>> };
>>
>> On October 19, 2015 at 5:12:19 PM, meumapple (meumap...@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
>>  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


counter.xqm
Description: Binary data


test.xq
Description: Binary data


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-20 Thread Christian Grün
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  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  
>> 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.html
>> [2] http://files.basex.org/releases/latest
>>
>>
>>>
>>> Thanks,
>>> Ron
>>>
>>>
>>> declare variable $root := ;
>>>
>>> declare function local:getuid () as xs:integer {
>>>  let $count := $root/@count
>>>  return (
>>>insert node  into $root,
>>>replace value of node $count with $count + 1
>>>  )
>>> };
>>>
>>> On October 19, 2015 at 5:12:19 PM, meumapple (meumap...@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
>>>  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.


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-20 Thread Ron Katriel
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  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.html
> [2] http://files.basex.org/releases/latest
> 
> 
>> 
>> Thanks,
>> Ron
>> 
>> 
>> declare variable $root := ;
>> 
>> declare function local:getuid () as xs:integer {
>>  let $count := $root/@count
>>  return (
>>insert node  into $root,
>>replace value of node $count with $count + 1
>>  )
>> };
>> 
>> On October 19, 2015 at 5:12:19 PM, meumapple (meumap...@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
>>  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.


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-20 Thread Christian Grün
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.html
[2] http://files.basex.org/releases/latest


>
> Thanks,
> Ron
>
>
> declare variable $root := ;
>
> declare function local:getuid () as xs:integer {
>   let $count := $root/@count
>   return (
> insert node  into $root,
> replace value of node $count with $count + 1
>   )
> };
>
> On October 19, 2015 at 5:12:19 PM, meumapple (meumap...@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
>  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.


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-20 Thread Ron Katriel
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  {
     { local:getuid() } ,
     { normalize-space($article/id_info/nct_id/text()) } ,
     { normalize-space($condition/text()) } 
  } 
)

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 (d...@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 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 := ;

declare function local:getuid () as xs:integer {
  let $count := $root/@count
  return (
    insert node  into $root,
    replace value of node $count with $count + 1
  )
};

On October 19, 2015 at 5:12:19 PM, meumapple (meumap...@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 
 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


Re: [basex-talk] Generating consecutive integers in a for loop

2015-10-20 Thread Dirk Kirsten
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 := ;
>
> declare function local:getuid () as xs:integer {
>   let $count := $root/@count
>   return (
> insert node  into $root,
> replace value of node $count with $count + 1
>   )
> };
>
> On October 19, 2015 at 5:12:19 PM, meumapple (meumap...@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
>>  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



[basex-talk] Generating consecutive integers in a for loop

2015-10-20 Thread Ron Katriel
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 := ;

declare function local:getuid () as xs:integer {
  let $count := $root/@count
  return (
    insert node  into $root,
    replace value of node $count with $count + 1
  )
};

On October 19, 2015 at 5:12:19 PM, meumapple (meumap...@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 
 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.