LaMa4J (“Lattice Manipulation for Java”) is a set of Java classes that implement a number of lattices and lattice operations. It is free software distributed under the GNU General Public License.

History and Motivation

MG4J uses minimal-interval semantics to express the semantics of a query. A single-index query is turned into an element of a interval-antichain lattice; the element expresses the regions of the documents that satisfy the query. Queries involving more than one index are turned into elements of a sum of such lattices.

Manipulating the above lattices is not always trivial, so we decided to write a full Java package that could manipulate easily any kind of lattice. Marco Rosa wrote the first implementation, under Sebastiano Vigna's supervision, as part of his degree thesis.


First of all, have a look at the Lattice and Element interfaces to see which operations are supported. The main idea is that by playing with an interactive environment such as the BeanShell you can create lattices, create elements, and use Java variables and syntactic constructs as if you were using an ad hoc computational algebra package. The Lattices static container provides methods that do nice things such as emitting a representation of the covering relation in the Graphviz language, that can be automatically drawn into a Hasse diagram, as shown on the right for the free lattice on three generators (actually, the sum of three 3-chains).

There are two ways you can use LaMa4J: you can enrich the existing set of lattices (see, e.g., Chain, Parts, and so on), or you can build new lattices using operators such as Product, Sum (just for distributive lattices) and dualisation.

Package Description