Commit bb1d6ba3 authored by Bruno Guillaume's avatar Bruno Guillaume

add links to complex_edges

parent a05792ea
......@@ -51,36 +51,9 @@ add_edge N -[suj]-> M
~~~
### Add a new edge with a label taken in the pattern
The command `add_edge e: N -> M` add a new edge in the current graph from the node matched with identifier `N` to the node matched with identifier `M` with the same label as the edge that was match in the pattern with the edge identifier `e`.
The command `add_edge e: N -> M` adds a new edge in the current graph from the node matched with identifier `N` to the node matched with identifier `M` with the same label as the edge that was match in the pattern with the edge identifier `e`.
#### Example:
`add_edge_pattern.grs`:
~~~grew
package M {
rule r {
pattern { A[phon=A]; B[phon=B]; e: B -> A }
commands { del_edge e; add_edge e: A -> B }
}
}
strat main { Onf(M) }
~~~
`input.gr`:
~~~grew
graph {
A [phon="A"];
B [phon="B"];
B -[x]-> A;
B -[y]-> A;
B -[z]-> A;
}
~~~
With the command `grew transform -grs add_edge_pattern.grs -i input.gr -o output.gr`, the rewriting will produce the graph `output.gr` below.
| `input.gr` | `output.gr` |
|:---:|:---:|
| ![input.gr](/examples/add_edge_pattern/in.svg) | ![output.gr](/examples/add_edge_pattern/out.svg) |
There is an example on usage of the command [here](../complex_edges#reverse-an-edge).
## Edge redirection
Commands are available to move globally incident edges of some node of the pattern.
......
......@@ -53,12 +53,14 @@ Some examples (with SUD labels) are given below.
| Syntax | Description | `comp``comp:obl` | `comp:obl@agent` | `comp:aux` | `comp:obj@lvc` |
|-------------------|-------------|:------:|:----------:|:----------------:|:----------:|:----------:|
| `X -[1=comp]-> Y` | any edge such that the feature `1` is defined with value `comp` | YES | YES | YES |YES | YES |
| `X -[1=comp, 2=obl¦aux]-> Y` | the feature `1` is defined with value `comp` and the feature `2` is defined with one of the two values `obl` or `aux` | NO | YES |YES |YES | NO|
| `X -[1=comp, 2<>obl¦aux]-> Y` | the feature `1` is defined with value `comp` and the feature `2` is defined with a value different from `obl` or `aux` | NO | NO | NO | NO | YES |
| `X -[1=comp, 2=obl¦aux]-> Y`* | the feature `1` is defined with value `comp` and the feature `2` is defined with one of the two values `obl` or `aux` | NO | YES |YES |YES | NO|
| `X -[1=comp, 2<>obl¦aux]-> Y`* | the feature `1` is defined with value `comp` and the feature `2` is defined with a value different from `obl` or `aux` | NO | NO | NO | NO | YES |
| `X -[1=comp, !deep]-> Y` | the feature `1` is defined with value `comp` and the feature `deep` is not defined | YES | YES | NO |YES | NO|
| `X -[1=comp, 2=*]-> Y` | the feature `1` is defined with value `comp` and the feature `2` is defined with any value | NO | YES | YES |YES | YES|
| `X -[comp]-> Y` | the exact label `comp` and nothing else | YES | NO | NO | NO | NO |
\* replace the symbol `¦` by the pipe `|` symbol in Grew (the right symbol cannot be used in Markdown table!)
### :warning::warning: Matching with atomic labels :warning::warning:
It is important to note that from the pattern point of view, the two clauses `X -[1=comp]-> Y` (first line in the table) and `X -[comp]-> Y` (last line in the table) are not equivalent!
......
......@@ -17,11 +17,10 @@ The graphs we consider in Grew are defined as usually in mathematics by two sets
A node is described by a an identifier (needed to refer to nodes on edges definitions) and a feature structure (basically a finite list of pairs (*feature_name*, *feature_value*)).
An edge is described by two nodes (called the *source* and the *target* of the edge) and by an edge label.
Until version 1.1, edge label where atomic strings.
Since version 1.2 labels are encoded as feature structures (mainly to ease the writing of rules with complex label like `nsubj:pass` where we would like to be able to table about subparts `nsubj` and `pass` independently).
However, backward compatibility is ensured and the user do not need to manipulate subparts of labels, he/she can consider label are atomic (including labels like `nsubj:pass`).
See [below](#complex-edge-labels) for more detail on complex edge labels.
Until version 1.1, edge labels were atomic strings.
Since version 1.2 labels are encoded as feature structures (mainly to ease the writing of rules with complex label like `nsubj:pass` where we would like to be able to access to subparts `nsubj` and `pass` independently).
See [here](../complex_edges#complex-edges-in-graphs) for more detail on complex edge labels.
# Graph input formats
To describe a graph in practice, *Grew* offers several input formats: a native `gr` format, the `conll` format (and a few derived formats), the `amr` format.
......@@ -75,11 +74,7 @@ As a consequence, it is impossible to use both `phon` and `form` in the same sys
We highly recommend to use only the `form` feature in this setting. Of course, the same observation applies to `cat` and `upos` (`upos` should be prefered) and to `pos` and `xpos` (`xpos` should be chosen).
## The native format
:TODO:
TODO
## The AMR format
:TODO:
# Complex edge labels
:TODO:
TODO
......@@ -15,7 +15,7 @@ A Pattern is defined through 3 different parts that are all optional.
* any number of nogative clauses introduced by the keyword `without`; each clause filters out a subpart of the matchings previously selected
* :warning: New from version 1.2: at most one global clause introduced by the keyword `global` which filters out a subpart of graphs.
The global matching process is as follow:
The global matching process is:
* It takes a graph and a pattern as input.
* It outputs a set of matchings; a matching being a function from nodes and edges defined in the positive clause to nodes and edges of the host graph.
......@@ -27,7 +27,7 @@ The global matching process is as follow:
Note that if there is more than one negative matching, there are all interpreted independently.
One way to learn the syntax of patterns in grew is to follow the tutorial part of the [Grew-match](http://match.grew.fr) tool.
The basic syntax of patterns in grew can be learned using the tutorial part of the [Grew-match](http://match.grew.fr) tool.
## Positive pattern
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment