I’m pleased to announce that alf 0.9.3 has been released and pushed to
rubygems.org!
Alf follows semantic versioning (http://semver.org/) and has not reached
its
first stable 1.0.0 release. Quoting semver.org: “Anything may change at
any
time. The public API should not be considered stable”. Including alf
with
the
version requirement “~> 0.9.0” shouldn’t break your code, though.
This release is a milestone towards 0.10.0 whose aims is to provide new
data-source connectors. Release 0.9.3 contains important bug fixes and a
few
backward compatible features that were already ready for inclusion.
= Alf – Relational Algebra at your fingertips
- http://rubydoc.info/github/blambeau/alf/master/frames
- http://github.com/blambeau/alf
- http://rubygems.org/gems/alf
Alf brings the relational algebra both in Shell and in Ruby. In Shell,
because
manipulating any relation-like data source should be as straightforward
as
a
one-liner. In Ruby, because I’ve never understood why programming
languages
provide data structures like arrays, hashes, sets, trees and graphs but
not
relations… Let’s stop the segregation
Changes (changelog at
https://raw.github.com/blambeau/alf/master/CHANGELOG.md)
0.9.3 / 2011-07-23
Bug fixes
- Added Relation#allbut, forgotten in two previous releases
- Fixed (join xxx, DEE) and (join xxx, DUM)
- Fixed scoping bug when using attributes named :path, :expr or :block
in
Lispy compiled expressions (coming from .alf files) - Fixed ‘alf --yaml show suppliers’ that renderer a --text table instead
of
a yaml output - Fixed bugs when using Date and Time attributes with .rash files
- Fixed bugs when using Date and Time attributes in restrict expressions
compiled from the commandline - Fixed a few bugs when using attribute names that are ruby keywords
(restrict & extend)
New operators (available both in shell and in Lispy DSL)
-
Added MATCHING and NOT MATCHING operators. These operators are useful
shortcuts for the following expressions.(matching l, r) := (project (join l, r), [l's attributes]) (not_matching l, r) := (minus l, (matching l, r))
For example:
# Give suppliers who supply at least one part (matching suppliers, supplies) # Give suppliers who don't supply any part (not_matching suppliers, supplies)
-
Added RANK operator, which is useful for for computing quota queries
as
illustrated below. See ‘alf help rank’ for details.# Give the three heaviest parts (restrict (rank :parts, [[:weight, :desc]], :pos), lambda{ pos < 3
})
Enhancements when using Alf in shell
-
added ‘alf -r’, that mimics ‘ruby -r’ (require library before run)
-
When alf is invoked in shell (and only in this case), ALF_OPTS is used
as
global options to apply as if they were specified inline:% export ALF_OPTS="--env=. --yaml" % alf show suppliers
is the same as
% alf --env=. --yaml show suppliers
-
‘alf --help’ now distinguishes experimental operators (quota in
particular)
from those coming from the (much more stable) TUTORIAL D
specification.
The
former should be used with care as their specification may change at
any
time.
Enhancements when using Alf in Ruby
-
Alf.lispy now accepts any argument recognized by
Environment.autodetect;
it
obtains its working Environment that way. Among others:Alf.lispy(Alf::Environment.folder("path/to/an/existing/folder"))
is the same as:
Alf.lispy("path/to/an/existing/folder")
-
Added Relation::DUM and Relation::DEE constants (relations of empty
heading
with no and one tuple, respectively). They are also available as DUM
and
DEE
in Lispy functional expressions. -
Added a Heading abstraction, as a set of attribute (name, type) pairs.
Internal enhancements (extension points)
-
The Reader and Renderer classes accept a Hash of options as third
constructor argument. These options can be used by extension points. -
The Environment class now provides a class-based registering mechanism
‘ala’
Reader and Renderer. This allows auto-detecting the target environment
when
–env=… is used in shell. See Environment.autodetect and
Environment#recognizes? for contributing to this extension point. -
Internals now rely on Myrrha for code generation. This means that all
datatypes can now be safely used in relations and dumped to .rash
files in
particular.