⬆️ Top

Edge capture

This trap is linked to the fact that graphs cannot have two “identical” edges (same source, same target and same label), and the fact that commands are executed one after the other.

We use again the example of the page Changing an edge label and we consider the rule below:

rule change_features {
  pattern { e: GOV -[obj:lvc]-> DEP } 
  commands {
    e.1 = comp;    % change the edge feature '1' 
    e.2 = obj;     % change the edge feature '2'
    e.deep = lvc;  % change the edge feature 'deep'

The rule change_features can be used for the following transformation:

take_a_walk_UD sud_take_a_walk

The trap

Now, let’s change the input graph.

 input  Expected output after change_features
trap sud_take_a_walk trap_change_features

What happended?

As we said, commands are run one by one, after the application of the two first commands e.1 = comp and e.2 = obj, the label e has now the label comp:obj and is identical to the other edge from take to walk in the input graph. But there can not be several identical edges in a graph and so there is only one edge comp:obj from take to walk further modified by the last command e.deep = lvc producing the graph in the last column above.

To avoid the trap, one should use another alternative of writting the rule explained in page Changing an edge label.