RemoveΒΆ

The remove operation is performed with the kill command.

The kill command will delete global variables and all their descendants. The pieces to be deleted can be clearly identified by subindices.

For example:

kill ^movies("The Matrix","directors")

will delete the “directors” branch and its two subbranches

^movies("The Matrix","directors","Andy Wachowski")
^movies("The Matrix","directors","Lana Wachowski")

This can be easily verified with the zwrite command:

zwrite ^movies("The Matrix",*)

that now will return:

^movies("The Matrix")=""
^movies("The Matrix","actors","Carrie-Anne Moss")=""
^movies("The Matrix","actors","Keanu Reeves")=""
^movies("The Matrix","actors","Laurence Fishburne")=""
^movies("The Matrix","year",1999)=""

We can remove also a single child. For example, a specific actor:

kill ^movies("The Matrix","actors","Laurence Fishburne")

after which zwrite will return

^movies("The Matrix")=""
^movies("The Matrix","actors","Carrie-Anne Moss")=""
^movies("The Matrix","actors","Keanu Reeves")=""
^movies("The Matrix","year",1999)=""

To remove all the actors we can use the command

kill ^movies("The Matrix","actors")

this will delete the “actors” branch and its three subbranches

^movies("The Matrix","actors","Carrie-Anne Moss")
^movies("The Matrix","actors","Keanu Reeves")
^movies("The Matrix","actors","Laurence Fishburne")

This, again, can be verified with the zwrite command:

zwrite ^movies("The Matrix",*)

that now will return:

^movies("The Matrix")=""
^movies("The Matrix","year",1999)=""

and, of course we can remove the full movie with the command

kill ^movies("The Matrix")

or the entire tree of movies with

kill ^movies

The kill command, is indeed a powerful one !