# Commands

A sequence of commands is introduced by the keyword commands, separated by semicolon symbol ; and surrounded by braces.

## Edge deletion

To delete an edge, the del_edge command can refer to the full description of the edge or to an identifier e given in the pattern:

  del_edge A -[obj]-> B;
del_edge e;

Note that in the del_edge command, it is not possible to use disjunction or the joker value * in the edge label; the second syntax must be used.

## Edge creation

  add_edge A -[obj]-> B;

The command above creates a new edge from A to B with label obj.

If the label already exists, the command fails ( this may change in the next future ) ).

## Edges redirection

  shift A ==> B;

This command modifies all edges which are incident to A. Any edge in the graph starting in A (resp. ending in A) is redirected to start in B (resp end in B). Note that, after this command, the A node is isolated and should be deleted or reconnected to the graph by an upcoming command.

The commmanf fails ( this may change in the next future ):

• if A and B are connected
• if there is a node C and a label X such that A -[X]→ C and B -[X]→ C
• if there is a node C and a label X such that C -[X]→ A and C -[X]→ B

## Node deletion

  del_node A

This command removes the A nodes and all its incident edges.

#### Node creation

In the current version, a node can be added only as a “new neighbor” of some existing node. The command below adds a node (referred as D) as a new neighbor of A with edge label suj.

  add_node D: <-[suj]- A

Commands can also be used to update feature structures:

## Feature value update

This command adds a new feature to a node. If the node already contains a feature with the same name, the new feature replaces the old one. The command is written like an equality with the target node and feature name on the left. On the right hand side, the new value is described as a list (separated by the '+' symbol) of items; an item can be:

• a string (with surrounding quote if it's not an identifier);
• a feature specification.

The command below sets the m feature of node A to be “inf”:

  A.m = inf

The next command copies the value of the m feature of the feature structure of A to the one of B. If A does not defines a m feature, the command fails ( this may change in the next future ).

  B.m = A.m

It is also possible to copy feature value through different feature name (if is this is consistent with the domain):

  B.prep = A.lemma

Below, the command sets the label feature of the B node to be the concatenation of the two features C.lemma and A.m. If one of the two features in the right hand side doesn't exist, the command fails ( this may change in the next future ).

  B.label = C.lemma + A.m

Above, the two values are concatenated without any separator. You may prefer to use one of the commands below:

  B.label = C.lemma + "_" + A.m

## Feature deletion

The commands below removes the feature mood in A.

  del_feat A.mood

If A does not defines a mood feature, nothing appends.

# Rule example

rule accuser {
match {
V [cat=v, lemma="accuser"];
O [];
D [cat=det, lemma="de"];
DO [cat=v, mood = inf | pastp];

V -[OBJ]-> O;
V -[DE_OBJ]-> D;
D -[OBJ]-> DO
}
commands {
}