An Approach to the Validation of XML Documents ...

2 downloads 0 Views 2MB Size Report
Consignee. Transport. Means. Axle Load. Computation-Independent Model (CIM). Describes Real-World Objects. (EAEU Data Model, ISO 20022, …) Consignor.
An Approach to the Validation of XML Documents based on the Model Driven Architecture and the Object Constraint Language Denis Nikiforov, Dmitriy Korj, and Ruslan Sivakov Center of Information Technologies, Ekaterinburg, Russia

1. Problem

Customs Authority Consignor

Sanitary Veterinary Authority

Transport Authority Consignee 2

1. Problem Rules and Validation Software

Customs Authority Consignor

Sanitary Veterinary Authority

Transport Authority Consignee 3

1. Problem

Transport Means

Consignment Consignor

Axle Load Consignee

Consignment Consignor

Cargo

Product Consignment Item

Consignee

Best Before Date

Production Date

Total Mass Axle Load

Taxonomic Group Customs Authority

Consignor

Computation-Independent Model (CIM) Describes Real-World Objects (EAEU Data Model, ISO 20022, …)

Sanitary Veterinary Authority

Transport Means Overall Dimension

Transport Authority Consignee 4

1. Problem

CIM Platform-Independent Models (PIMs) Describes Details of Real-World Objects Contained in Electronic Documents

Declaration

Customs Authority Consignor

Certificate

Sanitary Veterinary Authority

Permit

Transport Authority Consignee 5

1. Problem

CIM

PIM

PIM

XML Schema

Customs Authority Consignor

JSON Schema

Sanitary Veterinary Authority

PIM

… Schema

Platform-Specific Models (PSMs)

Transport Authority Consignee 6

1. Problem

CIM

PIM

Structural Constraints: 1) Entity Kinds 2) Relations 3) Attributes 4) Data Types 5) Multiplicity

PIM

XML Schema

Customs Authority

XML

Consignor

JSON Schema

Sanitary Veterinary Authority

PIM

… Schema

Platform-Specific Models (PSMs)

Transport Authority Consignee

Data Level 7

1. Problem

CIM

Business Constraint PIM

PIM If an end date is specified, then it must not be earlier than the starting date

Structural Constraints: 1) Entity Kinds 2) Relations 3) Attributes 4) Data Types 5) Multiplicity

XML Schema

Customs Authority

XML

Consignor

XSLT

Sanitary Veterinary Authority

Java



Developers

Transport Authority Consignee

Data Level 8

1. Problem

CIM

Business Constraint PIM

PIM EndDate->notEmpty() implies StartDate notEmpty() implies StartDate XSLT EAEU Model

EAEU -> XSD 1.1

EAEU -> Java

XSLT

XSD 1.1

ISO 20022 -> XSLT

ISO 20022 Model

ISO 20022 -> XSD 1.1

Java

ISO 20022 -> Java

16

3.1. Features: Different PIMs and PSMs EAEU -> XSLT EAEU Model

EAEU -> XSD 1.1

EAEU -> Java

XSLT

XSD 1.1

ISO 20022 -> XSLT

ISO 20022 Model

ISO 20022 -> XSD 1.1

Java

ISO 20022 -> Java use OCL -> XPath

17

3.1. Features: Different PIMs and PSMs EAEU -> XSLT

XSLT

EAEU -> XSD 1.1

EAEU Model

EAEU -> Java

XSD 1.1

ISO 20022 -> XSLT

ISO 20022 -> XSD 1.1

ISO 20022 Model

Java

ISO 20022 -> Java use Structure Adapter isDataElement() isDataType() isAttribute() isExternalSource()

require

OCL -> XPath

require

Type System Adapter

isNumericType() isStringType() isBooleanType() isDateType() isDateTimeType() isTimeType() isDurationType()

18

3.1. Features: Different PIMs and PSMs EAEU -> XSLT

XSLT

EAEU -> XSD 1.1

EAEU Model

EAEU -> Java

XSD 1.1

ISO 20022 -> XSLT

ISO 20022 -> XSD 1.1

ISO 20022 Model

Java

ISO 20022 -> Java use Structure Adapter isDataElement() isDataType() isAttribute() isExternalSource()

require

OCL -> XPath

Hypothesis: The transformation could be universal.

require

Type System Adapter

isNumericType() isStringType() isBooleanType() isDateType() isDateTimeType() isTimeType() isDurationType()

19

3.2. Features: External Data Sources: Code Lists & Services

20

3.2. Features: External Data Sources: Code Lists & Services

21

3.2. Features: External Data Sources: Code Lists & Services

22

3.2. Features: External Data Sources: Code Lists & Services

23

3.3. Features: Determination of Source XML Elements

24

3.3. Features: Determination of Source XML Elements

1. Unfold forAll iterations

25

3.3. Features: Determination of Source XML Elements

1. Unfold forAll iterations

26

3.3. Features: Determination of Source XML Elements

1. Unfold forAll iterations 2. Determine paths for all

27

3.3. Features: Determination of Source XML Elements

1. Unfold forAll iterations 2. Determine paths for all Code

not found in Harmonized System. 28

3.3. Features: Determination of Source XML Elements

1. Unfold forAll iterations 2. Determine paths for all 3. Determine paths for Code validation messages not found in Harmonized System. 29

3.3. Features: Determination of Source XML Elements

Validated Elements

Link to Source Elements of Calculated Values

30

3.3. Features: Determination of Source XML Elements

31

3.4. Features: Preconditions

32

3.4. Features: Preconditions

33

3.5. Features: Kinds of Validation Messages Message Kind

Condition

Error

OCL expression evaluates to false

Success

OCL expression evaluates to true

Not checked

Premise of implication in OCL expression evaluates to false

Not found

The source of forAll iteration evaluates to empty collection

Unsupported

OCL expression contains constructions unsupported by a current platform (for example, references to external sources) 34

4. Example: Source OCL Specification

35

4. Example: Generated Java-based Validator

36

4. Example: Generated XSLT-based Validator

+ 200 rows

37

5. Further Work 1) Describe and Implement Semantic Checks for OCL let EAEU : Set(String) = Set{’AM’,’BY’,’KG’,’KZ’,’RU’} in self.CountryCode = EAEU 2) Prove Correctness of the OCL to XPath Transformation OCL (4-valued logic) or F F F ε ε ⊥ ⊥ T T

ε



T

ε ε ⊥ T

⊥ ⊥ ⊥ T

T T T T

(Count = 0) or (Sum / Count > 10) = T if Count = 0

XPath (3-valued non-deterministic logic) or F F F ε F ⊥ ⊥ T T

ε



F ⊥ F ⊥ ⊥ ⊥ T T⊥

T T T T⊥ T

(Count eq 0) or (Sum div Count gt 10) = T or ⊥ if Count = 0 38

Centre of Information Technologies LLC 115088, Moscow, Ugreshskaya Str., 2 s.74, office 8 Tel. +7 (495) 374-52-53 www.centre-it.com

Suggest Documents