Вы находитесь на странице: 1из 7

International Journal of Emerging Trends & Technology in Computer Science (IJETTCS)

Web Site: www.ijettcs.org Email: editor@ijettcs.org, editorijettcs@gmail.com Volume 2, Issue 3, May June 2013 ISSN 2278-6856

A Concoct Semiotic for Recursion in SQL


Ajeet A. Chikkamannur1, Dr. Shivanand M. Handigund2
1

Department of Computer Science and Engineering. Sri Venkateshwara College of Engineering Bangalore, 562157, India Department of Computer Science and Engineering Bangalore Institute of Technology Bangalore, 560064, India

Abstract:

The user of relational database requires the hierarchy of information/tuples from the relation. This information/tuples is proliferating either from top to bottom or bottom to top order with one or more assessment at each level of the ranking. We have not observed the straightforward structured query language (SQL) command to reclaim the ladder of information from a relation. Instead, the nesting of SQL can be used to reclaim the hierarchy of information/tuples but the query is providing the information related to the number of levels expressed in the nesting. This specification of the height in a query is constraining the navigation of information by complete level. Moreover, the ranking of information/tuples is retrieved either in top-down or bottom-up order, which is the complex and lengthy query with the use of current SQL. Hence, a single query semiotic is designed and developed to retrieve the hierarchy of information/tuples from a relation. The ranking of information/tuples can be in top-down or bottom-up order depending on the user aspiration. The topdown ranking is provided in terms of one-to-many relationship and the bottom-up ranking is provided in terms of one-to-one relationship existing among the tuples of relation.

Keywords: semiotic, relational algebra, recursion, relation, hierarchy

1. INTRODUCTION
The application deploying the relational database management system is storing the data in the relations. The relation is analogous to the perception of table in a physical structuring and disseminating. Some time the user of relational database needs the hierarchy of data from a relation. The retrieval of hierarchy of data by the existing SELECT semiotic (i.e. syntax, semantics and pragmatics) can be done but this is complicated task for the language user. This is because the semiotic needs to be expressed repeteadly and able to retrieve the data at a level corresponding to number of expressions. Further, in a hierarchy the ranking of data is proliferating either from top to bottom or bottom to top order with one or more assessment at each indentation of the hierarchy. The existing RECURSION semiotic of SQL provides the only one hierarchy The issue arising here is that how to obtain the proliferating data as per the requirement of user? To resolve this, the existing Structured Query Volume 2, Issue 3 May June 2013

Language (SQL) user has to put away the expertise to write the query. Further, the technical confront observed here is that, How to ameliorate or expand the semiotic of existing SQL to assuage of the common people with an easiness? This amelioration or expansion of semiotic towards assuage of user, magnetizes the many populace and try to rearrange the SQL as near natural language, which in turn makes the survival of language for long time i.e. avoiding them to become legacy. In literature, we have not observed the straight forward SQL semiotic to reclaim the ranking of data from a relation. One way of obtaining the ranking with pragmatic SQL is the expression of SELECT statament in nested form but the query result is providing the data related to the number of levels expressed in the nesting. This specification of the height in a query is constraining the navigation of data by complete level in a relation. Moreover, the hierarchy of data is retrieved either in topdown or bottom-up order, which is the still more complex semiotic with expressive power of current SQL. Hence, we have designed query semiotic to retrieve the ranking of data from a relation. The hierarchy of data is retrieved either in top-down or bottom-up order depending on the user desire. The work in this arena is carried out by many researchers to deploy the transitive closure operation on a relation [1, 2, 3, 4, 5] but we are enhancing and expanding the semiotic of the current SQL by the inclusion of concoctive semiotic with procedure in which the query semiotic is translated to the relational algebraic expression, This is commonly known as first phase of compilation in the SQL engine.

2. BACKGROUND
In literature, among the many approaches [7], some possible approaches, we have observed are naive evaluation, seminaive evaluation and static filtering. In naive evaluation process, the recursion result relation is obtained by the growth of relation up to the fix point specified in a query. The seminaive evaluation process appends the new tuples that are added on particular iteration to a relation. The static filtering process uses information from the query to eliminate useless tuples from a relation. However, our aim is to blend a semiotic in SQL to ameliorate the language towards naturalness. Hence, these evaluation processes can be concomitant Page 204

International Journal of Emerging Trends & Technology in Computer Science (IJETTCS)


Web Site: www.ijettcs.org Email: editor@ijettcs.org, editorijettcs@gmail.com Volume 2, Issue 3, May June 2013 ISSN 2278-6856
with our designed query semiotic execution. Further, to produce more number of evaluation processes, a singular procedure is designed by harnessing the virtues of these processes. Step 3. A set DIFFERENCE (--) operator is applied between T1 and T2. i.e. T1T1 T2 Then store the resulting relation in a T2. This will deletes the tuples from the T1corresponding to the tuple of T2. Step 4. Count the number of tuples in T2 by the application of COUNT operation. The count value is stored in the relational variable C1. This count operation is ensuring the growth of relation. Step 5. The natural JOIN ( ) operation is applied between T1 and T2 with the attributes value specified in a clause of a query. While specifying the join condition of JOIN operator, the first and second attributes of a clause are linked to T1 and T2 respectively. The resulting tuples are stored in T2. Here, the order of tuples in a hierarchy is depending on the order of linking attributes values in a query semiotic. Step 6. Apply the Count operator to count the number of tuples in a relation T2. The resulting count is stored in the variable C2. Step 7. The variable C1 and C2 values are compared for the growth of T2 in terms of tuples. If the count value of C1 and C2 are different then the count value of C2 is copied to the C1. Then the control is transferred to the step 4. With equal count value of C1 and C2, the procedure continues to a next step. Step 8. Display the tuple values of T2. The pseudo-code for the procedure is given below.
1. T1 RELATION 2. T2 RELATION 3. T2T2DIFFERENCE T1 4. T2SELECT<attribute.tuple>(T1) 5. C1COUNT(T2) 6. T2 T1JOIN<attribute1>, <attribute2> T2 7. T1T1DIFFERENCE T2 8. C2COUNT (T2) 9. C3 C2DIFFERENCE C1 10. COMPARE (C3, NULL) IF NOT TRUE THEN C1 C2 GOTO 6 11. DISP (T1)

3. DESIGN OF SEMIOTIC
The operational word see is sifted from the Basic English [6], which is known as second International English Language. This word is informative to the semantic pertaining to the meaning presented by the eyes. Naturally the visualization perceived by the eyes is in many directions. To position the limit in the direction, we have sifted one directional word in for the recursion semiotic design. The combination of words see, in are revealing the meaning of recursion i.e. see-in construes the meaning look inside until end The word for of query semiotic is sifted from the current SQL to recognize and link the data existing in attributes. Our designed query semiotic is analogous to the semiotic of query SELECT, FROM and WHERE clause. Hence, the user can constitute the query by the use of semiotic easily for the recursion. The revamped semiotic in Backus-Naur Form (BNF) is given below. SQL: =[SEE] <attribute.tuple=value> [IN] < RELATION> [FOR] <attribute1>, <attribute 2> The value specified by the user in the <attribute.tuple=value>expression of semiotic denotes the tuple of relation from which the navigation originates. In the expression<RELATION>, the user has to specify the relation for which the recursion is applied for the retrieval. The expressions<attribute1> and<attribute2> are the tuple values for the decision and advancement of hierarchy required by the user. The contemporary SQL engine is developed to execute the set theory and relational algebra expression operators. These operations are deployed in the engine for the execution on relation for the retrieval and modification. Hence, our task is to transform the query semiotic to the relational algebra expression, so that the query expression is executed by the SQL engine. The description of procedure to express the query semiotic in terms of relational algebra is given below: Step 1. Create a relational variable T1with tuple values and variable T2 without tuple values corresponding to the relation name specified in a query. Step 2. The originating tuple value is retrieved by the use of SELECT () operator on the variable T1. The conditional value of select operation is taken from the tuple expression of semiotic. The resulting tuple (s) of select operation is stored in a relation T2. Volume 2, Issue 3 May June 2013

4. CASE STUDY
To demonstrate the methodology, consider the Employee table shown in the figure1 with example data values stored. The bottom-up and top-down hierarchy of tuples is retrieved by the same query semiotic with alteration in the specification of linking attributes order. This is illustrated in separate sections for the same example. Page 205

International Journal of Emerging Trends & Technology in Computer Science (IJETTCS)


Web Site: www.ijettcs.org Email: editor@ijettcs.org, editorijettcs@gmail.com Volume 2, Issue 3, May June 2013 ISSN 2278-6856
Mi d 1 2 3 4 5 6 7 8 9 10 empnam e Shiva Ajeet Jose Maria Kamal King Raj Frank Simon Ram Mgri d Null 1 1 1 2 2 3 3 4 7 2 3 4 5 6 7 8 9 Ajeet Jose Maria Kamal King Raj Frank Simon 1 1 1 2 2 3 3 4 10 Ram 7

Figure 3. Data Values with First Iteration Step 3.The natural JOIN operation is performed for the condition of attributes Emp.Mid equated to Temp.Mgrid. This condition is satisfied by the tuple value of 7 for Emp.Mid and Temp.Mgrid in relations Emp and Temp respectively. Hence, the tuple values corresponding to Emp.Mid = 7 of Emp are selected. The selected tuple values are added to the Temp relation.
Emp Temp

Figure 1. Example Data Table 4.1 BOTTOM-UP HIERARCHY The query expression for retrieving the hierarchy of tuples in bottom up order is given below. SQL:= SEE ram IN employee FOR mid, mgrid; The description of the procedure for retrieving the tuples is given below: Step1.The two temporary relations Emp and Temp are created in confirmation with a relation employee. Then the tuples of Temp relation are deleted. The condition is depicted in the figure 2
Emp Temp

Mi d 1 2 3 4 5 6 8 9

empnam e Shiva Ajeet Jose Maria Kamal King Frank Simon

Mgri d Null 1 1 1 2 2 3 4

Mi d

empnam e

Mgri d

Raj

Mi d 1 2 3 4 5 6 7 8 9 10

Empnam e Shiva Ajeet Jose Maria Kamal King Raj Frank Simon Ram

Mgri d Null 1 1 1 2 2 3 3 4 7

Mi d

empnam e

Mgri d

10

Ram

Figure 4. Data Values with Second Iteration On executing the COUNT function on a Temp relation gives up a value 2. The count value 1 resulted in step 2 is different from the count value 2 i.e. the table Temp is grown by the one-tuple values. Hence, the JOIN operation is applied again. The difference operator is executed on relations Emp and Temp for deleting the tuple corresponding to Emp.Mid = 7 in Emp relation. The state of relations with data values is shown in the figure 4. Step 4.Again, the natural JOIN operation is performed for the condition of attributes Emp.Mid equated to Temp.Mgrid. The condition is satisfied by the tuple value of 3 for Emp.Mid and Temp.Mgrid in relations Emp and Temp respectively. Hence, the tuple values corresponding to Emp.Mid as 3 of Emp are selected. The selected tuple values are added to the Temp relation. On executing the COUNT function on a Temp relation gives up a value 3. The count value 2 of previous step is different from the current count value 3.The relation Temp is grown by the one-tuple values. Hence, the JOIN operation is applied another time. The difference operator is executed on relations Emp and Temp for Page 206

Figure 2. Temporary Relations Step 2. The SELECT operator is applied with condition value as ram. The resulting tuple is stored in the Temp relation. On application of COUNT function to Temp is resulting in a value of 1. The application of difference operator on relations Emp and Temp and storing in Emp relation is deleting the tuple corresponding to Emp.Mid = 10 in Emp relation. This is shown in the figure 3 with resulting relations data values.
Emp Temp

Mi d 1

empnam e Shiva

Mgri d Null

Mi d

empnam e

Mgri d

Volume 2, Issue 3 May June 2013

International Journal of Emerging Trends & Technology in Computer Science (IJETTCS)


Web Site: www.ijettcs.org Email: editor@ijettcs.org, editorijettcs@gmail.com Volume 2, Issue 3, May June 2013 ISSN 2278-6856
deleting the tuple corresponding to Emp.Mid = 3 in Emp relation. The state of the relations with data values is shown in the figure 5.
Emp Temp

continuation of process stops here. Since the augmentation of tuples with Temp relation is not emerged, the relation temp is displayed as final result, which is shown in the figure 7.
Mi d 10 7 3 1 empnam e Ram Raj Jose Shiva Mgri d 7 3 1 Null

Mi d 1 2 4 5 6 8 9

empnam e Shiva Ajeet Maria Kamal King Frank Simon

Mgri d Null 1 1 2 2

Mi d

empnam e

Mgri d

Jose

Figure 7. Recursion Output Relation


7 Raj 3

3 4 10 Ram 7

4.2 TOP-DOWN HIERARCHY


The query expression for retrieving the hierarchy of tuples in top-down order is given below. SQL: = SEE shiva IN employee FOR Mgrid, Mid; The description of procedure for retrieving the tuples is given below: Step1. The two temporary relations Emp and Temp are created in assertion with a relation employee. Then the tuples of Temp relation are deleted. This is depicted in the figure 8.
Emp Temp

Figure 5. Data Values with Third Iteration Step 5. The natural JOIN operation is performed for the condition of attributes Emp.Mid equated to Temp.Mgrid. The condition is satisfied by the tuple value of 1 for Emp.Mid and Temp.Mgrid in relations Emp and Temp respectively. Hence, the tuple values corresponding to Emp.Mid as 1 of Emp are selected. The selected tuple values are added to the Temp relation. On executing the COUNT function on a Temp relation gives up a value 4. The count value 4 of previous step is different from the current count value 3. The relation Temp is grown by the one-tuple values. Hence, the JOIN operation is applied another time. The difference operator is executed on relations Emp and Temp for deleting the tuple corresponding to Emp.Mid = 1 in Emp relation. The state of the relations with data values is shown in the figure 6.

Emp

Temp

Mi d 2 4 5 6 8 9

empnam e Ajeet Maria Kamal King Frank Simon

Mgri d 1

Mi d 1 3

empnam e Shiva Jose

Mgri d Null 1

Mi d 1 2 3 4 5 6 7 8 9 10

empnam e Shiva Ajeet Jose Maria Kamal King Raj Frank Simon Ram

Mgri d Null 1 1 1 2 2 3 3 4 7

Mi d

Empnam e

Mgri d

1 2 2 7 3 4 10 Ram 7 Raj 3

Figure 8. Temporary Relations Step 2. The SELECT operator is applied with condition value as shiva. The resulting tuple is stored in the Temp relation. On application of COUNT function to Temp relation is resulting in a count value of 1 tuple. Since the relation is grown, the difference operator is applied and the application of the operator on the relations Emp and Temp is deleting the tuple corresponding to Temp.Mid = 1 from the Emp relation. The resulting relations with data values are shown in the figure 9.
Emp Temp

Figure 6. Data Values with Fourth Iteration Step 6. The natural JOIN operation is performed for the condition of attributes Emp.Mid equated to Temp.Mgrid. The condition is not satisfied because of Temp.Mgrid = NULL in the relation Temp. Hence, no tuple is added to the Temp relation. The execution of COUNT function on a Temp relation is yielding the value same as previous step value of 4. Hence, the Volume 2, Issue 3 May June 2013

Mi d

empnam e

Mgri d

Mi d

empnam e

Mgri d

Page 207

International Journal of Emerging Trends & Technology in Computer Science (IJETTCS)


Web Site: www.ijettcs.org Email: editor@ijettcs.org, editorijettcs@gmail.com Volume 2, Issue 3, May June 2013 ISSN 2278-6856
1 2 3 4 5 6 7 8 9 10 Ajeet Jose Maria Kamal King Raj Frank Simon Ram 1 1 1 2 2 3 3 4 7 Shiva Null Mi d
Emp Temp

empnam e

Mgri d

Figure 9. Data Values with First Iteration Step 3. The natural JOIN operation is performed for the condition of attributes Emp.Mgrid equated to Temp.Mid. This condition is satisfied by the three tuples with Mid 2, 3 and 4. Hence, these tuples are included in the Temp relation. On executing the COUNT function on a Temp relation gives up a value 4. The count value 1 resulted in step 2 is different from the count value 4 i.e. the table Temp is grown by the three-tuple values. Hence, the JOIN operation is applied once again. Furhter, the difference operator is executed on relations Emp and Temp for deleting the tuples corresponding to the Emp.Mid with value 2, 3 and 4 from the Emp relation. The state of the relations with resulting tuples data values is shown in the figure 10.
10 Ram 7

Mi d 1 2 3 4 5 6 7 8 9

Empnam e Shiva Ajeet Jose Maria Kamal King Raj Frank Simon

Mgri d Null 1 1 1 2 2 3 3 4

Figure 10. Data values with Third Iteration Step 5. The natural JOIN operation is performed for the condition of attributes Emp.Mgrid equated to Temp.Mid. This condition is satisfied by the tuple 10 for Temp.Mid value 7. Hence, the tuple is included in the Temp relation. On executing the COUNT function on a Temp relation gives up a value of count as 10. The count value 9 resulted in the previous step is different from the count value 10 i.e. the table Temp is grown by the one tuple value. Hence, the JOIN operation is applied once again and the difference operator is executed on relations Emp and Temp for deleting the tuple corresponding to Emp.Mid = 10 in Emp relation. The resulting relations with data values with data values are shown in the figure 11.
Emp Temp

Emp

Temp

Mi d

empnam e

Mgri d

Mi d 1 2 3 4

Empnam e Shiva Ajeet Jose Maria

Mgri d Null 1 1 1

Mid

empname

Mgrid

Mid 1 2 3 4 5 6 7 8 9

Empname Shiva Ajeet Jose Maria Kamal King Raj Frank Simon

Mgrid Null 1 1 1 2 2 3 3 4

5 6 7 8 9 10

Kamal King Raj Frank Simon Ram

2 2 3 3 4 7

Figure 10 Data Values with Second Iteration Step 4. The natural JOIN operation is performed for the condition of attributes Emp.Mgrid equated to the Temp.Mid. This condition is satisfied by the tuples 5, 6, 7, 8 and 9 for the Temp.Mid values 2, 3 and 4. Hence, these tuples are included in the Temp relation. On executing the COUNT function on a Temp relation gives up a count value 9. The count value 4 resulted in previous step is different from the count value of 9 i.e. the table Temp is grown by the five-tuple values. Hence, the JOIN operation is applied once again with exection of difference operator on relations Emp and Temp for deleting the tuple corresponding to Emp.Mid equals to 5, 6, 7, 8 and 9 from the Emp relation. The resulting relations with data values is shown in the figure 11.
10 Ram 7

Figure 11. Data Values with Fourth Iteration Step 6. The natural JOIN operation is performed for the condition of attributes Emp.Mgrid equated to Temp.Mid. This condition is not satisfied by any tuple for Temp.Mid. Hence, no tuple is included in the Temp relation. On executing the COUNT function on a Temp relation gives up a value 10, which is same as the count value of previous step. The relation Temp is not grown by the inclusion of any tuples. Hence, the JOIN operation is not applied once again. The tuples of Temp relation is displayed as resulting tuples. Page 208

Volume 2, Issue 3 May June 2013

International Journal of Emerging Trends & Technology in Computer Science (IJETTCS)


Web Site: www.ijettcs.org Email: editor@ijettcs.org, editorijettcs@gmail.com Volume 2, Issue 3, May June 2013 ISSN 2278-6856
Mi d 1 2 3 4 5 6 7 8 9 10 empnam e shiva ajeet jose maria kamal king raj frank Simon Ram Mgri d Null 1 1 1 2 2 3 3 4 7

Figure 12. Resulting Relation

5. DISCUSSION
We are designed the methodology by underpinning the recursive function call feature of the programming language. In programming language, the recursive call allocates the memory corresponding to the memory specified in the recursive function. This is continuing up to the termination point specified in the call and then proceeds in a reverse direction for providing the results to previous step and the memory allocation of current call is de-allocated. Hence, to accomplish this concept, our methodology creates two temporary relations with and without tuples from the relation on which the recursion operation is to be applied. On each iteration, the tuple is transformed from a relation to relation. Here, the sum of the size of the two temporary relations is equal to the total size of the relation. This is because the tuples of one relation is deleted and at the same time added to the another relation. This is efficient in the relation with large size because the growth of single relation disadvantageous in comparison with separate and grow in two relations. With the initial conditions specified in the query semiotic or/and application of JOIN and DIFFERENCE operators on relations, the tuple(s) is transferred from the one temporary relation to another. The function COUNT and COMPARE is used to verify the growth of the relation for iteration.

pragmatics of the user requirement of ranking the hierarchy. Further, we have designed a procedure to map the semiotic to the relational algebraic expression. These expressions are executed by the contemporary SQL engine. In the procedure, two relation variables are utilized to distribute and balance the total number of tuples obtained from a single relation in accord with semiotic expression. This is retaining the total size of relation by dynamically transferring the tuples from one relation to another relation. The COUNT operator is used to ensure the incremental append of the tuples. On true condition of attach, the ranking of the next tuple is identified on the values of current tuple. The top-down retrieval yields the tuples having one-to-many relationship. Other way, the bottom-up retrieval yields the tuples having one-to-one relationship. The relationship is determined by the tuple values of the attributes specified in the semiotic. This is an initiation in the journey of ameliorating the SQL towards naturalness. In future, the work is to be extended for the expanding the base of SELECT query semiotic ubiquitously towards naturalness along with other operations of SQL.

References
[1] Francois Bancilhon, Raghuram Krishnan An Amateurs Introduction to Recursive Query Processing Strategies, Proc, 1986 ACM SIGMOD International Conference on Management of data, Washington D.C. May 1986. [2] Yannis E. Ioannidis On the computation of Transitive Closure of Relational Operators, Proceeding 12th International Conference on Very Large Data Bases, Koyto, Japan, 1986. [3] H. V. Jagadish, Rakesh Agrawal, Linda Ness, A study of Transitive Closure as a Recursion Mechanism, Proceeding 1987 ACM SIGMOD International Conference on Management of Data, Sanfransico, California 1987 [4] Rakesh Agrawal, H. V. Jagadish, Direct Algorithm for Computing the Transitive Closure of Database Relations, Proceedings of 13th International Conference on Very Large Data Bases, Brighton, UK, 1987. [5] Hongiun Lu, New Strategies for Computing the Transitive Closure of a Database Relation, Proceeding International Conference on Very Large Data Bases, Brighton, UK, 1987. [6] Charles Kay Ogden, Basic English and Grammatical Reform, Cambridge: The Orthological Institute, 1937. [7] C. J. Date, A. Kannan, S. Swamynathan, An Introduction to Database Systems 8th edition, Pearson Education, 2008.

6. CONCLUSION
We have designed the query semiotic for the recursive operation by the selection of the word see. The semantic of expression recursion is inferred by the combination of the word see and in. The syntax of the expression is modeled in the BNF form, which is commonly used in the compiler design. This syntax is analogous to the syntax of SELECT, FROM, WHERE phrase. The two navigation of recursion progression is deployed by the blend of another directional word for. The top-down and bottom-up hierarchy of tuples information is provided by the specification of linking attributes of a relation. The change in the order of linking attributes is changing the ranking of data provided. This is satisfying the Volume 2, Issue 3 May June 2013

Page 209

International Journal of Emerging Trends & Technology in Computer Science (IJETTCS)


Web Site: www.ijettcs.org Email: editor@ijettcs.org, editorijettcs@gmail.com Volume 2, Issue 3, May June 2013 ISSN 2278-6856 Author
Ajeet A. Chikkamannur received his M. Tech. degree in Computer Science and Engineering in 2001 from the Visvesvaraya Technological University (VTU), India. Currently submitted the Ph.D thesis to VTU. and the research is focused on Design of Fourth Generation Language. His research interests are Object Oriented System Development, Database Management Systems, System Simulation and Modeling. Presently working as Professor, Department of Computer Science and Engineering and teaching for graduate and post graduate courses. Prof. Dr. Shivanand M. Handigund received his Ph.D. degree from the Indian Institute of Technology Bombay in 2001. Currently, he is working as a full Professor and Head Super Computer Division, Department of Computer Science and Engineering at Bangalore Institute of Technology, Bangalore. His research interests include Software Project Management, Software Engineering, Reverse Engineering, Database Management Systems, Object Technology and Computer Graphics. He is teaching several courses of Academia and Industry for last thirty five years and has published number of papers in national and international journals/conferences. He has delivered number of keynote addresses/technical lectures at various colleges and platforms in India and abroad. He has organized number of conferences and involved as reviewer for IEEE conference technical papers.

Volume 2, Issue 3 May June 2013

Page 210

Вам также может понравиться