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:
If the user click on “
Back”, it will be directed to the
welcome page.
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:
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.
If the user click on
button, user can
modify relations of the selected database. This can be done in
relation page (
schema/edit.jsp
)
If the user click on Import 'school' schema, the school schema will be loaded inside the virtual schemas list
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
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
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:
Create a new virtual schema
Edit a virtual schema
Create a new virtual schema
First of all user has to set the Schema name
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
).
At the end of the insertion the user has to click “Save” in order to save new virtual schema
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:
If the user click on
“Cancel”, it will be directed to the
schema page.
If the user click on
“Add new relation”, it will be directed to the
edit relation page (
schema/editRelation.jsp
) with parameter
?action=addrel
.
If the user click on
button, the selected relation will be
dropped from the schema
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
If the user click on “Save”, the current structure of the schema will be saved
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:
Create a new relation
Edit a relation
The following are the details of each possible action in this page:
In order to create a new relation, user has to set Relation Name, Keys and Attribute Names and after that press “Save”
If the user press
“Cancel”, the relation will be not created and it will be directed to
schema selection page (
schema/index.jsp
)
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.
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.
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:
Server mode: in this modality we have only the structure of database
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:
Return to schema selection by pressing the “Back to schema selection” button. The user will be directed to the
schema page.
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 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:
The following are the details of each possible action in this page:
If the user click on
“Cancel”, it will be directed to the
constraints page and all the modification will be discarded.
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
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:
If the user click on
“Cancel”, it will be directed to the
constraints page and all the modification will be discarded.
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
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:
If the user click on
“Cancel”, it will be directed to the
constraints page and all the modification will be discarded.
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
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:
If the user click on
“Cancel”, it will be directed to the
constraints page and all the modification will be discarded.
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
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