Colleen, thanks for your reply. we will probably switch to a script to
drive the info studio import (5.4 Loading Data into Databases) as
there we have a choice to add collections programmatically (as opposed
to the gui).  however, I noticed that it doesn't seem to be possible
to have xquery/xslt transforms to be called when scripting the info
studio. did I understand that right?

also, thanks for filing a bug report.

regards,
Jakob.



On Thu, Mar 17, 2011 at 16:36, Colleen Whitney
<[email protected]> wrote:
> Jakob,
>
> No, you've done it absolutely right, the problem is that Information Studio 
> isn't propagating collections that have been added to the documents when 
> they're inserted into your target database.  That's a bug, which I am filing 
> now on your behalf.
>
> Because you're extracting the data you want to use to generate the collection 
> from the document, the "Document Settings" tab in the GUI that lets you add 
> static collections isn't going to help you.  A not too appealing work-around 
> is to add the collections via CPF or a post-commit trigger on the target 
> database.
>
> --Colleen
>
> ________________________________________
> From: [email protected] 
> [[email protected]] On Behalf Of Jakob Fix 
> [[email protected]]
> Sent: Thursday, March 17, 2011 6:19 AM
> To: General Mark Logic Developer Discussion
> Subject: [MarkLogic Dev General] info studio + xquery transformation
>
> Hi, simple problem here:
>
> importing a number of documents using information studio. I'd like to
> add a number of collection to each imported document. while the code
> seems to be correct (see below, copied and pasted directly from the
> text box in info studio),  and all documents are loaded just fine, the
> collections aren't attached to the documents.
>
> please note this is the first time I'm using cpf so I probably haven't
> grasped all the concepts correctly.
>
> thanks in advance,
> cheers,
> Jakob.
>
>
> xquery version "1.0-ml";
>
> (: Copyright 2002-2010 MarkLogic Corporation.  All Rights Reserved. :)
>
> (:
> :: Custom action.  It must be a CPF action module.
> :: Replace this text completely, or use it as a template and
> :: add imports, declarations,
> :: and code between START and END comment tags.
> :: Uses the external variables:
> ::    $cpf:document-uri: The document being processed
> ::    $cpf:transition: The transition being executed
> :)
>
> import module namespace cpf = "http://marklogic.com/cpf";
>   at "/MarkLogic/cpf/cpf.xqy";
>
> (: START custom imports and declarations; imports must be in Modules :)
>
>
> (: END custom imports and declarations :)
>
> declare option xdmp:mapping "false";
>
> declare variable $cpf:document-uri as xs:string external;
> declare variable $cpf:transition as node() external;
>
> if ( cpf:check-transition($cpf:document-uri,$cpf:transition))
> then
>    try {
>       (: START your custom XQuery here :)
>      let $dateTime := document($cpf:document-uri)/Item/ExportDate
>      let $year-collection := string(year-from-dateTime($dateTime))
>      let $month-collection := concat($year-collection, '-',
> month-from-dateTime($dateTime))
>      let $day-collection := concat($month-collection, '-',
> day-from-dateTime($dateTime))
>      return xdmp:document-add-collections( $cpf:document-uri,
> ($year-collection, $month-collection, $day-collection) )
>      (: END your custom XQuery here :)
>      ,
>      cpf:success( $cpf:document-uri, $cpf:transition, () )
>    }
>    catch ($e) {
>       cpf:failure( $cpf:document-uri, $cpf:transition, $e, () )
>    }
> else ()
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to