Tool in Mylly: Relation algebra / Part that matches | fi
Part that matches another relation
Match takes two relations and produces the records of the first relation that match the shared attributes of the second.
The input and output relations are represented as TSV files.
Example
The first input relation consists of some word forms annotated with a lemma, a sentence number, and a token number. The second input relation consists of sentence numbers annotated with the mood of a sentence.
sen | tok | lemma | word |
---|---|---|---|
3 | 3 | niin | niin |
3 | 2 | se | se |
3 | 1 | olla | on |
5 | 1 | olla | on |
sen | mood |
---|---|
3 | calm |
4 | calm |
5 | angry |
The output relation consists of those records of the first input relation that had their sentence number in the second input relation (all of them).
tok | sen | lemma | word |
---|---|---|---|
2 | 3 | se | se |
1 | 3 | olla | on |
3 | 3 | niin | niin |
1 | 5 | olla | on |
On the other hand, reversing the roles of the input relations produces those records of the second relation (the one that annotates sentence numbers with moods) that have at least one corresponding token in the first relation (sentences 3 and 5 but no sentence 4).
sen | mood |
---|---|
3 | calm |
5 | angry |
Related tools
See also
- Relation algebra for context