[MarkLogic Dev General] Does CPF support multiple Conditions?

2012-01-25 Thread David Swearingen
We have a working pipeline with a condition element and an action element,
as would be expected.  We now need to in essence add a second condition,
where we would need both conditions to be evaluated, and if either returned
true, then the same action gets executed.

We do NOT wish to change the logic of the first condition (the .xqy file)
for reasons I won't get into here.

Is there a way to do this?  We tried adding a second state-transition
element, but that appears not to work, and this was just speculation since
we can't find any documentation to support doing this.

Thanks,
David Swearingen
42Six.com
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Does CPF support multiple Conditions?

2012-01-25 Thread Danny Sokolsky
Hi David,

If I understand correctly what you are trying to do, it should work by:


* Taking the first state-transition and changing its success action to 
be a no-op or similar.

* Adding a second state-transition that responds to the success of the 
first one, and putting your new condition in the new state-transition.

If you do not modify the action of the first state-transition, then if the 
condition is true, it will just run the action.

So if you want to try this based on the sample shown in the doc:

http://docs.marklogic.com/5.0doc/docapp.xqy#display.xqy?fname=http://pubs/5.0doc/xml/cpf/quickStart.xml

...then you can change the pipeline it uses to change the module on the 1st 
state-transaction, add another state-transition in the middle that responds to 
the first transition, and modify the final transition to respond to your new 
transition.

-Danny

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of David Swearingen
Sent: Wednesday, January 25, 2012 10:58 AM
To: general@developer.marklogic.com
Subject: [MarkLogic Dev General] Does CPF support multiple Conditions?

We have a working pipeline with a condition element and an action element, as 
would be expected.  We now need to in essence add a second condition, where we 
would need both conditions to be evaluated, and if either returned true, then 
the same action gets executed.

We do NOT wish to change the logic of the first condition (the .xqy file) for 
reasons I won't get into here.

Is there a way to do this?  We tried adding a second state-transition element, 
but that appears not to work, and this was just speculation since we can't find 
any documentation to support doing this.

Thanks,
David Swearingen
42Six.com
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Does CPF support multiple Conditions?

2012-01-25 Thread Mary Holstege
On Wed, 25 Jan 2012 10:58:17 -0800, David Swearingen  
dswearin...@42six.com wrote:

 We have a working pipeline with a condition element and an action  
 element, as would be expected.  We now need to in essence add a second  
 condition, where we would need both conditions to be evaluated, and if  
 either returned true, then the same action gets executed.

 We do NOT wish to change the logic of the first condition (the .xqy  
 file) for reasons I won't get into here.

 Is there a way to do this?  We tried adding a second state-transition  
 element, but that appears not to work, and this was just speculation  
 since we can't find any documentation to support doing this.

Adding another state transition for the same state could work:
they will be checked in document order.

It is easier just to add additional execute blocks to your
existing transition.

You can have as many execute blocks with conditions/action pairs
in a transition as you like. They will be tested in order, and the
first successful condition causing the associated action to be
invoked.  If none of the conditions returns true, the default
action will be invoked.  See, for example, the Status Change Handling
pipeline or the XInclude Processing pipeline.

//Mary

mary.holst...@marklogic.com
Principal Engineer
MarkLogic Corporation
___
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general