-- Convert deductive databases into graphs

This module contains predicates for converting a set of deductive databases into a set of graphs, one for each interpretation, using the mapping procedures described below.

First the database is converted into a collection of ground facts by computing intensional tables. Then the graphicalizer generates a graph for each interpretation.
The database is assumed to be in the following 'E/R' normal form:
Graphicalization strategy
The module provides two fundamental predicates: attach/1, for loading a data set (variant attach/0 for toy datasets asserted directly in the kLog script), and make_graphs/0, make_graphs/1 for generating graphs.
git log
- Paolo Frasconi
To be done
- Safety checks, assumption checks, throwing exceptions, performance tuning
attach(+DataFile:atom_or_list_of_atoms) is det
Load a dataset i.e. a set of database instances (or interpretations) by reconsulting the given file(s). Any previously attached data set will be internally cleaned up so only one data set can be attached at a time. Internally the predicate just consults the file containing declarations of the predicate interpretation/2 (a collection of ground facts). The predicate is stored in the 'graphicalize' module and should be never necessary to inspect it from outside this module.
attach is det
This first form is useful to attach a toy dataset written directly in the kLog script. The data need to be declared as
detach is det
Retracts all data ground atoms and results of graphicalization.
examples(-Set:list_of_atoms) is det
Returns in Set the interpretation identifiers in the attached domain.
database is det
For debugging purposes. List the extensional database.
database(?Ex) is det
For debugging purposes. List the extensional database of interpretation Ex.
assert_background_knowledge(+Dataset:list_of_atoms) is det
Deduce intensional facts from the background knowledge and interpretations listed in Dataset and assert all of them (at the top) in the form db:interpretation(Ex,Fact). Once asserted in this way, intensional and extensional groundings are indistinguishable. Use the first form to assert background knowledge for every interpretation in the domain.
make_graphs is det
Graphicalize the attached interpretations. Graphs are stored in memory.
map_prolog_ids_to_vertex_ids(+Ex:atom, +IDs:[atom], -NumericIds:[integer])
Retrieve numeric vertex IDs for a list of database identifiers IDs in interpretation Ex
domain_identifiers(?Ex, ?Type, ?Constants) is det
True if Constants are the constants of type Type in interpretation Ex.
check_db is det
Internal use. Performs some checks on the loaded data sets.