Introducing Asset Oriented Modeling and KLEEN

50
bdaum industrial communications Introducing Asset Oriented Modeling and KLEEN bdaum industrial communications What is AOM? Advantages of AOM The KLEEN modeler Current status and outlook

description

bdaum industrial communications What is AOM? Advantages of AOM The KLEEN modeler Current status and outlook. Introducing Asset Oriented Modeling and KLEEN. Asset Oriented Modeling. Rationale Concepts that differentiate AOM from ERM Higher order relationships - PowerPoint PPT Presentation

Transcript of Introducing Asset Oriented Modeling and KLEEN

Page 1: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

What is AOM?Advantages of AOMThe KLEEN modeler

Current status and outlook

Page 2: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Asset Oriented Modeling

RationaleConcepts that differentiate AOM from ERM

Higher order relationshipsRegular sets and regular grammarsKeysInheritancePluggable Model ComponentsNamespaces

Summary

Page 3: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Rationale

Entity-Relationship Modeling is too clumsy for todays complex data models (XML, SQL1999). There is always a design dilemma (what is an entity, what a relationship).

UML leans towards a specific data model (object-oriented) and is far too complex for conceptual modeling. Okay for OO-implementation models but lacks essential concepts (keys) for database modeling.

Page 4: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Binary relationships

Binary relationships are the most common type of relationship.

Product

orders

Customer

Page 5: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

N-ary relationships

Generally n-ary relationships cannot be replaced by binary relationships.

Course

teaches

Student

Tutor

Page 6: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Unary relationships

Unary relationships are usually used to describe a containment.

Orderline

Order

Page 7: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

0-ary relationships

0-ary relationship = entity

Order

Page 8: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Assets

Assets are generalized relationshipsThey serve as both entity and relationship

Page 9: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Arcs and Clusters

Arcs provide the necessary connectors for relationship assets.

Clusters describe alternatives

Page 10: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Level 2 Structures

L2S may be used to group assetsL2S act only as named boundariesMuch weaker construct than assetsEach L2S is identified by a mandatory identifying asset.

Page 11: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Applying AOM

asset

Scenario

Business Object

Model

L2S

Asset

Real World AOM

Page 12: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

AOM Container Hierarchy

Models may include other modelsLevel2 containers may be nestedAssets cannot be nestedProperties may be nested

Model

Asset

Property

Level2

Page 13: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

The model

Page 14: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Grammars

Assets, clusters and arcs constitute a grammarAsset names act as non-terminal symbolsAsset labels act as terminal symbols and determine the names of asset instances

Page 15: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Abstract Assets

Assets without label have instances with the same name as the asset.Assets with grayed-out labels are abstract and don't have instances.

• Abstract assets are typically used for type declarations or as super-assets.

Page 16: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Repetitionsaccount*, phone-no[1..4], address+

Properties

• Properties can be nested: name(first,middle?,last)

• Sequences, bags, alternativesmeeting(time&location)order(product|service)

• Recursionslabel{part(id,description,label*)}

Page 17: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Properties vs. Assets

Assets are first class citizensAssets may specify a namespace – properties notAssets may specify keys – properties notAssets may specify operations – properties not

Page 18: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Keys

Each asset may have one or several primary keys. Keys may be named.Each key is constituted from one or several key fields.Simple key fields refer to asset properties.Delegated key fields refer to key names in related assets.

Page 19: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Inheritance

Assets may inherit features (properties, keys, constraints, operations, annotations) from other assets.

Page 20: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Simple types

Pluggable type systemsMulti type system modelsType systems are declared on model level and identified via a prefix

Page 21: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Complex types

Assets can serve as type definitions

Page 22: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Complex type expressions

Complex type expressions: union, sequence, repetition.

Page 23: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Constraints

Pluggable constraint languagesPossibility to define abstract constraints

Page 24: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Operations

Operations are always abstract.

Can be constrained by a user defined vocabulary.

Can be guarded by pre- and postcondititions (contracts) using a declared constraint language.

Page 25: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Namespaces

Each model is identified by its default namespace.Multi-namespace models are possible by declaring namespace prefixes.Assets are assigned to namespaces by prefixing the asset name.L2S belong to the namespace of their identifying asset.Model merging is namespace controlled.

Namespace also identify type systems, constraint languages, and vocabularies.

Page 26: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Namespaces and Properties

Properties are namespace neutral. They are identified via their asset.Consequence: Inherited properties blend into the namespace of the inheriting asset (chameleon).

Page 27: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Implementation notes

Annotations can be used to provide hints for the implementation of the model.Annotations can be externalized into a separate annotation script.Scripts are connected to models via the models default namespace.External scripts allow for implementation neutral models and for implementation variants.

Page 28: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

“Everything is a relationship”Fits tightly with relational modelFlexible models (model evolution)

Grammar based (HRG)Fits tightly with XML schema languagesAdvanced model validationModel transformation (refactoring)

Powerful inheritance constructsCompact and consistent models

Genuine key conceptAllows to generate highly efficient access code

NamespacesDistributed model development, extensions

Summary

Page 29: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

KLEEN

Diagram EditorValidationGeneratorsCurrent statusWhat next?

Page 30: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Diagram Editor

Page 31: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Diagram Editor - Features

Automatic layout and arc routingViews for item features, inheritance, dependenciesIn-line editors for item featuresSyntax checking

Property expressions, constraints, annotations, etc.

Assistance (automatic completion)Property expressions, constraints, annotations, etc.

Export as PNG and SVG

Page 32: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Diagram Editor - Transformation

Explode assetImplode assetResolve inheritanceRevert arcExtract annotation script

Implosion

Inheritance resolution

Page 33: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Model merging

Composite models include other modelsNesting is possibleIncluded models are “alive”

Page 34: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Auditing

Systematic check forCompletenessConsistencyRedundancy

Page 35: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Model validation

Detects structural problemsOrphansArc and type cyclesContradicting constraints

Warns on best practice violationNon PNF key usage

Offers quick fixesA click on an error marker proposes a fix for most urgent problem

Page 36: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Implementation validation

Pluggable validators for different implementation targets.

Java, XML Schema, UML-XMI

Detects features not supported by the target environment.

e.g. Type sequences or liberal use of bags for XML Schema targets.

Page 37: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

XML Schema Generator

Generates standard XML SchemaCode generation can be controlled via scripting:

Attribute/Element/Any/IgnoreDefault and fixed valuesMixed contentDocumentation

<?xml version="1.0" encoding="UTF-8"?><xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.corp.com" xmlns="http://www.corp.com/orders" xmlns:c="http://www.corp.com" xmlns:jag="http://www.aomodeling.org/KLEEN/JavaGenerator" xmlns:uml="http://www.aomodeling.org/KLEEN/XmiGenerator" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsg="http://www.aomodeling.org/KLEEN/XSDgenerator"> <!--Schema created by KLEEN XSD generator version 0.4.0--> <xs:import namespace="http://www.corp.com/orders" schemaLocation="www_corp_com_orders_TYPELIB.xsd"/> <xs:include schemaLocation="www_corp_com_TYPELIB.xsd"/> <!--Asset c:customer--> <xs:element name="customer"> <xs:complexType> <xs:choice> <xs:sequence> <xs:element name="name"/> <xs:element name="customerID" type="xs:NMTOKEN"/> </xs:sequence> <xs:sequence> <xs:element name="name"> <xs:complexType> <xs:sequence> <xs:element name="first"/> <xs:element minOccurs="0" name="middle"/> <xs:element name="last"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="birthDate" type="xs:date"/> <xs:element name="customerID" type="xs:NMTOKEN"/> </xs:sequence> </xs:choice> </xs:complexType> <xs:key name="pk__c_customer_customerID"> <xs:selector xpath="."/> <xs:field xpath="c:customerID"/> </xs:key> </xs:element></xs:schema>

Page 38: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

XMI Generator

Generates standard XMI 1.0Generated code can be fed into UML modelers.

<Foundation.Core.ModelElement.name>customer</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.visibility xmi.value="public"/> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="false"/> <Foundation.Core.Namespace.ownedElement> <Foundation.Core.Class xmi.id="xmi.17" xmi.uuid="uuid-1b8119a-f4c6e35f47-75b2d4280b36b135d9e254f3b2e61b7f"> <Foundation.Core.ModelElement.name>c__customer</Foundation.Core.ModelElement.name> <Foundation.Core.ModelElement.visibility xmi.value="public"/> <Foundation.Core.ModelElement.isSpecification xmi.value="false"/> <Foundation.Core.GeneralizableElement.isRoot xmi.value="false"/> <Foundation.Core.GeneralizableElement.isLeaf xmi.value="false"/> <Foundation.Core.GeneralizableElement.isAbstract xmi.value="true"/> <Foundation.Core.Class.isActive xmi.value="false"/> <Foundation.Core.ModelElement.namespace> <Foundation.Core.Namespace xmi.idref="xmi.15"/> </Foundation.Core.ModelElement.namespace> <Foundation.Core.Classifier.feature/> <Foundation.Core.GeneralizableElement.specialization> <Foundation.Core.Generalization xmi.idref="xmi.21"/> <Foundation.Core.Generalization xmi.idref="xmi.32"/> </Foundation.Core.GeneralizableElement.specialization>

</Foundation.Core.Class>

Page 39: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Java Generator

Generates a class hierarchy mirroring the model structure.Produces code for marshalling/unmarshalling Java objects to/from XML.Compiles constraint expressions into Java.Generates a framework for adding business logic (AOM meets AOP!)Scripts can control code generation:

Array/List/Map/SetNo events / Simple events / Bubbled eventsAccessor methods vs. public fieldsDocumentation

Page 40: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Asset code

Classes represent asset types.Subclasses extend those types and represent assets (operations, arcs, etc.).Inner classes implement complex properties.Interfaces combine asset variants (clustered inheritance!) package www.corp.com;

import com.bdaum.aoModeling.runtime.*;

/** * Generated with KLEEN Java Generator V.0.4.5 */

public interface C_customer_type extends AomValueChangedNotifier {

/** * Method setCustomerID. Set value of property customerID * * @param value new element value */ public void setCustomerID(String _value); /** * Method getCustomerID. Get value of property customerID * * @return value of field customerID */ public String getCustomerID(); /** * perform constraint validation */ public void validate() throws ConstraintException;}

package www.corp.com.customer;

import com.bdaum.aoModeling.runtime.*;

import www.corp.com.C_customer_type;

/** * Generated with KLEEN Java Generator V.0.4.5 */

public interface C_customer extends C_customer_type { /** * perform constraint validation */ public void validate() throws ConstraintException;}

Page 41: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Type checks

Generates code for type checks into access methods.

/** * Method setProductNo. Set value of property productNo * * @param value new field value */public void setProductNo(String _value) { if (_value == null) throw new IllegalArgumentException( ModelMessages.getString("Argument.not_null", "productNo")); if (!TypeCheck.isString(_value)) throw new IllegalArgumentException( ModelMessages.getString("Argument.nonXML_characters","productNo")); if (!TypeCheck.isNMTOKEN(_value)) throw new IllegalArgumentException( ModelMessages.getString("Argument.invalid_type_pattern","productNo","NMTOKEN"));

productNo = _value;}

Page 42: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Constraints and Contracts

Explicit constraints are checked on demand.

/** * Constraint validateConstraint1: amount >= 0 * @throws com.bdaum.aoModeling.runtime.ConstraintException */public void validateConstraint1() throws ConstraintException { if (!(getAmount() >= 0)) throw new ConstraintException( ModelMessages.getString("Constraint.violated", "amount >= 0"));}

Contracts are checked before and after operations.

/** * Operation deliver. * @param _sender - the sender instance of this message */public void deliver(AomObject _sender) { assert getClient().getMerchandise().containsKey(getProduct().getProductId()) : "Product = client/merchandise"; performOperation(OP_deliver, _sender);}

Page 43: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Events

Three types of event notification: nonesimplebubbled

/** * Method setAmount. Set value of property amount * * @param value new field value */public void setAmount(int _value) { if (_value == amount) return; int oldStockedWith_amount = amount; amount = _value; fireIfValueChanged(this,oldStockedWith_amount,_value,PackageInterface.StockedWith_amount);}

Page 44: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Marshalling

Instances of generated Java classes can be saved as XML documents.Documents comply with XSD schemata generated by the XSD generator.

public void toXML(XmlSerializer out, String encoding, Boolean standalone) throws IOException, IllegalArgumentException, IllegalStateException {

out.startDocument(encoding, standalone);out.setPrefix("", PackageInterface._DEFAULT_NAMESPACE);out.setPrefix("xsi", PackageInterface._XSI_NAMESPACE);

out.startTag(null, "Shop");out.attribute(PackageInterface._XSI_NAMESPACE, "schemaLocation", PackageInterface._DEFAULT_NAMESPACE + " Shop.xsd");toXML(out);out.endTag(null, "Shop");out.flush();

}

Page 45: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Unmarshalling

XML documents can be parsed to create new Java objects.Pull parser interface allows parsing from InputStream, DOM-tree, SAX event stream, etc.Parser resolves links across documents.

public AomObject parseXmlDocument(XmlPullParser xpp) throws XmlPullParserException, IOException {if (xpp.getEventType() != XmlPullParser.START_DOCUMENT)

throw new XmlPullParserException(ModelMessages.getString(ErrorMessages.START_DOCUMENT_EXPECTED));xpp.next();ParserUtilities.verifyStartTag(xpp, "Shop", PackageInterface._DEFAULT_NAMESPACE, true);Shop instance = new Shop();this.parser = xpp;instance.parseAsset(this);parser = null;ParserUtilities.consumeEndTag(xpp);if (xpp.getEventType() != XmlPullParser.END_DOCUMENT)

throw new XmlPullParserException(ModelMessages.getString(ErrorMessages.END_DOCUMENT_EXPECTED, String.valueOf(xpp.getLineNumber())));return instance;

}

Page 46: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Instrumentation

Aspects can be dynamically connected to asset classes.A Main class with default instrumentation is generated.

/*--com.bdaum.aoModeling.generator.java/instrumentation operation */public static void attachMainOperationInstrumentation() {

Aspect _aspect;

/**** Create and register main operation aspects ****/

/*--com.bdaum.aoModeling.generator.java/aspect Shop_mainOperationAspect */ _aspect = new Shop_mainOperationAspect();

//--com.bdaum.aoModeling.generator.java/point OP_$init; Shop.attachInstrumentation(Shop.OP_$init, _aspect);

//--com.bdaum.aoModeling.generator.java/point OP_processOrders; Shop.attachInstrumentation(Shop.OP_processOrders, _aspect);

//--com.bdaum.aoModeling.generator.java/point OP_$dispose; Shop.attachInstrumentation(Shop.OP_$dispose, _aspect);

//--com.bdaum.aoModeling.generator.java/point;

Page 47: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Aspects

Four types of standard aspects are currently generated:

Operation (Custom Business logic)Logging (for debugging purposes)XML (for xs:any elements)Constraint (for abstract constraints)

public class Shop_mainOperationAspect extends OperationAspect {

public boolean isStatic() { return true; } public boolean run(int point,int mode,Object extension,AomObject receiver,AomObject sender) { final Shop aShop = (Shop) receiver; switch (point) { //--com.bdaum.aoModeling.generator.java/point OP_$init; case Shop.OP_$init : //TODO Implement operation Shop.OP_$init break; //--com.bdaum.aoModeling.generator.java/point OP_processOrders; case Shop.OP_processOrders : //TODO Implement operation Shop.OP_processOrders break; //--com.bdaum.aoModeling.generator.java/point OP_$dispose; case Shop.OP_$dispose : //TODO Implement operation Shop.OP_$dispose break; //--com.bdaum.aoModeling.generator.java/point; } return true; }}

Page 48: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Current status of KLEEN

All essentials of the core diagram editor are implemented.Validators for core model, Java, SQL, XML Schema and XMI.Generators for Java, SQL, XML Schema and XMI. Generated applications ready to execute.XPath constraint language.Java, XML Schema, SQL type systems – cross compiled to target environment.Design patterns, usage and authoring.

Page 49: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

What next?

Generators for JPA, WebServices and GUIsOther constraint languages (OCL?, XPath 2.0?)Better integration into RCP-frameworkAnd then: Process modeling?

Page 50: Introducing Asset Oriented Modeling and KLEEN

bdaum industrial communications

Thank you

www.aoModeling.org