Article Preview
Box 1.[ WITH [ RECURSIVE ] with_query [, ...] ]
INSERT INTO table_name [ (column_name [, ...]) ]
{ DEFAULT VALUES | VALUES ({ expression | DEFAULT } [, ...]) [, ...] | query }
[ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
Square brackets represent that some things are optional, | represents or and … means that something can be repeated more than once. However, during the years SQL has become quite complex and some statements (especially queries) have started to cause problems even for professionals (and for end users as well).
In this paper we present the idea of deductive data warehouses; Datalog is used as a language to analyze data in the data warehouse by simulating (advanced) OLAP capabilities. The paper is organized as follows: the following part defines deductive databases and deductive data warehouses. Next, a small example is built and data is analyzed by means of an advanced OLAP tool and by means of defined Datalog rules. In the end the conclusion is presented.
TopDeductive Databases
A problem (already mentioned earlier) whose consequences are still visible is the direct consequence of bad planning (or “no planning at all” approach). Many companies have implemented (over the years) many applications and/or information systems; however, they were all implemented in different applications languages (different generations of application languages were used) and they used different data storage mechanism (some applications used different types of files, some applications used databases, etc.). Today we know that you cannot focus on just one aspect of business; you have to have in mind the whole picture in order to manage and to know what is really going on. One cannot focus on sales data and not having in mind the purchasing department results and global trends (for example). Let’s assume that incomes were reduced in the past quarter; although this may seem to be bad, if we compare the global trends and our competitor’s (sales) results we can conclude that (for example) the decline was even worse for them (and that we are doing OK).
A data warehouse is a database organized (usually) in the form of a star (or snowflake) schema. A star schema usually contains dimensions and facts; these are both tables differing in that dimension tables are used to store attributes that are used to analyze data in fact tables that contains measures (i.e. numbers) used to evaluate (measure) business processes.
Figure 1 is easy to understand and end users can pose queries by themselves using OLAP tools that represent an intuitive way to analyze data. We will see some examples later on.