--------------------------------------------------------------------------
Software Design and Development Winter 2001
COM 1205 Prof. Karl Lieberherr
---------------------------------------------------------------------------
Project
Due dates: Second phase: March 6, 2001
---------------------------------------------------------------------------
This description is stored in file $SD/project/project2.txt
E.g.:
http://www.ccs.neu.edu/home/lieber/com1205/w01/project/project2.txt
PROJECT:
The project consists of first improving the project cdcheck from last quarter
and second, of reusing some of the functionality for checking XML schema.
DON't RUN cdcheck on denali.ccs.neu.edu.
In the second phase of the project, we reuse some of the functionality
from cdcheck and reuse it to check XML schemas.
READING:
Because we give you a cd for XML schemas, you don't need
to study the XML specification in detail. However, you
should read through the primer PART 0:
http://www.w3.org/TR/xmlschema-0/
Read up to table 1 only.
Read about collaborations in the UML Distilled book.
---
In
/proj/adaptive2/course/com1205/w01/project/XML-schema
is a class dictionary that describes a subset of the XML
schema notation.
A good way to learn the basics about XML schemas is to translate
XML schemas to class dictionaries.
The example below shows how to use the equivalent of
construction, alternation and repetition classes in XML.
The example is quite informative and shows you how you
can reuse your expertise in designing class dictionaries
for XML schema design.
XML schema for expressions: exp.xsd
===================================
Corresponding class dictionary:
===============================
(defines the same language as the XML schema)
import java.util.*;
import java.io.*;
import edu.neu.ccs.demeter.dj.*;
// *************************************************************************
// The following section has been generated automatically by the XML to Java
// conversion application.
// *************************************************************************
XMLDoc = " String "?>"
" Exp "" EOF.
Exp = ">"
" E "".
E : lookahead {{9}} S | lookahead {{9}} C.
S = ">"
[ "" Integer "" ]
"" int "".
C = ">"
[ "" Integer "" ]
"" String ""
List(argsListUnit).
argsListUnit = " Exp "".
Main = .
Preprocessor = .
List(S) ~ {S}.
ValidateVisitor = extends Visitor.
// *************************************************************************
// End of automatically generated section.
// *************************************************************************
A legal input (the expression (+ 3 5)):
An XML document satisfying the above XML schema:
================================================
"+"
3
5
The code for this example is in:
/proj/adaptive2/course/com1205/w01/project/XML-schema/from-prasenjit
(It turns out that a team of graduate students is
implementing a translator that translates XML schemas
to Java classes by first translating the schemas to class
dictionaries.
If you would like to see the translator (a DJ program),
take a look at:
/proj/adaptive3/lieber/com3360-2000/JSR31-2001/
This is a prototype implementation of JSR31
(Java Service Request) from
SUN Microsystems for a data binding approach to Java.
)
We see now very clearly the correspondence:
XML schema === class dictionary
XML document === sentence of language defined by class dictionary
With this background on XML, your task is to implement
the following reporters for XML schemas:
1. List all complex types that are used but not defined.
2. List all complex types that are defined but not used.
3. List all complex types that are defined more than once.
4. All parts must be unique.
Your task is to adapt the UML collaborations that you have developed
for checking class dictionaries to check XML schemas.
A part of this you have already done in the midterm.
But notice that the midterm class dictionary was simpler than the
one in
http://www.ccs.neu.edu/home/lieber/com1205/w01/project/XML-schema/XML2AP.cd
because the midterm cd did not support inheritance between types.
I also made several other small changes to the midterm cd.
I put the midterm program into:
http://www.ccs.neu.edu/research/demeter/course/exams/m-1205-w01/source/
What you need to turn in:
The Java code you wrote for 1, 2, 3 and 4.
The XML schemas that you used for testing your program.
We need a hard copy and the path to your directory with the running
program.
The documentation for your program needs to include a description
of the collaborations that you use and how you have adapted
those collaborations to checking XML schemas.
As example you can use the collaboration for "used-but-not-defined"
that we covered in class.