Hi Khaled and PJ,

see my answers below:


> 1) How can I get the list the triggers defined for a node or a document?


Use metadata document for triggers: doc("$triggers")
It contains all triggers that have been defined in the database: for each
trigger there is information of its corresponding document/collection,
trigger path in this document/collection and type of trigger.

In Sedna you can query metadata documents with XQuery as usual documents.
For example, to list all triggers and their corresponding documents:

for $i in fn:doc("$triggers")/triggers/trigger
return <trigger>{$i/@name, $i/@object_name}</trigger>


> 2) Is it possible to define a trigger for all the documents of database
> (even those that will be created after the trigger creation)?


When defining triggers in Sedna it is supposed that you know the structure
of the document at least approximately. To define a trigger for all
documents with some similar structure use collections.
When trigger is set on collection it will cover all new documents that will
be loaded into this collection after the trigger creation.

For example:

CREATE TRIGGER "tr1"
BEFORE INSERT
ON collection("my_large_col")/collectionRoot/item
FOR EACH NODE
DO
{
 UPDATE insert <inserted_item_tr1/> into doc("some_other_doc")/trg_data;
 (<item_after_trigger/>);
}

Hope this helps,

Maria Grineva
Sedna team


>
> Thank you for your help.
>
> Regards,
> Khaled
>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Sedna-discussion mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sedna-discussion
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion

Reply via email to