I am creating a CPF to perform an action when a document is deleted, but I'm
not seeing the entry in the error log.  Here is the part of my CPF XML file
pipeline file that handles the deletion:


  <state-transition>
    <annotation>Delete Reference Set XML</annotation>
    <state>http://marklogic.com/states/deleted</state>
    <on-success>http://marklogic.com/states/final</on-success>
    <on-failure>http://marklogic.com/states/error</on-failure>
    <default-action>
      <module>/citedrefs/reference-set-delete-cpf.xqy</module>
    </default-action>
  </state-transition>


And here is the module that handles the deletion:


xquery version "1.0-ml";
import module namespace cpf = "http://marklogic.com/cpf"; at
"/MarkLogic/cpf/cpf.xqy";
declare default function namespace "http://www.w3.org/2005/xpath-functions";;

declare variable $cpf:document-uri as xs:string external;
declare variable $cpf:transition as node() external;

(:xdmp:log("RUNNING XML DELIVERY TO REFERENCE SET TRANSFORM"):)
let $uid := string(doc($cpf:document-uri)/CRX/@u)
let $destination-database :="reference-set"
let $destination-doc-uri :=
    concat("/PsycINFO/ReferenceSet/", substring($uid, 1, 4), "/",
substring($uid, 6, 2), "/",substring($uid, 8, 3), "/", $uid, ".xml")

return
try { (
    xdmp:log(concat("reference-set-delete-cpf cpf:document-uri=",
$cpf:document-uri)),
    cpf:success($cpf:document-uri,$cpf:transition,())
) }
catch($e) {
    cpf:failure($cpf:document-uri,$cpf:transition,$e,())


1. Should the cpf:success state should be used since the document will be
deleted?  Any working examples out there?

2. Will the $cpf:document-uri contain the URI of the deleted document?

3. Is there some default deletion trigger that needs to be replaced or
disabled?


Thank you,

Tim Meagher


_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to