Professional Documents
Culture Documents
Requirement Freezing
Deadline Accepted. Decided that Java will be used as programming language. Update and Delete not to be implemented. Xpath to be used for Selection Parser not to be implemented.
Designing
Objective
The aim is to simulate an XML Database Management System. An XML database is a data persistence software system that allows data to be stored in XML format.
Designing (contd.)
Designing (contd.)
Project Specifications Language Used : Java, Xpath Platform : Windows/ Linux Libraries (Main) : Java awt, Java swing, JAXP (Java API for XML Processing)
Interface : It will be a GUI. A window will be opened where there will be a space for writing queries and a space for output.
Designing (contd.)
Designing (contd.)
Assumptions Valid data-types are string and number
There are no constraints implemented in the program It is assumed that system memory is big enough that the whole DOM tree can fit into memory.
Designing (contd.)
Commands accepted are create, insert, drop and select. create, insert and drop are in form of xml while select is in form of xpath. It is assumed that the operator has some idea about XML and Xpath.
The limitations of Java libraries over implementation of Xpath and Dom holds true. These limitations and over complications can be seen well in the code. It is assumed that input are such that do not violate these limitations.
Designing (contd.)
Flow of Control
The user will get a GUI interface. When the user will input the query in the query box and then click on execute button. The query will go to the parser component which will check the syntax of the query and then converts the correct query into the XML query form. This goes to the Query analyzer which will check the syntax of the XML query. It sends the correct XML query to the query processor. This component first checks the semantics of the query and then processes the query using XPath on the DOM tree of the database and then returns the output. This output goes to the output area of the GUI window.
Designing (contd.)
Designing (contd.)
Storage structure The basic idea is to store one table in a XML file. In fact for every table, two files will be used. One file will be storing the meta data. That is information about attributes, like their name, data type, constraints etc. This itself will be in XML format.
The other file will store the data ( i.e tuples of the table). This data will be consistent with the information in the meta data. That is before making any entry into the data file, we need to check for its consistency with the meta data file.
Designing (contd.)
All the files are stored into one folder. This folder corresponds to the database. If we have to maintain multiple databases, we can extend the concept to having a one folder for each database, stored in a folder that corresponding to complete packing.
When ever we create a table using a create( ) command, both the files will be created. Meta data file will be filled with the information about the information provided along with the create ( ) command.
Designing (contd.)
Data Flow Diagrams
Designing (contd.)
Level-1 DFD
Designing (contd.)
Level-2 DFD
Coding
Testing
Black Box Cause Effect Graph Equivalence Partitioning
Query is placed in the Query text-box. When Execute button is pressed, input is passed to the program, where it is processed and result (or error) is displayed on Output box. Clear button is used for clearing the input text-box.
So in any sequence C1 or ~C1 is always considered to be first to happen. In case if C2 and C3 are both true, C2 is considered to be before C3
2
(T/T/F)
3
(T/F/T)
4
(T/F/F)
5
(F/T/T)
6
(F/T/F)
7
(F/F/T)
8
(F/F/F)
A1
A2 A3
T
T T T
Execute Button
X X
1 2 3 4 5 6 7 8
Invalid Invalid
Invalid Invalid
X X
X
X
Equivalence Partitioning
In order to select , the format is xpath <4-char keyword> <DB-name> <query>
4-char keyword can be NUBR or STRG or BOOL or NDST. query = xpath query
Output = valid output or an error.
Possible Inputs for substring2 NUBR STRG BOOL NDST Any other string or number Null
Possible Inputs for substring4 Syntactically invalid query Syntactically valid query but semantically invalid query Syntactically and semantically valid query Null
Possible Outputs Output as a Number Output as a String Output as a Boolean Value Output as a Node Set Error message We club cases together to get a smaller set of partitions.
1) 2) 3)
4) 5) 6) 7) 8) 9)
Substring1 is not xpath. Rest of the substrings can take any value. Substring1 is xpath and substring3 is not a valid database name. Substring1 is xpath and substring3 is valid database name, substring2 is not one of the four valid keywords Substring1 is xpath and substring3 is valid database name, substring2 is one of the four valid keywords but substring4 is a query with invalid syntax. Substring1 is xpath and substring3 is valid database name, substring2 is one of the four valid keywords but substring4 is a query with valid syntax but invalid semantics. Everything is valid, Substring2 is NUBR Everything is valid, Substring2 is STRG Everything is valid, Substring2 is BOOL Everything is valid, Substring2 is NDST
1
xpathe NUBR
2
xpath NUBR
3
xpath NUB
4
xpath NUBR
5
xpath NUBR
Substring3
Substring4 Expected Output
Students
count(/row s/row) Error Message
Stud
count(/row s/row) Error Message
Students
count(/row s/row) Error Message
Students
_rows_row Error Message
Students
/rows/row Error Message
Substring2 Substring3
Substring4 Expected Output
NUBR Students
count(/rows/r ow) 8
STRG Students
/rows/row[1]/colu mn[@name=na me]/@value
BOOL Students
count(/rows/r ow) ==1 False
NDST Students
/rows/row[1] Whole first row
aditya
Expected Output
aditya
Error Message
Statement Coverage : 10/31 = 32.26% Branch Coverage : 01/08 = 12.25% Path coverage : 01/05 = 20.00%
Statement Coverage : 14/31 = 45.16% Branch Coverage : 02/08 = 25.00% Path coverage : 01/05 = 20.00%
tableData
tableDoc type
11
12 13 14,19
12
16,21 26
number
strVal
16
21
17
22
[1,3] &[1,5] : p-use of str [1,7], [1,13] &[1,31] : c-use of str [7,8], [7,9] & [7,10] : c-use of rest [8,9] : c-use of nextspace [9,11] : c-use of tablename [10,16] &[10,21] : c-use of xpathExpression [11,12] : c-use of tableData [12,16] &[12,21] : c-use of tableDoc [13,14] & [13,19] : p-use of type [13,26] : c-use of type [16,17] : c-use of number [21,22] : c-use of strVal
str
[1,3]
1,2,3
str
[1,5]
1,2,3,4,5
xpath NUBR students count(/rows/row) xpath NUBR students count(/rows/row) xpath STRG students /rows/row[1]/col umn[@name=n ame]/@value
type
[13,14]
13,14
type
[13,19]
aditya
str
[1,7]
1,2,3,4,5,6,7
str
[1,13]
1-13
str
[1,31]
1-6,29-31