FcaStone can
Cautions:
FcaStone can be downloaded as a zip archive which contains the fcastone and fcaflint executable scripts, the licence and readme files.
2a) If you have administrator privileges, you should copy the file to a shared bin directory (eg /usr/local/bin) and change the file permission to executable:
sudo mv fcastone /usr/local/bin sudo chmod 755 /usr/local/bin/fcastone
b) If you do not have administrator privileges, then you should move the file to a bin directory that you have access to and that is in your path (or create a bin directory under your home directory if it does not already exist).
mkdir ~/bin mv fcastone ~/bin chmod 755 ~/bin/fcastone
If this bin directory is not in your path, then you need to add it to your PATH variable (see here for further information on changing the Unix PATH variable).
3) If you are getting a "command not found" error right after installation,
you'll need to run
something like "rehash" or, alternatively, you could logout/login at
this point. Also, check the location of perl (for example by
typing "which perl"). Perl is expected to be installed in /usr/bin.
If necessary, edit
the first line of the fcastone executable so that it contains the
correct location of your perl installation.
Information about installing Perl can be found
here.
I have tested installing
ActivePerl, which is freely available and can be downloaded as
an msi file. The default installation sets the PATH variable so
that it can find the Perl executable.
This
website contains a short tutorial on installing ActivePerl
and on how to use the DOS prompt.
2) In order to avoid having to type long path names, it is probably
easiest to move the fcastone file into a directory which also
contains the FCA files that are to be used. The fcastone
file can be changed to executable format, or it can
be executed by preceding it with perl, i.e., "perl fcastone ...".
It might be useful to rename fcastone to fcastone.pl, so that
Windows knows the filetype.
The table below shows which features require Graphviz and which don't.
Note for use on a webserver:
unfortunately, it may be impossible to install Graphviz on a webserver
on a commercially hosted account (unless you can find a statically compiled
version of the dot executable which can be copied to the webserver), because
service providers
don't usually give out administrator passwords. It should be possible, however,
to install Graphviz on a virtual private server (because such accounts
come with administrator privileges).
FcaStone passes the data
straight to Graphviz. This means that only those output file formats are
available which are supported by the local Graphviz installation.
If the labels in the lattice diagrams are not readable, then there is a problem
with Graphviz's ability to find the local fonts (see Graphviz's documentation).
If one of the formats does not work, try another (eg. gif instead of jpg).
The file fcaStoneDotErrors.log shows the errors and warnings produced by
Graphviz. The name of this file can be changed or it can be suppressed
by editing the line that starts with "my $errorslocation = " in fcastone.
If Graphviz is installed in a location that is not in the main Shell
path, it is useful to uncomment the line in fcastone that starts with
"# $dotlocation = " and edit it to point to the location of dot.
Installation on Windows
1) Note: FcaStone requires the Perl programming language to be installed.
It is not difficult to install and run this software on a PC,
but Windows users may not be used to command-line programs.
Linux, Mac OS X and Windows:
Installation of Graphviz
For some of the lattice conversions,
FcaStone requires AT&T's Graphviz program "dot" to be installed.
Installation on Mac OS X, Windows and several Linux flavours is easy
because precompiled
versions of Graphviz are available and can be downloaded from the
Graphviz website. (It is advisable
to install a recent version. Some package archives contain very old versions
of Graphviz, which run much slower.)
Supported Formats
extension | I/O | type | scope | Graphviz required? | comments |
---|---|---|---|---|---|
cxt | input/output | FCA format | only context | no | P. Burmeister's format |
con | Colibri format | ||||
slf | Galicia format | ||||
bin.xml | Galicia format | ||||
tuples | tab separated values | Tupleware format
(like csv, but tab instead of comma + additional first line) only two column files supported | |||
html | output only | html table | can be used with scripts | ||
csv | input/output | comma separated values | used by databases/spreadsheets | ||
csc | FCA format | context + lattice | F. Vogt's Anaconda format (lattice not implemented) | ||
cex | no | ConExp, lattice not yet implemented | |||
csx | no | ToscanaJ, lattice not yet implemented | |||
fig | output only | vector graphics | yes for lattice | xfig | |
tex | latex | to be used with
B. Ganter's fca.sty,
lattice not yet implemented | |||
dot | graph format | only lattice | no | Graphviz format | |
gml | no | ||||
gxl | yes | format availability depends on local Graphviz installation | |||
svg | vector graphics | ||||
jpg | raster graphics | ||||
gif | |||||
png | |||||
ps | page description format | ||||
Other formats:
Many tools for image conversion exist elsewhere. Depending on the local Graphviz installation, more options may be available (eg. running "dot -Tdia -o outputfilename inputFileInDotFormat" on Linux will produce output suitable for the Dia program). Programs such as ps2eps, fig2dev, ImageMagick's "convert", etc provide further options for file conversions.
The default in FcaStone is to concatenate the labels belonging to the same node into one string which is then cut off after 30 characters. If the -c option is used, the objects and attributes are "clarified", i.e., only at most one object and attribute of each node is represented. The -t option places the labels of each node on top of each other. This is only useful if the output file is of type fig or svg and the file is afterwards edited in a vector graphics editor.
Two lattice designs are available (see some examples). Using the -b option, each node is represented as a box. The objects are listed in the bottom half, the attributes in the top half. The advantage of this format is that the labels never overlap because Graphviz will adjust the box sizes depending on the label sizes. The disadvantage is that this is not the standard FCA way of representing lattices. The other design (which is default) is more similar to traditional FCA lattices, with the disadvantage that labels can overlap. The -t option only applies to the second design. These design choices are based on what can be stored in the dot format. The gml output of FcaStone just places the labels across the nodes, which is not satisfactory. Therefore, gml output should only be used if the lattice is afterwards manually edited.
In general, automatically generated lattices will probably never be as perfect as hand drawn ones. If perfect lattice pictures are desired, then traditional FCA tools should be used. FcaStone's facility for lattice generation is more aimed at applications in which the lattices cannot be hand drawn (such as automatically generated ones on webpages) and don't need to be perfect (for example, because they are just used to provide a rough sketch of what the lattice looks like).
fcastoneSYNOPSIS
fcastone [-bBcgijmnNOprstuUw] inputfile outputfileDESCRIPTION
fcastone -l
The program determines the type of the format conversion by looking at the file extensions of the input and output files. If the files have incorrect extensions or are not correctly formated with respect to how FCA files with such extensions are usually formated, then the conversion will not work. The input and output files can be provided as PATH names, but the PATHs cannot contain any dots. Basically, everything after the first dot is considered the extension of the file.EXAMPLESAt the moment only files which contain one (binary) formal context and/or one lattice diagram can be processed.
The following options are available:
-b Box format: the nodes in the lattice are displayed as boxes, which contain the objects and attributes. -B another Box format: the nodes in the lattice are displayed as boxes, which contain the objects and attributes. Attributes are separated by commas and the list of attributes is truncated if it is too long. Objects are separated by space and not truncated. This format is used by the -j option (where the objects are image files). -c Clarify: the lattice diagram is clarified, which means that if more than one object or attribute belong to the same node, only one is printed. -g Graphviz: the lattice layout will be calculated with Graphviz (which means that Graphviz must be installed). It is not necessary to use -g with svg, jpg, gif, png, ps and pdf files because these imply using Graphviz. But for cex, csx, fig, and tex files using -g ensures that the lattice, not the context is generated (although this is only implemented for fig at the moment). In case of dot files, the -g option results in the coordinates being included in the file. -i Imagemap: adds clickable links of the format "script?attr=...+obj=..." to the nodes. This is only useful on a webserver with svg files or html imagemaps. The script that responds to the request needs to be installed in the same directory and must have the same name as the output file without extension. For example, if a script calls "fcastone -w -i format.cxt answer.svg", then the responding script must be called "answer". Because of the use of "-w", no output file "answer.svg" is produced (see the examples below). The "-i" option implies "-b", unless used with "-B". -j image files, such as Jpg, png, gif, etc: instead of names of objects. It is advisable to use thumbnail-sized images. In svg output, clicking on a thumbnail will open the image in full size. The names of the image files should be provided as "path_to_thumbnail|path_to_fullimage" or as "path_to_thumbnail" (if there is no full-sized image). Svg output files link to the images but do not include them, therefore the paths to the files need to be correct while FcaStone is running and while the svg files are viewed. For non-svg output formats it may be necessary to install extra Graphviz plugins. The "-j" option implies "-B". -l Licence: running "fcastone -l" without any other arguments prints the licence and warranty disclaimer. -m Microsoft: prints the output file with Microsoft style line breaks. This is only relevant for non-XML text files. -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. 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". -O One line input/output: this option is only needed if FcaStone is called from a program using bidirectional communication which can only send/receive one line at a time. The internal linebreaks of non-XML files should be replaced with the character sequence '|%|%' for this purpose. For XML files, linebreaks should simply be removed. The "-O" option implies "-s". -p Pipe: only relevant for csv files. Use a pipe (|) instead of a comma as delimiter. This option should be used if the data contains commata. (Note: tab delimited files are provided by the .tuples extension.) -r Rotating: only relevant for tex files. Ensures that the attributes are rotated sideways in the formal context. -s Silent mode: suppresses warnings about output files being overwritten if files with such names already exist. -t on Top: labels belonging to the same node are printed on top of each other. This is only useful for fig and svg files which are edited manually in a vector graphics editor. -u Unicode: tells FcaStone explicitly that the incoming data is in UTF-8 format. In most cases, this option will not make a difference. This option should not be used together with "-U". -U Unicode: converts incoming UTF-8 data into numeric character references. This option should be used if non-ASCII characters do not display properly and the output file is an XML file (html, svg, cex, csx, ...). The input file should be in UTF-8 encoding. -w Web mode: this mode reads the input from STDIN, writes the output to STDOUT and replaces "\n" with <br>. In this manner, fcastone can be called from a server-side script that generates a graphics file of a concept lattice to be displayed on a webpage. See the examples below. The "-w" option implies "-snN".
fcastone waters.cxt waters.cexFILES
fcastone -g waters.cxt waters.figUse on a website (Perl, explanation below):
#!/usr/local/bin/perl use CGI; print "Content-type: image/gif\n\n"; $fcacontent = "object1,attr1\n object1,attr2\n"; open (PIPE, "| fcastone -w -b format.csv format.gif"); print PIPE $fcacontent; close PIPE;Use on a website (PHP, explanation below):<?php header("Content-type: text/html"); $fcacontent = "object1,attr1\n object1,attr2\n"; $descriptorspec = array(0 => array("pipe", "r"),1 => array("pipe", "w") ); $process = proc_open('/usr/local/bin/fcastone -w -b format.csv format.cxt',$descriptors\ pec,$pipes); if (is_resource($process)) { fwrite($pipes[0], "$fcacontent"); fclose($pipes[0]); while (! feof($pipes[1])) {$retval .= fgets($pipes[1]);} echo $retval; fclose($pipes[1]); $return_value = proc_close($process); } ?>In these examples, format.csv and format.gif are just strings that indicate which formats are used for input and output; they are not filenames. The variable $fcacontent contains a context in csv format. SECURITY WARNING: any form variables that are piped into a program must be carefully checked for insecure data because otherwise a hacker might be able to execute any command on the server. For further explanations of this risk, do a websearch on "user submitted data" "security".Also, see the troubleshooting comments below.
fcaStoneDotErrors.logBUGS
(This file is created in the current directory and contains any errors or warnings produced by running Graphviz's dot.)
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.AUTHOR
This program was written by Uta Priss (http://www.upriss.org.uk). More information on FCA can be found at (http://www.upriss.org.uk/fca/).back to table of contentsThe algorithm for calculating the concepts is an implementation of Bernhard Ganter's algorithm described in "Two basic algorithms in concept analysis." Technische Hochschule Darmstadt, FB4-Preprint, 831, 1984. (It's slow because it's implemented using strings - the algorithm itself is fine.)
Text formatting
Graph layout and editors
Vector graphics editors
Troubleshooting/FAQ
This depends on the local setting (operating system, fonts, etc).
If one of the output formats (pdf, svg, png, jpg, gif, ps)
does not work, other formats should be tried.
Starting with version 0.2, FcaStone provides several options for using
UTF-8 encoded data:
More information on Unicode can be found on the
Unicode website.
That depends on the input and output formats that are used and if Graphviz is
involved. For csv files, if commas are within the data, the delimiter can be
changed to the pipe symbol (|) via the -p option or to
the tab character by using the .tuples extension.
If Graphviz is involved, double quotes (") are not allowed in the data, unless the -B
option is used (in which case angle brackets (< >) might cause a problem).
The combination -> can also be a problem for Graphviz.
The lattices are produced by Graphviz, not FcaStone. These issues
depend on the local Graphviz installation. If one of the output
formats (jpg, gif, pdf, ps, svg) performs poorly, other formats should be tried.
See the installation information.
Scripts on the web often run as a different user.
fcastone.sourceforge.net
www.upriss.org.uk