Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Florent Georges
On 8 December 2014 at 19:01, Frank Mortier wrote:

> $doc/b/c[@xml:lang eq"nl"]

  By the way, do not use string comparison directly against @xml:lang,
use fn:lang() instead: $doc/b/c[lang('nl')].

  Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Frank Mortier
Dear Danny, indeed I know how to do that.

Dear Christophe and Michael, indeed I need to get rid of the space. Thanks for 
pointing the obvious out to me.

Apparently, however, this is not an issue in Danny's solution. Hence, I will go 
for Danny's solution.

Thanks,
Frank




-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Danny Sokolsky
Sent: 08 December 2014 19:48
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

You already know how to do that.  Just do something like this (passing a 
sequence into a word-query treats each item as an or):

let $s := (fn:tokenize("auto, kind", ",")) let $doc  := 
 
   car
   auto
   voiture
 
 
   house
   huis
   maison
 
 
   child
   kind
   enfant
 

return $doc//c[cts:contains(., cts:word-query($s, "lang=nl") )]

-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Frank Mortier
Sent: Monday, December 08, 2014 10:38 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Thanks 

Danny, I need to get from the string ('auto, kind') to ('auto', 'kind').

Chris, it should return 'car' and 'child'.

Tim, does not work, returns only  the first id 'car'

Rob, same answer as for Danny.




-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Danny Sokolsky
Sent: 08 December 2014 19:15
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Hi Frank,

Or how about if you do a language-sensitive search.  For example:

let $doc  :=

 
   car
   auto
   voiture
 
 
   house
   huis
   maison
 
 
   child
   kind
   enfant
 

return $doc//c[cts:contains(., cts:or-query((
 cts:word-query("auto", "lang=nl"),
 cts:word-query("kind", "lang=nl"))) )] => auto kind

-Danny

-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Christopher Hamlin
Sent: Monday, December 08, 2014 10:14 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Hi Frank,

Not exactly sure if it's what you want, but maybe helps you get closer:

 for $x in $doc/b/c[@xml:lang eq"nl"]
 where $x/fn:string() = fn:tokenize('auto, kind', ',')
 return
 $x/../@id/fn:string()

returns 'car'.

I changed it so it compares the string value of $x with a list of strings from 
tokenize.  Note that I'm using = instead of eq.  That lets you use a sequence 
compare.  Also the return now returns the @id attribute node.

- Chris
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Michael Gursky
I think you need to either get rid of the space in "auto, kind" or change
"," to ", " in your call to fn:tokenize().  fn:tokenize("auto, kind", ",")
returns "auto" and " kind" (note leading space), so the second token
matches nothing.

On Mon, Dec 8, 2014 at 1:48 PM, Danny Sokolsky  wrote:

> You already know how to do that.  Just do something like this (passing a
> sequence into a word-query treats each item as an or):
>
> let $s := (fn:tokenize("auto, kind", ","))
> let $doc  :=
> 
>  
>car
>auto
>voiture
>  
>  
>house
>huis
>maison
>  
>  
>child
>kind
>enfant
>  
>  
> return $doc//c[cts:contains(., cts:word-query($s, "lang=nl") )]
>
> -Original Message-
> From: general-boun...@developer.marklogic.com [mailto:
> general-boun...@developer.marklogic.com] On Behalf Of Frank Mortier
> Sent: Monday, December 08, 2014 10:38 AM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node
> results in inconsistent output
>
> Thanks
>
> Danny, I need to get from the string ('auto, kind') to ('auto', 'kind').
>
> Chris, it should return 'car' and 'child'.
>
> Tim, does not work, returns only  the first id 'car'
>
> Rob, same answer as for Danny.
>
>
>
>
> -----Original Message-
> From: general-boun...@developer.marklogic.com [mailto:
> general-boun...@developer.marklogic.com] On Behalf Of Danny Sokolsky
> Sent: 08 December 2014 19:15
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node
> results in inconsistent output
>
> Hi Frank,
>
> Or how about if you do a language-sensitive search.  For example:
>
> let $doc  :=
> 
>  
>car
>auto
>voiture
>  
>  
>house
>huis
>maison
>  
>  
>child
>kind
>enfant
>  
>  
> return $doc//c[cts:contains(., cts:or-query((
>  cts:word-query("auto", "lang=nl"),
>              cts:word-query("kind", "lang=nl"))) )] =>  xml:lang="nl">auto kind
>
> -Danny
>
> -Original Message-
> From: general-boun...@developer.marklogic.com [mailto:
> general-boun...@developer.marklogic.com] On Behalf Of Christopher Hamlin
> Sent: Monday, December 08, 2014 10:14 AM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node
> results in inconsistent output
>
> Hi Frank,
>
> Not exactly sure if it's what you want, but maybe helps you get closer:
>
>  for $x in $doc/b/c[@xml:lang eq"nl"]
>  where $x/fn:string() = fn:tokenize('auto, kind', ',')
>  return
>  $x/../@id/fn:string()
>
> returns 'car'.
>
> I changed it so it compares the string value of $x with a list of strings
> from tokenize.  Note that I'm using = instead of eq.  That lets you use a
> sequence compare.  Also the return now returns the @id attribute node.
>
> - Chris
> ___
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> ___
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> ___
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> ___
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
>
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Danny Sokolsky
You already know how to do that.  Just do something like this (passing a 
sequence into a word-query treats each item as an or):

let $s := (fn:tokenize("auto, kind", ","))
let $doc  :=

 
   car
   auto
   voiture
 
 
   house
   huis
   maison
 
 
   child
   kind
   enfant
 

return $doc//c[cts:contains(., cts:word-query($s, "lang=nl") )]

-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Frank Mortier
Sent: Monday, December 08, 2014 10:38 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Thanks 

Danny, I need to get from the string ('auto, kind') to ('auto', 'kind').

Chris, it should return 'car' and 'child'.

Tim, does not work, returns only  the first id 'car'

Rob, same answer as for Danny.




-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Danny Sokolsky
Sent: 08 December 2014 19:15
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Hi Frank,

Or how about if you do a language-sensitive search.  For example:

let $doc  :=

 
   car
   auto
   voiture
 
 
   house
   huis
   maison
 
 
   child
   kind
   enfant
 

return $doc//c[cts:contains(., cts:or-query((
 cts:word-query("auto", "lang=nl"),
 cts:word-query("kind", "lang=nl"))) )] => auto kind

-Danny

-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Christopher Hamlin
Sent: Monday, December 08, 2014 10:14 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Hi Frank,

Not exactly sure if it's what you want, but maybe helps you get closer:

 for $x in $doc/b/c[@xml:lang eq"nl"]
 where $x/fn:string() = fn:tokenize('auto, kind', ',')
 return
 $x/../@id/fn:string()

returns 'car'.

I changed it so it compares the string value of $x with a list of strings from 
tokenize.  Note that I'm using = instead of eq.  That lets you use a sequence 
compare.  Also the return now returns the @id attribute node.

- Chris
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Frank Mortier
Thanks 

Danny, I need to get from the string ('auto, kind') to ('auto', 'kind').

Chris, it should return 'car' and 'child'.

Tim, does not work, returns only  the first id 'car'

Rob, same answer as for Danny.




-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Danny Sokolsky
Sent: 08 December 2014 19:15
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Hi Frank,

Or how about if you do a language-sensitive search.  For example:

let $doc  :=

 
   car
   auto
   voiture
 
 
   house
   huis
   maison
 
 
   child
   kind
   enfant
 

return $doc//c[cts:contains(., cts:or-query((
 cts:word-query("auto", "lang=nl"),
 cts:word-query("kind", "lang=nl"))) )] => auto kind

-Danny

-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Christopher Hamlin
Sent: Monday, December 08, 2014 10:14 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Hi Frank,

Not exactly sure if it's what you want, but maybe helps you get closer:

 for $x in $doc/b/c[@xml:lang eq"nl"]
 where $x/fn:string() = fn:tokenize('auto, kind', ',')
 return
 $x/../@id/fn:string()

returns 'car'.

I changed it so it compares the string value of $x with a list of strings from 
tokenize.  Note that I'm using = instead of eq.  That lets you use a sequence 
compare.  Also the return now returns the @id attribute node.

- Chris
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Tim
I haven’t taken the time to experiment, but try 

 

 where $x = (fn:tokenize('auto, kind', ','))

 

Tim M.

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Frank Mortier
Sent: Monday, December 08, 2014 1:02 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

 

Given the following doc:

 

  let $doc  :=



 

   car

   auto

   voiture

 

 

   house

   huis

   maison

 

 

   child

   kind

   enfant

 



…….

 

And the following string  (‘kind,  car’),  and language code (‘nl’), I would 
like to retrieve the id attribute values.

 

I am looking for a simple flowr but do not seem to understand why the following 
is not working. 

 

 for $x in $doc/b/c[@xml:lang eq"nl"]

 where $x eq fn:tokenize('auto, kind', ',')

 return 

 $x/../@value

 

Only gives the ‘id‘ whereas (‘auto’, ‘kind’) as in $x eq (‘auto’, ‘kind’) 
works? 

 

Any suggestions would be welcome.

 

Frank

 

___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Whitby, Rob
How about this?

$doc/b[c eq ("kind", "auto") and c/@xml:lang eq "nl"]/@id/fn:string()


From: Frank Mortier mailto:f.mort...@dsvlaw.be>>
Reply-To: MarkLogic Developer Discussion 
mailto:general@developer.marklogic.com>>
Date: Monday, 8 December 2014 18:01
To: MarkLogic Developer Discussion 
mailto:general@developer.marklogic.com>>
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Given the following doc:

  let $doc  :=

 
   car
   auto
   voiture
 
 
   house
   huis
   maison
 
 
   child
   kind
   enfant
 
 
…….

And the following string  (‘kind,  car’),  and language code (‘nl’), I would 
like to retrieve the id attribute values.

I am looking for a simple flowr but do not seem to understand why the following 
is not working.

 for $x in $doc/b/c[@xml:lang eq"nl"]
 where $x eq fn:tokenize('auto, kind', ',')
 return
 $x/../@value

Only gives the ‘id‘ whereas (‘auto’, ‘kind’) as in $x eq (‘auto’, ‘kind’) works?

Any suggestions would be welcome.

Frank
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Danny Sokolsky
Hi Frank,

Or how about if you do a language-sensitive search.  For example:

let $doc  :=

 
   car
   auto
   voiture
 
 
   house
   huis
   maison
 
 
   child
   kind
   enfant
 

return $doc//c[cts:contains(., cts:or-query((
 cts:word-query("auto", "lang=nl"),
 cts:word-query("kind", "lang=nl"))) )]
=>
auto
kind

-Danny

-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Christopher Hamlin
Sent: Monday, December 08, 2014 10:14 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Marklogic node replace of same node 
results in inconsistent output

Hi Frank,

Not exactly sure if it's what you want, but maybe helps you get closer:

 for $x in $doc/b/c[@xml:lang eq"nl"]
 where $x/fn:string() = fn:tokenize('auto, kind', ',')
 return
 $x/../@id/fn:string()

returns 'car'.

I changed it so it compares the string value of $x with a list of strings from 
tokenize.  Note that I'm using = instead of eq.  That lets you use a sequence 
compare.  Also the return now returns the @id attribute node.

- Chris
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Christopher Hamlin
Hi Frank,

Not exactly sure if it's what you want, but maybe helps you get closer:

 for $x in $doc/b/c[@xml:lang eq"nl"]
 where $x/fn:string() = fn:tokenize('auto, kind', ',')
 return
 $x/../@id/fn:string()

returns 'car'.

I changed it so it compares the string value of $x with a list of
strings from tokenize.  Note that I'm using = instead of eq.  That
lets you use a sequence compare.  Also the return now returns the @id
attribute node.

- Chris
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Frank Mortier
Given the following doc:

  let $doc  :=

 
   car
   auto
   voiture
 
 
   house
   huis
   maison
 
 
   child
   kind
   enfant
 
 
…….

And the following string  (‘kind,  car’),  and language code (‘nl’), I would 
like to retrieve the id attribute values.

I am looking for a simple flowr but do not seem to understand why the following 
is not working.

 for $x in $doc/b/c[@xml:lang eq"nl"]
 where $x eq fn:tokenize('auto, kind', ',')
 return
 $x/../@value

Only gives the ‘id‘ whereas (‘auto’, ‘kind’) as in $x eq (‘auto’, ‘kind’) works?

Any suggestions would be welcome.

Frank
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Raghu
Hi Ron,

1) An update request does not see its own updates.  Fetching the value of
something from the database after an update to that thing will return the
value from the database as-of the time the request started running.
 - I totally agree Ron, I'm checking the value by exploring the
database and NOT using the doc statement.


2) It is possible for deadlocks to occur, especially in clusters, when
multiple requests are attempting to lock the same URIs, either explicitly
or implicitly.  One of the ways these deadlocks are resolved is to pick one
of the deadlocking requests and summarily kill it.  Then start it over
again.  MarkLogic has ACID properties, so killing a request causes a
rollback to its initial starting state.  If the killed request had logged
something before it was killed, you may see the same messages logged again
from the second run.  This is all quite normal.

   - No clusters, just a standalone host. Leaving that aside,my doubt is
that every time the first xquery locks the resource (URI), how is the
second xquery able to update the node? Isn't the outcome supposed to be the
same always?

Thanks!
Raghu

On Mon, Dec 8, 2014 at 9:15 PM, Ron Hitchens  wrote:

>
>Two things of note:
>
> 1) An update request does not see its own updates.  Fetching the value of
> something from the database after an update to that thing will return the
> value from the database as-of the time the request started running.
>
> 2) It is possible for deadlocks to occur, especially in clusters, when
> multiple requests are attempting to lock the same URIs, either explicitly
> or implicitly.  One of the ways these deadlocks are resolved is to pick one
> of the deadlocking requests and summarily kill it.  Then start it over
> again.  MarkLogic has ACID properties, so killing a request causes a
> rollback to its initial starting state.  If the killed request had logged
> something before it was killed, you may see the same messages logged again
> from the second run.  This is all quite normal.
>
> ---
> Ron Hitchens {r...@overstory.co.uk}  +44 7879 358212
>
> On Dec 8, 2014, at 3:21 PM, Raghu 
> wrote:
>
> I've used two different browsers for each qconsole, yet the same results.
>
> On Mon, Dec 8, 2014 at 8:49 PM, Raghu 
> wrote:
>
>> Thanks David Ennis,
>>
>> PFB the response below
>>
>> 1. The second xquery doesn't have a sleep, that was a copy paste error on
>> my part.
>> 2. I'm verifying the document content by using the qconsole explore
>> button and clicking on the link.
>> 3. The sleep would not lock, but the node replace statement in the xquery
>> could obtain a write lock (I believe)
>>
>> However I don't understand the scenario where either of the xqueries
>> getting executed twice?
>> Is it just me? Is somebody else also able to reproduce this as well?
>> I'm working on a concurrent request POC, any help is appreciated
>>
>> Thanks!
>> Raghu
>>
>> On Mon, Dec 8, 2014 at 6:19 PM, David Ennis 
>> wrote:
>>
>>> HI.
>>>
>>> I don't have a full answer, but a few pointers:
>>>
>>> - Your xquery2 is the same as xquery1 (includes sleep).  This is
>>> probably not what you meant to include as it does not match your
>>> description where you say that there si no sleep on xquery2
>>>
>>> - In the same statement you update the node and also read it back via
>>> doc() to verify it.  This does not work this way in the query console.  So
>>> you may be seeing some confusing results due to this.
>>>
>>> - I do not believe that the sleep will lock the document for 10 seconds
>>> in your example, so I don't think you should expect to see anythong
>>> blocking for that reason.
>>>
>>>
>>> Perhaps spawning your two samples would help you on your way. If nothing
>>> else, it will take the query console out of the equation.
>>>
>>>
>>>
>>>
>>>
>>> Kind Regards,
>>> David Ennis
>>>
>>>
>>> David Ennis
>>> *Content Engineer*
>>>
>>> [image: HintTech]  
>>> Mastering the value of content
>>> creative | technology | content
>>>
>>> Delftechpark 37i
>>> 2628 XJ Delft
>>> The Netherlands
>>> T: +31 88 268 25 00
>>> M: +31 63 091 72 80
>>>
>>> [image: http://www.hinttech.com] 
>>>   
>>> 
>>>
>>> On 8 December 2014 at 13:32, Raghu 
>>> wrote:
>>>
 Hi all,


 I have two xqueries

  xquery# 1. Sleeps for 10 secs (xdmp:sleep) and updates an existing
 node with a new value and logs the value "Executing #1".
  xquery# 2. Updates the same node which is being updated in xquery
 #1 but no sleep and logs the value "Executing #2".


 I am executing these in the order #1 first and #2 second via two
 separate query console of the same server

 I expected the xquery#2 to either wait for 10 seconds (if a write lock
 is obtained on the document) or update the node even before the xquery#1
 does it's 

Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Ron Hitchens

   Two things of note:

1) An update request does not see its own updates.  Fetching the value of 
something from the database after an update to that thing will return the value 
from the database as-of the time the request started running.

2) It is possible for deadlocks to occur, especially in clusters, when multiple 
requests are attempting to lock the same URIs, either explicitly or implicitly. 
 One of the ways these deadlocks are resolved is to pick one of the deadlocking 
requests and summarily kill it.  Then start it over again.  MarkLogic has ACID 
properties, so killing a request causes a rollback to its initial starting 
state.  If the killed request had logged something before it was killed, you 
may see the same messages logged again from the second run.  This is all quite 
normal.

---
Ron Hitchens {r...@overstory.co.uk}  +44 7879 358212

On Dec 8, 2014, at 3:21 PM, Raghu  wrote:

> I've used two different browsers for each qconsole, yet the same results.
> 
> On Mon, Dec 8, 2014 at 8:49 PM, Raghu  
> wrote:
> Thanks David Ennis,
> 
> PFB the response below
> 
> 1. The second xquery doesn't have a sleep, that was a copy paste error on my 
> part.
> 2. I'm verifying the document content by using the qconsole explore button 
> and clicking on the link.
> 3. The sleep would not lock, but the node replace statement in the xquery 
> could obtain a write lock (I believe)
> 
> However I don't understand the scenario where either of the xqueries getting 
> executed twice?
> Is it just me? Is somebody else also able to reproduce this as well?
> I'm working on a concurrent request POC, any help is appreciated
> 
> Thanks!
> Raghu
> 
> On Mon, Dec 8, 2014 at 6:19 PM, David Ennis  wrote:
> HI.
> 
> I don't have a full answer, but a few pointers:
> 
> - Your xquery2 is the same as xquery1 (includes sleep).  This is probably not 
> what you meant to include as it does not match your description where you say 
> that there si no sleep on xquery2
> 
> - In the same statement you update the node and also read it back via doc() 
> to verify it.  This does not work this way in the query console.  So you may 
> be seeing some confusing results due to this.
> 
> - I do not believe that the sleep will lock the document for 10 seconds in 
> your example, so I don't think you should expect to see anythong blocking for 
> that reason. 
> 
> 
> Perhaps spawning your two samples would help you on your way. If nothing 
> else, it will take the query console out of the equation.
> 
> 
> 
> 
> 
> Kind Regards,
> David Ennis
> 
> 
> David Ennis
> Content Engineer
> 
>  
> Mastering the value of content
> creative | technology | content
> 
> Delftechpark 37i
> 2628 XJ Delft
> The Netherlands
> T: +31 88 268 25 00
> M: +31 63 091 72 80 
> 
>
> 
> On 8 December 2014 at 13:32, Raghu  wrote:
> Hi all,
> 
> 
> I have two xqueries
> 
>  xquery# 1. Sleeps for 10 secs (xdmp:sleep) and updates an existing node 
> with a new value and logs the value "Executing #1".
>  xquery# 2. Updates the same node which is being updated in xquery #1 but 
> no sleep and logs the value "Executing #2".
> 
> 
> I am executing these in the order #1 first and #2 second via two separate 
> query console of the same server
> 
> I expected the xquery#2 to either wait for 10 seconds (if a write lock is 
> obtained on the document) or update the node even before the xquery#1 does 
> it's update, but the output seems to be differing every time, the strange 
> thing is sometimes the xquery#2 is getting executed twice (Confirmed via log 
> as well as the updated value in the document) or vice versa.
> 
> PFB the xqueries and xml used
> 
> xquery#1
> 
> xdmp:sleep(1),
> 
> xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,0003),
> 
> xdmp:sleep(1),
> 
> xdmp:log("Executing #1"),
> 
> doc("book.xml")/catalog/book[1]/price
> 
>  
> 
> 
> 
> 
> xquery#2 
> 
> 
> 
> xdmp:sleep(1),
> 
> xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,4445),
> 
> xdmp:sleep(1),
> 
> xdmp:log("Executing #2"),
> 
> doc("book.xml")/catalog/book[1]/price
> 
> 
> 
> Sample xml
> 
> 
>   
> Gambardella, Matthew
>   XML Developer's Guide
>   Computer
>   0004
>   2000-10-01
>   An in-depth look at creating applications with 
> XML.
>   
> 
> 
> I'm using Marklogic version 7.0-2.3, I'm unable to figure out a pattern. Can 
> someone explain this behavior?
>  
> 
> Thanks!
> Raghu
> 
> ___
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> 
> 
> 
> ___
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
> 
> 
> 
> ___
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.c

Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Raghu
I've used two different browsers for each qconsole, yet the same results.

On Mon, Dec 8, 2014 at 8:49 PM, Raghu 
wrote:

> Thanks David Ennis,
>
> PFB the response below
>
> 1. The second xquery doesn't have a sleep, that was a copy paste error on
> my part.
> 2. I'm verifying the document content by using the qconsole explore button
> and clicking on the link.
> 3. The sleep would not lock, but the node replace statement in the xquery
> could obtain a write lock (I believe)
>
> However I don't understand the scenario where either of the xqueries
> getting executed twice?
> Is it just me? Is somebody else also able to reproduce this as well?
> I'm working on a concurrent request POC, any help is appreciated
>
> Thanks!
> Raghu
>
> On Mon, Dec 8, 2014 at 6:19 PM, David Ennis 
> wrote:
>
>> HI.
>>
>> I don't have a full answer, but a few pointers:
>>
>> - Your xquery2 is the same as xquery1 (includes sleep).  This is probably
>> not what you meant to include as it does not match your description where
>> you say that there si no sleep on xquery2
>>
>> - In the same statement you update the node and also read it back via
>> doc() to verify it.  This does not work this way in the query console.  So
>> you may be seeing some confusing results due to this.
>>
>> - I do not believe that the sleep will lock the document for 10 seconds
>> in your example, so I don't think you should expect to see anythong
>> blocking for that reason.
>>
>>
>> Perhaps spawning your two samples would help you on your way. If nothing
>> else, it will take the query console out of the equation.
>>
>>
>>
>>
>>
>> Kind Regards,
>> David Ennis
>>
>>
>> David Ennis
>> *Content Engineer*
>>
>> [image: HintTech]  
>> Mastering the value of content
>> creative | technology | content
>>
>> Delftechpark 37i
>> 2628 XJ Delft
>> The Netherlands
>> T: +31 88 268 25 00
>> M: +31 63 091 72 80
>>
>> [image: http://www.hinttech.com] 
>>   
>> 
>>
>> On 8 December 2014 at 13:32, Raghu 
>> wrote:
>>
>>> Hi all,
>>>
>>>
>>> I have two xqueries
>>>
>>>  xquery# 1. Sleeps for 10 secs (xdmp:sleep) and updates an existing
>>> node with a new value and logs the value "Executing #1".
>>>  xquery# 2. Updates the same node which is being updated in xquery
>>> #1 but no sleep and logs the value "Executing #2".
>>>
>>>
>>> I am executing these in the order #1 first and #2 second via two
>>> separate query console of the same server
>>>
>>> I expected the xquery#2 to either wait for 10 seconds (if a write lock
>>> is obtained on the document) or update the node even before the xquery#1
>>> does it's update, but the output seems to be differing every time, the
>>> strange thing is sometimes the xquery#2 is getting executed twice
>>> (Confirmed via log as well as the updated value in the document) or vice
>>> versa.
>>>
>>> PFB the xqueries and xml used
>>>
>>> *xquery#1*
>>>
>>> xdmp:sleep(1),
>>>
>>>
>>> xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,0003),
>>>
>>> xdmp:sleep(1),
>>>
>>> xdmp:log("Executing #1"),
>>>
>>> doc("book.xml")/catalog/book[1]/price
>>>
>>>
>>>
>>>
>>>
>>> *xquery#2 *
>>>
>>>
>>> xdmp:sleep(1),
>>>
>>>
>>> xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,4445),
>>>
>>> xdmp:sleep(1),
>>>
>>> xdmp:log("Executing #2"),
>>>
>>> doc("book.xml")/catalog/book[1]/price
>>>
>>>
>>> *Sample xml*
>>>
>>> 
>>> 
>>>   Gambardella, Matthew
>>> XML Developer's Guide
>>> Computer
>>> 0004
>>> 2000-10-01
>>> An in-depth look at creating applications with
>>> XML.
>>> 
>>> 
>>>
>>> I'm using Marklogic version 7.0-2.3, I'm unable to figure out a pattern.
>>> Can someone explain this behavior?
>>>
>>>
>>> Thanks!
>>> Raghu
>>>
>>> ___
>>> General mailing list
>>> General@developer.marklogic.com
>>> http://developer.marklogic.com/mailman/listinfo/general
>>>
>>>
>>
>> ___
>> General mailing list
>> General@developer.marklogic.com
>> http://developer.marklogic.com/mailman/listinfo/general
>>
>>
>
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Raghu
Thanks David Ennis,

PFB the response below

1. The second xquery doesn't have a sleep, that was a copy paste error on
my part.
2. I'm verifying the document content by using the qconsole explore button
and clicking on the link.
3. The sleep would not lock, but the node replace statement in the xquery
could obtain a write lock (I believe)

However I don't understand the scenario where either of the xqueries
getting executed twice?
Is it just me? Is somebody else also able to reproduce this as well?
I'm working on a concurrent request POC, any help is appreciated

Thanks!
Raghu

On Mon, Dec 8, 2014 at 6:19 PM, David Ennis 
wrote:

> HI.
>
> I don't have a full answer, but a few pointers:
>
> - Your xquery2 is the same as xquery1 (includes sleep).  This is probably
> not what you meant to include as it does not match your description where
> you say that there si no sleep on xquery2
>
> - In the same statement you update the node and also read it back via
> doc() to verify it.  This does not work this way in the query console.  So
> you may be seeing some confusing results due to this.
>
> - I do not believe that the sleep will lock the document for 10 seconds in
> your example, so I don't think you should expect to see anythong blocking
> for that reason.
>
>
> Perhaps spawning your two samples would help you on your way. If nothing
> else, it will take the query console out of the equation.
>
>
>
>
>
> Kind Regards,
> David Ennis
>
>
> David Ennis
> *Content Engineer*
>
> [image: HintTech]  
> Mastering the value of content
> creative | technology | content
>
> Delftechpark 37i
> 2628 XJ Delft
> The Netherlands
> T: +31 88 268 25 00
> M: +31 63 091 72 80
>
> [image: http://www.hinttech.com] 
>   
> 
>
> On 8 December 2014 at 13:32, Raghu 
> wrote:
>
>> Hi all,
>>
>>
>> I have two xqueries
>>
>>  xquery# 1. Sleeps for 10 secs (xdmp:sleep) and updates an existing
>> node with a new value and logs the value "Executing #1".
>>  xquery# 2. Updates the same node which is being updated in xquery #1
>> but no sleep and logs the value "Executing #2".
>>
>>
>> I am executing these in the order #1 first and #2 second via two separate
>> query console of the same server
>>
>> I expected the xquery#2 to either wait for 10 seconds (if a write lock is
>> obtained on the document) or update the node even before the xquery#1 does
>> it's update, but the output seems to be differing every time, the strange
>> thing is sometimes the xquery#2 is getting executed twice (Confirmed via
>> log as well as the updated value in the document) or vice versa.
>>
>> PFB the xqueries and xml used
>>
>> *xquery#1*
>>
>> xdmp:sleep(1),
>>
>>
>> xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,0003),
>>
>> xdmp:sleep(1),
>>
>> xdmp:log("Executing #1"),
>>
>> doc("book.xml")/catalog/book[1]/price
>>
>>
>>
>>
>>
>> *xquery#2 *
>>
>>
>> xdmp:sleep(1),
>>
>>
>> xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,4445),
>>
>> xdmp:sleep(1),
>>
>> xdmp:log("Executing #2"),
>>
>> doc("book.xml")/catalog/book[1]/price
>>
>>
>> *Sample xml*
>>
>> 
>> 
>>   Gambardella, Matthew
>> XML Developer's Guide
>> Computer
>> 0004
>> 2000-10-01
>> An in-depth look at creating applications with
>> XML.
>> 
>> 
>>
>> I'm using Marklogic version 7.0-2.3, I'm unable to figure out a pattern.
>> Can someone explain this behavior?
>>
>>
>> Thanks!
>> Raghu
>>
>> ___
>> General mailing list
>> General@developer.marklogic.com
>> http://developer.marklogic.com/mailman/listinfo/general
>>
>>
>
> ___
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
>
>
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread David Ennis
HI.

I don't have a full answer, but a few pointers:

- Your xquery2 is the same as xquery1 (includes sleep).  This is probably
not what you meant to include as it does not match your description where
you say that there si no sleep on xquery2

- In the same statement you update the node and also read it back via doc()
to verify it.  This does not work this way in the query console.  So you
may be seeing some confusing results due to this.

- I do not believe that the sleep will lock the document for 10 seconds in
your example, so I don't think you should expect to see anythong blocking
for that reason.


Perhaps spawning your two samples would help you on your way. If nothing
else, it will take the query console out of the equation.





Kind Regards,
David Ennis


David Ennis
*Content Engineer*

[image: HintTech]  
Mastering the value of content
creative | technology | content

Delftechpark 37i
2628 XJ Delft
The Netherlands
T: +31 88 268 25 00
M: +31 63 091 72 80

[image: http://www.hinttech.com] 
  


On 8 December 2014 at 13:32, Raghu  wrote:

> Hi all,
>
>
> I have two xqueries
>
>  xquery# 1. Sleeps for 10 secs (xdmp:sleep) and updates an existing
> node with a new value and logs the value "Executing #1".
>  xquery# 2. Updates the same node which is being updated in xquery #1
> but no sleep and logs the value "Executing #2".
>
>
> I am executing these in the order #1 first and #2 second via two separate
> query console of the same server
>
> I expected the xquery#2 to either wait for 10 seconds (if a write lock is
> obtained on the document) or update the node even before the xquery#1 does
> it's update, but the output seems to be differing every time, the strange
> thing is sometimes the xquery#2 is getting executed twice (Confirmed via
> log as well as the updated value in the document) or vice versa.
>
> PFB the xqueries and xml used
>
> *xquery#1*
>
> xdmp:sleep(1),
>
>
> xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,0003),
>
> xdmp:sleep(1),
>
> xdmp:log("Executing #1"),
>
> doc("book.xml")/catalog/book[1]/price
>
>
>
>
>
> *xquery#2 *
>
>
> xdmp:sleep(1),
>
>
> xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,4445),
>
> xdmp:sleep(1),
>
> xdmp:log("Executing #2"),
>
> doc("book.xml")/catalog/book[1]/price
>
>
> *Sample xml*
>
> 
> 
>   Gambardella, Matthew
> XML Developer's Guide
> Computer
> 0004
> 2000-10-01
> An in-depth look at creating applications with
> XML.
> 
> 
>
> I'm using Marklogic version 7.0-2.3, I'm unable to figure out a pattern.
> Can someone explain this behavior?
>
>
> Thanks!
> Raghu
>
> ___
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
>
>
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


[MarkLogic Dev General] Marklogic node replace of same node results in inconsistent output

2014-12-08 Thread Raghu
Hi all,


I have two xqueries

 xquery# 1. Sleeps for 10 secs (xdmp:sleep) and updates an existing
node with a new value and logs the value "Executing #1".
 xquery# 2. Updates the same node which is being updated in xquery #1
but no sleep and logs the value "Executing #2".


I am executing these in the order #1 first and #2 second via two separate
query console of the same server

I expected the xquery#2 to either wait for 10 seconds (if a write lock is
obtained on the document) or update the node even before the xquery#1 does
it's update, but the output seems to be differing every time, the strange
thing is sometimes the xquery#2 is getting executed twice (Confirmed via
log as well as the updated value in the document) or vice versa.

PFB the xqueries and xml used

*xquery#1*

xdmp:sleep(1),

xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,0003),

xdmp:sleep(1),

xdmp:log("Executing #1"),

doc("book.xml")/catalog/book[1]/price





*xquery#2 *


xdmp:sleep(1),

xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,4445),

xdmp:sleep(1),

xdmp:log("Executing #2"),

doc("book.xml")/catalog/book[1]/price


*Sample xml*



  Gambardella, Matthew
XML Developer's Guide
Computer
0004
2000-10-01
An in-depth look at creating applications with
XML.



I'm using Marklogic version 7.0-2.3, I'm unable to figure out a pattern.
Can someone explain this behavior?


Thanks!
Raghu
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general