graphicalize.pl -- 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:
- Attributes are either object identifiers or properties.
- For each identifier i, there is at least one table t such that i
is the primary key of t. This table is basically the class or
entity-set of i.
- For each table, the primary key only consists of identifiers. So
multiway relationships are always represented by a table keyed by
the object identifiers involved in the relationship, augmented
with properties of the relationship.
- Graphicalization strategy
- There is a vertex for each entity tuple (called an i-vertex), and
a vertex for each relationship tuple (an r-vertex). Vertices are
labeled by their tuples. Note that because of the above assumptions
there is one and only one i-vertex for each identifier.
- There is an edge between an i-vertex and an r-vertex if i belongs
to the tuple r. The graph is bipartite and there are no edges
between vertices of the same kind.
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
- - 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
- 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.