Title: XML Schema Design Quality Testing using Expert System
1XML Schema Design Quality Testingusing Expert
System
Thesis Presentation
- December 14, 2005
- Daehong, Kim
2Contents
- Introduction
- XML schema design quality testing
- Rule-based expert system
- Framework
- Rule encoding
- Fact transformation
- Prototype Live demo
- Conclusion
3XML XML Schema
4XML Schema Design
phonenumber1.xsd
ltxsdschema xmlnsxsd"http//www.w3.org/2001/XMLS
chema"gt ltxsdsimpleType
namephonenumber"gt
ltxsdrestriction base"xsdstring"gt
ltxsdpattern value "0-93-0-93-0-94"/gt
lt/xsdrestrictiongt lt/xsdsimpleTypegt lt
/xsdschemagt
054-279-8243
phonenumber2.xsd
ltxsdschema xmlnsxsd"http//www.w3.org/2001/XMLS
chema"gt ltxsdelement namephonenumber2"gt
ltxsdsimpleTypegt
ltxsdrestriction base"xsdstring"gt ltxsdpatter
n value "0-93-0-94-0-94"/gt
lt/xsdrestrictiongt lt/xsdsimpleTypegt
lt/xsdelementgt lt/xsdschemagt
010-2798-2431
5XML Schema Design
phonenumber3.xsd
ltxsdschema xmlnsxsd"http//www.w3.org/2001/XMLS
chema"gt ltxsdsimpleType
namephonenumber"gt
ltxsdrestriction base"xsdstring"gt
ltxsdpattern value "0-93-0-93-0-94"/gt
lt/xsdrestrictiongt lt/xsdsimpleTypegt
ltxsdelement namephonenumber2"gt
ltxsdsimpleTypegt
ltxsdrestriction base"xsdstring"gt ltxsdpatter
n value "0-93-0-94-0-94"/gt
lt/xsdrestrictiongt lt/xsdsimpleTypegt
lt/xsdelementgt
ltxsdelement nameLabPhone"
typephonenumber"/gt ltxsdelement
nameMobilePhone" typephonenumber2"/gt
lt/xsdschemagt
6Organization Conventions
Best practice for extensibility and reusability
of the schema Local type should not be used.
Globally defined types allow reuse while the
local types do not.
- OAGIS Best Practices
- KIEC XML Guideline
- UBL Naming and Design rules
- ASC X12 Reference Model for XML Design
- And more
7XML Schema Design Quality Testing
Schema design
OrganizationConventions
Developer
- It helps the developer to make XML schema
consistent.
8XML Schema Design Quality Testing
- Testing system requirements
- Several organizational conventions should be
satisfied. - Distributed work should be enabled.
- Common conventions should be shared or reused.
- Rule-based Expert System
- Decision making system based on knowledge of rules
9Rule-based Expert System
- JESS (Java Expert System Shell script) for
- JAVA Web implementation
Expert System Shell
Explanation system
Interface
Inference engine
User
Domain-specific Knowledge base
Knowledge base editor
10Objectives
To propose the rule-based expert system to ensure
the quality of XML Schema design
- To show the system framework
- To encode testing rules from organization
conventions
- To translate XML schemas into facts
- To implement the prototype
11Framework
12System Framework
XML Schemaspecification
OrganizationConventions
Check Schema against Organization Conventions
XML Schema
Schema Diagnosis
A0
Expert System
XSLT Engine
13System Framework
Rule DesignGuide
XSLT for XML2JESS
Organization conventions
Validation Rules
Encode Rules
A1
XML Schema
Facts
Transforminto Facts
A2
A2
Schema Diagnosis
Rule Execution
A3
XSLT Engine
ExpertSystem
14Fact Definition
(deftemplate laboratory (slot University) (slot
Department) (slot Name) )
(assert laboratory (University POSTECH)
(Department IME) (Name ISL))
(laboratory (University POSTECH) (Department IME)
(Name ISL))
15Template Definition
deftemplate element (slot id) (slot name)
deftemplate attribute (slot id) (slot name)
(slot value) deftemplate relation (slot type
(default attribute)) (slot parent) (slot child)
deftemplate text (slot id) (slot value)
ltelement nameUnvgt ltcomplexTypegt
ltelement nameDepgt
ltcomplexTypegt ltelement
nameLab/gt lt/complexTypegt
lt/elementgt lt/complexTypegt lt/elementgt
element
complextype
name (Unv)
element
complextype
name (Dep)
element
name (Lab)
16Fact Transformation
element
ltelement nameDepgt ltcomplexType/gt lt/elementgt
complextype
name (Dep)
XSLT
Templates Definition (deftemplate element
(slot id) (slot name)) (deftemplate attribute
(slot id) (slot name) (slot value)) (deftemplate
relation (slot type (default attribute)) (slot
parent) (slot child)) (deftemplate text (slot id)
(slot value)) Fact Assertion (assert (element
(id N000001) (name xsdelement))) (assert
(relation (type attribute) (parent N000001)
(child N000002))) (assert (attribute (id N000002)
(name name) (value Dep)) (assert (relation (type
element) (parent N000001) (child
N000003))) (assert (element (id N000003) (name
xsdcomplexType))
17Rule Encoding
- Organization convention to JESS Rules
The schema must have Lab element as the child
node of Dep element
(defrule laboratory (element (id ?e-id) (name
Dep)) (relation (type element) (parent ?e-id)
(child ?e-id2)) (element (id ?e-id2) (name
Lab)) gt (printout t "Good Schema Design
crlf)) )
18Prototype
19Implementation architecture
Application/Servlet Server
JESS executionmodule
Test scriptmanage module
Client
Login to system
I/O Interface
Upload test script
Execute test
Show test result
Organization guideline
Rule script
Reference
Interaction
20Demo Scenario
- OAGI design document
- Check for improper use of local type
- Global element
- To allow it to be referenced and reused
- Scenario
- Find the local type.
- If the local type does not exist, printout This
schema does not local type. - If the local type exist, printout This local
type should not be used for each local type.
21Testing XML Schema
lt?xml version"1.0" encoding"ISO-8859-1"?gt ltxsds
chema xmlnsxsd"http//www.w3.org/2001/XMLSchema"
gt ltxsdsimpleType name"phonenumber"gt
ltxsdrestriction base"xsdstring"gt
ltxsdpattern value "0-93-0-93-0
-94"/gt lt/xsdrestrictiongt
lt/xsdsimpleTypegt lt/xsdschemagt
lt?xml version"1.0" encoding"ISO-8859-1"?gt ltxsds
chema xmlnsxsd"http//www.w3.org/2001/XMLSchema"
gt ltxsdelement name"phonenumber2"gt
ltxsdsimpleTypegt
ltxsdrestriction base"xsdstring"gt ltxsdpattern
value "0-93-0-94-0-94"/gt
lt/xsdrestrictiongt
lt/xsdsimpleTypegt lt/xsdelementgt lt/xsdsch
emagt
22Live Demo
23Conclusion
XML Schema Design Quality Testing
24Q A