alf-shell 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +4 -0
- data/Manifest.txt +1 -0
- data/doc/commands/exec.md +16 -0
- data/doc/commands/help.md +11 -0
- data/doc/commands/main.md +33 -0
- data/doc/commands/show.md +19 -0
- data/doc/operators/non_relational/autonum.md +23 -0
- data/doc/operators/non_relational/clip.md +31 -0
- data/doc/operators/non_relational/coerce.md +15 -0
- data/doc/operators/non_relational/compact.md +20 -0
- data/doc/operators/non_relational/defaults.md +32 -0
- data/doc/operators/non_relational/generator.md +20 -0
- data/doc/operators/non_relational/sort.md +24 -0
- data/doc/operators/non_relational/type-safe.md +20 -0
- data/doc/operators/relational/extend.md +18 -0
- data/doc/operators/relational/group.md +27 -0
- data/doc/operators/relational/infer-heading.md +20 -0
- data/doc/operators/relational/intersect.md +13 -0
- data/doc/operators/relational/join.md +28 -0
- data/doc/operators/relational/matching.md +24 -0
- data/doc/operators/relational/minus.md +12 -0
- data/doc/operators/relational/not-matching.md +20 -0
- data/doc/operators/relational/project.md +28 -0
- data/doc/operators/relational/quota.md +21 -0
- data/doc/operators/relational/rank.md +27 -0
- data/doc/operators/relational/rename.md +17 -0
- data/doc/operators/relational/restrict.md +25 -0
- data/doc/operators/relational/summarize.md +25 -0
- data/doc/operators/relational/ungroup.md +20 -0
- data/doc/operators/relational/union.md +14 -0
- data/doc/operators/relational/unwrap.md +20 -0
- data/doc/operators/relational/wrap.md +24 -0
- data/lib/alf/shell/version.rb +1 -1
- metadata +32 -2
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
Executes an .alf file on current database
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
alf #(command_name) [FILE]
|
7
|
+
|
8
|
+
OPTIONS
|
9
|
+
|
10
|
+
#(summarized_options)
|
11
|
+
|
12
|
+
DESCRIPTION
|
13
|
+
|
14
|
+
This command executes the .alf file passed as first argument (or what comes
|
15
|
+
on standard input) as a alf query to be executed on the current database.
|
16
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
alf - Relational algebra at your fingertips
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
alf [--version] [--help]
|
7
|
+
alf -e '(lispy command)'
|
8
|
+
alf [FILE.alf]
|
9
|
+
alf [alf opts] OPERATOR [operator opts] ARGS ...
|
10
|
+
alf help OPERATOR
|
11
|
+
|
12
|
+
OPTIONS
|
13
|
+
|
14
|
+
#(summarized_options)
|
15
|
+
|
16
|
+
RELATIONAL OPERATORS
|
17
|
+
|
18
|
+
#(summarized_subcommands relational_operators)
|
19
|
+
|
20
|
+
EXPERIMENTAL RELATIONAL OPERATORS
|
21
|
+
|
22
|
+
#(summarized_subcommands experimental_operators)
|
23
|
+
|
24
|
+
NON-RELATIONAL OPERATORS
|
25
|
+
|
26
|
+
#(summarized_subcommands non_relational_operators)
|
27
|
+
|
28
|
+
OTHER NON-RELATIONAL COMMANDS
|
29
|
+
|
30
|
+
#(summarized_subcommands other_non_relational_commands)
|
31
|
+
|
32
|
+
See 'alf help COMMAND' for details about a specific command.
|
33
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
Output input tuples through a specific renderer (text, yaml, ...)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
alf #(command_name) NAME -- [ORDERING]
|
7
|
+
|
8
|
+
OPTIONS
|
9
|
+
|
10
|
+
#(summarized_options)
|
11
|
+
|
12
|
+
DESCRIPTION
|
13
|
+
|
14
|
+
When a name is specified as commandline arg, request the database to
|
15
|
+
provide the corresponding relation variable and prints its value.
|
16
|
+
Otherwise, take what comes on standard input.
|
17
|
+
|
18
|
+
Note that this command is not an operator and should not be piped
|
19
|
+
anymore.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
Extend its operand with an unique autonumber attribute
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This non-relational operator guarantees uniqueness of output tuples by adding
|
11
|
+
an attribute called AS whose value is an auto-numbered Integer.
|
12
|
+
|
13
|
+
If the presence of duplicates was the only "non-relational" aspect of the input,
|
14
|
+
the result is a valid relation for which AS is a candidate key.
|
15
|
+
|
16
|
+
EXAMPLE
|
17
|
+
|
18
|
+
# Autonumber suppliers with default attribute name
|
19
|
+
!(alf autonum suppliers)
|
20
|
+
|
21
|
+
# Autonumber suppliers with a `unique_id` attribute
|
22
|
+
!(alf autonum suppliers -- unique_id)
|
23
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
Clip input tuples to a subset of attributes
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
OPTIONS
|
9
|
+
|
10
|
+
#(summarized_options)
|
11
|
+
|
12
|
+
DESCRIPTION
|
13
|
+
|
14
|
+
This operator clips tuples on attributes whose names are specified in
|
15
|
+
ATTRIBUTES. This is similar to the relational PROJECT operator, expect
|
16
|
+
that CLIP does not remove duplicates afterwards.
|
17
|
+
|
18
|
+
Clipping may therefore lead to bags of tuples instead of sets. The result
|
19
|
+
is therefore **not** a valid relation unless a candidate key is preserved.
|
20
|
+
|
21
|
+
With the allbut option, the operator keeps attributes in ATTRIBUTES, instead
|
22
|
+
of projecting them away.
|
23
|
+
|
24
|
+
EXAMPLE
|
25
|
+
|
26
|
+
# Clip suppliers on `name` and `city`
|
27
|
+
!(alf clip suppliers -- name city)
|
28
|
+
|
29
|
+
# Clip suppliers on all other attributes
|
30
|
+
!(alf clip suppliers --allbut -- name city)
|
31
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
Remove tuple duplicates
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This non-relational operator removes duplicates from its input operand.
|
11
|
+
In other words, it converts a bag of tuples to a set of tuples in a
|
12
|
+
brute-force manner.
|
13
|
+
|
14
|
+
If the presence of duplicates was the only "non-relational" aspect of
|
15
|
+
the operand, the result is a valid relation.
|
16
|
+
|
17
|
+
EXAMPLE
|
18
|
+
|
19
|
+
alf compact suppliers
|
20
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
Force default values on missing/nil attributes
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
OPTIONS
|
9
|
+
|
10
|
+
#(summarized_options)
|
11
|
+
|
12
|
+
DESCRIPTION
|
13
|
+
|
14
|
+
This non-relational operator rewrites input tuples to ensure that all values
|
15
|
+
for attribute names specified in DEFAULTS are present and not nil. Missing or
|
16
|
+
nil attributes are replaced by the specified default value.
|
17
|
+
|
18
|
+
A value specified in DEFAULTS may be any tuple expression. This allows computing
|
19
|
+
the default value as an expression on the current tuple.
|
20
|
+
|
21
|
+
With the strict option, the operator projects resulting tuples on attributes for
|
22
|
+
which a default value has been specified. Using the strict mode guarantees that
|
23
|
+
the heading of all tuples is the same, and that no nil value ever remains.
|
24
|
+
|
25
|
+
Note that this operator never removes duplicates. Even in strict mode the result
|
26
|
+
might be an invalid relation.
|
27
|
+
|
28
|
+
EXAMPLE
|
29
|
+
|
30
|
+
alf defaults suppliers -- country "'Belgium'"
|
31
|
+
alf defaults --strict suppliers -- country "'Belgium'"
|
32
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
Generate a relation with an auto-numbered attribute
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This non-relational operator generates a relation of one attribute called AS,
|
11
|
+
whose value is an auto-number ranging from 1 to SIZE, inclusively.
|
12
|
+
|
13
|
+
EXAMPLE
|
14
|
+
|
15
|
+
# Default behavior: AS is `num` and SIZE is 10
|
16
|
+
!(alf generator)
|
17
|
+
|
18
|
+
# That you can override
|
19
|
+
!(alf generator -- 5 -- id)
|
20
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
Sort input tuples according to an order relation
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This non-relational operator sorts input tuples according to ORDERING.
|
11
|
+
|
12
|
+
This is, of course, a non relational operator as relations are unordered
|
13
|
+
sets. It is provided for displaying purposes and normalization of
|
14
|
+
non-relational inputs.
|
15
|
+
|
16
|
+
EXAMPLE
|
17
|
+
|
18
|
+
# Sort suppliers by name
|
19
|
+
!(alf sort suppliers -- name asc)
|
20
|
+
|
21
|
+
# Sort suppliers by city in descending order, then on name on ascending
|
22
|
+
# order
|
23
|
+
!(alf sort suppliers -- city desc name asc)
|
24
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
Check that input tuples are of a specified heading
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This non-relational ensures that input tuples match a given heading (in strict mode),
|
11
|
+
or a projection (in non-strict mode). This is useful when connecting to data-sources whose
|
12
|
+
relation representations must absolutely be checked for type safety.
|
13
|
+
|
14
|
+
EXAMPLE
|
15
|
+
|
16
|
+
# Check that the suppliers have the correct heading (since is missing, but ok)
|
17
|
+
!(alf type-safe suppliers -- sid String name String status Integer city String since Date)
|
18
|
+
|
19
|
+
# Strict, no attribute can be missing
|
20
|
+
!(alf type-safe --strict suppliers -- sid String name String status Integer city String)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
Relational extension (additional, computed attributes)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator extends its operand with new attributes whose value is the result
|
11
|
+
of evaluating tuple expressions specified in EXT. The latter are specified as
|
12
|
+
(name, expression) pairs.
|
13
|
+
|
14
|
+
EXAMPLE
|
15
|
+
|
16
|
+
# Compute a few attributes on suppliers by extension
|
17
|
+
!(alf extend supplies -- big "qty > 100" price "qty * 12.2")
|
18
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
Relational grouping (relation-valued attributes)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
OPTIONS
|
9
|
+
|
10
|
+
#(summarized_options)
|
11
|
+
|
12
|
+
DESCRIPTION
|
13
|
+
|
14
|
+
This operator groups attributes in ATTRIBUTES as a new, relation-valued
|
15
|
+
attribute named AS.
|
16
|
+
|
17
|
+
With the allbut option, it groups all attributes not specified in ATTRIBUTES
|
18
|
+
instead.
|
19
|
+
|
20
|
+
EXAMPLE
|
21
|
+
|
22
|
+
# Group pid and qty as a relation-valued attribute names supplying
|
23
|
+
!(alf group supplies -- pid qty -- supplying)
|
24
|
+
|
25
|
+
# Group all but pid ...
|
26
|
+
!(alf group supplies --allbut -- pid -- supplying)
|
27
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
Relational heading inference (print the relation type)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator simply outputs a relation containing one tuple: the heading of
|
11
|
+
its operand.
|
12
|
+
|
13
|
+
EXAMPLE
|
14
|
+
|
15
|
+
# What is the heading of the `suppliers` relation?
|
16
|
+
!(alf infer-heading suppliers)
|
17
|
+
|
18
|
+
# What is the heading of the following join?
|
19
|
+
!(alf join suppliers supplies | alf infer-heading)
|
20
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
Relational intersection (aka a logical and)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator computes the relational intersection of its operands. Such
|
11
|
+
intersection is simply the set of tuples that appear both in LEFT and in
|
12
|
+
RIGHT.
|
13
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
Relational join (and cartesian product)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator computes the (natural) join of its operands.
|
11
|
+
|
12
|
+
Natural join means that, unlike what is commonly used in SQL, joining is based
|
13
|
+
on equality of all attributes that are shared between LEFT and RIGHT performed
|
14
|
+
on common attribute names. You can use the `rename` operator if this behavior
|
15
|
+
does not fit your needs.
|
16
|
+
|
17
|
+
When operands have no attribute in common, this operator naturally "degenerates"
|
18
|
+
to a cartesian product.
|
19
|
+
|
20
|
+
EXAMPLE
|
21
|
+
|
22
|
+
# Computes natural join of suppliers and supplies (on sid, the only
|
23
|
+
# attribute they have in common)
|
24
|
+
!(alf join suppliers supplies)
|
25
|
+
|
26
|
+
# The following example demontrates the cartesian product with a generated
|
27
|
+
# relation
|
28
|
+
!(alf generator -- 3 -- num | alf join cities)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
Relational matching (join + project back on left)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator restricts its LEFT operand to tuples for which there exists at
|
11
|
+
least one tuple in RIGHT that (naturally) joins. This is a shortcut operator
|
12
|
+
for the following longer expression:
|
13
|
+
|
14
|
+
(project (join xxx, yyy), [xxx's attributes])
|
15
|
+
|
16
|
+
Or equivalently,
|
17
|
+
|
18
|
+
(join xxx, (project xxx, [common attributes]))
|
19
|
+
|
20
|
+
EXAMPLE
|
21
|
+
|
22
|
+
# Which suppliers supply at least one part?
|
23
|
+
!(alf matching suppliers supplies)
|
24
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
Relational not matching (inverse of matching)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator restricts LEFT tuples to those for which there does not
|
11
|
+
exist any tuple in RIGHT that (naturally) joins. This is a shortcut
|
12
|
+
operator for the following longer expression:
|
13
|
+
|
14
|
+
(minus xxx, (matching xxx, yyy))
|
15
|
+
|
16
|
+
EXAMPLE
|
17
|
+
|
18
|
+
# Which suppliers do not supply any part?
|
19
|
+
!(alf not-matching suppliers supplies)
|
20
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
Relational projection (clip + compact)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
OPTIONS
|
9
|
+
|
10
|
+
#(summarized_options)
|
11
|
+
|
12
|
+
DESCRIPTION
|
13
|
+
|
14
|
+
This operator projects tuples on attributes whose names are specified in
|
15
|
+
ATTRIBUTES. Unlike SQL, this operator **always** removes duplicates in the
|
16
|
+
result so that the output is a set of tuples, that is, a relation.
|
17
|
+
|
18
|
+
With the allbut option, the operator projects ATTRIBUTES away instead of
|
19
|
+
keeping them.
|
20
|
+
|
21
|
+
EXAMPLE
|
22
|
+
|
23
|
+
# What are supplier cities ?
|
24
|
+
!(alf project suppliers -- city)
|
25
|
+
|
26
|
+
# What are all but supplier's id and name
|
27
|
+
!(alf project --allbut suppliers -- sid name)
|
28
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
Generalized quota-queries (position, sum progression, etc.)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
**This operator is a work in progress and should be used with care.**
|
11
|
+
|
12
|
+
This operator is an attempt to generalize RANK in two directions:
|
13
|
+
|
14
|
+
* Use a full SUMMARIZATION instead of hard-coding a ranking attribute via count()
|
15
|
+
* Providing a BY key so that summarizations can actually be done on sub-groups
|
16
|
+
|
17
|
+
EXAMPLE
|
18
|
+
|
19
|
+
# Compute linear progression of quantities by supplier number
|
20
|
+
!(alf quota supplies -- sid -- qty -- position count sum_qty "sum{ qty }")
|
21
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
Relational ranking (explicit tuple positions)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator computes the ranking of input tuples, according to ORDER.
|
11
|
+
|
12
|
+
Precisely, it extends its operand with an attribute called AS whose value
|
13
|
+
is the number of tuples which are considered strictly less according to the
|
14
|
+
order relation denoted by ORDER.
|
15
|
+
|
16
|
+
Note that, unless the ordering includes a candidate key for the input relation,
|
17
|
+
the new AS attribute is not necessarily a candidate key for the output.
|
18
|
+
|
19
|
+
EXAMPLE
|
20
|
+
|
21
|
+
# Rank parts by weight
|
22
|
+
!(alf rank parts -- weight -- position)
|
23
|
+
|
24
|
+
# Rank parts by weight in descending order. Ensure that position is a
|
25
|
+
# candidate key by including a key in ordering
|
26
|
+
!(alf rank parts -- weight desc pid asc -- position)
|
27
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
Relational renaming (rename some attributes)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This command renames attributes as specified in RENAMING, taken as successive
|
11
|
+
(old name, new name) pairs
|
12
|
+
|
13
|
+
EXAMPLE
|
14
|
+
|
15
|
+
# Rename a few supplier attributes
|
16
|
+
!(alf rename suppliers -- name supplier_name city supplier_city)
|
17
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
Relational restriction (aka where, predicate filtering)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This command restricts restricts relations to those tuples for which PREDICATE
|
11
|
+
evaluates to true.
|
12
|
+
|
13
|
+
PREDICATE must be a valid tuple expression that returns a truth-value. It
|
14
|
+
may be specified as a ruby code literal, or a mapping between (name, value)
|
15
|
+
pairs. In the latter case, PREDICATE is built as a conjunction of attribute
|
16
|
+
equalities.
|
17
|
+
|
18
|
+
EXAMPLE
|
19
|
+
|
20
|
+
# Who are suppliers with a status greater than 20?
|
21
|
+
!(alf restrict suppliers -- "status > 20")
|
22
|
+
|
23
|
+
# Which suppliers live in London?
|
24
|
+
!(alf restrict suppliers -- city "'London'")
|
25
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
Relational summarization (group-by + aggregate ops)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
OPTIONS
|
9
|
+
|
10
|
+
#(summarized_options)
|
11
|
+
|
12
|
+
DESCRIPTION
|
13
|
+
|
14
|
+
This operator summarizes input tuples over a projection given by BY.
|
15
|
+
SUMMARIZATION is a mapping between attribute names and summarizing
|
16
|
+
expressions.
|
17
|
+
|
18
|
+
With the allbut option, the operator uses all attributes not specified
|
19
|
+
in BY as the projection key.
|
20
|
+
|
21
|
+
EXAMPLE
|
22
|
+
|
23
|
+
# Compute the sum of supplied quantities, by supplier id
|
24
|
+
!(alf summarize supplies -- sid -- total_qty "sum{ qty }")
|
25
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
Relational un-grouping (inverse of group)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator flattens its operand by ungrouping the relation-valued
|
11
|
+
attribute ATTR.
|
12
|
+
|
13
|
+
EXAMPLE
|
14
|
+
|
15
|
+
# Given `pid` and `qty` groupped as `supplying`
|
16
|
+
!(alf group supplies -- pid qty -- supplying)
|
17
|
+
|
18
|
+
# Let's ungroup them
|
19
|
+
!(alf group supplies -- pid qty -- supplying | alf ungroup -- supplying)
|
20
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
Relational union
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator computes the union of its operands, that is the set of
|
11
|
+
tuples that appear in LEFT or in RIGHT.
|
12
|
+
|
13
|
+
The result is a valid relation in that it never contains duplicates.
|
14
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
Relational un-wrapping (inverse of wrap)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
DESCRIPTION
|
9
|
+
|
10
|
+
This operator flattens its operand by unwrapping the tuple-valued
|
11
|
+
attribute ATTR.
|
12
|
+
|
13
|
+
EXAMPLE
|
14
|
+
|
15
|
+
# Given, `city` and `status` wrapped as `loc_and_status`
|
16
|
+
!(alf wrap suppliers -- city status -- loc_and_status)
|
17
|
+
|
18
|
+
# Let's unwrap them
|
19
|
+
!(alf wrap suppliers -- city status -- loc_and_status | alf unwrap -- loc_and_status)
|
20
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
Relational wrapping (tuple-valued attributes)
|
3
|
+
|
4
|
+
SYNOPSIS
|
5
|
+
|
6
|
+
#(signature)
|
7
|
+
|
8
|
+
OPTIONS
|
9
|
+
|
10
|
+
#(summarized_options)
|
11
|
+
|
12
|
+
DESCRIPTION
|
13
|
+
|
14
|
+
This operator wraps attributes in ATTRIBUTES as a new, tuple-valued attribute
|
15
|
+
named AS.
|
16
|
+
|
17
|
+
With the allbut option, it wraps all attributes not specified in ATTRIBUTES
|
18
|
+
instead.
|
19
|
+
|
20
|
+
EXAMPLE
|
21
|
+
|
22
|
+
# Wrap `city` and `status` and a tuple-value attribute named `loc_and_status`
|
23
|
+
!(alf wrap suppliers -- city status -- loc_and_status)
|
24
|
+
|
data/lib/alf/shell/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alf-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -103,6 +103,36 @@ files:
|
|
103
103
|
- Gemfile
|
104
104
|
- Gemfile.lock
|
105
105
|
- bin/alf
|
106
|
+
- doc/commands/exec.md
|
107
|
+
- doc/commands/help.md
|
108
|
+
- doc/commands/main.md
|
109
|
+
- doc/commands/show.md
|
110
|
+
- doc/operators/non_relational/autonum.md
|
111
|
+
- doc/operators/non_relational/clip.md
|
112
|
+
- doc/operators/non_relational/coerce.md
|
113
|
+
- doc/operators/non_relational/compact.md
|
114
|
+
- doc/operators/non_relational/defaults.md
|
115
|
+
- doc/operators/non_relational/generator.md
|
116
|
+
- doc/operators/non_relational/sort.md
|
117
|
+
- doc/operators/non_relational/type-safe.md
|
118
|
+
- doc/operators/relational/extend.md
|
119
|
+
- doc/operators/relational/group.md
|
120
|
+
- doc/operators/relational/infer-heading.md
|
121
|
+
- doc/operators/relational/intersect.md
|
122
|
+
- doc/operators/relational/join.md
|
123
|
+
- doc/operators/relational/matching.md
|
124
|
+
- doc/operators/relational/minus.md
|
125
|
+
- doc/operators/relational/not-matching.md
|
126
|
+
- doc/operators/relational/project.md
|
127
|
+
- doc/operators/relational/quota.md
|
128
|
+
- doc/operators/relational/rank.md
|
129
|
+
- doc/operators/relational/rename.md
|
130
|
+
- doc/operators/relational/restrict.md
|
131
|
+
- doc/operators/relational/summarize.md
|
132
|
+
- doc/operators/relational/ungroup.md
|
133
|
+
- doc/operators/relational/union.md
|
134
|
+
- doc/operators/relational/unwrap.md
|
135
|
+
- doc/operators/relational/wrap.md
|
106
136
|
- lib/alf/shell/command/exec.rb
|
107
137
|
- lib/alf/shell/command/help.rb
|
108
138
|
- lib/alf/shell/command/main.rb
|
@@ -301,7 +331,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
301
331
|
version: '0'
|
302
332
|
segments:
|
303
333
|
- 0
|
304
|
-
hash:
|
334
|
+
hash: 1359397490184999599
|
305
335
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
306
336
|
none: false
|
307
337
|
requirements:
|