marklogic-community / Corona

Community REST API for MarkLogic
Other
37 stars 9 forks source link

Sample Insert Transformer #88

Open bobstarbird opened 11 years ago

bobstarbird commented 11 years ago

import module namespace imu = "http://xqdev.com/in-mem-update" at "/MarkLogic/appservices/utils/in-mem-update.xqy";

(: xdmp:eval(string($transformer), (xs:QName("content"), $content, xs:QName("requestParameters"), $requestParameters, xs:QName("testMode"), false()), same-statement) :)

declare variable $content as node() external ; declare variable $requestParameters as map:map external; declare variable $testMode as xs:boolean external;

if ($testMode) then () else let $uuid := map:get($requestParameters, "uuid") let $content := imu:node-replace($content/question/@qid, attribute qid {$uuid}) return $content

eedeebee commented 11 years ago

Bob,

Can you say a little bit more here?

-Eric

bobstarbird commented 11 years ago

Yes, Eric, but I am lame with GITHUB. I will try to provide a sample that shows what I have learned. Maybe I can learn something, but I could not simple comment. Bob

On Thu, Sep 6, 2012 at 11:20 PM, Eric Bloch notifications@github.comwrote:

Bob,

Can you say a little bit more here?

-Eric

— Reply to this email directly or view it on GitHubhttps://github.com/marklogic/Corona/issues/88#issuecomment-8354897.

Robert Starbird Software Professional Services Leader and Engineer Cell: (781) 548-9427 robert.starbird@gmail.com http://www.linkedin.com/in/robertstarbird

eedeebee commented 11 years ago

Ah, there is corona@developer.marklogic.com if you're looking to open a conversation. The issues thing is really just for bugs and rfes - neither of which does this appear to be (as far as i can tell).

bobstarbird commented 11 years ago

Agreed. It was a sample that I thought I could share for a baseline xquery transform. It was not immediately obvious that the eval during transform insert would fail with the sample data so I thought it would be good to illustrate a working transform using the testMode parameter (in-mem-update fails if the node being replaced does not exist)

Bob

On Thu, Sep 6, 2012 at 11:47 PM, Eric Bloch notifications@github.comwrote:

Ah, there is corona@developer.marklogic.com if you're looking to open a conversation. The issues thing is really just for bugs and rfes - neither of which does this appear to be (as far as i can tell).

— Reply to this email directly or view it on GitHubhttps://github.com/marklogic/Corona/issues/88#issuecomment-8355262.

Robert Starbird Software Professional Services Leader and Engineer Cell: (781) 548-9427 robert.starbird@gmail.com http://www.linkedin.com/in/robertstarbird