project automotive coarse architecture xmi doors uml-suite ascet-sd © telelogic ab 2002

36
Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Upload: landon-harris

Post on 27-Mar-2015

219 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Project AutomotiveCoarse architecture

XMI

DOORS UML-Suite ASCET-SD

© Telelogic AB 2002

Page 2: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Markup Languages

• SGML <Standard Generalization Markup Language> developed in the early `80s, and as ISO standard since 1986.

• HTML <HyperText Markup Language> development started in 1990.

• XML <eXtensible Markup Language> development started in 1996 and it is W3C standard since February 1998.

• XMI <XML Metadata Interchange> was adopted as a recommended technology by the OMG on March 23, 1999.

© Telelogic AB 2002

Page 3: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

<SGML> ‘‘Standard Generalization Markup Language‘‘ </SGML>

• The markup describes the document‘s structure, not the document appearance

• The markup conforms to the model, which is a similar to a datebase schema. This means that it can be processed by software or stored in a database.

• The document structure is written in a Document Type Definition (DTD)

• DTD specifies a set of elements, their relationship, and the tag set to mark the document.

© Telelogic AB 2002

Page 4: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

<HTML> ‘‘HyperText Markup Language‘‘</HTML>

- The most popular application of SGML is HTML.- HTML is one set of tags that follows the rules of SGML.- The set of tags (almost 100 tags) defined by HTML is adapted to

the structure of hypertext documents.- HTML has been extended over the years. The first version had a

dozen tags; the latest version (HTML 4.0) is close to 100 tags.- Despite all these tags more are needed (for mathematical and

chemical formulas etc.)- On the other hand developers of handheld devices want fewer tags

because small devices, like smart phones, are not powerful enough to process HTML pages.

- The W3C expects that by the year 2002, 75% of surfers won‘t be using a PC. Rather, they will access the Web from so-called smart phones.

© Telelogic AB 2002

Page 5: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

<XML> ‘‘eXtesible Markup Language‘‘</XML>

• It is a new markup language developed by the W3C mainly to overcome limitation of HTML.

• A markup language is a mechanism to identify structures in a document.

• XML is really a meta-language for describing markup languages.

• XML is a method for putting structured data in a text file.

• Structured information contains both content (words, pictures etc.)

© Telelogic AB 2002

Page 6: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

XML Document

Like HTML, XML makes use of tags (<...>) and attributes (of the form name=“value“), but while HTML specifies what each tag & attribute means, XML uses tags only to delimit pieces of data, and leaves the interpretation of the data completely to the application that reads it.

Example:<p> in HTML is paragraph<p> in XML may be price, person, property or something else.Conclusion:XML makes essentially two changes to HTML:- It predifines no tags.- It is stricker. XML adopt a very strict syntax. A strict syntax result in

smaller, faster, and lighter browsers.

© Telelogic AB 2002

Page 7: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

A simple XML document

<?xml version=“1.0“?>

<!– This is a comment -- >

<diagram diagType=“CAD“ name=“Diagram1“>

<node >

<label>huhu</label>

<scope/>

<property>ASCET_SD_Project</property>

</node>

</diagram>

© Telelogic AB 2002

Page 8: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

XML document structure

Xml documents are composed of markup and content. There are six kinds of markup that can occur in an XML document:

1. Elements

2. Comments

3. Processing Instructions

4. Entity References

5. CDATA Sections

6. Document Type Declarations (DTD)

© Telelogic AB 2002

Page 9: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Elements

• Elements are the most common form of markup. Delimited by angle brackets, most elements identify the nature of the content they surround. For example

<label>huhu</label>

If element is not empty it begins with a start tag, <label>, and ends with an end tag </label>.

huhu is content of element <label>.

• Some elements may be empty. For example

<scope/>

in which they have no content.

© Telelogic AB 2002

Page 10: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Attributes

Attributes are name-value pairs that occur inside start-tags after the element name. For example,

<diagram diagType=“CAD“ name=“Diagram1“>

diagram element has two attributes. First diagType with value CAD and second name with value Diagram1.

In XML, all attribute values must be quoted.

© Telelogic AB 2002

Page 11: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Comments

• Comments begin with <!– and end with -->

• Comments can contain any data except literal string --. For example,

<!-- This is a comment -->An XML processor is not requred to pass them along to an application,

© Telelogic AB 2002

Page 12: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Processing Instructions

Processing instructions (Pis) are an escape hatch to provide information to an application. Like comments, they are not textually part of the XML document, but the XML processor is required to pass them to an application. It is a mechanism to insert non-XML statements, such as scripts, in the document. Processing instruction have the form

<?name pidata?>

The name, called the PI target, identifies the PI to the application.

PI names beginning with xml are reserved for XML standardization For example,

<?xml version=“1.0“?>

This processing instruction identifies the document as an XML document and indicates the version of XML.

© Telelogic AB 2002

Page 13: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Entity ReferencesThe document in example 1. is self contanied. The document is complete and it can be stored in just one file. Complex documents are split over several files: the text, graphics and so on. XML organizes documents physically in entities. In some cases, entities are equivalent to files.

Entities are inserted in the document throught entity references. It is the name of entity between an ampersand and semicolon. For example, if we have defined entity “srb“ which has value “Serbia“ than the following two lines are equivalent:

<country>&srb;</country>

<country>Serbia</country>

© Telelogic AB 2002

Page 14: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

CDATA Sections

In a document, a CDATA section instructs parser to ignore most markup characters. For example,

<![CDATA[

*p = &q;

b = (i <=3);

]]>

Between the start of the section, <![CDATA[ and the end of the section ]]>, all character data is passed directly to the application, without interpretation.

© Telelogic AB 2002

Page 15: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Document Type Definition <DTD>

• DTD is a mechanism to describe the structure of document.

• DTD is the original modeling language or schema for XML.

• DTD contains four kinds of declarations in XML:

1. Element type declarations

2. Attribute list declarations

3. Entity declarations

4. Notation declarations

© Telelogic AB 2002

Page 16: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Relationship Between the DTD and the XML document

• DTD is a formal description of the document. Software tools can read it and learn about document structure.

• The role of the DTD is to specify which elements are allowed where in the document. So, the main benefits of using DTD are:

1. The XML processor enforces the structure, as defined in the DTD.

2. The DTD can declare default or fixed values for attributes. This might result in smaller document.

• We can validate XML document with an XML processor.

© Telelogic AB 2002

Page 17: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

The DTD Syntax

Listing 2 is diagram introduced in Example 1 but with one difference: It has a new <!DOCTYPE> statement.

<?xml version=“1.0“?>

<!– This is a comment -- >

<!DOCTYPE diagram SYSTEM “examxml.dtd“>

<diagram diagType=“CAD“ name=“Diagram1“>

<node >

<label>huhu</label>

<scope/>

<property>ASCET_SD_Project</property>

</node>

</diagram>

This new statement links document file to the DTD file. Listing 3 is ist DTD.

© Telelogic AB 2002

Page 18: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Example of DTD file

<!ELEMENT diagram (node+)>

<!ATTLIST diagram

diagType CDATA #REQUIRED

name CDATA #REQUIRED

>

<!ELEMENT node (label?, property, scope?)>

<!ELEMENT label (#PCDATA)>

<!ELEMENT scope EMPTY>

<!ELEMENT property (#PCDATA)>

Listing 3. examxml.dtd file.

© Telelogic AB 2002

Page 19: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Document Type Declaration

Document type declaration attaches a DTD to a document:

<!DOCTYPE diagram SYSTEM “examxml.dtd“>

It consist of markup (<!DOCTYPE), the name of top-level element (diagram), the DTD (SYSTEM “examxml.dtd“) and a right angle bracket.

© Telelogic AB 2002

Page 20: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Element Type Declarations (1)

Element type declarations identify the names of elements and the nature of their content:

<!ELEMENT diagram (node+)>

This declaration identifies the element diagram. Ist content model follows the element name. The content model defines what an element may contain. In this case, diagram must contain element node. The plus after node indicates that it may be repeated more than once. Declaration of element node :

<!ELEMENT node (label?, property, scope?)>

indicate that it must contain property exactly once, and may contain label and scope.

© Telelogic AB 2002

Page 21: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Element Type Declarations (2)

In addition to element names, the special symbol #PCDATA is reserved to indicate that element can contain text.

<!ELEMENT label (#PCDATA)>

<!ELEMENT property (#PCDATA)>

Two other content models are possible: EMPTY indicates that the element has no content

<!ELEMENT scope EMPTY>

and consequently no end-tag.

ANY indicates that any content is allowed. For example:

<!ELEMENT scope ANY>

© Telelogic AB 2002

Page 22: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Attribute List Declarations

Attribute list declarations identify which elements may have attributes, what attributes thay may have, what values the attributes may hold, and what value is the default:

<!ATTLIST diagram

diagType CDATA #REQUIRED

name CDATA #REQUIRED

>

In this example diagram element has two attributes diagType and name and this attributes are strings.

© Telelogic AB 2002

Page 23: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Well-Formed and Valid Documents

There are two categories of XML documents:

• WELL-FORMED

• VALID

Well-formed document is written according to the XML syntax. It has right mix of start and end tags, attributes are properly quoted and so on. Well-formed documents have no DTD, so XML processor cannot check their structure. It only checks that they follow the syntax rules.

Valid documents have a DTD. The XML processor will check that the documents are syntactically correct but it also ansures they follow the structure described in the DTD.

The DTD is useful during document creation.

© Telelogic AB 2002

Page 24: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

<XMI>“XML Metadata Interchange</XMI>

XMI is new OMG standard which combines UML and XML.

IBM, Unisys and other industry leaders have created a new open industry standard that combines the benefits of the web based XML standard for defining, validating, and sharing document formats on the web with the benefits of the object-oriented Unified Modeling Language (UML).

XMI specifies an open information interchange model that is intended to give developers working with object technology the ability to exchange programming data over the Internet in a standardized way, thus bringing consistency and compatibility to applications created in collaborative environments. As result we have that development teams using various tools from multiple vendors can still collaborate on applications and use the web to exchange data between tools, applications and repositories.

© Telelogic AB 2002

Page 25: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Open Interchange with XMI

• Different architectures for application interchange:

• 6 bridges written by 6 vendors

Design tools(UML...)

Design tools(UML...)

XMIXMIDevelopmentTools

DevelopmentTools

DatabaseSchema

DatabaseSchema

ReportsReports

RepositoryRepository

Software Assets(C.C++,Java code)

Software Assets(C.C++,Java code)

© Telelogic AB 2002

Page 26: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Current situation• A web of point bridges. N*N-N = 30 bridges by N=6 vendors

Tool5

Tool6

Tool1

Tool4

Tool3

Tool2

© Telelogic AB 2002

Page 27: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

XML and XMIXMI defines sets of rules for using XML in environment of object oriented information applications. We shall demonstrate the feutures of XMI on one example. Example is one XML document for an automobile:

<?xml version=“1.0“?>

<!DOCTYPE Auto SYSTEM “auto.dtd“>

<Auto>

<Make >Ford</Make>

<Model>Mustang</Model>

<Year>1999</Year>

<Color>blue</Color>

<Price>25000</Price>

</Auto>

The corresponding DTD is:

<!ELEMENT Auto (Make, Model, Year, Color, Price)>© Telelogic AB 2002

Page 28: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

XMI Generation Rules

XMI defines two sets of rules that provide open interchange and leverage the capabilities of XML.

1. The DTD generation is used to specify an interchange format.

2. The Document generation creates documents that use a given XMI DTD. Following figure shows the auto model in UML.

Auto

MakeModelYearColorPrice

Auto as a UML class

© Telelogic AB 2002

Page 29: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

XMI DTD generation

An XMI DTD can be generated from the UML model of the auto as shown in following listing:

<!ELEMENT Auto (Auto.Make, Auto.Model, Auto.Year,

Auto.Color, Auto.Price)>

<!ELEMENT Auto.Make (#PCDATA)>

<!ELEMENT Auto.Model (#PCDATA)>

<!ELEMENT Auto.Year (#PCDATA)>

<!ELEMENT Auto.Color (#PCDATA)>

<!ELEMENT Auto.Price (#PCDATA)>

There is one XML element for each class.© Telelogic AB 2002

Page 30: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

XMI Document generation

Following listing shows the auto example as an XMI document using elements from the generated auto XMI DTD.<?xml version=“1.0“ encoding=“UTF-8“?><!DOCTYPE XMI SYSTEM “auto.dtd“><XMI xmi.version=“1.0“> <XMI.header>

<XMI.documentation>An example of an auto.

</XMI.documentation> </XMI.header><XMI.content>

<Auto><Auto.Make >Ford</Auto.Make><Auto.Model>Mustang</Auto.Model><Auto.Year>1999</Auto.Year><Auto.Color>blue</Auto.Color><Auto.Price>25000</Auto.Price>

</Auto></XMI.content></XMI>

Page 31: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

Application interchange of an XMI document using an XMI DTD generated from UML model.

Following example shows that an XMI-generated DTD for UML allows interchange between design tools:

Auto

MakeModelYearColorPrice

Application1

XMIDTD

XMIDoc

Application2

© Telelogic AB 2002

Page 32: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

XSL TransformationXSLT is a language to specify transformation of XML documents. It takes an XML document and transform it into another XML document. XSLT may be used for other general transforms as well. So one XML document can be transformed in HTML, XMI or TCL document.

Sourcedocument

XSLTStyle Sheet

XSLProcessor

ResultingDocument

© Telelogic AB 2002

Page 33: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

The XSL processing sequence

Source document

XSL stylesheet

XML parser

Applytemplates

Write resultTo output

Result file orstream

Source tree

Rules base

Result tree© Telelogic AB 2002

Page 34: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

XML input treeotexport

diagram

node

label scope property

type id labelType itemType scope id name labelType itemType id

node

name node4 name cl scopePhase node4 stereotype

CAD

cl node4name

Diagram1

diagType

name

name class x y width height id

huhu package 688.00 592.00 188.00 70.00 node4

ASCET_SD_Projecthuhu

© Telelogic AB 2002

Page 35: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

XMI output tree

XMI

XMI.content

ModuleProject

Project.CoordinateX ProjectCoordinateY Project.Name Project.label Module.Name Module.label

Xmi.uuid node3

688.00 592.00 huhu huhu haha name

node4 Xmi.uuid

© Telelogic AB 2002

Page 36: Project Automotive Coarse architecture XMI DOORS UML-Suite ASCET-SD © Telelogic AB 2002

The XSL processing sequence

• An XML parser converts a source document into a sorce tree.

• XML parser reads in the XSL style sheet and organize the template rules for efficient lookup.

• XSL processor “walks“ the source tree starting from root node, and attempts to match each node to a corresponding template rule.

• If such a match is made, the template is copied into the result tree.

• Processing continues until the source tree has been completely traversed.

• XSL processor walks the result tree and copies what it finds into an output file or a stream.

© Telelogic AB 2002