Getting started (continued)
This section covers advanced use cases: importing data into Relational Context Families, building lattices, and AOC-Posets from imported data.
Import with Family
Build a Relational Context Family (.rcft) from a set of CSV files using the FAMILY command with the IMPORT action.
Input
The example considers 5 CSV files containing 3 formal contexts (FC) and 2 relational contexts (RC):
- FC with 10 pizzas with no specific description (
pizza.csv) - FC with 14 ingredients, described by season and diet attributes (
ingredient.csv) - FC with 5 pizzerias with no specific description (
pizzeria.csv) - RC connecting pizzas to the ingredients they contain (
pizza2ingredient.csv) - RC connecting pizzerias to the pizzas they offer (
pizzeria2pizza.csv)
CSV format
Files contain an unnamed table with attributes in the first row and objects in the first column. Cells contain 0/1 or empty/x.
;summer;winter;vegan;vege;medit
tomato;x;;x;x;x
eggplant;x;;x;x;x
zucchini;x;;x;x;x
redpepper;x;;x;x;x
Output
The output is a file pizzasRCFT.rcft suitable for the RCA command or RCAexplore.
Commands
Step 1 — Import ingredient.csv
Creates pizzasRCFT.rcft with a formal context named "ingredient".
java -jar fca4j-cli.jar FAMILY pizzasRCFT.rcft -a IMPORT ingredient.csv -n ingredient -x CSV -s SEMICOLON
Step 2 — Import pizzeria.csv
java -jar fca4j-cli.jar FAMILY pizzasRCFT.rcft -a IMPORT pizzeria.csv -n pizzeria -x CSV -s SEMICOLON
Step 3 — Import pizza.csv
java -jar fca4j-cli.jar FAMILY pizzasRCFT.rcft -a IMPORT pizza.csv -n pizza -x CSV -s SEMICOLON
Step 4 — Import pizza2ingredient.csv (relational context)
java -jar fca4j-cli.jar FAMILY pizzasRCFT.rcft -a IMPORT pizza2ingredient.csv -n pizza2ingredient -x CSV -v -s SEMICOLON -op exist -source pizza -target ingredient
Step 5 — Import pizzeria2pizza.csv (relational context)
java -jar fca4j-cli.jar FAMILY pizzasRCFT.rcft -a IMPORT pizzeria2pizza.csv -n pizzeria2pizza -x CSV -v -s SEMICOLON -op exist -source pizzeria -target pizza
Extra — Test with the RCA command
Build associated concept lattices in the ./results directory:
mkdir results
java -jar fca4j-cli.jar RCA ./pizzasRCFT.rcft ./results -v -a ADD_EXTENT
dot -Tpdf results/step3.dot -o results/resultat.pdf
For more information, see the RCA command.
Building Lattice from imported data
See the Lattice command for building concept lattices from any formal context.
Building AOC-Poset from imported data
See the AocPoset command for building AOC-Posets.