2017-06-30 3 views
0

Ich verwende MarkLogic CPF.MarkLogic CPF führt keine Aktion zum Löschen von Dokumenten durch

Ich habe CPF konfiguriert für die unter 3 Staaten

http://marklogic.com/states/initial

http://marklogic.com/states/updated

http://marklogic.com/states/deleted

Alles funktioniert gut, wenn initial & updated Staaten

aber Wenn ich ein Dokument lösche, führt CPF das konfigurierte Modul nicht aus.

bitte unter der Pipeline-Konfiguration finden (klebte nur für gelöschte Zustand)

<state-transition> 
    <annotation> 
      when document is deleted in 'abc' collection 
    </annotation> 
    <state>http://marklogic.com/states/deleted</state> 
    <on-success>http://marklogic.com/states/done</on-success> 
    <on-failure>http://marklogic.com/states/error</on-failure> 
    <execute> 
     <condition> 
      <module>/MarkLogic/cpf/actions/namespace-condition.xqy</module> 
      <options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy"> 
       <root-element>head</root-element> 
       <namespace>https://www.head.org/Schema/head/hd</namespace> 
      </options> 
     </condition> 
     <action> 
      <module>delete-record.xqy</module> 
     </action> 
    </execute> 
</state-transition> 

CPF für abc Sammlung konfiguriert ist.

Wenn ich ein Dokument mit Wurzelknoten als head mit Namespace als https://www.head.org/Schema/head/hd

delete-record.xqy Modul ausgeführt wird, nicht immer löschen.

Bitte helfen Sie mir, das Problem zu finden, wenn mehr Details bitte lassen Sie es mich wissen.

Update:

komplette Pipeline-Konfiguration

<pipeline xmlns="http://marklogic.com/cpf/pipelines"> 
    <pipeline-name>Combined Search</pipeline-name> 
    <pipeline-description>Make a single copy</pipeline-description> 
    <success-action> 
     <module>/MarkLogic/cpf/actions/success-action.xqy</module> 
    </success-action> 
    <failure-action> 
     <module>/MarkLogic/cpf/actions/failure-action.xqy</module> 
    </failure-action> 
    <state-transition> 
     <annotation> 
      on creation 
     </annotation> 
     <state>http://marklogic.com/states/initial</state> 
     <on-success>http://marklogic.com/states/done</on-success> 
     <on-failure>http://marklogic.com/states/error</on-failure> 
     <execute> 
      <condition> 
       <module>/MarkLogic/cpf/actions/namespace-condition.xqy</module> 
       <options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy"> 
        <root-element>head</root-element> 
        <namespace>https://www.head.org/Schema/head/hd 
        </namespace> 
       </options> 
      </condition> 
      <action> 
       <module>create-full-record.xqy</module> 
      </action> 
     </execute> 
    </state-transition> 
    <state-transition> 
     <annotation> 
      on update 
     </annotation> 
     <state>http://marklogic.com/states/updated</state> 
     <on-success>http://marklogic.com/states/done</on-success> 
     <on-failure>http://marklogic.com/states/error</on-failure> 
     <execute> 
      <condition> 
       <module>/MarkLogic/cpf/actions/namespace-condition.xqy</module> 
       <options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy"> 
        <root-element>head</root-element> 
        <namespace>https://www.head.org/Schema/head/hd 
        </namespace> 
       </options> 
      </condition> 
      <action> 
       <module>update-record-biblio.xqy</module> 
      </action> 
     </execute> 
     <execute> 
      <condition> 
       <module>/MarkLogic/cpf/actions/namespace-condition.xqy</module> 
       <options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy"> 
        <root-element>media</root-element> 
        <namespace>https://www.media.org/Schema/Media/md</namespace> 
       </options> 
      </condition> 
      <action> 
       <module>update-media.xqy</module> 
      </action> 
     </execute> 
     <execute> 
      <condition> 
       <module>/MarkLogic/cpf/actions/namespace-condition.xqy</module> 
       <options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy"> 
        <root-element>tracking</root-element> 
        <namespace>https://www.tracking.org/Schema/Tracking/tr</namespace> 
       </options> 
      </condition> 
      <action> 
       <module>update-tracking.xqy</module> 
      </action> 
     </execute> 
    </state-transition> 
    <status-transition> 
     <annotation> 
      on deletion 
     </annotation> 
     <status>deleted</status> 
     <on-success>http://marklogic.com/states/done</on-success> 
     <on-failure>http://marklogic.com/states/error</on-failure> 
     <always>true</always> 
     <execute> 
      <condition> 
       <module>/MarkLogic/cpf/actions/namespace-condition.xqy</module> 
       <options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy"> 
        <root-element>head</root-element> 
        <namespace>https://www.head.org/Schema/head/hd 
        </namespace> 
       </options> 
      </condition> 
      <action> 
       <module>delete-record.xqy</module> 
      </action> 
     </execute> 
    </status-transition> 
</pipeline> 

keine Aktion für die Dokumentenerstellung durchgeführt wird, updation & deletetion. Bitte helfen Sie mir, die Fehler zu finden, die ich mache.

Ich habe zwei Pipelines an die Domäne angeschlossen.

über ein & Status Change Handling

Update:

Analyse:

habe ich ein Protokoll in namespace-condition.xqy Datei. Beim Löschen eines Dokuments über Datei wird aufgerufen und Wenn ich die fn:doc-available($cpf:document-uri) überprüft, gibt es mir false zurück. Das bedeutet, dass das Dokument bereits gelöscht ist.

Für status-transition & state-transition es funktioniert nicht, bitte helfen Sie mir, den Fehler zu verstehen und wie ich es lösen kann.

+0

Ich denke, das Dokument ist bereits zu dem Zeitpunkt, zu dem die Zustandsbedingung ausgewertet wird, weg, so dass Sie keine Bedingungen verwenden können, die auf etwas angewiesen sind, das an das Dokument angehängt ist (Inhalt, Eigenschaften, Sammlungen usw.). Ich vermute, Sie können es nur von uri abhängig machen .. – grtjn

+0

@grtjn Ich machte einige Änderungen wie von 'mholsteste' vorgeschlagen, aber immer noch mit einigen Problemen konfrontiert, könnten Sie mir bitte dabei helfen. Ich habe die Frage aktualisiert. Wenn Sie mehr Details benötigen, lassen Sie es mich wissen. –

Antwort

1

Die Zustandsnamen sind an sich nicht aussagekräftig. Wenn Sie sich die Definitionen in der Pipeline für die Verarbeitung von Statusänderungen ansehen, sehen Sie, dass der Status bei einer Erstellung (und ähnlich bei einer Aktualisierung) auf http://marklogic.com/states/initial gesetzt wird. Zum Löschen wird jedoch nicht der Status gesetzt, sondern ein Aktion.Wenn Sie als Reaktion auf eine Löschung eigene Aktionen ausführen möchten, benötigen Sie einen Statusübergang und keinen Statusübergang. Etwas wie:

<status-transition> 
    <annotation> 
    Do some extra work. 
    </annotation> 
    <status>deleted</status> 
    <priority>5000</priority> 
    <always>true</always>  
    <execute> 
    <condition> 
     <module>/MarkLogic/cpf/actions/namespace-condition.xqy</module> 
     <options xmlns="/MarkLogic/cpf/actions/namespace-condition.xqy"> 
      <root-element>head</root-element> 
      <namespace>https://www.head.org/Schema/head/hd</namespace> 
     </options> 
    </condition> 
    <action> 
     <module>delete-record.xqy</module> 
    </action> 
</execute> 

Die „immer“, sagt dies die normale Löschverarbeitung in der Statusänderung zusätzlich zu tun Pipeline Handhabung.

+0

Beim Hinzufügen von 'status-transition' mit Status' delete'. CPF funktioniert nicht mehr für "http: // marklogic.com/states/initial" & "http: // marklogic.com/states/updated" 'state-transitions". Es wird keine Aktion ausgelöst. –

+0

Ich habe die komplette Pipeline-Konfiguration in der Frage –

+0

hinzugefügt Ich habe die Frage aktualisiert. Die Analyse hinzugefügt. bitte hilfe! –

0

Haben Sie die Pipeline für Statusänderungsverarbeitung an Ihre Domäne angehängt? Es ist derjenige, der für die Behandlung der Statusereignisse der Erstellung und Aktualisierung zuständig ist, diese Zustände so einzustellen, dass die Zustandsübergänge reagieren können.

+0

Ja 'Statusänderung Behandlung' Pipeline ist an die Domäne angehängt. –

+0

Um dies zu diagnostizieren, aktivieren Sie die CPF Trace-Ereignisse (Gruppe> Diagnose, geben Sie CPF ein und Sie erhalten mehrere Ereignisse aktiviert) sowie 'CPF Condition Invoke',' CPF Condition Result' und 'CPF Action Invoke '. Dies gibt Ihnen einen sehr plaudernden Schlag von dem, was CPF versucht zu tun. Sie können auch das 'feinere' Level-Debugging aktivieren, das Ihnen die Precommit-Trigger anzeigen soll – mholstege

Verwandte Themen