FcaFlint: software for FCA context operations

FcaFlint implements context operations for FCA formal contexts. It can be used as a standalone tool (in which case the context must be formatted in the ".cxt" or "Burmeister" format), or it can be used in combination with FcaStone (using any context format supported by FcaStone).

The context operations of FcaFlint are based on Relation Algebra. Crosses in the ".cxt" format correspond to 1s in Relation Algebra. (For background on Relation Algebra with FCA see this introduction). Assuming two files "ex1.cxt" and "ex2.cxt":

Operation Explanation
dual(ex1.cxt) Objects and attributes are switched. Lattice is upside down.
invers(ex1.cxt) Invers context: 0s become 1s; 1s become 0s.
union(ex1.cxt, ex2.cxt) Union: context has 1s where one of the input contexts has a 1.
inters(ex1.cxt, ex2.cxt) Intersection: context has 1s where both of the input contexts have a 1.
compos(ex1.cxt, ex2.cxt) Relational composition.
appos(ex1.cxt, ex2.cxt) Apposition: ex1 on the left of ex2.
subpos(ex1.cxt, ex2.cxt) Subposition: ex2 underneath of ex1.
equal(ex1.cxt, ex2.cxt) Compares two matrices. Prints "Matrices are equal" or "Matrices are not equal".
trans(ex1.cxt) Transitive closure of composition.
<ONE> Context which contains all 1s.
<NUL> Context which contains all 0s.
<DIA> Context which contains 1s on the diagonal, 0s otherwise.
<AID> Context which contains 0s on the diagonal, 1s otherwise.

Examples:

fcaflint "inters(ex1.cxt,invers((ex1.cxt))" output.cxt
fcaflint "inters(ex1.cxt,compos(ex1.cxt,ex2.cxt))" output.cxt
fcaflint "equal(ex1.cxt,(dual(dual(ex1.cxt))))" output.cxt prints: "Matrices are equal"
fcaflint "invers(<ONE>)" output.cxt prints: "Result is NUL matrix"
fcaflint file.bat output.cxt Reads the operations from a batch file "file.bat". The operations can be formatted using any amount of white space, tabs, newlines. The file should not contain any double quotes.

Notes:

  • Filenames must contain only letters and numbers and exactly one dot (such as "ex1.cxt"). They cannot contain PATH information (i.e., this does not work with files "home/user/example.cxt" or "example.lat.xml" etc).
  • Operations involving <ONE>, <NUL>, <DIA>, <AID> will attempt to adjust the matrix dimensions as required. But some combinations are not supported. For example, "appos(<ONE>,<DIA>)" produces an error because this neither is a standard matrix, nor it is known what the dimensions are.
  • Error messages: there is no sophisticated error reporting. If there is a syntax error in the operations (for example, the operations are not properly nested or the brackets are not matched), a runtime error "Can't use an undefined value" is produced. Some of the other error messages are also not user-friendly.
  • Limits: the software has been tested for contexts with several hundred rows. Union and intersection are reasonably fast for larger contexts. Composition can be slower. Transitive closure should not be used with larger matrices as it can be very slow.

    Installation, Licence, etc

    FcaFlint is bundled with FcaStone. An installation of the latest version of FcaStone also installs FcaFlint. Both tools use the same licence.

    If other file types than "cxt" are requested, FcaFlint will call FcaStone, which is expected to be in "/usr/local/bin/". If FcaStone is installed in a different location, the line $fcastonelocation = "/usr/local/bin/fcaflint" should be edited in FcaFlint.

    Command-line options

    FcaFlint has the following command-line options:
    -F This option provides slightly more checking with respect to the compatibility of the sets of objects and attributes. Warnings are produced if the sets do not match. The reasoning behind this option is further described in the papers given in the References below. Without "-F", formal contexts are considered purely as matrices (corresponding to an "unnamed perspective"). With "-F", the names of the objects and attributes are considered as well. The full version of the named perspective as described in the papers is not yet available, but planned for future releases.
    -n No input file: reads from STDIN instead of a file. The command-line should contain something like "format.cxt" instead of the name of the input file to indicate the type of the input data. This option is certain to work for "cxt" files, but it may not work for other file types on some operating systems or with older Perl distributions. If the input consists of more than one file, the character sequence "|!|" must be inserted between the files. The "-n" option implies "-s".
    -N No output file: writes to STDOUT instead of a file. The command-line should contain something like "format.cxt" instead of the name of the output file to indicate the type of the output data. The "-N" option implies "-s".
    -s Silent mode: suppresses warnings about output files being overwritten if files with such names already exist.

    References

    Links


    Bugs

    This version is an alpha release of the software. I am sure there are still many bugs in the software. If you find a bug, please, send me an email (see http://www.upriss.org.uk for my current email address). Please, include the following in your email: 1) the command-line that you used, 2) the name of the operating system of your computer, 3) a short description of the problem, 4) the input file as an attachment.
    Copyright 2009 Uta Priss.
    fcastone.sourceforge.net   www.upriss.org.uk