User Tools

Site Tools


magik-demo:developer:magik-business-logic

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:

  • Server schemas → the user create these schemas (or import from sample schema), thus the user may “Select”, “View”, “Edit” or “Delete” the schemas.
  • Remote schemas → the user load existing schemas from remote databases, thus the only action provided is to “Select”, “View” or “Delete” the connection to it.

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:

  • showFK.jsp: this jsp page is used for managing foreign keys (FK) of the schema. Main action available:
    1. Add new FK by pressing the button. The user will be directed to edit FK page (constraints/editFK.jsp)
    2. Edit a FK by pressing the button related to the FK that we want to edit
    3. Delete a FK by pressing the button related to the FK that we want to delete

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

  • showFDC.jsp: this jsp page is used for managing finite domain constraints (FDC) of the schema. Main action available:
    1. Add new FDC by pressing the button. The user will be directed to edit FDC page (constraints/editFDC.jsp)
    2. Edit a FDC by pressing the button related to the FDC that we want to edit
    3. Delete a FDC by pressing the button related to the FDC that we want to delete

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

  • showTC.jsp: this jsp page is used for managing table completeness statements (TC) of the schema. Main action available:
    1. Add new TC by pressing the button. The user will be directed to edit TC page (constraints/editTC.jsp)
    2. Edit a TC by pressing the button related to the TC that we want to edit
    3. Delete a TC by pressing the button related to the TC that we want to delete
  • showQuery.jsp: this jsp page is used for managing queries of the schema. Main action available:
    1. Add new query by pressing the button. The user will be directed to edit query page (constraints/editQuery.jsp)
    2. Edit a query by pressing the button related to the query that we want to edit
    3. Delete a query by pressing the button related to the query that we want to delete
    4. View the selected query in the right side box

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.

  • If the query is complete in VIRTUAL mode, it will be displayed in the bottom of the page the result:

  • If the query is complete in REMOTE mode, it will be displayed in the bottom of the page the result with, if there are, data related to the query

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

  • If the query is incomplete, it will be displayed in the bottom of the page which table are incomplete and if there are, the most specific generalization (MSG) query and the least specific specialization queries (LSS) In the page is also possible:
    • Add TC-statements suggested to the other of the schema. The user has just to select which ones he wants to add and press “Add selected TC-statement(s)” button
    • Add approximize query given by MAGIK to the other queries already inside the schema. The user has just to select which ones he wants to add and press “Add selected query(ies)”
    • Recalculate MSG in order to obtain, if it possible, more MSG queries that has depth at most the depth of the original query plus the number set in the textbox on the left side of the button
    • Also in REMOTE mode is possible to see how many entries there are for each query. Also is possible view the data output by clicking on View data output comparison

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:

  • New for the definition of a new foreign key
  • Edit for modifying foreign key already inserted

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:

  • New for the definition of a new finite domain constraint
  • Edit for modifying finite domain constraint already inserted

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:

  • New for the definition of a table completeness statement
  • Edit for modifying table completeness statement already inserted

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:

  • New for the definition of a new query
  • Edit for modifying query already inserted

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

magik-demo/developer/magik-business-logic.txt · Last modified: 2017/07/06 15:24 (external edit)