Project synopsis Database scheme driven GUI construction for the Internet or a desktop application By V S Narayana Raju Datla (Roll No:-06CS6024) Under the Supervision of Prof. Chitta Ranjan Mandal Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Approved by ___________________________ __________________ Signature of Project Supervisor Signature of Student Abstract: The graphical user interface (GUI) generation for many software manually is tedious task and time consuming job. This work tries to addresses these two drawbacks by generating the GUI automatically. This was met with limited success because of the added load on the human designer. In this work we have used a methodology along with user specified stored procedures to create an interface forms that are used by the user to interact with backend database system. This tool does not require specifying a single line of code for user interface (UI) except input for the tool and Stored Procedure. It will generate and displays the forms that are available to the user. Apart from these forms this tool it self generates the basic queries like INSERT, DELETE, UPDATE, CREATE that are executed on the base tables. We have used JAVA to develop this tool and we have tested our results by using SQL SERVER. We have developed this tool on LINUX platform. 1. Introduction: Problem statement: User interface will perform a crucial role in the success of the software. Until now most of the user interfaces are developed manually and this development will consume lot of time and cost. To overcome these draw backs we are trying to develop a tool that will generate the user interfaces automatically for all types of applications. But, this automation has met with limited success for application such as database driven systems. In this work we aim to develop a tool for the construction of user interface forms for internet or desktop applications automatically from database schema. We have developed the methodology that has described below. But user interface forms from schema are may not sufficient for all applications, therefore we are using the feature (Stored Procedures) of Structured Query Language (SQL) to get the needs of the application. The methodology will create basic interface forms directly from database schema and the stored procedures will generate the forms as per the requirement of the user. Back Ground: In 1980’s, the user interface systems specified as a state transition diagram or event based representations to specify the interface in response to events. With the improvements in these representations, now-a-days the model-based tools are raging from automatic interface generators to tools that offer advice to the designers. Initially the automatic interface generator uses the data models as input to the tool. But these tools have some problem if the user may need data from different multiple tables on the same interface. So the data model is not enough to get the required forms. Therefore we have used user specified Stored procedures in this tool. The form construction is proceeding in two steps. In the first step the system will take the schema as input which consists of entities, relationships and attributes. The tool creates the relational tables in the backend database on the input specified and generates the forms by using the methodology. The navigational units present in the form are those entities that are related to the form (i.e. either entity or relationship). In the second step the user has to specify the queries in ‘stored procedures’. Because the user interface is application dependent, all the interfaces are not possible from schema. Based on those procedures specified by the user we will get the required forms. This tool can be used for both internet and desktop applications. We will describe the methodology for the first step i.e. generation of the forms from database schema. 2. INPUT: Input to the procedure going for any graphical input, just we will do it like a text based input. Basically the input to the tool is Extended Entity Relationship (EER) schema because the tables itself not take care of all the relations in EER schema. The input was entered as a text. So i made some representations for the schema. The string that I enter is a relationship between entries. The entries in the database: The input to the tool is categorized into the following six ways. 1. Entity sets 2. Relationship sets with 0/1 cardinality on at least one side, and any cardinality on the other, 3. Relationship sets with m: n cardinality and n-ary relationships 4. Multi-valued attributes 5. Entity subclasses that have extra attributes and/or extra relationships, with no multiple inheritance 6. Weak entity sets (existence dependencies) with a unique identifier 2. Methodology for construction of FORMS from schema: 2.1. ENTITIES: Relational mapping: For this type entries create a table for the entity set. The columns of the table are the attributes of the strong entity set. The primary key of the table is the primary key of the entity set. UI Mapping: Presentation units: For each entity set create a separate screen with all the attributes. Add update, insert and delete buttons that allow basic database operations. Navigation units: The screen gets links to the screens that correspond to every m:n relationship set in which the entity set participates, and to the screens that correspond to every multi-valued attribute of the entity set 2.2. Relationship sets with 0/1 cardinality on at least one side, and any cardinality on the other Relational mapping: Add a column(s) in the table that corresponds to the entity set that is on the “Any Cardinality” side. The column(s) we add here is the primary key of the entity set that is on the 0/1 side and any other attributes of the relationship set. UI Mapping: Presentation units: For this types of relationships use the screen that is developed for the entity set that corresponds to the “Any Cardinality” side. Navigation units: For this type of relationship no additional navigation units are required. 2.3. Relationship sets with m:n cardinality and n-ary relationships Relational mapping: For this type of relationship create a separate table for the relationship set. The columns of the table are the attributes of the relationship set (if any) including primary keys of all the entity sets that participate in the relationship set. The primary key of the table is union of primary keys of all the entity sets that participate in the relationship set. UI Mapping: For this relationship create a separate screen with all the attributes of the relationship set, as well as the primary keys of all participant entity sets. Add update, insert and delete buttons that allow basic database operations. If the relationship has no attributes then disable the update button. Navigation units: The screen gets links to the screens that correspond to every participant entity set 2.4. Multi-valued attributes Relational mapping: For this type of attributes create a separate table for the multi-valued attribute. The columns of the table are the primary key of the entity set to which the attribute belongs and a separate column for values of the attribute. The primary key of the table is all the columns of the table. UI Mapping: Presentation units: For these attributes create a separate screen with the primary key of the entity set and the multi-valued attribute. Add update, insert and delete buttons that allow basic database operations. Navigation units: The screen gets a link to the screen for the entity set that owns the multivalued attribute. 2.5. Entity subclasses that have extra attributes and/or extra relationships Relational mapping: For these types of entities create a separate table for the super class first, using the rules for mapping entity sets we have seen earlier. For each subclass entity set, create a separate table. The columns of each table are the additional attributes of the corresponding subclass entity set including primary key of the super class entity set. The primary key of the subclass table is the primary key of the super class table. UI Mapping: Presentation units: For these types of entities create a separate screen with all the extra attributes of the subclass, as well as the primary key of the super class entity set. Add update, insert and delete buttons that allow basic database operations. Navigation units: The screen gets a link to the screen that corresponds to the super class entity set 2.6. Weak entity sets (existence dependencies) with a unique identifier Relational mapping: For these types of entity sets create a separate table for the weak entity set. The columns of the table are the attributes of the weak entity set including primary key of the corresponding strong entity set. The primary key of the table is the primary key of the corresponding strong entity set including the unique identifier of the weak entity set. UI Mapping: Presentation units: For these entity sets create a separate screen with all the attributes of the weak entity set, as well as the primary key of the strong entity set. Add update, insert and delete buttons that allow basic database operations. Navigation units: The screen gets a link to the screen that corresponds to the strong entity set 3.FORMS FROM STORED PROCEDURE DEFINITION: It is impossible to get all the forms from the database specification. So we will take stored procedure definition as input and produce the form corresponding to that definition. The attributes that are there in the select clause are the attributes to be displayed as the result of the query and those fields that are there in definition before to the AS clause and the variables that start with the ’@’ without having the output at the end of the variable are the inputs. Advantages of Stored procedure: 1. Precompiled execution: SQL Server compiles each stored procedure once and then reutilizes the execution plan. This results in tremendous performance boosts when stored procedures are called repeatedly. 2. Reduced network traffic: If network bandwidth is a concern in the environment, you'll be happy to learn that stored procedures can reduce long SQL queries to a single line that is transmitted over the wire. 3. Efficient reuse of code and programming abstraction: Stored procedures can be used by multiple users and client programs. If you utilize them in a planned manner, you'll find the development cycle takes less time. 4. security : You can grant users permission to execute a stored procedure independently of underlying table permissions Results: These forms are just for taking the schema as input. Input: EmpId EmpName EmpEmail* 1 EMPLOYEES n n Emp WorkOn Proj dateBegan, dateEnded Emp Manage Emp m ProjID ProjDescription PROJECTS *multivalued The output for above input is i.e. the forms generated by the tool 5. CONCLUSION: We have implemented the methodology that will describe the forms from schema and stored procedures concept to get the needs of the application. Here in this implementation, we have assumed that NUMBER OF ENTITIES, MAXIMUM NUBER OF ATTRIBBUTES, is constant through out that execution. In this we have used the SQL SERVER as DBMS for testing our results. References: 1. Akhilesh Bajaj , Inferring the User Interface From An EER Data Schema, (2006), Americas Conference on Information Systems 2. Amy K. Karlson, Ralph D. Semmel and David P. Silberberg, Knowledge-Based Information Access, 3. Korth, H., Silberschatz, A. and Sudarshan S., Database Systems Concepts, (2005), McGraw Hill, New York. 4. Magesh Jayapandian and H. V. Jagadish,Automating the Design and Construction of Query Forms, University of Michigan, (2006), IEEE computer society 5. NicolaAloia, Cesare Concordia and Maria Teresa Paratore, AUTOMATIC GUI GENERATION FOR WEB BASED INFORMATION SYSTEMS, (2003) 6. http://databases.about.com/od/sqlserver/a/storedprocedure.htm 7. http://msdn2.microsoft.com/en-us/library/aa214299 (SQL.80).aspx 8. SQL Server 2000 Stored Procedure and XML Programming, Dejan sunderic, Second Edition, McGraw Hill 9. Miguel Calejo, Mário Araújo, Sónia Mota Araújo and Nuno Soares, Web Application Maker a model-based approach to web database development, (2002),