alf-shell 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -2
- data/Gemfile.lock +29 -10
- data/bin/alf +2 -0
- data/doc/man/alf-explain.man +22 -0
- data/doc/man/alf-metadata.man +13 -0
- data/doc/man/alf-show.man +16 -0
- data/doc/man/alf.man +77 -0
- data/doc/man/allbut.man +39 -0
- data/doc/man/among.man +25 -0
- data/doc/man/avg.man +37 -0
- data/doc/man/between.man +24 -0
- data/doc/man/concat.man +55 -0
- data/doc/man/contradiction.man +26 -0
- data/doc/man/count.man +20 -0
- data/doc/man/eq.man +29 -0
- data/doc/man/extend.man +33 -0
- data/doc/man/frame.man +60 -0
- data/doc/man/group.man +51 -0
- data/doc/man/gt.man +30 -0
- data/doc/man/gte.man +30 -0
- data/doc/man/intersect.man +54 -0
- data/doc/man/join.man +84 -0
- data/doc/man/lt.man +30 -0
- data/doc/man/lte.man +30 -0
- data/doc/man/matching.man +73 -0
- data/doc/man/max.man +36 -0
- data/doc/man/min.man +36 -0
- data/doc/man/minus.man +54 -0
- data/doc/man/native.man +32 -0
- data/doc/man/neq.man +29 -0
- data/doc/man/not_matching.man +51 -0
- data/doc/man/page.man +60 -0
- data/doc/man/project.man +36 -0
- data/doc/man/rank.man +42 -0
- data/doc/man/rename.man +29 -0
- data/doc/man/restrict.man +38 -0
- data/doc/man/stddev.man +37 -0
- data/doc/man/sum.man +37 -0
- data/doc/man/summarize.man +45 -0
- data/doc/man/tautology.man +26 -0
- data/doc/man/ungroup.man +30 -0
- data/doc/man/union.man +55 -0
- data/doc/man/unwrap.man +37 -0
- data/doc/man/variance.man +37 -0
- data/doc/man/wrap.man +37 -0
- data/doc/txt/alf-explain.man +22 -0
- data/doc/txt/alf-metadata.man +16 -0
- data/doc/txt/alf-show.man +19 -0
- data/doc/txt/alf.man +80 -0
- data/doc/txt/allbut.txt +31 -0
- data/doc/txt/among.txt +20 -0
- data/doc/txt/avg.txt +22 -0
- data/doc/txt/between.txt +19 -0
- data/doc/txt/concat.txt +31 -0
- data/doc/txt/contradiction.txt +15 -0
- data/doc/txt/count.txt +14 -0
- data/doc/txt/eq.txt +19 -0
- data/doc/txt/extend.txt +29 -0
- data/doc/txt/frame.txt +48 -0
- data/doc/txt/group.txt +37 -0
- data/doc/txt/gt.txt +20 -0
- data/doc/txt/gte.txt +20 -0
- data/doc/txt/intersect.txt +42 -0
- data/doc/txt/join.txt +65 -0
- data/doc/txt/lt.txt +20 -0
- data/doc/txt/lte.txt +20 -0
- data/doc/txt/matching.txt +54 -0
- data/doc/txt/max.txt +21 -0
- data/doc/txt/min.txt +21 -0
- data/doc/txt/minus.txt +42 -0
- data/doc/txt/native.txt +27 -0
- data/doc/txt/neq.txt +19 -0
- data/doc/txt/not_matching.txt +39 -0
- data/doc/txt/page.txt +48 -0
- data/doc/txt/project.txt +28 -0
- data/doc/txt/rank.txt +34 -0
- data/doc/txt/rename.txt +25 -0
- data/doc/txt/restrict.txt +26 -0
- data/doc/txt/stddev.txt +22 -0
- data/doc/txt/sum.txt +22 -0
- data/doc/txt/summarize.txt +33 -0
- data/doc/txt/tautology.txt +15 -0
- data/doc/txt/ungroup.txt +26 -0
- data/doc/txt/union.txt +43 -0
- data/doc/txt/unwrap.txt +29 -0
- data/doc/txt/variance.txt +22 -0
- data/doc/txt/wrap.txt +29 -0
- data/lib/alf/shell.rb +2 -32
- data/lib/alf/shell/alfrc.rb +3 -0
- data/lib/alf/shell/command.rb +2 -18
- data/lib/alf/shell/command/explain.rb +37 -0
- data/lib/alf/shell/command/help.rb +3 -21
- data/lib/alf/shell/command/main.rb +20 -78
- data/lib/alf/shell/command/metadata.rb +32 -0
- data/lib/alf/shell/command/show.rb +17 -5
- data/lib/alf/shell/support.rb +21 -13
- data/lib/alf/shell/version.rb +1 -1
- data/spec/integration/explain/explain.cmd +1 -0
- data/spec/integration/explain/explain.stdout +11 -0
- data/spec/integration/show/group.alf +2 -0
- data/spec/integration/show/show_alf.cmd +1 -0
- data/spec/integration/{group/group_0.stdout → show/show_alf.stdout} +0 -0
- data/tasks/doc.rake +4 -0
- metadata +116 -178
- data/doc/commands/exec.md +0 -16
- data/doc/commands/help.md +0 -11
- data/doc/commands/main.md +0 -33
- data/doc/commands/show.md +0 -12
- data/doc/operators/non_relational/autonum.md +0 -23
- data/doc/operators/non_relational/clip.md +0 -31
- data/doc/operators/non_relational/coerce.md +0 -15
- data/doc/operators/non_relational/compact.md +0 -20
- data/doc/operators/non_relational/defaults.md +0 -32
- data/doc/operators/non_relational/generator.md +0 -20
- data/doc/operators/non_relational/sort.md +0 -24
- data/doc/operators/non_relational/type-safe.md +0 -20
- data/doc/operators/relational/extend.md +0 -18
- data/doc/operators/relational/frame.md +0 -26
- data/doc/operators/relational/group.md +0 -27
- data/doc/operators/relational/hierarchize.md +0 -14
- data/doc/operators/relational/infer-heading.md +0 -20
- data/doc/operators/relational/intersect.md +0 -13
- data/doc/operators/relational/join.md +0 -28
- data/doc/operators/relational/matching.md +0 -24
- data/doc/operators/relational/minus.md +0 -12
- data/doc/operators/relational/not-matching.md +0 -20
- data/doc/operators/relational/page.md +0 -31
- data/doc/operators/relational/project.md +0 -28
- data/doc/operators/relational/quota.md +0 -21
- data/doc/operators/relational/rank.md +0 -27
- data/doc/operators/relational/rename.md +0 -17
- data/doc/operators/relational/restrict.md +0 -25
- data/doc/operators/relational/summarize.md +0 -25
- data/doc/operators/relational/ungroup.md +0 -20
- data/doc/operators/relational/union.md +0 -14
- data/doc/operators/relational/unwrap.md +0 -20
- data/doc/operators/relational/wrap.md +0 -24
- data/lib/alf/shell/command/exec.rb +0 -16
- data/lib/alf/shell/doc_manager.rb +0 -84
- data/lib/alf/shell/ext/signature.rb +0 -45
- data/lib/alf/shell/from_argv.rb +0 -84
- data/lib/alf/shell/operator.rb +0 -63
- data/spec/integration/__database__/group.alf +0 -3
- data/spec/integration/alf/alf_e.cmd +0 -1
- data/spec/integration/alf/alf_e.stdout +0 -4
- data/spec/integration/alf/alf_help.cmd +0 -1
- data/spec/integration/alf/alf_help.stdout +0 -76
- data/spec/integration/alf/alf_r.cmd +0 -1
- data/spec/integration/alf/alf_r.stdout +0 -5
- data/spec/integration/autonum/autonum_0.cmd +0 -1
- data/spec/integration/autonum/autonum_0.stdout +0 -9
- data/spec/integration/autonum/autonum_1.cmd +0 -1
- data/spec/integration/autonum/autonum_1.stdout +0 -9
- data/spec/integration/clip/clip_0.cmd +0 -1
- data/spec/integration/clip/clip_0.stdout +0 -9
- data/spec/integration/clip/clip_1.cmd +0 -1
- data/spec/integration/clip/clip_1.stdout +0 -9
- data/spec/integration/coerce/coerce_1.cmd +0 -1
- data/spec/integration/coerce/coerce_1.stdout +0 -5
- data/spec/integration/compact/compact_0.cmd +0 -1
- data/spec/integration/compact/compact_0.stdout +0 -9
- data/spec/integration/defaults/defaults_0.cmd +0 -1
- data/spec/integration/defaults/defaults_0.stdout +0 -9
- data/spec/integration/defaults/defaults_1.cmd +0 -1
- data/spec/integration/defaults/defaults_1.stdout +0 -9
- data/spec/integration/defaults/defaults_2.cmd +0 -1
- data/spec/integration/defaults/defaults_2.stdout +0 -9
- data/spec/integration/extend/extend_0.cmd +0 -1
- data/spec/integration/extend/extend_0.stdout +0 -16
- data/spec/integration/frame/frame_0.cmd +0 -1
- data/spec/integration/frame/frame_0.stdout +0 -6
- data/spec/integration/generator/generator_1.cmd +0 -1
- data/spec/integration/generator/generator_1.stdout +0 -10
- data/spec/integration/generator/generator_2.cmd +0 -1
- data/spec/integration/generator/generator_2.stdout +0 -5
- data/spec/integration/generator/generator_3.cmd +0 -1
- data/spec/integration/generator/generator_3.stdout +0 -5
- data/spec/integration/group/group_0.cmd +0 -1
- data/spec/integration/group/group_1.cmd +0 -1
- data/spec/integration/group/group_1.stdout +0 -32
- data/spec/integration/help/help_1.cmd +0 -1
- data/spec/integration/help/help_1.stdout +0 -12
- data/spec/integration/intersect/intersect_0.cmd +0 -1
- data/spec/integration/intersect/intersect_0.stdout +0 -9
- data/spec/integration/join/join_0.cmd +0 -1
- data/spec/integration/join/join_0.stdout +0 -16
- data/spec/integration/matching/matching_0.cmd +0 -1
- data/spec/integration/matching/matching_0.stdout +0 -8
- data/spec/integration/minus/minus_0.cmd +0 -1
- data/spec/integration/minus/minus_0.stdout +0 -4
- data/spec/integration/not-matching/not-matching_0.cmd +0 -1
- data/spec/integration/not-matching/not-matching_0.stdout +0 -5
- data/spec/integration/page/page_0.cmd +0 -1
- data/spec/integration/page/page_0.stdout +0 -6
- data/spec/integration/project/project_0.cmd +0 -1
- data/spec/integration/project/project_0.stdout +0 -9
- data/spec/integration/project/project_1.cmd +0 -1
- data/spec/integration/project/project_1.stdout +0 -9
- data/spec/integration/quota/quota_0.cmd +0 -1
- data/spec/integration/quota/quota_0.stdout +0 -16
- data/spec/integration/rank/rank_1.cmd +0 -1
- data/spec/integration/rank/rank_1.stdout +0 -10
- data/spec/integration/rank/rank_2.cmd +0 -1
- data/spec/integration/rank/rank_2.stdout +0 -10
- data/spec/integration/rank/rank_3.cmd +0 -1
- data/spec/integration/rank/rank_3.stdout +0 -10
- data/spec/integration/rank/rank_4.cmd +0 -1
- data/spec/integration/rank/rank_4.stdout +0 -6
- data/spec/integration/rank/rank_5.cmd +0 -1
- data/spec/integration/rank/rank_5.stdout +0 -6
- data/spec/integration/rename/rename_0.cmd +0 -1
- data/spec/integration/rename/rename_0.stdout +0 -9
- data/spec/integration/restrict/restrict_0.cmd +0 -1
- data/spec/integration/restrict/restrict_0.stdout +0 -6
- data/spec/integration/restrict/restrict_1.cmd +0 -1
- data/spec/integration/restrict/restrict_1.stdout +0 -6
- data/spec/integration/sort/sort_0.cmd +0 -1
- data/spec/integration/sort/sort_0.stdout +0 -9
- data/spec/integration/sort/sort_1.cmd +0 -1
- data/spec/integration/sort/sort_1.stdout +0 -9
- data/spec/integration/sort/sort_2.cmd +0 -1
- data/spec/integration/sort/sort_2.stdout +0 -9
- data/spec/integration/sort/sort_3.cmd +0 -1
- data/spec/integration/sort/sort_3.stdout +0 -9
- data/spec/integration/summarize/summarize_0.cmd +0 -1
- data/spec/integration/summarize/summarize_0.stdout +0 -8
- data/spec/integration/union/union_0.cmd +0 -1
- data/spec/integration/union/union_0.stdout +0 -9
- data/spec/integration/unwrap/unwrap_0.cmd +0 -1
- data/spec/integration/unwrap/unwrap_0.stdout +0 -9
- data/spec/integration/wrap/wrap_0.cmd +0 -1
- data/spec/integration/wrap/wrap_0.stdout +0 -9
- data/spec/unit/doc_manager/dynamic.md +0 -1
- data/spec/unit/doc_manager/example.md +0 -1
- data/spec/unit/doc_manager/example_1.txt +0 -11
- data/spec/unit/doc_manager/static.md +0 -1
- data/spec/unit/doc_manager/test_call.rb +0 -41
- data/spec/unit/ext/signature/test_argv2args.rb +0 -82
- data/spec/unit/ext/signature/test_to_shell.rb +0 -103
- data/spec/unit/from_argv/test_to_attr_list.rb +0 -30
- data/spec/unit/from_argv/test_to_attr_name.rb +0 -27
- data/spec/unit/from_argv/test_to_boolean.rb +0 -32
- data/spec/unit/from_argv/test_to_heading.rb +0 -37
- data/spec/unit/from_argv/test_to_ordering.rb +0 -28
- data/spec/unit/from_argv/test_to_predicate.rb +0 -26
- data/spec/unit/from_argv/test_to_renaming.rb +0 -23
- data/spec/unit/from_argv/test_to_size.rb +0 -32
- data/spec/unit/from_argv/test_to_summarization.rb +0 -19
- data/spec/unit/from_argv/test_to_tuple_computation.rb +0 -18
- data/spec/unit/from_argv/test_to_tuple_expression.rb +0 -38
- data/spec/unit/main/test_class_methods.rb +0 -44
- data/spec/unit/operator/test_autonum.rb +0 -28
- data/spec/unit/operator/test_clip.rb +0 -29
- data/spec/unit/operator/test_coerce.rb +0 -22
- data/spec/unit/operator/test_compact.rb +0 -16
- data/spec/unit/operator/test_defaults.rb +0 -29
- data/spec/unit/operator/test_extend.rb +0 -21
- data/spec/unit/operator/test_generator.rb +0 -37
- data/spec/unit/operator/test_group.rb +0 -32
- data/spec/unit/operator/test_infer_heading.rb +0 -16
- data/spec/unit/operator/test_intersect.rb +0 -18
- data/spec/unit/operator/test_join.rb +0 -18
- data/spec/unit/operator/test_matching.rb +0 -18
- data/spec/unit/operator/test_minus.rb +0 -18
- data/spec/unit/operator/test_not_matching.rb +0 -18
- data/spec/unit/operator/test_project.rb +0 -38
- data/spec/unit/operator/test_quota.rb +0 -23
- data/spec/unit/operator/test_rank.rb +0 -30
- data/spec/unit/operator/test_rename.rb +0 -21
- data/spec/unit/operator/test_restrict.rb +0 -36
- data/spec/unit/operator/test_sort.rb +0 -49
- data/spec/unit/operator/test_summarize.rb +0 -30
- data/spec/unit/operator/test_ungroup.rb +0 -28
- data/spec/unit/operator/test_union.rb +0 -18
- data/spec/unit/operator/test_unwrap.rb +0 -28
- data/spec/unit/operator/test_wrap.rb +0 -30
data/doc/commands/exec.md
DELETED
@@ -1,16 +0,0 @@
|
|
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
|
-
|
data/doc/commands/help.md
DELETED
data/doc/commands/main.md
DELETED
@@ -1,33 +0,0 @@
|
|
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
|
-
|
data/doc/commands/show.md
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
|
2
|
-
Output input tuples through the default renderer in a specific order.
|
3
|
-
|
4
|
-
SYNOPSIS
|
5
|
-
|
6
|
-
alf #(command_name) NAME -- [ORDERING]
|
7
|
-
|
8
|
-
DESCRIPTION
|
9
|
-
|
10
|
-
When a name is specified as commandline arg, request the database to
|
11
|
-
provide the corresponding relation variable and prints its value.
|
12
|
-
Otherwise, take what comes on standard input.
|
@@ -1,23 +0,0 @@
|
|
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
|
-
|
@@ -1,31 +0,0 @@
|
|
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
|
-
|
@@ -1,20 +0,0 @@
|
|
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
|
-
|
@@ -1,32 +0,0 @@
|
|
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
|
-
|
@@ -1,20 +0,0 @@
|
|
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
|
-
|
@@ -1,24 +0,0 @@
|
|
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
|
-
|
@@ -1,20 +0,0 @@
|
|
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)
|
@@ -1,18 +0,0 @@
|
|
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
|
-
|
@@ -1,26 +0,0 @@
|
|
1
|
-
|
2
|
-
Relational framing (aka offset/limit, yet sounder)
|
3
|
-
|
4
|
-
SYNOPSIS
|
5
|
-
|
6
|
-
#(signature)
|
7
|
-
|
8
|
-
DESCRIPTION
|
9
|
-
|
10
|
-
This command provides the classical offset/limit over the input relation.
|
11
|
-
|
12
|
-
This operator skips tuples whose ranking according to `ordering` is between
|
13
|
-
`0` and `offset` exclusive (in other words, it skips `offset` tuples). In
|
14
|
-
addition, it returns maximum `limit` tuples.
|
15
|
-
|
16
|
-
To be sound, this operator requires the ordering to include a candidate key
|
17
|
-
for the input relation. Alf will automatically extend the ordering you provide
|
18
|
-
to guarantee this, provided key inference is possible.
|
19
|
-
|
20
|
-
EXAMPLE
|
21
|
-
|
22
|
-
# Take the first two suppliers ordered by name (then by id)
|
23
|
-
!(alf frame suppliers -- name -- 0 -- 2)
|
24
|
-
|
25
|
-
# Take the next two suppliers
|
26
|
-
!(alf frame suppliers -- name -- 2 -- 2)
|
@@ -1,27 +0,0 @@
|
|
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
|
-
|
@@ -1,20 +0,0 @@
|
|
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
|
-
|
@@ -1,13 +0,0 @@
|
|
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
|
-
|
@@ -1,28 +0,0 @@
|
|
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)
|
@@ -1,24 +0,0 @@
|
|
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
|
-
|