qtil
advanced-security/qtil-swift 0.0.3
Search

Module Tp5

A module for transforming a “Tuple predicate” with 5 arguments.

In qtil speak:

  • a “Function” (FnX) is a predicate with a bindingset[] on all of its arguments, and a result
  • a "TuplePredicate " (TpX) is a predicate with finite arguments and no result
  • a “Relation” (RelX) is a predicate with finite arguments and a finite result
  • a “Property” (PropX) is a predicate with a bindingset[] on all arguments no result

Essentially, a tuple predicate Tp<A, B, C> represents a finite set of tuples (a, b, c). This module accepts a tuple predicate (predicate p(A, B, C)) as an input, and offers functional programming features on top of it such as map and filter, as well as some relational algebra features such as projection and joins.

Example:

predicate livesIn(Person p, City c) { c = p.getCity() }
string describe(Person p, City c) { result = p.getName() + " lives in " + c.getName() }

// selects "Peter lives in New York", "Wanda lives in London", ...
select Tp2<Person, City, livesIn/2>::Map<string, describe/2>::find()

Import path

import qtil.fn.generated.Tp

Predicates

contains

Checks if (a, b, c, …) is a member of the tuple set represented by this “tuple predicate.”

doCount

Count the number of tuples in this tuple set.

dropFifth

Drop the fifth column in the set of tuples that satisfy the given predicate, and get a new tuple set after that column has been dropped.

dropFirst

Drop the first column in the set of tuples that satisfy the given predicate, and get a new tuple set after that column has been dropped.

dropFourth

Drop the fourth column in the set of tuples that satisfy the given predicate, and get a new tuple set after that column has been dropped.

dropSecond

Drop the second column in the set of tuples that satisfy the given predicate, and get a new tuple set after that column has been dropped.

dropThird

Drop the third column in the set of tuples that satisfy the given predicate, and get a new tuple set after that column has been dropped.

fifth

Get the set of fifth values in the set of tuples that satisfy the given predicate.

first

Get the set of first values in the set of tuples that satisfy the given predicate.

fourth

Get the set of fourth values in the set of tuples that satisfy the given predicate.

second

Get the set of second values in the set of tuples that satisfy the given predicate.

third

Get the set of third values in the set of tuples that satisfy the given predicate.

Modules

AllHoldsFor

A module with a single predicate, holds, that holds if all of the tuples in the current tuple set satisfy the given property prop.

AnyHoldsFor

A module with a single predicate, holds, that holds if any of the tuples in the current tuple satisfy the given property prop.

ContainedBy

A module with a single predicate, holds, that holds if all of the tuples in the current tuple set satisfy the given property prop.

ContainsAll

A module with a single predicate, holds, that holds if the current tuple set contains all of the tuples of the given tuple predicate tp2.

ContainsAny

A module with a single predicate, holds, that holds if the current tuple set contains any of the tuples of the given tuple predicate tp2.

Difference

Creates a new tuple predicate that holds the elements only in the current tuple set, not the given one.

ExtendMapFifth

Maps the set of fifth values in the set of tuples that satisfy the given predicate, against a mapper function, and use the result to add a column to this tuple set.

ExtendMapFirst

Maps the set of first values in the set of tuples that satisfy the given predicate, against a mapper function, and use the result to add a column to this tuple set.

ExtendMapFourth

Maps the set of fourth values in the set of tuples that satisfy the given predicate, against a mapper function, and use the result to add a column to this tuple set.

ExtendMapSecond

Maps the set of second values in the set of tuples that satisfy the given predicate, against a mapper function, and use the result to add a column to this tuple set.

ExtendMapThird

Maps the set of third values in the set of tuples that satisfy the given predicate, against a mapper function, and use the result to add a column to this tuple set.

ExtendRelateFifth

Maps the set of fifth values in the set of tuples that satisfy the given predicate, against a mapper function, and use the result to add a column to this tuple set.

ExtendRelateFirst

Maps the set of first values in the set of tuples that satisfy the given predicate, against a mapper function, and use the result to add a column to this tuple set.

ExtendRelateFourth

Maps the set of fourth values in the set of tuples that satisfy the given predicate, against a mapper function, and use the result to add a column to this tuple set.

ExtendRelateSecond

Maps the set of second values in the set of tuples that satisfy the given predicate, against a mapper function, and use the result to add a column to this tuple set.

ExtendRelateThird

Maps the set of third values in the set of tuples that satisfy the given predicate, against a mapper function, and use the result to add a column to this tuple set.

Filter

Takes a property which filters the contents of the current tuple set and produces a new one.

Intersect

Takes a tuple set and intersects it with the current tuple set to produce a new one.

Map

Map a function over the tuples in this tuple set, and get a new tuple predicate back representing the set of tuples after being transformed by that function.

MapFifth

Maps the set of fifth values in the set of tuples that satisfy the given predicate, against a mapper function.

MapFirst

Maps the set of first values in the set of tuples that satisfy the given predicate, against a mapper function.

MapFourth

Maps the set of fourth values in the set of tuples that satisfy the given predicate, against a mapper function.

MapRelateFifth

Maps the set of fifth values in the set of tuples that satisfy the given predicate, against a mapper relation.

MapRelateFirst

Maps the set of first values in the set of tuples that satisfy the given predicate, against a mapper relation.

MapRelateFourth

Maps the set of fourth values in the set of tuples that satisfy the given predicate, against a mapper relation.

MapRelateSecond

Maps the set of second values in the set of tuples that satisfy the given predicate, against a mapper relation.

MapRelateThird

Maps the set of third values in the set of tuples that satisfy the given predicate, against a mapper relation.

MapSecond

Maps the set of second values in the set of tuples that satisfy the given predicate, against a mapper function.

MapThird

Maps the set of third values in the set of tuples that satisfy the given predicate, against a mapper function.

Project1

An alias for Map, but the result is a “tuple set” (a predicate(A a) with one parameter and no result) instead of a ResultSet (a predicate R pred() with no parameters and result R).

Project2

Project this tuple set to a new tuple set of 2 values per row, by using a set of projection functions.

Project3

Project this tuple set to a new tuple set of 3 values per row, by using a set of projection functions.

Project4

Project this tuple set to a new tuple set of 4 values per row, by using a set of projection functions.

Project5

Project this tuple set to a new tuple set of 5 values per row, by using a set of projection functions.

Project6

Project this tuple set to a new tuple set of 6 values per row, by using a set of projection functions.

ProjectRelate1

An alias for Relate, but the result is a “tuple set” (a predicate(A a) with one parameter and no result) instead of a ResultSet (a predicate R pred() with no parameters and result R).

ProjectRelate2

Project this tuple set to a new tuple set of 2 values per row, by using a set of relations.

ProjectRelate3

Project this tuple set to a new tuple set of 3 values per row, by using a set of relations.

ProjectRelate4

Project this tuple set to a new tuple set of 4 values per row, by using a set of relations.

ProjectRelate5

Project this tuple set to a new tuple set of 5 values per row, by using a set of relations.

ProjectRelate6

Project this tuple set to a new tuple set of 6 values per row, by using a set of relations.

Query

Query for the contents of this tuple, by defining a query predicate tpQuery to import.

Relate

Maps a relation over the tuples in this tuple set, and get a new tuple predicate back representing the related values to the tuples in this set.

Union

Creates a new tuple predicate that is a union of the current tuple set and the given one.

Parameters