Module Tp3::ProjectRelate2
Project this tuple set to a new tuple set of 2 values per row, by using a set of relations.
Sibling module of Project2 (which takes a set of “functions” instead of “relations”).
Each projection relation accepts the values of a tuple from this tuple set, and returns a new value, where the value held by the nth relation will become the nth column in the new tuple set.
For example, the following projection switches (first, last) names to (last, first) names.
predicate siblings(Person a, Person b) { ... }
Person motherOf(Person a, Person b) { ... }
Person fatherOf(Person a, Person b) { ... }
import Tp2<Person, Person, siblings/2>
::Project2<Person, Person, motherOf/2, fatherOf/2>
as SiblingParents
// Selects (mother, father) that have a pair of children
from Person mother, Person father where SiblingParents::tp(mother, father)
select mother, father
Import path
import qtil.fn.generated.Tp