Table of Contents

MAGIK Business Logic

This image is the Business Logic that stays backward MAGIK.

For a detailed information and GUI implementation of the pages, please follow the link underlying:

schema/index.jsp

The schema page contains the list of schemas of which the current active user has. There are two categories of schemas:

The following are the details of each possible action in this page:

  1. If the user click on “Back”, it will be directed to the welcome page.
  2. If the user click on “<schema_name>” or button, it will be directed to the same page (schema/index.jsp) that includes a new part of page schema/viewRelation.jsp in which user can view relations of the selected database:
  3. If the user click on button, the related database will be removed from the list and, only in case of virtual schema, it will be dropped.
  4. If the user click on button, user can modify relations of the selected database. This can be done in relation page (schema/edit.jsp)
  5. If the user click on Import 'school' schema, the school schema will be loaded inside the virtual schemas list
  6. If the user click on Add new schema, it will be directed to the relation page (schema/edit.jsp) in order to add a new virtual schema
  7. If the user click on Establish new remote connection, it will be directed to the database connection page (schema/editConnection.jsp) in order to establish a remote connection to real database
  8. If the user click on Connect to Database, it will be directed to the constraints page (constraints/index.jsp) in order to select the schema that we want to analyze

Back to Top | Back to Home Page

schema/edit.jsp

This page is used for 2 main operations:

  1. Create a new virtual schema
  2. Edit a virtual schema

Create a new virtual schema

  1. First of all user has to set the Schema name
  2. After that user has to insert the relations. This can be done by press the Add new relation button that direct the user to the edit relation page (schema/editRelation.jsp).
  3. At the end of the insertion the user has to click “Save” in order to save new virtual schema
  4. If the user press “Cancel” he will be directed to edit relation page (schema/editRelation.jsp)

Edit a virtual schema

The following are the details of each possible action in this page:

  1. If the user click on “Cancel”, it will be directed to the schema page.
  2. If the user click on “Add new relation”, it will be directed to the edit relation page (schema/editRelation.jsp) with parameter ?action=addrel.
  3. If the user click on button, the selected relation will be dropped from the schema
  4. If the user click on button, it will be directed to the edit relation page (schema/editRelation.jsp) in order to modify the selected relation
  5. If the user click on “Save”, the current structure of the schema will be saved
  6. If the user press “Cancel” he will be directed to edit relation page (schema/editRelation.jsp)

Back to Top | Back to Home Page

schema/editRelation.jsp

This page is used for 2 different operations:

  1. Create a new relation
  2. Edit a relation

The following are the details of each possible action in this page:

  1. In order to create a new relation, user has to set Relation Name, Keys and Attribute Names and after that press “Save”
  2. If the user press “Cancel”, the relation will be not created and it will be directed to schema selection page (schema/index.jsp)
  3. If the user click on “Save”, all the modifications done will be stored and it will be directed to the relation page (schema/edit.jsp)

Back to Top | Back to Home Page

schema/editConnection.jsp

This page is used for Create a new connection to a remote database

If a user want to create a new connection to a remote database it has to fill this page.

  1. If the user press Connect the information inside the form will be saved and, if correct, the new connection can be available in schema page with also a notice of this insertion.
  2. If the user press Cancel the information inside the form will be discard and it will be directed to schema page.

constraints/index.jsp

This page is the most important of all the system, because from here you can ask to MAGIK if a query is complete or not.

Recall that we have two different modality for databases:

  1. Server mode: in this modality we have only the structure of database
  2. Remote mode: in this modality we have a real structure (with foreign and primary keys constraints and also finite domain constraints that has to be always verified) and also real data.

For these reasons, this page has different features, depending on the database modality.

This page is a composition of jsp pages:

<note important>All the features are available only in VIRTUAL mode </note>

<note important>All the features are available only in VIRTUAL mode </note>

Other action that can be done in index.jsp is:

  1. Return to schema selection by pressing the “Back to schema selection” button. The user will be directed to the schema page.
  2. Execute MAGIK by pressing “Run” button. The user will be directed to the same page but with some modifications.

Run Query

MAGIK after its execution, will answer if the query is complete or not under the the constraints selected.

By pressing on View data output comparison MAGIK show how many entries are available for the query

Back to Top | Back to Home Page

constraints/editFK.jsp

<note important>Page available only for VIRTUAL schemas</note>

This page can be reached in 2 different modalities:

The following are the details of each possible action in this page:

  1. If the user click on “Cancel”, it will be directed to the constraints page and all the modification will be discarded.
  2. If the user click on “Save”, it will be directed to the constraints page (constraints/index.jsp) and the new foreign key or the modification will be saved in the schema
  3. If the user click on “Show Relations”, it will be seen the table that are inside the schema

Back to Top | Back to Home Page

constraints/editFDC.jsp

For REMOTE schemas, one needs to edit schema database schema using favorite database management program. For example, to create a finite domain constrain using ENUM construct in PostgresSQL database one can execute the following code:

CREATE TYPE school.type AS enum ('primary','middle');

In this way new data type is created. Then defining attribute name is some table to be of this type, create Finite Domain Constraint on that attribute.

<note important>Page available only for VIRTUAL schemas</note>

This page can be reached in 2 different modalities:

The following are the details of each possible action in this page:

  1. If the user click on “Cancel”, it will be directed to the constraints page and all the modification will be discarded.
  2. If the user click on “Save”, it will be directed to the constraints page (constraints/index.jsp) and the new finite domain constraints or the modification will be saved in the schema
  3. If the user click on “Show Relations”, it will be seen the table that are inside the schema

Back to Top | Back to Home Page

constraints/editTC.jsp

This page can be reached in 2 different modalities:

The following are the details of each possible action in this page:

  1. If the user click on “Cancel”, it will be directed to the constraints page and all the modification will be discarded.
  2. If the user click on “Save”, it will be directed to the constraints page (constraints/index.jsp) and the new table completeness statement or the modification will be saved in the schema
  3. If the user click on “Show Relations”, it will be seen the table that are inside the schema

Back to Top | Back to Home Page

constraints/editQuery.jsp

This page can be reached in 2 different modalities:

The following are the details of each possible action in this page:

  1. If the user click on “Cancel”, it will be directed to the constraints page and all the modification will be discarded.
  2. If the user click on “Save”, it will be directed to the constraints page (constraints/index.jsp) and the new query or the modification will be saved in the schema
  3. If the user click on “Show Relations”, it will be seen the table that are inside the schema

Back to Top | Back to Home Page