[MarkLogic Dev General] Triggers works
finewhendocumentcreatedusing xdmp:document-insert,
but not when document loaded using webdav
Isha Chadha
i.chadha at mpstechnologies.com
Thu Jul 10 22:55:18 PDT 2008
Thanks Ian.. U played the right string!!
Its working now.
And yeah timezone is certainly an advantage here..So I am gonna make the
most outta it :-)
Thanks Danny for making me mention all possible details here. It might be a
help to other beginners.
Isha
_____
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Ian Small
Sent: Friday, July 11, 2008 11:16 AM
To: General Mark Logic Developer Discussion
Subject: RE: [MarkLogic Dev General] Triggers works
finewhendocumentcreatedusing xdmp:document-insert,but not when document
loaded using webdav
Hey Isha -
Let me see if I can beat Danny to the punch here... More importantly, we
might be able to take advantage of the 24 hours of timezones.
It's just a guess, but it smells to me like the problem is here:
Root of webdav server is: myRootDir/
trgr:directory-scope("/myRootDir/", "1"),
xdmp:document-insert("/myRootDir/test.xml", <test><abc>nsdasf</abc></test>)
as the saying goes, "one of these is not like the others". it looks to me
like your webdav server root is missing a leading slash:
Root of webdav server should be: /myRootDir/
that would completely explain the behavior you're seeing where things
inserted through webdav don't trigger - because they're not in the scope of
the trigger.
can you try changing this and see if things improve?
thanks
ian
_____
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Isha Chadha
Sent: Thursday, July 10, 2008 9:21 PM
To: 'General Mark Logic Developer Discussion'
Subject: RE: [MarkLogic Dev General] Triggers works fine
whendocumentcreatedusing xdmp:document-insert,but not when document loaded
using webdav
Hey Danny,
Thanks for replying :-)
Root of webdav server is: myRootDir/
My trigger definition which calls a logging module is:
import module namespace trgr="http://marklogic.com/xdmp/triggers"
at "/MarkLogic/triggers.xqy"
trgr:create-trigger("myTrigger", "Simple trigger example",
trgr:trigger-data-event(
trgr:directory-scope("/myRootDir/", "1"),
trgr:document-content("create"),
trgr:post-commit()),
trgr:trigger-module(xdmp:database("myDatabase"), "/modules/", "log.xqy"),
fn:true(), xdmp:default-permissions() )
and module to be called when triggered is:
xdmp:document-insert("/modules/log.xqy",
text{ "
import module namespace trgr='http://marklogic.com/xdmp/triggers'
at '/MarkLogic/triggers.xqy'
define variable $trgr:uri as xs:string external
xdmp:log(fn:concat('*****Document ', $trgr:uri, ' was created.*****'))"
}
And lastly document insert uri which successfully fires the trigger is:
xdmp:document-insert("/myRootDir/test.xml", <test><abc>nsdasf</abc></test>)
Thanks
Isha
_____
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Danny Sokolsky
Sent: Thursday, July 10, 2008 9:42 PM
To: General Mark Logic Developer Discussion
Subject: RE: [MarkLogic Dev General] Triggers works fine when
documentcreatedusing xdmp:document-insert,but not when document loaded using
webdav
Hi Isha,
Is it possible that your trigger scope does not cover the root of the WebDAV
server? To answer this:
* What is the document-insert URI that is successfully firing the trigger?
* What is the root of the WebDAV server?
* What is the trigger definition?
Also, you say "my WebDAV Server uses the same database against which the
trigger is created". What exactly do you mean there? The WebDAV server
should point to the same *content* database as your document-insert is
pointing to. The content database in turn references the triggers database
(where the triggers are stored).
-Danny
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Isha Chadha
Sent: Wednesday, July 09, 2008 9:46 PM
To: general at developer.marklogic.com
Subject: [MarkLogic Dev General] Triggers works fine when document
createdusing xdmp:document-insert,but not when document loaded using webdav
Hi,
I created a trigger which gets activated when I use xdmp:document-insert,
following all steps as mentioned in dev_guide.pdf.
It is working as expected.
But if I insert another document using Marklogic WebDav server
(Drag-n-Drop).They don't seem to be get activated...My WebDav server uses
the same database against which trigger was created.
Is there some other way to do this or am I missing something here?
Thanks,
Isha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xqzone.marklogic.com/pipermail/general/attachments/20080711/b86790bb/attachment-0001.html
More information about the General
mailing list