XML Schema Design Quality Testing using Expert System

24
XML Schema Design Quality Testing using Expert System December 14, 2005 Daehong, Kim Thesis Presentation

description

Thesis Presentation. XML Schema Design Quality Testing using Expert System. December 14, 2005 Daehong, Kim. Contents. Introduction XML schema design quality testing Rule-based expert system Framework Rule encoding Fact transformation Prototype & Live demo Conclusion. Example1.xml. - PowerPoint PPT Presentation

Transcript of XML Schema Design Quality Testing using Expert System

XML Schema Design Quality Testingusing Expert System

December 14, 2005

Daehong, Kim

Thesis Presentation

2

Contents

Introduction XML schema design quality testing Rule-based expert system

Framework Rule encoding Fact transformation

Prototype & Live demo Conclusion

3

XML & XML Schema

<Unv>POSTECH

<Dep>IME

<Lab>ISL</Lab>

</Dep>

</Unv>

Example1.xml

<Unv>SNU

<Dep>CHEM

<Lab>H2</Lab>

</Dep>

</Unv>

Example2.xml

<element name=“Unv”>

<complexType>

<element name=“Dep”>

<complexType>

<element name=“Lab”/>

</complexType>

</element>

</complexType>

</element>

Laboratory.xsdPOSTECH

IME

ISL

Example1.txt

4

Global Type

Local Type

XML Schema Design

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:simpleType name=“phonenumber"> <xsd:restriction base="xsd:string">

<xsd:pattern value ="[0-9]{3}-[0-9]{3}-[0-9]{4}"/> </xsd:restriction>

</xsd:simpleType></xsd:schema>

phonenumber1.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name=“phonenumber2"> <xsd:simpleType>

<xsd:restriction base="xsd:string"><xsd:pattern value ="[0-9]{3}-[0-9]{4}-[0-9]{4}"/>

</xsd:restriction> </xsd:simpleType>

</xsd:element></xsd:schema>

phonenumber2.xsd

054-279-8243

010-2798-2431

5

XML Schema Design

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:simpleType name=“phonenumber"> <xsd:restriction base="xsd:string">

<xsd:pattern value ="[0-9]{3}-[0-9]{3}-[0-9]{4}"/> </xsd:restriction>

</xsd:simpleType>

phonenumber3.xsd

<xsd:element name=“phonenumber2"> <xsd:simpleType>

<xsd:restriction base="xsd:string"><xsd:pattern value ="[0-9]{3}-[0-9]{4}-[0-9]{4}"/>

</xsd:restriction> </xsd:simpleType>

</xsd:element>

<xsd:element name=“LabPhone" type=“phonenumber"/> <xsd:element name=“MobilePhone" type=“phonenumber2"/>

</xsd:schema> Schema error – Undefined value for ‘type’ encountered

6

Organization Conventions

OAGIS Best Practices KIEC XML Guideline UBL Naming and Design rules ASC X12 Reference Model for XML Design And more…

Best practice for extensibility and reusability of the schemaLocal type should not be used. Globally defined types allow reuse while the local types do not.

7

XML Schema Design Quality Testing

Schema design

OrganizationConventions

Developer

It helps the developer to make XML schema consistent.

8

XML 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

9

Rule-based Expert System

Domain-specific Knowledge base

UserInference engine

Inte

rface

Expert System Shell

Knowledge base editor

Explanation system

JESS (Java Expert System Shell script) for

JAVA – Web implementation

10

Objectives

To propose the rule-based expert system to ensure the quality of XML Schema design

1) To show the system framework

2) To encode testing rules from organization conventions

3) To translate XML schemas into facts

4) To implement the prototype

Framework

12

System Framework

XML SchemaCheck SchemaagainstOrganization Conventions

OrganizationConventions

XML Schemaspecification

Schema Diagnosis

Expert System XSLT Engine

A0

13

System Framework

Organization conventions

Rule DesignGuide

Validation Rules

A2

XML Schema

ExpertSystem

XSLT Engine

XSLT for XML2JESS

Schema Diagnosis

Facts

EncodeRules

Transforminto Facts

RuleExecution

A3

A1

A2

14

Fact Definition

(deftemplate laboratory (slot University) (slot Department) (slot Name) )

(laboratory (University POSTECH) (Department IME) (Name ISL))

(assert laboratory (University POSTECH) (Department IME) (Name ISL))

15

Template 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)

<element name=“Unv”>

<complexType>

<element name=“Dep”>

<complexType>

<element name=“Lab”/>

</complexType>

</element>

</complexType>

</element>

element

complextype name (Unv)

element

complextype name (Dep)

element

name (Lab)

16

Fact Transformation

XML Schema to JESS Fact

; 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 xsd:element)))(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 xsd:complexType))…

XSLT

<element name=“Dep”><complexType/></element>

element

complextype name (Dep)

17

Rule Encoding

Organization convention to JESS Rules

(defrule laboratory (element (id ?e-id) (name Dep)) (relation (type element) (parent ?e-id) (child ?e-id2)) (element (id ?e-id2) (name Lab))

=> (printout t "Good Schema Design” crlf))

)

The schema must have Lab element as the child node of Dep element

Prototype

19

Implementation architecture

JESS execution

module

Application/Servlet Server

Reference

Interaction

UsersUsersKIEC v2.0

UsersUsersNIST

Organization guideline

UsersUsersJESS

Rule script

UsersUsersOAGI

UsersUsers…

Test scriptmanage module

I/O

InterfaceClient

Upload test script

Execute test

Show test result

Login to system

20

Demo Scenario

OAGI design document Check for improper use of local type

Global element To allow it to be referenced and reused

Scenario1. Find the local type.

2. If the local type does not exist, printout “This schema does not local type”.

3. If the local type exist, printout “This local type should not be used” for each local type.

21

Testing XML Schema

<?xml version="1.0" encoding="ISO-8859-1"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:simpleType name="phonenumber"> <xsd:restriction base="xsd:string">

<xsd:pattern value ="[0-9]{3}-[0-9]{3}-[0-9]{4}"/> </xsd:restriction>

</xsd:simpleType></xsd:schema>

<?xml version="1.0" encoding="ISO-8859-1"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="phonenumber2"> <xsd:simpleType> <xsd:restriction base="xsd:string">

<xsd:pattern value ="[0-9]{3}-[0-9]{4}-[0-9]{4}"/> </xsd:restriction> </xsd:simpleType> </xsd:element></xsd:schema>

Live Demo

23

Conclusion

XML Schema DesignQuality Testing

XML Schema DesignQuality Testing

Promotion to InteroperabilityPromotion to

Interoperability

Easiness to Schema Development

Easiness to Schema Development

Induction to interest in standardization

Induction to interest in standardization

24

Q & A

Thank you