Skip to Main Navigation Skip to Content

Automate to Rapidly Prioritize and Quantify Cyber Risk

18. Data Package

The KDM Data Package defines a set of meta-model elements whose purpose is to represent organization of data in the existing software system. This fact of knowledge corresponds to the logical view. It is determined by a data description language. KDM Data model uses the foundation provided by the Code package related to the representations of simple datatypes. KD Data model represents complex data repositories, such as record files, relational databases, structured data stream, XML schemas and documents.

Organization of the Data Package

The Data package consists of the following 11 class diagrams:

  • Data Model
  • Data Inheritance
  • RelationalData
  • ColumnSet
  • StructuredData
  • ContentElements
  • ContentRelations
  • KeyIndex
  • KeyRelations
  • DataActions
  • ExtendedDataElements

The Data Package depends on the following packages:

  • Core
  • kdm
  • Source
  • Code
  • Action

Data Model Class Diagram

The Data Model follows the uniform pattern for KDM models to extend the KDM Framework with specific meta-model elements related to data organization in complex data repositories. Diagram in See – Data Model. shows the classes and associations of the DataModel class diagram.

– Data Model

DataModel Class

The DataModel Class the specific KDM model which corresponds to the logical organization of data of the existing software system, in particular, related to persistent data. DataModel follows the uniform pattern for KDM models.

Superclass

KDMModel

Associations

dataElement :DataElement[0..*] data elements owned by the given DataModel

Constraints

Semantics

Data model is a logical container for the instances of data elements. It is the implementer’s responsibility to arrange the instances of the data elements into one or more DataModels.

AbstractDataElement Class (abstract)

The AbstractDataElement class is an abstract meta-model element that represents the discreet instance of a given data element within a system. For example, a Customer_Number is one type of data element that might be found within a system. Data model defines several specific subclasses of AbstractDataElement, corresponding to common subcategories of data elements.

Superclass

KDMEntity

Associations

abstraction: ActionElement[1] The “abstracted” actions which are owned by the current element
dataRelation:DataRelation[0..*] Data relationships that are originate from this data element
source: SourceRef[0..1] Link to the physical artifact for the given data element

Constraints

Semantics

Abstracted actions are owned by the data model. Usually they provide an abstracted representation of one or more API calls in the code model. Abstracted actions own action relations to elements of code model, as well as some data relations.

Abstracted actions are ordered. The first action is the entry point.

AbstractDataRelationship Class (abstract)

An AbstractDataRelationship class is an abstract superclass of the meta-model elements which represent associations between data elements.

Superclass

KDMRelationship

Constraints

Semantics

AbstractDataRelationship is an abstract class that is used to constrain the subclasses of KDMRelationship in the Data model.

Data Inheritances class diagram

The DataInheritances Diagram shown in See – DataInheritances Diagram. shows how various data classes derive from the Core KDM classes. Each of the Data Package classes within this diagram inherits certain properties from KDM classes defined within the KDM Core Package.

– DataInheritances Diagram

DataResources Class Diagram

The DataResources class diagram provides basic meta-model constructs to represent data elements within the KDM framework. The class diagram shown in See – RelationalData Class Diagram. captures these classes and their relations.

The DataResources diagram defines the framework for various data models. This framework follows the common pattern of the Runtme Resource Layer. Data model defines a generic DataResource meta-model element which represents various resources common to databases, such as a DataEvent and an IndexElement. Data model also defines a generic DataContainer class which represents various data containers, such as a relational schema, a database catalog, an XML schema, and a ColumnSet. DataContainer is a subclass of DataResource. DataContainer owns certain Data resources. Data model includes AbstractDataContent element which is a direct subclass of AbstractDataElement, and not a subclass of DataResource. Subclasses of AbstractContentElement are owned by XMLSchema element.

– RelationalData Class Diagram

DataResource Class (generic)

The DataResource class is a generic meta-model element that represents various database resources, such as DataEvent and IndexElement.

Superclass

AbstractDataElement

Constraints:

DataResource should have at least one stereotype

Semantics

DataResource is a generic meta-model element with under specified semantics. DataResource is a database element that is associated with a certain data container, such as a Schema or a Table. It is a concrete class that can be used as the base element of a new “virtual” meta-model entity types of the data model. This is one of the KDM extension points which can integrate additional language-specific, application-specific or implementer-specific pieces of knowledge into the standard KDM representation. DataResource is more specific than a generic ExtendedDataElement.

DataContainer Class (generic)

The DataContainer class is a generic meta-model element that represents various database containers.

Superclass

DataResource

Associations

dataElement :DataResource[0..*] owned data resources

Semantics

DataContainer is a generic meta-model element with under specified semantics. DataContainer is a database element that is a logical container for Data resource, such as DataEvent or IndexElement. It is a concrete class that can be used as the base element of a new “virtual” meta-model entity types of the data model. This is one of the KDM extension points which can integrate additional language-specific, application-specific or implementer-specific pieces of knowledge into the standard KDM representation. DataContainer is more specific than a generic ExtendedDataElement.

Catalog Class

The Catalog class is the top level container that represents a relational or a hierarchical database.

Superclass

DataContainer

Semantics

RelationalSchema Class

The RelationalSchema class is a relational database schema.

Superclass

DataContainer

Associations

codeElement:CodeItem[0..*] Stored procedures owned by this schema

Semantics

Owned CodeElement represent stored procedures as well as scripts in data description language and data manipulation language, such as T-SQL. Data manipulation performed by embedded data manipulation statements (for example, embedded SQL) from code in some programming language (for example Cobol, or C) is represented via “abstracted data actions”. Abstracted actions represent a “virtual” data manipulation statement which is being implemented through embedded data manipulation constructs (and the corresponding “generated” API calls).

In the situation of the data manipulation and data description scripts that are executed directly by the relational database engine, KDM allows more tight integration of the corresponding CodeItem with the Data Model.

DataEvent Class

The DataEvent class is a meta-model element that represents various events in databases which can trigger execution of stored procedures, the so-called triggers. KDM models database events as “first class citizens” of the KDM representation.

Superclass

DataResource

Attributes

kind :String semantic description of the data event

Semantics

Events are changes in entities or in relations among entities, so that the core KDM elements are entities and relations rather than events. However, KDM represents events as “first class citizens”, although events might have to take on some of the character of entities for this to be acceptable. KDM data event represent various event in databases as KDM entities. Data event are associated with triggers. A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server. DML triggers execute when a user tries to modify data through a data manipulation language (DML) event. DML events are INSERT, UPDATE, or DELETE statements on a table or view. DDL triggers execute in response to a variety of data definition language (DDL) events. These events primarily correspond to CREATE, ALTER, and DROP statements, and certain system stored procedures that perform DDL-like operations. Logon triggers fire in response to the LOGON event that is raised when a user sessions is being established.

As a subclass of AbstractDataElement, a DataEvent can own “abstracted” action element. Trigger is a stored procedure, which is represented as a CallableUnit, owned by a certain RelationalSchema. Trigger is associated with a data event through a Calls relationship, owned by the “abstracted” action of the corresponding data event. DataEvent is owned by a certain DataContainer.

DataAction class

DataAction class follow the pattern of a “resource action” class, specific to the data package. The nature of the action represented by a particular element is designated by its “kind” attribute. Descriptions of the common platform action kind are provided in Appendix 2. Resource Layer actions.

Superclass

AbstractDataElement

Attributes

kind:String represents the nature of the action performed by this element

Associations

implementation:ActionElement[0..*] group association to ActionElement represented by the current DataAction
dataElement:DataEvent[0..*] event elements owned by the current DataAction

Semantics

DataAction represents an “virtual” action element which represents the logical action performed by the runtime platform of the existing software system.

ColumnSet Class Diagram

The ColumnSet class diagram provides basic meta-model elements to define the tables and views of relational databases, segments of hierarchical databases and record files as collections of columns. The class diagram shown in See – ColumnSet Class Diagram. captures these classes and their relations.

– ColumnSet Class Diagram

ColumnSet (generic)

The ColumnSet class is a generic meta-model element which represents collections of columns (also referred to as fields). Columns are modeled as ItemUnits.

Superclass

DataContainer

Associations

itemUnit :ItemUnit[0..*] Individual columns owned by this ColumnSet are represented as data elements

Semantics

ColumnSet corresponds to an ISO/IEC 11404 Table datatype, whose values are collections of values in the product space of one or more field datatypes, such that each value in the product space represents an association among the values of the fields. Although the field datatypes may be infinite, any given value of a table datatype contains a finite number of associations.

KDM defines several concrete subclasses of ColumnSet to represent several common data organizations, such as relational Tables and Views, Record files and Segments of hierarchical databases.

Fields of the Columnset are represented as ItemUnits.

RelationalTable Class

A RelationalTable is a specific subclass of ColumnSet class that represents tables of relational databases.

Superclass

ColumnSet

Semantics

Tables are entities that contain all the data in relational databases. Each table represents a type of data that is meaningful to its users. A table definition is a collection of columns. In tables, data is organized in a row-and-column format similar to a spreadsheet. Each row represents a unique record, and each column represents a field within the record. For example, a table that contains employee data for a company can contain a row for each employee and columns representing employee information such as employee number, name, address, job title, and home telephone number.

Tables in a relational database have the following main components:

  • Columns. Each column represents some attribute of the object modeled by the table, such as a parts table having columns for ID, color, and weight.
  • Rows. Each row represents an individual occurrence of the object modeled by the table. For example, the parts table would have one row for each part carried by the company.

The PlatformResource that corresponds to RelationalTable is DataManager.

Example (T-SQL)

CREATE TABLE products (ID int primary key, name varchar, type varchar)

CREATE TABLE contracts (ID int primary key, product int, revenue decimal, dateSigned date)

CREATE TABLE revenueRecognitions (contract int, amount decimal, recognizedOn date,

PRIMARY KEY(contract, recognizedOn))

CREATE PROCEDURE INSERT_RECOGNITION

(IN contractID int, IN amount decimal, IN recognizedOn date, OUT result int)

LANGUAGE SQL

BEGIN

INSERT INTO revenueRecognitions VALUES( contractID, amount, recognizedOn);

SET result = 1;

END

CREATE TRIGGER reminder1

ON Contracts.revenueRecognitions

AFTER INSERT, UPDATE

AS RAISERROR ('Notify Sales', 16, 10)

GO

<?xml version="1.0" encoding="UTF-8"?>

<kdm:Segment xmi:version="2.1"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:action="http://kdm.omg.org/action"

xmlns:code="http://kdm.omg.org/code"

xmlns:data="http://kdm.omg.org/data"

xmlns:kdm="http://kdm.omg.org/kdm"

xmlns:platform="http://kdm.omg.org/platform" name="Schema Example">

<model xmi:id="id.0" xmi:type="data:DataModel" name="Contracts">

<dataElement xmi:id="id.1" xmi:type="data:RelationalSchema" name="Contracts">

<dataElement xmi:id="id.2" xmi:type="data:RelationalTable" name="products">

<dataElement xmi:id="id.3" xmi:type="data:UniqueKey" name="ID" implementation="id.4"/>

<itemUnit xmi:id="id.4" name="ID" type="id.57"/>

<itemUnit xmi:id="id.5" name="name" type="id.58"/>

<itemUnit xmi:id="id.6" name="type" type="id.58"/>

</dataElement>

<dataElement xmi:id="id.7" xmi:type="data:RelationalTable" name="contracts">

<dataElement xmi:id="id.8" xmi:type="data:UniqueKey" name="ID" implementation="id.11"/>

<dataElement xmi:id="id.9" xmi:type="data:ReferenceKey" implementation="id.12">

<dataRelation xmi:id="id.10" xmi:type="data:KeyRelation" to="id.3" from="id.9"/>

</dataElement>

<itemUnit xmi:id="id.11" name="ID" type="id.57"/>

<itemUnit xmi:id="id.12" name="product" type="id.57"/>

<itemUnit xmi:id="id.13" name="revenue" type="id.59"/>

<itemUnit xmi:id="id.14" name="dateSigned" type="id.60"/>

</dataElement>

<dataElement xmi:id="id.15" xmi:type="data:RelationalTable" name="revenueRecognitions">

<dataElement xmi:id="id.16" xmi:type="data:UniqueKey" implementation="id.25 id.27"/>

<dataElement xmi:id="id.17" xmi:type="data:ReferenceKey" implementation="id.25">

<dataRelation xmi:id="id.18" xmi:type="data:KeyRelation" to="id.8" from="id.17"/>

</dataElement>

<dataElement xmi:id="id.19" xmi:type="data:DataEvent" name="e1" kind="Insert">

<abstraction xmi:id="id.20" name="e1.1" kind="Call">

<actionRelation xmi:id="id.21" xmi:type="action:Calls" to="id.47" from="id.20"/>

</abstraction>

</dataElement>

<dataElement xmi:id="id.22" xmi:type="data:DataEvent" name="e2" kind="Update">

<abstraction xmi:id="id.23" name="e2.1" kind="Call">

<actionRelation xmi:id="id.24" xmi:type="action:Calls" to="id.47" from="id.23"/>

</abstraction>

</dataElement>

<itemUnit xmi:id="id.25" name="contract" type="id.57"/>

<itemUnit xmi:id="id.26" name="amount" type="id.59"/>

<itemUnit xmi:id="id.27" name="recognizedOn" type="id.60"/>

</dataElement>

<codeElement xmi:id="id.28" xmi:type="code:CallableUnit" name="INSERT_RECOGNITIONS" kind="regular">

<entryFlow xmi:id="id.29" to="id.35" from="id.28"/>

<codeElement xmi:id="id.30" xmi:type="code:Signature">

<parameterUnit xmi:id="id.31" name="contractID" type="id.57" pos="1"/>

<parameterUnit xmi:id="id.32" name="amount" type="id.59" pos="2"/>

<parameterUnit xmi:id="id.33" name="recognizedOn" type="id.60" pos="3"/>

<parameterUnit xmi:id="id.34" name="result" type="id.57" kind="byReference" pos="4"/>

</codeElement>

<codeElement xmi:id="id.35" xmi:type="action:ActionElement" name="a1" kind="Insert">

<source xmi:id="id.36" language="SQL"

snippet="INSERT INTO revenueRecognitions VALUES( contractID, amount, recognizedOn);"/>

<actionRelation xmi:id="id.37" xmi:type="action:Reads" to="id.31" from="id.35"/>

<actionRelation xmi:id="id.38" xmi:type="action:Reads" to="id.32" from="id.35"/>

<actionRelation xmi:id="id.39" xmi:type="action:Reads" to="id.33" from="id.35"/>

<actionRelation xmi:id="id.40" xmi:type="data:WritesColumnSet" to="id.15" from="id.35"/>

<actionRelation xmi:id="id.41" xmi:type="data:ProducesDataEvent" to="id.19" from="id.35"/>

</codeElement>

<codeElement xmi:id="id.42" xmi:type="action:ActionElement" name="a2" kind="Assign">

<source xmi:id="id.43" language="SQL" snippet="SET result = 1;"/>

<codeElement xmi:id="id.44" xmi:type="code:Value" name="1"/>

<actionRelation xmi:id="id.45" xmi:type="action:Reads" to="id.44" from="id.42"/>

<actionRelation xmi:id="id.46" xmi:type="action:Writes" to="id.34" from="id.42"/>

</codeElement>

</codeElement>

<codeElement xmi:id="id.47" xmi:type="code:CallableUnit" name="reminder1">

<entryFlow xmi:id="id.48" to="id.49" from="id.47"/>

<codeElement xmi:id="id.49" xmi:type="action:ActionElement" name="a3" kind="Throw">

<codeElement xmi:id="id.50" xmi:type="code:ValueList" name="error">

<valueElement xmi:id="id.51" xmi:type="code:Value"

name="&quot;Notify sales!&quot;" type="id.58"/>

<valueElement xmi:id="id.52" xmi:type="code:Value" name="16" type="id.57"/>

<valueElement xmi:id="id.53" xmi:type="code:Value" name="10" type="id.57"/>

</codeElement>

<actionRelation xmi:id="id.54" xmi:type="action:Throws" to="id.50" from="id.49"/>

</codeElement>

</codeElement>

</dataElement>

</model>

<model xmi:id="id.55" xmi:type="code:CodeModel">

<codeElement xmi:id="id.56" xmi:type="code:LanguageUnit" name="SQL datatypes">

<codeElement xmi:id="id.57" xmi:type="code:IntegerType" name="sql int"/>

<codeElement xmi:id="id.58" xmi:type="code:StringType" name="sql varchar"/>

<codeElement xmi:id="id.59" xmi:type="code:DecimalType" name="sql decimal"/>

<codeElement xmi:id="id.60" xmi:type="code:DateType" name="sql date"/>

<codeElement xmi:id="id.61" xmi:type="code:BooleanType"/>

</codeElement>

</model>

<model xmi:id="id.62" xmi:type="platform:PlatformModel">

<platformElement xmi:id="id.63" xmi:type="platform:ExternalActor">

<abstraction xmi:id="id.64" >

<actionRelation xmi:id="id.65" xmi:type="data:ProducesDataEvent" to="id.19" from="id.64"/>

</abstraction>

</platformElement>

</model>

</kdm:Segment>

RelationalView Class

A RelationalView class is a specific subclass of the ColumnSet class that represents Views of relational databases. A view is a virtual table whose contents are defined by a query. Like a real table, a view consists of a set of named columns and rows of data. Unless indexed, a view does not exist as a stored set of data values in a database. The rows and columns of data come from tables referenced in the query defining the view and are produced dynamically when the view is referenced.

A view acts as a filter on the underlying tables referenced in the view. The query that defines the view can be from one or more tables or from other views in the current or other databases. Distributed queries can also be used to define views that use data from multiple heterogeneous sources. This is useful, for example, if you want to combine similarly structured data from different servers, each of which stores data for a different region of your organization.

Superclass

ColumnSet

Constraints

Semantics

A view can be thought of as either a virtual table or a stored query. Unless a view is indexed, its data is not stored in the database as a distinct object. What is stored in the database is a SELECT statement. The result set of the SELECT statement forms the virtual table returned by the view. A user can use this virtual table by referencing the view name in SQL statements the same way a table is referenced. Usually there are no restrictions on querying through views and few restrictions on modifying data through them.

In KDM, a RelationalView owns ItemUnits which correspond to the fields of the virtual table. An “abstracted” action of the View can stored the corresponding SELECT statement.

DataSegment Class

A DataSegment class is meta-model element that represents a segment of a hierarchical database, such as IMS.

Superclass

ColumnSet

Constraints

Semantics

A hierarchical database is a kind of database management system that links records together in a tree data structure such that each record type has only one owner. Hierarchical structures were widely used in the first mainframe database management systems. However, due to their restrictions, they often cannot be used to relate structures that exist in the real world.

A database segment defines the fields for a set of segment instances similar to the way a relational table defines columns for a set of rows in a table. In this way, segments relate to relational tables, and fields in a segment relate to columns in a relational table.

Example (IMS):

DLR_PCB1 PCB TYPE=DB,DBDNAME=DEALERDB,PROCOPT=GO,KEYLEN=42

SENSEG NAME=DEALER,PARENT=0

SENSEG NAME=MODEL,PARENT=DEALER

SENSEG NAME=ORDER,PARENT=MODEL

SENSEG NAME=SALES,PARENT=MODEL

SENSEG NAME=STOCK,PARENT=MODEL

PSBGEN PSBNAME=DLR_PSB,MAXQ=200,LANG=JAVA

END

DBD NAME=DEALERDB,ACCESS=(HDAM,OSAM),RMNAME=(DFSHDC40.1.10)

SEGM NAME=DEALER,PARENT=0,BYTES=94,

FIELD NAME=(DLRNO,SEQ,U),BYTES=4,START=1,TYPE=C

FIELD NAME=DLRNAME,BYTES=30,START=5,TYPE=C

SEGM NAME=MODEL,PARENT=DEALER,BYTES=43

FIELD NAME=(MODTYPE,SEQ,U),BYTES=2,START=1,TYPE=C

FIELD NAME=MAKE,BYTES=10,START=3,TYPE=C

FIELD NAME=MODEL,BYTES=10,START=13,TYPE=C

FIELD NAME=YEAR,BYTES=4,START=23,TYPE=C

FIELD NAME=MSRP,BYTES=5,START=27,TYPE=P

SEGM NAME=ORDER,PARENT=MODEL,BYTES=127

FIELD NAME=(ORDNBR,SEQ,U),BYTES=6,START=1,TYPE=C

FIELD NAME=LASTNME,BYTES=25,START=50,TYPE=C

FIELD NAME=FIRSTNME,BYTES=25,START=75,TYPE=C

SEGM NAME=SALES,PARENT=MODEL,BYTES=113

FIELD NAME=(SALDATE,SEQ,U),BYTES=8,START=1,TYPE=C

FIELD NAME=LASTNME,BYTES=25,START=9,TYPE=C

FIELD NAME=FIRSTNME,BYTES=25,START=34,TYPE=C

FIELD NAME=STKVIN,BYTES=20,START=94,TYPE=C

SEGM NAME=STOCK,PARENT=MODEL,BYTES=62

FIELD NAME=(STKVIN,SEQ,U),BYTES=20,START=1,TYPE=C

FIELD NAME=COLOR,BYTES=10,START=37,TYPE=C

FIELD NAME=PRICE,BYTES=5,START=47,TYPE=C

FIELD NAME=LOT,BYTES=10,START=52,TYPE=C

DBDGEN

FINISH

END

<?xml version="1.0" encoding="UTF-8"?>

<kdm:Segment xmi:version="2.1"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:code="http://kdm.omg.org/code"

xmlns:data="http://kdm.omg.org/data"

xmlns:kdm="http://kdm.omg.org/kdm" name="IMS Example">

<model xmi:id="id.0" xmi:type="data:DataModel">

<dataElement xmi:id="id.1" xmi:type="data:Catalog" name="DEALERDB">

<dataElement xmi:id="id.2" xmi:type="data:DataSegment" name="Dealer">

<dataElement xmi:id="id.3" xmi:type="data:DataSegment" name="Model">

<dataElement xmi:id="id.4" xmi:type="data:DataSegment" name="Order">

<dataElement xmi:id="id.5" xmi:type="data:UniqueKey" implementation="id.6"/>

<itemUnit xmi:id="id.6" name="ORDNBR" type="id.30" size="2"/>

<itemUnit xmi:id="id.7" name="LASTNME" type="id.30" size="25"/>

<itemUnit xmi:id="id.8" name="FIRSTNME" type="id.30" size="25"/>

</dataElement>

<dataElement xmi:id="id.9" xmi:type="data:DataSegment" name="Sales">

<dataElement xmi:id="id.10" xmi:type="data:UniqueKey" implementation="id.11"/>

<itemUnit xmi:id="id.11" name="SALDATE" type="id.30" size="8"/>

<itemUnit xmi:id="id.12" name="LASTNME" type="id.30" size="25"/>

<itemUnit xmi:id="id.13" name="FIRSTNME" type="id.30" size="25"/>

<itemUnit xmi:id="id.14" name="STKVIN" type="id.30" size="20"/>

</dataElement>

<dataElement xmi:id="id.15" xmi:type="data:DataSegment" name="Stock">

<dataElement xmi:id="id.16" xmi:type="data:UniqueKey" implementation="id.17"/>

<itemUnit xmi:id="id.17" name="STKVIN" type="id.30" size="20"/>

<itemUnit xmi:id="id.18" name="COLOR" type="id.30" size="10"/>

<itemUnit xmi:id="id.19" name="PRICE" type="id.30" size="5"/>

<itemUnit xmi:id="id.20" name="LOT" type="id.30" size="10"/>

</dataElement>

<dataElement xmi:id="id.21" xmi:type="data:UniqueKey" implementation="id.22"/>

<itemUnit xmi:id="id.22" name="MODTYPE" type="id.30" size="2"/>

<itemUnit xmi:id="id.23" name="MAKE" size="10"/>

<itemUnit xmi:id="id.24" name="YEAR" size="4"/>

<itemUnit xmi:id="id.25" name="MSRP" type="id.31" size="5"/>

</dataElement>

<dataElement xmi:id="id.26" xmi:type="data:UniqueKey" implementation="id.27"/>

<itemUnit xmi:id="id.27" name="DRLNO" type="id.30" size="4"/>

<itemUnit xmi:id="id.28" name="DLRNAME" size="30"/>

</dataElement>

</dataElement>

</model>

<model xmi:id="id.29" xmi:type="code:CodeModel" name="Common IMS datatypes">

<codeElement xmi:id="id.30" xmi:type="code:StringType" name="IMS type c"/>

<codeElement xmi:id="id.31" xmi:type="code:DecimalType" name="IMS type packeddecimal"/>

</model>

</kdm:Segment>

RecordFile Class

The RecordFile class is a meta-model element which represents files as a set of records. RecordFile can be indexed or sequential.

Superclass

ColumnSet

Constraints

Semantics

In a non-relational database system, a record is an entry in a file, consisting of individual elements of information, which together provide full details about an aspect of the information needed by the system. Individual elements are held in fields and all records are held in files. An example of a record might be an employee. Every detail of the employee, for example, date of birth, department code, or full names will be found in a number of fields. A file is a set of records, where each record is a sequence of fields. A sequential file is a computer file storage format in which one record follows another. Records can be accessed sequentially only. It is required with magnetic tape. An indexed file owns one or more indexes that allow records to be retrieved by a specific value or in a particular sort order.

Example (cobol):

The following example illustrates the representation of RecordFile. The CodeModel of this example is incomplete as it focuses on the DataModel, and well as combined representation involving the CodeMode, DataModel, PlatformModel and EventModel.

FILE-CONTROL.

SELECT SEQUENTIAL-FILE ASSIGN TO 'A:\SEQ.DAT'

ORGANIZATION IS LINE SEQUENTIAL.

SELECT INDEXED-FILE

ASSIGN TO 'A:\INDMAST.DAT'

ORGANIZATION IS INDEXED

ASSESS IS SEQUENTIAL

RECORD KEY IS IND-SOC-SEC-NUM

FILE STATUS IS INDEXED-STATUS-BYTES.

FILE SECTION.

FD SEQUENTIAL FILE

RECORD COTNAINS 39 CHARACTERS

DATA RECORD IS SEQUENTIAL-RECORD.

01 SEQUENTIAL-RECORD.

05 SEQ-SOC-SEC-NUM PIC X(9).

05 SEQ-REST-OF-RECORD PIC X(30).

FD INDEXED-FILE

RECORD CONTAINS 39 CHARACTERS

DATA RECORD IS INDEXED-RECORD.

01 INDEXED-RECORD.

05 IND-SOC-SEC-NUM PIC X(9).

05 IND-REST-OF-RECORD PIC X(30).

PROCEDURE DIVISION.

0010-UPDATE-MASTER-FILE.

OPEN INPUT SEQUENTIAL-FILE

OUTPUT INDEXED-FILE.

PERFROM UNTIL END-OF-FILE-SWITCH = 'YES'

READ SEQUENTIAL-FILE

AT END

MOVE 'YES' TO END-OF-FILE-SWITCH

NOT AT END

MOVE SEQ-SOC-SEC-NUM TO IND-SOC-SEC-NUM

MOVE SEQ-REST-OF-RECORD TO IND-REST-OF-RECORD

WRITE INDEXED-RECORD

INVALID KEY PERFORM 0020-EXPLAIN-WRITE-ERROR

END-WRITE

END-READ

END-PERFORM.

CLOSE SEQUENTIAL-FILE

INDEXED-FILE.

<?xml version="1.0" encoding="UTF-8"?>

<kdm:Segment xmi:version="2.1"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:action="http://kdm.omg.org/action"

xmlns:code="http://kdm.omg.org/code"

xmlns:data="http://kdm.omg.org/data"

xmlns:event="http://kdm.omg.org/event"

xmlns:kdm="http://kdm.omg.org/kdm"

xmlns:platform="http://kdm.omg.org/platform" name="RecordFile example">

<model xmi:id="id.0" xmi:type="data:DataModel">

<dataElement xmi:id="id.1" xmi:type="data:RecordFile" name="SEQUENTIAL-FILE">

<itemUnit xmi:id="id.2" name="SEQ-SOC-SEC-NUM" type="id.115" ext="PIC X(9)" size="9"/>

<itemUnit xmi:id="id.3" name="SEQ-REST-OF-RECORD" type="id.115" ext="PIC X(30)" size="30"/>

</dataElement>

<dataElement xmi:id="id.4" xmi:type="data:RecordFile" name="INDEXED-FILE">

<dataElement xmi:id="id.5" xmi:type="data:UniqueKey" implementation="id.7"/>

<dataElement xmi:id="id.6" xmi:type="data:Index" implementation="id.7"/>

<itemUnit xmi:id="id.7" name="IND-SOC-SEC-NUM" type="id.115" ext="PIC X(9)" size="9"/>

<itemUnit xmi:id="id.8" name="IND-REST-OF-RECORD" type="id.115" ext="PIC X(30)" size="30"/>

</dataElement>

<dataElement xmi:id="id.9" xmi:type="data:DataAction" name="da1" kind="open" implementation="id.44">

<abstraction xmi:id="id.10" name="da1" kind="open">

<actionRelation xmi:id="id.11" xmi:type="data:ManagesData" to="id.1" from="id.10"/>

<actionRelation xmi:id="id.12" xmi:type="platform:ManagesResource" to="id.75" from="id.10"/>

</abstraction>

</dataElement>

<dataElement xmi:id="id.13" xmi:type="data:DataAction" name="da2" kind="open" implementation="id.44">

<abstraction xmi:id="id.14" name="da2" kind="open">

<actionRelation xmi:id="id.15" xmi:type="platform:ManagesResource" to="id.79" from="id.14"/>

<actionRelation xmi:id="id.16" xmi:type="data:ManagesData" to="id.4" from="id.14"/>

</abstraction>

</dataElement>

<dataElement xmi:id="id.17" xmi:type="data:DataAction" name="da3" kind="read" implementation="id.47">

<abstraction xmi:id="id.18" name="da3" kind="read">

<actionRelation xmi:id="id.19" xmi:type="data:ReadsColumnSet" to="id.1" from="id.18"/>

<actionRelation xmi:id="id.20" xmi:type="action:Writes" to="id.2" from="id.18"/>

<actionRelation xmi:id="id.21" xmi:type="action:Writes" to="id.3" from="id.18"/>

<actionRelation xmi:id="id.22" xmi:type="platform:ReadsResource" to="id.75" from="id.18"/>

</abstraction>

<dataElement xmi:id="id.23" name="at end" kind="EOF">

<abstraction xmi:id="id.24" name="ae1">

<actionRelation xmi:id="id.25" xmi:type="action:ExceptionFlow" to="id.50" from="id.24"/>

</abstraction>

</dataElement>

<dataElement xmi:id="id.26" name="not at end" kind="NOT EOF">

<abstraction xmi:id="id.27" name="nae1">

<actionRelation xmi:id="id.28" xmi:type="action:Flow" to="id.53" from="id.27"/>

</abstraction>

</dataElement>

</dataElement>

<dataElement xmi:id="id.29" xmi:type="data:DataAction" name="da4" kind="write"

implementation="id.59">

<abstraction xmi:id="id.30" name="da4" kind="write">

<actionRelation xmi:id="id.31" xmi:type="action:Reads" to="id.7" from="id.30"/>

<actionRelation xmi:id="id.32" xmi:type="action:Reads" to="id.8" from="id.30"/>

<actionRelation xmi:id="id.33" xmi:type="data:WritesColumnSet" to="id.4" from="id.30"/>

<actionRelation xmi:id="id.34" xmi:type="platform:WritesResource" to="id.79" from="id.30"/>

</abstraction>

<dataElement xmi:id="id.35" name="invalid key" kind="INVALID KEY">

<abstraction xmi:id="id.36" name="ik1">

<actionRelation xmi:id="id.37" xmi:type="action:ExceptionFlow" to="id.62" from="id.36"/>

</abstraction>

</dataElement>

</dataElement>

<dataElement xmi:id="id.38" xmi:type="data:DataAction" name="da5" kind="close">

<abstraction xmi:id="id.39" name="da5" kind="close"/>

</dataElement>

<dataElement xmi:id="id.40" xmi:type="data:DataAction" name="da6" kind="close">

<abstraction xmi:id="id.41" name="da5" kind="close"/>

</dataElement>

</model>

<model xmi:id="id.42" xmi:type="code:CodeModel">

<codeElement xmi:id="id.43" xmi:type="code:CodeAssembly">

<codeElement xmi:id="id.44" xmi:type="action:ActionElement" name="a0" kind="open">

<source xmi:id="id.45" language="Cobol"

snippet="OPEN INPUT SEQUENTIAL-FILE OUTPUT INDEXED-FILE."/>

<actionRelation xmi:id="id.46" xmi:type="action:Flow" to="id.47" from="id.44"/>

</codeElement>

<codeElement xmi:id="id.47" xmi:type="action:ActionElement" name="a1" kind="read">

<source xmi:id="id.48" language="Cobol" snippet="READ SEQUENTIAL-FILE"/>

<actionRelation xmi:id="id.49" xmi:type="action:Flow" to="id.53" from="id.47"/>

</codeElement>

<codeElement xmi:id="id.50" xmi:type="action:ActionElement" name="a2">

<source xmi:id="id.51" language="Cobol" snippet="MOVE 'YES' TO END-OF-FILE-SWITCH"/>

<actionRelation xmi:id="id.52" xmi:type="action:Flow" to="id.64" from="id.50"/>

</codeElement>

<codeElement xmi:id="id.53" xmi:type="action:ActionElement" name="a3">

<source xmi:id="id.54" language="Cobol" snippet="MOVE SEQ-SOC-SEC-NUM TO IND-SOC-SEQ-NUM"/>

<actionRelation xmi:id="id.55" xmi:type="action:Flow" to="id.56" from="id.53"/>

</codeElement>

<codeElement xmi:id="id.56" xmi:type="action:ActionElement" name="a4">

<source xmi:id="id.57" language="Cobol" snippet="MOVE SEQ-REST-OF-RECORD TO IND-REST-OF-RECORD"/>

<actionRelation xmi:id="id.58" xmi:type="action:Flow" to="id.59" from="id.56"/>

</codeElement>

<codeElement xmi:id="id.59" xmi:type="action:ActionElement" name="a5" kind="call">

<source xmi:id="id.60" language="Cobol" snippet="WRITE INDEXED-RECORD"/>

<actionRelation xmi:id="id.61" xmi:type="action:Flow" to="id.64" from="id.59"/>

</codeElement>

<codeElement xmi:id="id.62" xmi:type="action:ActionElement" name="a6" kind="write">

<source xmi:id="id.63" language="Cobol" snippet="PERFORM 0020-EXPLAIN-WRITE-ERROR"/>

</codeElement>

<codeElement xmi:id="id.64" xmi:type="action:ActionElement" name="a7" kind="write">

<source xmi:id="id.65" language="Cobol" snippet="UNTIL END-OF-FILE-SWITCH = 'YES'"/>

<actionRelation xmi:id="id.66" xmi:type="action:FalseFlow" to="id.47" from="id.64"/>

<actionRelation xmi:id="id.67" xmi:type="action:TrueFlow" to="id.68" from="id.64"/>

</codeElement>

<codeElement xmi:id="id.68" xmi:type="action:ActionElement" name="a8" kind="close">

<source xmi:id="id.69" language="Cobol" snippet="Close SEQUENTIAL-FILE INDEXED-FILE."/>

</codeElement>

</codeElement>

</model>

<model xmi:id="id.70" xmi:type="platform:PlatformModel">

<platformElement xmi:id="id.71" xmi:type="platform:DeployedSoftwareSystem" groupedComponent="id.73"/>

<platformElement xmi:id="id.72" xmi:type="platform:Machine">

<deployedComponent xmi:id="id.73" groupedCode="id.43"/>

<deployedResource xmi:id="id.74" >

<platformElement xmi:id="id.75" xmi:type="platform:StreamResource">

<abstraction xmi:id="id.76" name="ra1" kind="">

<actionRelation xmi:id="id.77" xmi:type="data:HasContent" to="id.1" from="id.76"/>

<actionRelation xmi:id="id.78" xmi:type="event:HasState" to="id.89" from="id.76"/>

</abstraction>

</platformElement>

<platformElement xmi:id="id.79" xmi:type="platform:FileResource">

<abstraction xmi:id="id.80" name="ra2" kind="">

<actionRelation xmi:id="id.81" xmi:type="data:HasContent" to="id.4" from="id.80"/>

</abstraction>

</platformElement>

</deployedResource>

</platformElement>

<platformElement xmi:id="id.82" xmi:type="platform:PlatformAction" name="pa1" kind="open">

<abstraction xmi:id="id.83" name="pa1">

<actionRelation xmi:id="id.84" xmi:type="platform:ManagesResource" to="id.75" from="id.83"/>

</abstraction>

</platformElement>

<platformElement xmi:id="id.85" xmi:type="platform:PlatformAction" name="pa2" kind="open">

<abstraction xmi:id="id.86" name="pa2">

<actionRelation xmi:id="id.87" xmi:type="platform:ManagesResource" to="id.79" from="id.86"/>

</abstraction>

</platformElement>

</model>

<model xmi:id="id.88" xmi:type="event:EventModel">

<eventElement xmi:id="id.89" xmi:type="event:EventResource" name="sequential-file">

<eventElement xmi:id="id.90" xmi:type="event:State" name="closed">

<eventElement xmi:id="id.91" xmi:type="event:Transition" name="tr1">

<eventRelation xmi:id="id.92" xmi:type="event:ConsumesEvent" to="id.110" from="id.91"/>

<eventRelation xmi:id="id.93" xmi:type="event:NextState" to="id.103" from="id.91"/>

<eventRelation xmi:id="id.94" xmi:type="event:NextState" to="id.95" from="id.91"/>

</eventElement>

</eventElement>

<eventElement xmi:id="id.95" xmi:type="event:State" name="opened.not at end">

<eventElement xmi:id="id.96" xmi:type="event:Transition" name="tr2">

<eventRelation xmi:id="id.97" xmi:type="event:ConsumesEvent" to="id.111" from="id.96"/>

<eventRelation xmi:id="id.98" xmi:type="event:NextState" to="id.103" from="id.96"/>

<eventRelation xmi:id="id.99" xmi:type="event:NextState" to="id.95" from="id.96"/>

</eventElement>

<eventElement xmi:id="id.100" xmi:type="event:Transition" name="tr3">

<eventRelation xmi:id="id.101" xmi:type="event:ConsumesEvent" to="id.112" from="id.100"/>

<eventRelation xmi:id="id.102" xmi:type="event:NextState" to="id.90" from="id.100"/>

</eventElement>

</eventElement>

<eventElement xmi:id="id.103" xmi:type="event:State" name="opened.at end">

<eventElement xmi:id="id.104" xmi:type="event:Transition" name="tr4">

<eventRelation xmi:id="id.105" xmi:type="event:ConsumesEvent" to="id.112" from="id.104"/>

<eventRelation xmi:id="id.106" xmi:type="event:NextState" to="id.90" from="id.104"/>

</eventElement>

<eventElement xmi:id="id.107" xmi:type="event:Transition" name="tr5">

<eventRelation xmi:id="id.108" xmi:type="event:ConsumesEvent" to="id.111" from="id.107"/>

<eventRelation xmi:id="id.109" xmi:type="event:NextState" to="id.103" from="id.107"/>

</eventElement>

</eventElement>

<eventElement xmi:id="id.110" xmi:type="event:Event" name="open" kind="open"/>

<eventElement xmi:id="id.111" xmi:type="event:Event" name="read"/>

<eventElement xmi:id="id.112" xmi:type="event:Event" name="close"/>

</eventElement>

</model>

<model xmi:id="id.113" xmi:type="code:CodeModel">

<codeElement xmi:id="id.114" xmi:type="code:LanguageUnit">

<codeElement xmi:id="id.115" xmi:type="code:StringType" name="X"/>

</codeElement>

</model>

</kdm:Segment>

KeyIndex Class Diagram

The KeyIndex class diagram collects together classes and associations of the Data package. They provide basic meta-model constructs to define the various data related relationships.

The class diagram shown in See – KeyIndex Class Diagram. captures these classes and their relations.

– KeyIndex Class Diagram

IndexElement Class (generic)

IndexElement class is a generic meta-model element that defines the common properties of the index items and key items of persistent data stores. IndexElement uses the KDM group mechanism. IndexElement is subclassed by concrete classes with more precise semantics. IndexElement is itself a concrete class that can be used as an extended meta-model element with an appropriate stereotype to represent situations that do not fit into the semantics of the subclasses of the IndexElement.

Superclass

DataResource

Associations

implementation : ItemUnit[1] The set of ItemUnits that constitute the index

Constraints:

Index owned by a data element should group elements which are owned by that data element

IndexElement should have a stereotype

Semantics

IndexElement defines a group of data elements that can be used as an endpoint for various data relationships.

UniqueKey Class

A UniqueKey is meta-model element that represents primary keys in relational database table, segments of hierarchical databases or indexed files. UniqueKey is a group of columns.

Superclass

IndexElement

Constraints

UniqueKey owned by a data element should group ItemUnit elements which are owned by that data element

Semantics

A UniqueKey represents the primary key to a certain table or relational database or certain fields in an indexed file. A primary key is one or more columns whose values uniquely identify every row in a table or every record in an indexed file. Normally an index always exists on the primary key.

ReferenceKey Class

A ReferenceKey is meta-model element that represents foreign key in databases or indexed files. ReferenceKey is a group of columns.

Superclass

IndexElement

Constraints

ReferenceKey owned by a data element should group ItemUnit elements which are owned by that data element

Semantics

A foreign key is the primary key of one data structure that is placed into a related data structure to represent a relationship among those structures. Foreign keys resolve relationships, and support navigation among data structures. ReferenceKey is a group of one or more columns in a relational database table or segment of a hierarchical database or an indexed file that implements a many-to-one relationship that the table, segment or file in question has with another table, segment or file or with itself.

Index Class

An Index class is a meta-model element that represents an index to a relational or hierarchical database or an indexed file.

Superclass

IndexElement

Constraints

Index owned by a data element should group ItemUnit elements which are owned by that data element

Semantics

Index is a mechanism to locate and access data within a database. An index may quote one or more columns and be a means of enforcing uniqueness on their values.

Key Relations class diagram

See – KeyRelations Class Diagram. depicts the key relations within the Data Package. A Key is a way to access data without reading through an entire data structure sequentially.

– KeyRelations Class Diagram

A KeyRelation class associates a ReferenceKey in one data container, with a UniqueKey in another container which means that there is one and only one key value for that data.

KeyRelationship Class

A KeyRelationship is a meta-model element that represents an association between a ReferenceKey with the corresponding UniqueKey.

Superclass

AbstractDataRelationship

Associations

from : ReferenceKey[1] foreign key in a certain table, segment or file
to: UniqueKey[1] primary key is a certain table, segment or key

Constraints

Semantics

ReferenceKey is a group of one or more columns in a relational database table or segment of a hierarchical database or an indexed file that implements a many-to-one relationship that the table, segment or file in question has with another table, segment or file or with itself.

DataActions class diagram

DataAction class diagram defines a set of meta-model elements whose purpose is to represent semantic associations between the elements of data models, as well as associations between data models and other KDM models. See – DataActions Class Diagram. depicts the key classes and association of the DataAction diagram. Data actions follow the common pattern of “resource actions”. Each data action is a “projection” of one or more action elements of the Code Model that use some API to the runtime platform to manage data resources. Each data action is linked back to the corresponding action elements from one or more code models through the “implementation” association. Each data action may own one or more “abstracted” actions, which are used to model detailed resource related semantics.

– DataActions Class Diagram

ReadsColumnSet class

ReadsColumnSet class follows the pattern of a “resource action relationship”. It represents various types of accesses to data resources where there is a flow of data from the resource. ReadsColumnSet relationship is similar to Reads relationship from Action Package. The nature of the operation on the resource is represented by the “kind” attribute of the DataAction that owns this relationship through the “abstracted” action container property.

Superclass

Action::AbstractActionRelationship

Associations:

from:ActionElement[1] “abstracted” action owned by some resource
to:ColumnSet[1] the data resource being accessed

Constraints:

This relationship should not be used in Code models

Semantics

ReadsColumnSet represents a data flow from a certain ColumnSet element to a data action.

WritesColumnSet class

WritesColumnSet class follows the pattern of a “resource action relationship”. It represents various types of accesses to user interface resources where there is a flow of data to the resource. WritesColumnSet relationship is similar to Writes relationship from Action Package. The nature of the operation on the resource is represented by the “kind” attribute of the DataAction that owns this relationship through the “abstracted” action container property.

Superclass

Action::AbstractActionRelationship

Associations:

from:ActionElement[1] “abstracted” action owned by some resource
to:ColumnSet[1] the data resource being accessed

Constraints:

This relationship should not be used in Code models

Semantics

WritesColumnSet represents a data flow from a data action to a certain ColumnSet element.

ManagesData class

Manages class follows the pattern of a “resource action relationship”. It represents various types of accesses to user interface resources where there is no flow of data to or from the resource. ManagesData relationship is similar to Addresses relationship from Action Package. The nature of the operation on the resource is represented by the “kind” attribute of the DataAction that owns this relationship through the “abstracted” action container property.

Superclass

Action::AbstractActionRelationship

Associations:

from:ActionElement[1] “abstracted” action owned by some resource
to:AbstractDataElement[1] the data resource being accessed

Constraints:

This relationship should not be used in Code models

Semantics

Manages represents a certain change of state to a certain AbstractDataElement.

HasContent class

HasContent class follows the pattern of a “resource action relationship”. HasContent is a structural relationship. It does not represent resource manipulations. HasContent relationship uses the “abstracted” action container mechanism to provide certain capabilities to other Resource Layer packages. “HasContent” relationship makes it possible to associate an element of a data model with any resource.

Superclass

Action::AbstractActionRelationship

Associations:

from:ActionElement[1] “abstracted” action owned by some resource
to:AbstractDataElement[1] the data resource being accessed

Constraints:

This relationship should not be used in Code models

Semantics

HasContent represents an association between any KDM resource or behavior abstraction element (through the “abstracted” action mechanism) and the data element, describing the data organization related to this element.

Example (Java, embedded SQL, JDBC):

CREATE TABLE products (ID int primary key, name varchar, type varchar)

CREATE TABLE contracts (ID int primary key, product int, revenue decimal, dateSigned date)

final String findContractStatement=

"SELECT * FROM contracts c, products p" +

"WHERE ID = ? AND c.product = p.ID ";

public void calculateRecognitions( long contractID ) {

Connection db=DriverManager.getConnection("jdbc:odbc:foobar","sunny","");

PreparedStatement stmt=db.prepareStatement(findContractStatement);

stmt.setLong(1,contractID);

ResultSet contracts=stmt.executeQuery();

contracts.next();

Money totalRevenue=Money.dollars(contracts.getBigDecimal("revenue"));

MfDate recognitionDate=new MfDate(contracts.getDate("dateSigned"));

}

<?xml version="1.0" encoding="UTF-8"?>

<kdm:Segment xmi:version="2.1"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:action="http://kdm.omg.org/action"

xmlns:code="http://kdm.omg.org/code"

xmlns:data="http://kdm.omg.org/data"

xmlns:kdm="http://kdm.omg.org/kdm"

xmlns:platform="http://kdm.omg.org/platform" name="Data Example">

<model xmi:id="id.0" xmi:type="data:DataModel" name="Contracts">

<dataElement xmi:id="id.1" xmi:type="data:RelationalSchema" name="Contracts">

<dataElement xmi:id="id.2" xmi:type="data:RelationalTable" name="products">

<dataElement xmi:id="id.3" xmi:type="data:UniqueKey" name="ID" implementation="id.4"/>

<itemUnit xmi:id="id.4" name="ID" type="id.172"/>

<itemUnit xmi:id="id.5" name="name" type="id.173"/>

<itemUnit xmi:id="id.6" name="type" type="id.173"/>

</dataElement>

<dataElement xmi:id="id.7" xmi:type="data:RelationalTable" name="contracts">

<dataElement xmi:id="id.8" xmi:type="data:UniqueKey" name="ID" implementation="id.11"/>

<dataElement xmi:id="id.9" xmi:type="data:ReferenceKey" implementation="id.12">

<dataRelation xmi:id="id.10" xmi:type="data:KeyRelation" to="id.3" from="id.9"/>

</dataElement>

<itemUnit xmi:id="id.11" name="ID" type="id.172"/>

<itemUnit xmi:id="id.12" name="product" type="id.172"/>

<itemUnit xmi:id="id.13" name="revenue" type="id.174"/>

<itemUnit xmi:id="id.14" name="dateSigned" type="id.175"/>

</dataElement>

</dataElement>

<dataElement xmi:id="id.15" xmi:type="data:DataAction" name="d1" kind="Connect"

implementation="id.79">

<abstraction xmi:id="id.16" name="da1" kind="Connect">

<actionRelation xmi:id="id.17" xmi:type="action:Reads" to="id.80" from="id.16"/>

<actionRelation xmi:id="id.18" xmi:type="action:Reads" to="id.81" from="id.16"/>

<actionRelation xmi:id="id.19" xmi:type="action:Reads" to="id.82" from="id.16"/>

<actionRelation xmi:id="id.20" xmi:type="platform:ManagesResource" to="id.67"/>

</abstraction>

</dataElement>

<dataElement xmi:id="id.21" xmi:type="data:DataAction" name="d2" kind="Select"

implementation="id.90 id.96 id.104">

<source xmi:id="id.22" language="sql"

snippet="&quot;select * from contracts c, products p where ID = ? and c.product=p.ID &quot;"/>

<abstraction xmi:id="id.23" name="w1" kind="Equal">

<codeElement xmi:id="id.24" xmi:type="code:StorableUnit" name="t1" type="id.176" kind="register"/>

<actionRelation xmi:id="id.25" xmi:type="action:Reads" to="id.11" from="id.23"/>

<actionRelation xmi:id="id.26" xmi:type="action:Reads" to="id.77" from="id.23"/>

<actionRelation xmi:id="id.27" xmi:type="action:Writes" to="id.24" from="id.23"/>

<actionRelation xmi:id="id.28" xmi:type="action:Flow" to="id.29"/>

</abstraction>

<abstraction xmi:id="id.29" name="w2" kind="Equal">

<codeElement xmi:id="id.30" xmi:type="code:StorableUnit" name="t2" type="id.176" kind="register"/>

<actionRelation xmi:id="id.31" xmi:type="action:Reads" to="id.12" from="id.29"/>

<actionRelation xmi:id="id.32" xmi:type="action:Reads" to="id.4" from="id.29"/>

<actionRelation xmi:id="id.33" xmi:type="action:Writes" from="id.29"/>

<actionRelation xmi:id="id.34" xmi:type="action:Flow" to="id.35" from="id.29"/>

</abstraction>

<abstraction xmi:id="id.35" name="w3" kind="And">

<codeElement xmi:id="id.36" xmi:type="code:StorableUnit" name="t3" type="id.176" kind="register"/>

<actionRelation xmi:id="id.37" xmi:type="action:Reads" to="id.24" from="id.35"/>

<actionRelation xmi:id="id.38" xmi:type="action:Reads" to="id.30"/>

<actionRelation xmi:id="id.39" xmi:type="action:Flow" to="id.40" from="id.35"/>

</abstraction>

<abstraction xmi:id="id.40" name="w4" kind="Condition">

<actionRelation xmi:id="id.41" xmi:type="action:TrueFlow" to="id.42" from="id.40"/>

</abstraction>

<abstraction xmi:id="id.42" name="s1" kind="Select">

<actionRelation xmi:id="id.43" xmi:type="data:ReadsColumnSet" to="id.7" from="id.42"/>

<actionRelation xmi:id="id.44" xmi:type="action:Reads" to="id.11" from="id.42"/>

<actionRelation xmi:id="id.45" xmi:type="action:Reads" to="id.12" from="id.42"/>

<actionRelation xmi:id="id.46" xmi:type="action:Reads" to="id.13" from="id.42"/>

<actionRelation xmi:id="id.47" xmi:type="action:Reads" to="id.14" from="id.42"/>

<actionRelation xmi:id="id.48" xmi:type="data:ReadsColumnSet" to="id.2"/>

<actionRelation xmi:id="id.49" xmi:type="action:Reads" to="id.4" from="id.42"/>

<actionRelation xmi:id="id.50" xmi:type="action:Reads" to="id.5" from="id.42"/>

<actionRelation xmi:id="id.51" xmi:type="action:Reads" to="id.6" from="id.42"/>

<actionRelation xmi:id="id.52" xmi:type="action:Writes" to="id.103" from="id.42"/>

<actionRelation xmi:id="id.53" xmi:type="platform:ReadsResource" to="id.67" from="id.42"/>

</abstraction>

</dataElement>

<dataElement xmi:id="id.54" xmi:type="data:DataAction" name="d3" kind="Retrieve"

implementation="id.115">

<abstraction xmi:id="id.55" name="da2" kind="Assign">

<actionRelation xmi:id="id.56" xmi:type="action:Reads" to="id.13" from="id.55"/>

<actionRelation xmi:id="id.57" xmi:type="action:Addresses" to="id.103" from="id.55"/>

<actionRelation xmi:id="id.58" xmi:type="action:Writes" to="id.117" from="id.55"/>

</abstraction>

</dataElement>

<dataElement xmi:id="id.59" xmi:type="data:DataAction" name="d4" kind="Retrieve"

implementation="id.130">

<abstraction xmi:id="id.60" name="da3" kind="Assign">

<actionRelation xmi:id="id.61" xmi:type="action:Reads" to="id.14" from="id.60"/>

<actionRelation xmi:id="id.62" xmi:type="action:Addresses" to="id.103" from="id.60"/>

<actionRelation xmi:id="id.63" xmi:type="action:Writes" to="id.132" from="id.60"/>

</abstraction>

</dataElement>

</model>

<model xmi:id="id.64" xmi:type="platform:PlatformModel">

<platformElement xmi:id="id.65" xmi:type="platform:Machine">

<resource xmi:id="id.66" >

<resource xmi:id="id.67" xmi:type="platform:DataManager" name="foobar">

<abstraction xmi:id="id.68" name="dm1">

<actionRelation xmi:id="id.69" xmi:type="data:HasContent" to="id.1"/>

</abstraction>

</resource>

</resource>

</platformElement>

</model>

<model xmi:id="id.70" xmi:type="code:CodeModel" name="Application">

<codeElement xmi:id="id.71" xmi:type="code:ClassUnit" name="DataExample">

<codeElement xmi:id="id.72" xmi:type="code:MemberUnit" name="findContractStatement">

<codeRelation xmi:id="id.73" xmi:type="code:HasValue" to="id.145" from="id.72"/>

</codeElement>

<codeElement xmi:id="id.74" xmi:type="code:MethodUnit" name="calculateRecognitions">

<entryFlow xmi:id="id.75" to="id.79" from="id.74"/>

<codeElement xmi:id="id.76" xmi:type="code:Signature">

<parameterUnit xmi:id="id.77" name="contractNumber" type="id.179"/>

</codeElement>

<codeElement xmi:id="id.78" xmi:type="code:StorableUnit" name="db" type="id.155" kind="local"/>

<codeElement xmi:id="id.79" xmi:type="action:ActionElement" name="c1" kind="Call">

<codeElement xmi:id="id.80" xmi:type="code:Value" name="&quot;jdbc:odbc:foobar&quot;"/>

<codeElement xmi:id="id.81" xmi:type="code:Value" name="&quot;sunny&quot;" type="id.178"/>

<codeElement xmi:id="id.82" xmi:type="code:Value" name="&quot;&quot;" type="id.178"/>

<actionRelation xmi:id="id.83" xmi:type="action:Reads" to="id.80" from="id.79"/>

<actionRelation xmi:id="id.84" xmi:type="action:Reads" to="id.81" from="id.79"/>

<actionRelation xmi:id="id.85" xmi:type="action:Reads" to="id.82" from="id.79"/>

<actionRelation xmi:id="id.86" xmi:type="action:Calls" to="id.154" from="id.79"/>

<actionRelation xmi:id="id.87" xmi:type="action:Writes" to="id.78" from="id.79"/>

<actionRelation xmi:id="id.88" xmi:type="action:Flow" to="id.90" from="id.79"/>

</codeElement>

<codeElement xmi:id="id.89" xmi:type="code:StorableUnit" name="stmt" type="id.161" kind="local"/>

<codeElement xmi:id="id.90" xmi:type="action:ActionElement" name="c2" kind="MethodCall">

<actionRelation xmi:id="id.91" xmi:type="action:Addresses" to="id.78" from="id.90"/>

<actionRelation xmi:id="id.92" xmi:type="action:Reads" to="id.72" from="id.90"/>

<actionRelation xmi:id="id.93" xmi:type="action:Calls" to="id.156" from="id.90"/>

<actionRelation xmi:id="id.94" xmi:type="action:Writes" to="id.89" from="id.90"/>

<actionRelation xmi:id="id.95" xmi:type="action:Flow" to="id.96" from="id.90"/>

</codeElement>

<codeElement xmi:id="id.96" xmi:type="action:ActionElement" name="c3" kind="MethodCall">

<codeElement xmi:id="id.97" xmi:type="code:Value" name="1"/>

<actionRelation xmi:id="id.98" xmi:type="action:Addresses" to="id.89" from="id.96"/>

<actionRelation xmi:id="id.99" xmi:type="action:Reads" to="id.97" from="id.96"/>

<actionRelation xmi:id="id.100" xmi:type="action:Reads" to="id.77" from="id.96"/>

<actionRelation xmi:id="id.101" xmi:type="action:Calls" to="id.162" from="id.96"/>

<actionRelation xmi:id="id.102" xmi:type="action:Flow" to="id.104" from="id.96"/>

</codeElement>

<codeElement xmi:id="id.103" xmi:type="code:StorableUnit" name="contracts" type="id.157"

kind="local"/>

<codeElement xmi:id="id.104" xmi:type="action:ActionElement" name="c4" kind="MethodCall">

<actionRelation xmi:id="id.105" xmi:type="action:Addresses" to="id.89" from="id.104"/>

<actionRelation xmi:id="id.106" xmi:type="action:Calls" to="id.163" from="id.104"/>

<actionRelation xmi:id="id.107" xmi:type="action:Writes" to="id.103" from="id.104"/>

<actionRelation xmi:id="id.108" xmi:type="action:Flow" to="id.109" from="id.104"/>

</codeElement>

<codeElement xmi:id="id.109" xmi:type="action:ActionElement" name="c5" kind="MethodCall">

<actionRelation xmi:id="id.110" xmi:type="action:Addresses" to="id.103" from="id.109"/>

<actionRelation xmi:id="id.111" xmi:type="action:Calls" to="id.158" from="id.109"/>

<actionRelation xmi:id="id.112" xmi:type="action:Flow" to="id.114" from="id.109"/>

</codeElement>

<codeElement xmi:id="id.113" xmi:type="code:StorableUnit" name="totalRevenue" type="id.165"

kind="local"/>

<codeElement xmi:id="id.114" xmi:type="action:ActionElement" name="c6" kind="Compound">

<codeElement xmi:id="id.115" xmi:type="action:ActionElement" name="c6.1" kind="Call">

<codeElement xmi:id="id.116" xmi:type="code:Value" name="&quot;revenue&quot;"/>

<codeElement xmi:id="id.117" xmi:type="code:StorableUnit" name="t4" kind="register"/>

<actionRelation xmi:id="id.118" xmi:type="action:Addresses" to="id.103" from="id.115"/>

<actionRelation xmi:id="id.119" xmi:type="action:Calls" to="id.159" from="id.115"/>

<actionRelation xmi:id="id.120" xmi:type="action:Writes" to="id.117" from="id.115"/>

<actionRelation xmi:id="id.121" xmi:type="action:Flow" to="id.122" from="id.115"/>

</codeElement>

<codeElement xmi:id="id.122" xmi:type="action:ActionElement" name="c6.2" kind="Call">

<actionRelation xmi:id="id.123" xmi:type="action:Reads" to="id.117" from="id.122"/>

<actionRelation xmi:id="id.124" xmi:type="action:Calls" to="id.166" from="id.122"/>

<actionRelation xmi:id="id.125" xmi:type="action:Writes" to="id.113" from="id.122"/>

<actionRelation xmi:id="id.126" xmi:type="action:Flow"/>

</codeElement>

<actionRelation xmi:id="id.127" xmi:type="action:Flow" to="id.115" from="id.114"/>

</codeElement>

<codeElement xmi:id="id.128" xmi:type="code:StorableUnit" name="recognizedDate" type="id.168"

kind="local"/>

<codeElement xmi:id="id.129" xmi:type="action:ActionElement" name="c7" kind="MethodCall">

<codeElement xmi:id="id.130" xmi:type="action:ActionElement" name="c7.1" kind="Call">

<codeElement xmi:id="id.131" xmi:type="code:Value" name="&quot;dateSigned&quot;"/>

<codeElement xmi:id="id.132" xmi:type="code:StorableUnit" name="t5" kind="register"/>

<actionRelation xmi:id="id.133" xmi:type="action:Addresses" to="id.103" from="id.130"/>

<actionRelation xmi:id="id.134" xmi:type="action:Calls" to="id.160" from="id.130"/>

<actionRelation xmi:id="id.135" xmi:type="action:Writes" to="id.132" from="id.130"/>

<actionRelation xmi:id="id.136" xmi:type="action:Flow" to="id.137" from="id.130"/>

</codeElement>

<codeElement xmi:id="id.137" xmi:type="action:ActionElement" name="c7.2" kind="New">

<actionRelation xmi:id="id.138" xmi:type="action:Creates" to="id.168" from="id.137"/>

<actionRelation xmi:id="id.139" xmi:type="action:Writes" to="id.128" from="id.137"/>

<actionRelation xmi:id="id.140" xmi:type="action:Flow"/>

</codeElement>

<codeElement xmi:id="id.141" xmi:type="action:ActionElement" name="c7.3" kind="MethodCall">

<actionRelation xmi:id="id.142" xmi:type="action:Reads" to="id.132" from="id.137"/>

<actionRelation xmi:id="id.143" xmi:type="action:Calls" to="id.169" from="id.141"/>

<actionRelation xmi:id="id.144" xmi:type="action:Writes" to="id.128" from="id.141"/>

</codeElement>

</codeElement>

</codeElement>

<codeElement xmi:id="id.145" xmi:type="code:Value"

name="&quot;SELECT * FROM contracts c, products p WHERE ID=? AND c.product=p.ID&quot;"

type="id.178"/>

<codeElement xmi:id="id.146" xmi:type="code:MethodUnit" name="init" kind="constructor">

<entryFlow xmi:id="id.147" to="id.148" from="id.146"/>

<codeElement xmi:id="id.148" xmi:type="action:ActionElement" name="i1" kind="Assign">

<actionRelation xmi:id="id.149" xmi:type="action:Reads" to="id.145" from="id.148"/>

<actionRelation xmi:id="id.150" xmi:type="action:Writes" to="id.72" from="id.148"/>

</codeElement>

</codeElement>

</codeElement>

</model>

<model xmi:id="id.151" xmi:type="code:CodeModel" name="Java packages">

<codeElement xmi:id="id.152" xmi:type="code:Package" name="java.sql">

<codeElement xmi:id="id.153" xmi:type="code:ClassUnit" name="DriverManager">

<codeElement xmi:id="id.154" xmi:type="code:MethodUnit" name="getConnection" kind="abstract"/>

</codeElement>

<codeElement xmi:id="id.155" xmi:type="code:ClassUnit" name="Connection">

<codeElement xmi:id="id.156" xmi:type="code:MethodUnit" name="prepareStatement" kind="abstract"/>

</codeElement>

<codeElement xmi:id="id.157" xmi:type="code:ClassUnit" name="ResultSet">

<codeElement xmi:id="id.158" xmi:type="code:MethodUnit" name="next" kind="abstract"/>

<codeElement xmi:id="id.159" xmi:type="code:MethodUnit" name="getBigDecimal" kind="abstract"/>

<codeElement xmi:id="id.160" xmi:type="code:MethodUnit" name="getDate" kind="abstract"/>

</codeElement>

<codeElement xmi:id="id.161" xmi:type="code:ClassUnit" name="Statement">

<codeElement xmi:id="id.162" xmi:type="code:MethodUnit" name="setLong" kind="abstract"/>

<codeElement xmi:id="id.163" xmi:type="code:MethodUnit" name="executeQuery" kind="abstract"/>

</codeElement>

</codeElement>

<codeElement xmi:id="id.164" xmi:type="code:Package" name="Money">

<codeElement xmi:id="id.165" xmi:type="code:ClassUnit" name="Money">

<codeElement xmi:id="id.166" xmi:type="code:MethodUnit" name="dollars" kind="abstract"/>

</codeElement>

</codeElement>

<codeElement xmi:id="id.167" xmi:type="code:Package" name="MfDate">

<codeElement xmi:id="id.168" xmi:type="code:ClassUnit" name="MfDate">

<codeElement xmi:id="id.169" xmi:type="code:MethodUnit" name="MfDate" kind="abstract"/>

</codeElement>

</codeElement>

</model>

<model xmi:id="id.170" xmi:type="code:CodeModel" name="Common Datatypes">

<codeElement xmi:id="id.171" xmi:type="code:LanguageUnit" name="SQL datatypes">

<codeElement xmi:id="id.172" xmi:type="code:IntegerType" name="sql int"/>

<codeElement xmi:id="id.173" xmi:type="code:StringType" name="sql varchar"/>

<codeElement xmi:id="id.174" xmi:type="code:DecimalType" name="sql decimal"/>

<codeElement xmi:id="id.175" xmi:type="code:DateType" name="sql date"/>

<codeElement xmi:id="id.176" xmi:type="code:BooleanType"/>

</codeElement>

<codeElement xmi:id="id.177" xmi:type="code:LanguageUnit" name="Java datatypes">

<codeElement xmi:id="id.178" xmi:type="code:StringType"/>

<codeElement xmi:id="id.179" xmi:type="code:IntegerType" name="java long"/>

<codeElement xmi:id="id.180" xmi:type="code:IntegerType" name="java byte"/>

</codeElement>

</model>

</kdm:Segment>

StructuredData Class Diagram

The StructuredData class diagram provides basic meta-model constructs to define the XML files that can be used by enterprise applications for persistent storage or as an exchange mechanism between components. The class diagram shown in See – StructuredData Class Diagram. captures these classes and their relations.

– StructuredData Class Diagram

XMLSchema

The XMLSchema class represents the top level container for a KDM metamodel of an XML document.

Superclass

AbstractDataElement

Associations

contentElement :AbstractContentElement[0..*] Individual content elements owned by this schema

Semantics

XMLSchema is a logical container for AbstractContentElements as well as some other DataResource elements, for example DataEvents.

AbstractContentElement (abstract)

The AbstractContentElement class is a abstract parent for several concrete classes whose purpose is to represent the content of XML schemas and documents as well as various structured data items that can be associated with other KDM elements.

Superclass

AbstractDataElement

Semantics

AbstractContentElement represents common properties of content elements.

ContentElements Class Diagram

The ContentElements class diagram defines basic meta-model constructs to represent XML elements. The class diagram shown in See – ContentElements Class Diagram. captures these classes and their relations.

– ContentElements Class Diagram

ContentItem (generic)

The ContentItem class is a generic meta-model element which represents named items and references of the XML schema: elements, attributes, references and groups.

Superclass

AbstractContentElement

Associations

contentElement :AbstractContentElement[0..*] Owned content elements
type:ComplexContentType[0..1] Content type of the current ContentItem

Semantics

ComplexContentType

The ComplexContentType class represents Complex Types of an XML schema definition. XSD indicators are modeled as subclasses of ComplexContentType.

Superclass

AbstractContentElement

Associations

contentElement :AbstractContentElement[0..*] Owned content elements

Semantics

SimpleContentType

The SimpleContentType class represents Simple Types of an XML schema definition.

Superclass

ComplexContentType

Attributes

kind:String Content kind of the current SimpleContentType

Associations

type:ComplexContentType[0..*] Content type of the current ContentItem

Semantics

Simple types, such as string and decimal, are built in to XML Schema, while others are derived from the built-in’s. kind of SimpleContentType can be “list”, “union”, “enumeration”, etc.

ContentRestriction

The ContentRestriction class represents restrictions to Simple Types, Elements, Attributes and References.

Superclass

AbstractContentElement

Attributes

kind :String Type of the content restriction (XML)
value:String value of the constraint

Semantics

kind is an XSD restriction, such as minExclusive, minInclusive, maxExclusive, maxInclusive, totalDigits, fractionDigits, length, minLength, maxLength, enumeration, whiteSpace, pattern; or XSD an element attribute, such as minOccurs, maxOccurs, required, fixed; or an XSD enumeration.

Example:

<xsd:simpleType name="myInteger">

<xsd:restriction base="xsd:integer">

<xsd:minInclusive value="10000"/>

<xsd:maxInclusive value="99999"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name="SKU">

<xsd:restriction base="xsd:string">

<xsd:pattern value="\d{3}-[A-Z]{2}"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name="USState">

<xsd:restriction base="xsd:string">

<xsd:enumeration value="AK"/>

<xsd:enumeration value="AL"/>

<xsd:enumeration value="AR"/>

<!-- and so on ... -->

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name="listOfMyIntType">

<xsd:list itemType="myInteger"/>

</xsd:simpleType>

<xsd:simpleType name="USStateList">

<xsd:list itemType="USState"/>

</xsd:simpleType>

<xsd:simpleType name="SixUSStates">

<xsd:restriction base="USStateList">

<xsd:length value="6"/>

</xsd:restriction>

</xsd:simpleType>

<xsd:simpleType name="zipUnion">

<xsd:union memberTypes="USState listOfMyIntType"/>

</xsd:simpleType>

<?xml version="1.0" encoding="UTF-8"?>

<kdm:Segment xmi:version="2.1"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:code="http://kdm.omg.org/code"

xmlns:data="http://kdm.omg.org/data"

xmlns:kdm="http://kdm.omg.org/kdm" name="XML Simple Content Example">

<model xmi:id="id.0" xmi:type="data:DataModel">

<dataElement xmi:id="id.1" xmi:type="data:XMLSchema" name="SimpleType examples">

<contentElement xmi:id="id.2" xmi:type="data:SimpleContentType" name="MyInteger">

<dataRelation xmi:id="id.3" xmi:type="data:RestrictionOf" to="id.27" from="id.2"/>

<contentElement xmi:id="id.4" xmi:type="data:ContentRestriction"

kind="minInclusive" value="10000"/>

<contentElement xmi:id="id.5" xmi:type="data:ContentRestriction"

kind="maxInclusive" value="99999"/>

</contentElement>

<contentElement xmi:id="id.6" xmi:type="data:SimpleContentType" name="SKU">

<dataRelation xmi:id="id.7" xmi:type="data:RestrictionOf" to="id.29" from="id.2"/>

<contentElement xmi:id="id.8" xmi:type="data:ContentRestriction"

kind="pattern" value="&quot;\d{3}-[A-Z]{2}&quot;"/>

</contentElement>

<contentElement xmi:id="id.9" xmi:type="data:SimpleContentType" name="USState">

<contentElement xmi:id="id.10" xmi:type="data:ContentRestriction"

kind="enumeration" value="&quot;AK&quot;"/>

<contentElement xmi:id="id.11" xmi:type="data:ContentRestriction"

kind="enumeration" value="&quot;AL&quot;"/>

<contentElement xmi:id="id.12" xmi:type="data:ContentRestriction"

kind="enumeration" value="&quot;AR&quot;"/>

</contentElement>

<contentElement xmi:id="id.13" xmi:type="data:SimpleContentType" name="listOfMyIntType">

<contentElement xmi:id="id.14" xmi:type="data:ListContent">

<dataRelation xmi:id="id.15" xmi:type="data:TypedBy" to="id.2" from="id.14"/>

</contentElement>

</contentElement>

<contentElement xmi:id="id.16" xmi:type="data:SimpleContentType" name="USStateList">

<contentElement xmi:id="id.17" xmi:type="data:ListContent" name="">

<dataRelation xmi:id="id.18" xmi:type="data:TypedBy" to="id.9" from="id.17"/>

</contentElement>

</contentElement>

<contentElement xmi:id="id.19" xmi:type="data:SimpleContentType" name="SixUSStates">

<dataRelation xmi:id="id.20" xmi:type="data:RestrictionOf" to="id.16" from="id.19"/>

<contentElement xmi:id="id.21" xmi:type="data:ContentRestriction" kind="length" value="6"/>

</contentElement>

<contentElement xmi:id="id.22" xmi:type="data:SimpleContentType" name="zipUnion">

<contentElement xmi:id="id.23" xmi:type="data:UnionContent">

<dataRelation xmi:id="id.24" xmi:type="data:TypedBy" to="id.9" from="id.23"/>

<dataRelation xmi:id="id.25" xmi:type="data:TypedBy" to="id.13" from="id.23"/>

</contentElement>

</contentElement>

</dataElement>

<dataElement xmi:id="id.26" xmi:type="data:XMLSchema" name="xsd">

<contentElement xmi:id="id.27" xmi:type="data:SimpleContentType" name="xsd:Integer">

<dataRelation xmi:id="id.28" xmi:type="data:DatatypeOf" to="id.41" from="id.27"/>

</contentElement>

<contentElement xmi:id="id.29" xmi:type="data:SimpleContentType" name="xsd:String">

<dataRelation xmi:id="id.30" xmi:type="data:DatatypeOf" to="id.42" from="id.29"/>

</contentElement>

<contentElement xmi:id="id.31" xmi:type="data:SimpleContentType" name="xsd:Decimal">

<dataRelation xmi:id="id.32" xmi:type="data:DatatypeOf" to="id.43" from="id.31"/>

</contentElement>

<contentElement xmi:id="id.33" xmi:type="data:SimpleContentType" name="xsd:positiveInteger">

<dataRelation xmi:id="id.34" xmi:type="data:DatatypeOf" to="id.41" from="id.33"/>

</contentElement>

<contentElement xmi:id="id.35" xmi:type="data:SimpleContentType" name="xsd:date">

<dataRelation xmi:id="id.36" xmi:type="data:DatatypeOf" to="id.44" from="id.35"/>

</contentElement>

<contentElement xmi:id="id.37" xmi:type="data:SimpleContentType" name="xsd:any"/>

<contentElement xmi:id="id.38" xmi:type="data:SimpleContentType" name="xsd:NMTOKEN"/>

</dataElement>

</model>

<model xmi:id="id.39" xmi:type="code:CodeModel">

<codeElement xmi:id="id.40" xmi:type="code:LanguageUnit">

<codeElement xmi:id="id.41" xmi:type="code:IntegerType" name="xsd integer"/>

<codeElement xmi:id="id.42" xmi:type="code:StringType" name="xsd string"/>

<codeElement xmi:id="id.43" xmi:type="code:DecimalType" name="xsd decimal"/>

<codeElement xmi:id="id.44" xmi:type="code:DateType" name="xsd date"/>

</codeElement>

</model>

</kdm:Segment>

AllContent Class

An AllContent class is a meta-model element that represents complex types with the “all” order indicator.

Superclass

ComplexContentType

Constraints

Semantics

SeqContent Class

An SeqContent class is a meta-model element that represents complex types with the “sequence” order indicator.

Superclass

ComplexContentType

Constraints

Semantics

ChoiceContent Class

An ChoiceContent class is a meta-model element that represents complex types with the “choice” order indicator.

Superclass

XMLComplexType

Constraints

Semantics

GroupContent Class

An GroupContent class is a meta-model element that represents complex types with the “group” group indicator.

Superclass

ComplexContentType

Constraints

Semantics

MixedContent Class

An MixedContent class is a meta-model element that represents complex types with the “mixed” indicator.

Superclass

ComplexContentType

Constraints

Semantics

ContentAttribute Class

An ContentAttribute class is a meta-model element that represents the XML “attribute” declaration mechanism of XML Schemas.

Superclass

ContentItem

Constraints

Semantics

ContentElement Class

An ContentElement class is a meta-model element that represents the XML “element” declaration mechanism of XML Schemas.

Superclass

ContentItem

Constraints

Semantics

ContentReference Class

An ContentReference class is a meta-model element that represents the XML “reference” declaration mechanism of XML Schemas.

Superclass

ContentItem

Constraints

Semantics

Example:

<xsd:element name="letterBody">

<xsd:complexType mixed="true">

<xsd:sequence>

<xsd:element name="salutation">

<xsd:complexType mixed="true">

<xsd:sequence>

<xsd:element name="name" type="xsd:string"/>

</xsd:sequence>

</xsd:complexType>

</xsd:element>

<xsd:element name="quantity" type="xsd:positiveInteger"/>

<xsd:element name="productName" type="xsd:string"/>

<xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>

<!-- etc. -->

</xsd:sequence>

</xsd:complexType>

</xsd:element>

<xsd:complexType name="USAddress" >

<xsd:sequence>

<xsd:element name="name" type="xsd:string"/>

<xsd:element name="street" type="xsd:string"/>

<xsd:element name="city" type="xsd:string"/>

<xsd:element name="state" type="xsd:string"/>

<xsd:element name="zip" type="xsd:decimal"/>

</xsd:sequence>

<xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>

</xsd:complexType>

<xsd:complexType name="Items">

<xsd:sequence>

<xsd:element name="item" minOccurs="0" maxOccurs="unbounded">

<xsd:complexType>

<xsd:sequence>

<xsd:element name="productName" type="xsd:string"/>

<xsd:element name="quantity">

<xsd:simpleType>

<xsd:restriction base="xsd:positiveInteger">

<xsd:maxExclusive value="100"/>

</xsd:restriction>

</xsd:simpleType>

</xsd:element>

<xsd:element name="USPrice" type="xsd:decimal"/>

<xsd:element ref="comment" minOccurs="0"/>

<xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>

</xsd:sequence>

<xsd:attribute name="partNum" type="SKU" use="required"/>

</xsd:complexType>

</xsd:element>

</xsd:sequence>

</xsd:complexType>

<xsd:element name="internationalPrice">

<xsd:complexType>

<xsd:complexContent>

<xsd:restriction base="xsd:anyType">

<xsd:attribute name="currency" type="xsd:string"/>

<xsd:attribute name="value" type="xsd:decimal"/>

</xsd:restriction>

</xsd:complexContent>

</xsd:complexType>

</xsd:element>

<xsd:complexType name="PurchaseOrderType">

<xsd:sequence>

<xsd:choice>

<xsd:group ref="shipAndBill"/>

<xsd:element name="singleUSAddress" type="USAddress"/>

</xsd:choice>

<xsd:element ref="comment" minOccurs="0"/>

<xsd:element name="items" type="Items"/>

</xsd:sequence>

<xsd:attribute name="orderDate" type="xsd:date"/>

</xsd:complexType>

<xsd:group id="shipAndBill">

<xsd:sequence>

<xsd:element name="shipTo" type="USAddress"/>

<xsd:element name="billTo" type="USAddress"/>

</xsd:sequence>

</xsd:group>

<?xml version="1.0" encoding="UTF-8"?>

<kdm:Segment xmi:version="2.1"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:code="http://kdm.omg.org/code"

xmlns:data="http://kdm.omg.org/data"

xmlns:kdm="http://kdm.omg.org/kdm" name="XML Complex Content Example">

<model xmi:id="id.0" xmi:type="data:DataModel">

<dataElement xmi:id="id.1" xmi:type="data:XMLSchema" name="Complex Content">

<contentElement xmi:id="id.2" xmi:type="data:ContentElement" name="letterBody">

<dataRelation xmi:id="id.3" xmi:type="data:TypedBy" to="id.4" from="id.2"/>

<contentElement xmi:id="id.4" xmi:type="data:MixedContent" name="m1">

<contentElement xmi:id="id.5" xmi:type="data:SeqContent">

<contentElement xmi:id="id.6" xmi:type="data:ContentElement" name="salutation">

<dataRelation xmi:id="id.7" xmi:type="data:TypedBy" to="id.8" from="id.6"/>

<contentElement xmi:id="id.8" xmi:type="data:MixedContent">

<contentElement xmi:id="id.9" xmi:type="data:SeqContent">

<contentElement xmi:id="id.10" xmi:type="data:ContentElement" name="name">

<dataRelation xmi:id="id.11" xmi:type="data:TypedBy" to="id.88" from="id.10"/>

</contentElement>

</contentElement>

</contentElement>

</contentElement>

<contentElement xmi:id="id.12" xmi:type="data:ContentElement" name="quantity">

<dataRelation xmi:id="id.13" xmi:type="data:TypedBy" to="id.92" from="id.12"/>

</contentElement>

<contentElement xmi:id="id.14" xmi:type="data:ContentElement" name="productName">

<dataRelation xmi:id="id.15" xmi:type="data:TypedBy" to="id.88" from="id.14"/>

</contentElement>

<contentElement xmi:id="id.16" xmi:type="data:ContentElement" name="shipDate">

<dataRelation xmi:id="id.17" xmi:type="data:TypedBy" to="id.94" from="id.16"/>

</contentElement>

</contentElement>

</contentElement>

</contentElement>

<contentElement xmi:id="id.18" xmi:type="data:ComplexContentType" name="USAddress">

<contentElement xmi:id="id.19" xmi:type="data:SeqContent">

<contentElement xmi:id="id.20" xmi:type="data:ContentElement" name="name">

<dataRelation xmi:id="id.21" xmi:type="data:TypedBy" to="id.88" from="id.20"/>

</contentElement>

<contentElement xmi:id="id.22" xmi:type="data:ContentElement" name="street">

<dataRelation xmi:id="id.23" xmi:type="data:TypedBy" to="id.88" from="id.22"/>

</contentElement>

<contentElement xmi:id="id.24" xmi:type="data:ContentElement" name="city">

<dataRelation xmi:id="id.25" xmi:type="data:TypedBy" to="id.88" from="id.24"/>

</contentElement>

<contentElement xmi:id="id.26" xmi:type="data:ContentElement" name="state">

<dataRelation xmi:id="id.27" xmi:type="data:TypedBy" to="id.88" from="id.26"/>

</contentElement>

<contentElement xmi:id="id.28" xmi:type="data:ContentElement" name="zip">

<dataRelation xmi:id="id.29" xmi:type="data:TypedBy" to="id.88" from="id.28"/>

</contentElement>

</contentElement>

<contentElement xmi:id="id.30" xmi:type="data:ContentAttribute" name="country">

<dataRelation xmi:id="id.31" xmi:type="data:TypedBy" to="id.97" from="id.30"/>

<contentElement xmi:id="id.32" xmi:type="data:ContentRestriction"

kind="fixed" value="&quot;US&quot;"/>

</contentElement>

</contentElement>

<contentElement xmi:id="id.33" xmi:type="data:ComplexContentType" name="items">

<contentElement xmi:id="id.34" xmi:type="data:SeqContent">

<contentElement xmi:id="id.35" xmi:type="data:ContentElement" name="item">

<dataRelation xmi:id="id.36" xmi:type="data:TypedBy" to="id.39" from="id.35"/>

<contentElement xmi:id="id.37" xmi:type="data:ContentRestriction" kind="minOccurs" value="0"/>

<contentElement xmi:id="id.38" xmi:type="data:ContentRestriction"

kind="maxOccurs" value="unbounded"/>

<contentElement xmi:id="id.39" xmi:type="data:ComplexContentType" name="i">

<contentElement xmi:id="id.40" xmi:type="data:SeqContent">

<contentElement xmi:id="id.41" xmi:type="data:ContentElement" name="productName1">

<dataRelation xmi:id="id.42" xmi:type="data:TypedBy" to="id.88" from="id.41"/>

</contentElement>

<contentElement xmi:id="id.43" xmi:type="data:ContentElement" name="quantity1">

<dataRelation xmi:id="id.44" xmi:type="data:TypedBy" to="id.45" from="id.43"/>

<contentElement xmi:id="id.45" xmi:type="data:SimpleContentType" name="st1">

<dataRelation xmi:id="id.46" xmi:type="data:RestrictionOf" to="id.92" from="id.45"/>

<contentElement xmi:id="id.47" xmi:type="data:ContentRestriction"

kind="maxExclusive" value="100"/>

</contentElement>

</contentElement>

<contentElement xmi:id="id.48" xmi:type="data:ContentElement" name="USPrice">

<dataRelation xmi:id="id.49" xmi:type="data:TypedBy" to="id.90" from="id.48"/>

</contentElement>

<contentElement xmi:id="id.50" xmi:type="data:ContentReference">

<dataRelation xmi:id="id.51" xmi:type="data:ReferenceTo" to="id.83" from="id.50"/>

<contentElement xmi:id="id.52" xmi:type="data:ContentRestriction"

kind="minOccurs" value="0"/>

</contentElement>

<contentElement xmi:id="id.53" xmi:type="data:ContentElement" name="shipDate1">

<dataRelation xmi:id="id.54" xmi:type="data:TypedBy" to="id.94" from="id.53"/>

</contentElement>

</contentElement>

<contentElement xmi:id="id.55" xmi:type="data:ContentAttribute" name="partNum">

<dataRelation xmi:id="id.56" xmi:type="data:TypedBy" from="id.55"/>

<contentElement xmi:id="id.57" xmi:type="data:ContentRestriction"

kind="use" value="required"/>

</contentElement>

</contentElement>

</contentElement>

</contentElement>

</contentElement>

<contentElement xmi:id="id.58" xmi:type="data:ContentElement" name="international price">

<contentElement xmi:id="id.59" xmi:type="data:ComplexContentType" name="">

<dataRelation xmi:id="id.60" xmi:type="data:RestrictionOf" to="id.96" from="id.59"/>

<contentElement xmi:id="id.61" xmi:type="data:ContentAttribute" name="currency1">

<dataRelation xmi:id="id.62" xmi:type="data:TypedBy" to="id.88" from="id.61"/>

</contentElement>

<contentElement xmi:id="id.63" xmi:type="data:ContentAttribute" name="value">

<dataRelation xmi:id="id.64" xmi:type="data:TypedBy" to="id.90" from="id.61"/>

</contentElement>

</contentElement>

</contentElement>

<contentElement xmi:id="id.65" xmi:type="data:ComplexContentType" name="PurchaseOrderType">

<contentElement xmi:id="id.66" xmi:type="data:SeqContent">

<contentElement xmi:id="id.67" xmi:type="data:ChoiceContent">

<contentElement xmi:id="id.68" xmi:type="data:ContentReference">

<dataRelation xmi:id="id.69" xmi:type="data:ReferenceTo" to="id.79" from="id.68"/>

</contentElement>

<contentElement xmi:id="id.70" xmi:type="data:ContentElement" name="singleUSAddress">

<dataRelation xmi:id="id.71" xmi:type="data:TypedBy" to="id.18" from="id.70"/>

</contentElement>

</contentElement>

<contentElement xmi:id="id.72" xmi:type="data:ContentReference">

<dataRelation xmi:id="id.73" xmi:type="data:ReferenceTo" to="id.83" from="id.72"/>

<contentElement xmi:id="id.74" xmi:type="data:ContentRestriction" kind="minOccurs" value="0"/>

</contentElement>

<contentElement xmi:id="id.75" xmi:type="data:ContentElement" name="items">

<dataRelation xmi:id="id.76" xmi:type="data:TypedBy" to="id.33" from="id.75"/>

</contentElement>

</contentElement>

<contentElement xmi:id="id.77" xmi:type="data:ContentAttribute" name="orderDate">

<dataRelation xmi:id="id.78" xmi:type="data:TypedBy" to="id.94" from="id.77"/>

</contentElement>

</contentElement>

<contentElement xmi:id="id.79" xmi:type="data:GroupContent" name="shipAndBill">

<contentElement xmi:id="id.80" xmi:type="data:SeqContent">

<contentElement xmi:id="id.81" xmi:type="data:ContentElement"/>

<contentElement xmi:id="id.82" xmi:type="data:ContentElement"/>

</contentElement>

</contentElement>

<contentElement xmi:id="id.83" xmi:type="data:ContentElement" name="comment">

<dataRelation xmi:id="id.84" xmi:type="data:TypedBy" to="id.88" from="id.83"/>

</contentElement>

</dataElement>

<dataElement xmi:id="id.85" xmi:type="data:XMLSchema" name="xsd">

<contentElement xmi:id="id.86" xmi:type="data:SimpleContentType" name="xsd:Integer">

<dataRelation xmi:id="id.87" xmi:type="data:DatatypeOf" to="id.100" from="id.86"/>

</contentElement>

<contentElement xmi:id="id.88" xmi:type="data:SimpleContentType" name="xsd:String">

<dataRelation xmi:id="id.89" xmi:type="data:DatatypeOf" to="id.101" from="id.88"/>

</contentElement>

<contentElement xmi:id="id.90" xmi:type="data:SimpleContentType" name="xsd:Decimal">

<dataRelation xmi:id="id.91" xmi:type="data:DatatypeOf" to="id.102" from="id.90"/>

</contentElement>

<contentElement xmi:id="id.92" xmi:type="data:SimpleContentType" name="xsd:positiveInteger">

<dataRelation xmi:id="id.93" xmi:type="data:DatatypeOf" to="id.100" from="id.92"/>

</contentElement>

<contentElement xmi:id="id.94" xmi:type="data:SimpleContentType" name="xsd:date">

<dataRelation xmi:id="id.95" xmi:type="data:DatatypeOf" to="id.103" from="id.94"/>

</contentElement>

<contentElement xmi:id="id.96" xmi:type="data:SimpleContentType" name="xsd:any"/>

<contentElement xmi:id="id.97" xmi:type="data:SimpleContentType" name="xsd:NMTOKEN"/>

</dataElement>

</model>

<model xmi:id="id.98" xmi:type="code:CodeModel">

<codeElement xmi:id="id.99" xmi:type="code:LanguageUnit">

<codeElement xmi:id="id.100" xmi:type="code:IntegerType" name="xsd integer"/>

<codeElement xmi:id="id.101" xmi:type="code:StringType" name="xsd string"/>

<codeElement xmi:id="id.102" xmi:type="code:DecimalType" name="xsd decimal"/>

<codeElement xmi:id="id.103" xmi:type="code:DateType" name="xsd date"/>

</codeElement>

</model>

</kdm:Segment>

ContentRelations Class Diagram

The ContentRelations class diagram provides basic meta-model relationships that represent various structural properties of the content. The class diagram shown in See – ContentRelations Class Diagram. captures these classes and their relations.

– ContentRelations Class Diagram

TypedBy class

The TypedBy class represents the relationship between a ContentItem and a content type, that be represented by a ComplexContentType class or one of its subclasses.

Superclass

AbstractDataRelationship

Associations:

from:ContentItem[1] the content element or attribute
to:ComplexContentType[1] the content type element

Constraints:

The “from” endpoint should be a ContentElement or a ContentAttribute class

Semantics:

TypedBy relationship represents an association between a content element and its type when this type is user-defined. This relationship is similar to HasType from CodeModel.

DatatypeOf class

The DatatypeOf class represents the relationship between a CompelxContentType and a Datatype defined in some Code model.

Superclass

AbstractDataRelationship

Associations:

from:ComplexContentType[1] the content type
to:Datatype[1] the datatype element

Constraints:

Semantics:

DatatypeOf relationship represents an association between a content type and primitive datatype.

ReferenceTo class

The ReferenceTo class represents the relationship between a ContentReference and a ContentElement, ContentAttribute or ContentGroup definition.

Superclass

AbstractDataRelationship

Associations:

from:ContentItem[1] the content reference
to:ContentItem[1] the content element or attribute or group

Constraints:

The “from” endpoint should be a ContentReference

The “to” endpoint should be a ContentElement, a ContentAttribute or GroupContent

Semantics:

ReferenceTo relationship represents an association between a content reference and the corresponding definition.

ExtensionTo class

The ExtensionTo class represents the relationship between a two content types, where one type is an extension to another. The semantics of deriving new types by extension is that as the result a new complex type or simple type is defined that contain all the elements of the original type plus additional elements that are provided as the extension.

Superclass

AbstractDataRelationship

Associations:

from:ComplexContentType[1] the new (extended) content type
to:ComplexContentType[1] the base content type

Constraints:

Semantics:

ExtensionTo relationship represents an association between a content type and its base type.

RestrictionOf class

The RestrictionOf class represents the relationship between a two content types, where one type is a restriction to another. The semantics of deriving new types by restriction is that as the result a new complex type or simple type is defined that contains all the elements and constraints of the original type plus additional constraints that are provided as the restriction.

Superclass

AbstractDataRelationship

Associations:

from:ComplexContentType[1] the new (restricted) content type
to:ComplexContentType[1] the base content type

Constraints:

Semantics:

RestrictionOf relationship represents an association between a content type and its base type.

ExtenededDataElements Class Diagram

The ExtendedDataElements class diagram defines two “wildcard” generic elements for the data model as determined by the KDM model pattern: a generic data entity and a generic data relationship..

The classes and associations of the ExtendedDataElements diagram are shown in See – ExtendedDataElements Class Diagram..

– ExtendedDataElements Class Diagram

ExtendedDataElement Class

The ExtendedDataElement class is a generic meta-model element that can be used to define new “virtual” meta-model elements through the KDM light-weight extension mechanism

Superclass

AbstractDataElement

Constraints

ExtendedDataElement should have at least one stereotype

Semantics

An data entity with under specified semantics. It is a concrete class that can be used as the base element of a new “virtual” meta-model entity types of the data model. This is one of the KDM extension points which can integrate additional language-specific, application-specific or implementer-specific pieces of knowledge into the standard KDM representation.

DataRelationship Class

The DataRelationship class is a generic meta-model element that can be used to define new “virtual” meta-model elements through the KDM light-weight extension mechanism

Superclass

AbstractDataRelationship

Associations

from:AbstractDataElement[1] The data element origin endpoint of the relationship
to:KDMEntity[1] the target of the relationship

Constraints

DataRelationship should have at least one stereotype

Semantics

An data relationship with under specified semantics. It is a concrete class that can be used as the base element of a new “virtual” meta-model relationship types of the data model. This is one of the KDM extension points which can integrate additional language-specific, application-specific or implementer-specific pieces of knowledge into the standard KDM representation.