Introducing Asset Oriented Modeling and KLEEN - PowerPoint PPT Presentation

1 / 50
About This Presentation
Title:

Introducing Asset Oriented Modeling and KLEEN

Description:

Okay for OO-implementation models but lacks essential concepts (keys) for database modeling. ... Simple key fields refer to asset properties. ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 51
Provided by: aomod
Category:

less

Transcript and Presenter's Notes

Title: Introducing Asset Oriented Modeling and KLEEN


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

2
Asset Oriented Modeling
  • Rationale
  • Concepts that differentiate AOM from ERM
  • Higher order relationships
  • Regular sets and regular grammars
  • Keys
  • Inheritance
  • Pluggable Model Components
  • Namespaces
  • Summary

3
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.

4
Binary relationships
  • Binary relationships are the most common type of
    relationship.

orders
Customer
Product
5
N-ary relationships
  • Generally n-ary relationships cannot be replaced
    by binary relationships.

Tutor
teaches
Course
Student
6
Unary relationships
  • Unary relationships are usually used to describe
    a containment.

Order
Orderline
7
0-ary relationships
  • 0-ary relationship entity

Order
8
Assets
  • Assets are generalized relationships
  • They serve as both entity and relationship

9
Arcs and Clusters
  • Arcs provide the necessary connectors for
    relationship assets.
  • Clusters describe alternatives

10
Level 2 Structures
  • L2S may be used to group assets
  • L2S act only as named boundaries
  • Much weaker construct than assets
  • Each L2S is identified by a mandatory
    identifying asset.

11
Applying AOM
Real World
AOM
Model
Scenario
L2S
Business Object
Asset
asset
12
AOM Container Hierarchy
  • Models may include other models
  • Level2 containers may be nested
  • Assets cannot be nested
  • Properties may be nested

Model
Level2
Asset
Property
13
The model

14
Grammars
  • Assets, clusters and arcs constitute a grammar
  • Asset names act as non-terminal symbols
  • Asset labels act as terminal symbols and
    determine the names of asset instances

15
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.

16
Properties
  • Properties can be nested name(first,middle?,last
    )?
  • Sequences, bags, alternativesmeeting(timelocatio
    n)order(productservice)?
  • Repetitionsaccount, phone-no1..4, address
  • Recursionslabelpart(id,description,label)

17
Properties vs. Assets
  • Assets are first class citizens
  • Assets may specify a namespace properties not
  • Assets may specify keys properties not
  • Assets may specify operations properties not

18
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.

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

20
Simple types
  • Pluggable type systems
  • Multi type system models
  • Type systems are declared on model level and
    identified via a prefix

21
Complex types
  • Assets can serve as type definitions

22
Complex type expressions
  • Complex type expressions union, sequence,
    repetition.

23
Constraints
  • Pluggable constraint languages
  • Possibility to define abstract constraints

24
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.

25
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.

26
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).

27
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.

28
Summary
  • Everything is a relationship
  • Fits tightly with relational model
  • Flexible models (model evolution)?
  • Grammar based (HRG)?
  • Fits tightly with XML schema languages
  • Advanced model validation
  • Model transformation (refactoring)?
  • Powerful inheritance constructs
  • Compact and consistent models
  • Genuine key concept
  • Allows to generate highly efficient access code
  • Namespaces
  • Distributed model development, extensions

29
KLEEN
  • Diagram Editor
  • Validation
  • Generators
  • Current status
  • What next?

30
Diagram Editor
31
Diagram Editor - Features
  • Automatic layout and arc routing
  • Views for item features, inheritance,
    dependencies
  • In-line editors for item features
  • Syntax checking
  • Property expressions, constraints, annotations,
    etc.
  • Assistance (automatic completion)?
  • Property expressions, constraints, annotations,
    etc.
  • Export as PNG and SVG

32
Diagram Editor - Transformation
  • Explode asset
  • Implode asset
  • Resolve inheritance
  • Revert arc
  • Extract annotation script

Implosion
Inheritance resolution
33
Model merging
  • Composite models include other models
  • Nesting is possible
  • Included models are alive

34
Auditing
  • Systematic check for
  • Completeness
  • Consistency
  • Redundancy

35
Model validation
  • Detects structural problems
  • Orphans
  • Arc and type cycles
  • Contradicting constraints
  • Warns on best practice violation
  • Non PNF key usage
  • Offers quick fixes
  • A click on an error marker proposes a fix for
    most urgent problem

36
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.

37
XML Schema Generator
  • Generates standard XML Schema
  • Code generation can be controlled via
    scripting
  • Attribute/Element/Any/Ignore
  • Default and fixed values
  • Mixed content
  • Documentation

lt?xml version"1.0" encoding"UTF-8"?gt ltxsschema
attributeFormDefault"unqualified"
elementFormDefault"qualified"
targetNamespace"http//www.corp.com"
xmlns"http//www.corp.com/orders"
xmlnsc"http//www.corp.com"
xmlnsjag"http//www.aomodeling.org/KLEEN/JavaGen
erator" xmlnsuml"http//www.aomodeling.org/
KLEEN/XmiGenerator" xmlnsxs"http//www.w3.o
rg/2001/XMLSchema" xmlnsxsg"http//www.aomo
deling.org/KLEEN/XSDgenerator"gt lt!--Schema
created by KLEEN XSD generator version 0.4.0--gt
ltxsimport namespace"http//www.corp.com/orders
" schemaLocation"www_corp_com_ord
ers_TYPELIB.xsd"/gt ltxsinclude
schemaLocation"www_corp_com_TYPELIB.xsd"/gt
lt!--Asset ccustomer--gt ltxselement
name"customer"gt ltxscomplexTypegt
ltxschoicegt ltxssequencegt
ltxselement name"name"/gt
ltxselement name"customerID"
type"xsNMTOKEN"/gt
lt/xssequencegt ltxssequencegt
ltxselement name"name"gt
ltxscomplexTypegt
ltxssequencegt
ltxselement name"first"/gt
ltxselement minOccurs"0"
name"middle"/gt
ltxselement name"last"/gt
lt/xssequencegt
lt/xscomplexTypegt
lt/xselementgt ltxselement
name"birthDate" type"xsdate"/gt
ltxselement name"customerID"
type"xsNMTOKEN"/gt
lt/xssequencegt lt/xschoicegt
lt/xscomplexTypegt ltxskey
name"pk__c_customer_customerID"gt
ltxsselector xpath"."/gt ltxsfield
xpath"ccustomerID"/gt lt/xskeygt
lt/xselementgt lt/xsschemagt
38
XMI Generator
  • Generates standard XMI 1.0
  • Generated code can be fed into UML modelers.

ltFoundation.Core.ModelE
lement.namegtcustomerlt/Foundation.Core.ModelElement
.namegt
ltFoundation.Core.ModelElement.visibility
xmi.value"public"/gt
ltFoundation.Core.ModelElement.isSpecification
xmi.value"false"/gt
ltFoundation.Core.GeneralizableElement.isRoot
xmi.value"false"/gt
ltFoundation.Core.GeneralizableElement.isLeaf
xmi.value"false"/gt
ltFoundation.Core.GeneralizableElement.isAbstract
xmi.value"false"/gt
ltFoundation.Core.Namespace.ownedElementgt
ltFoundation.Core.Class
xmi.id"xmi.17" xmi.uuid"uuid-1b8119a-f4c6e35f47-
75b2d4280b36b135d9e254f3b2e61b7f"gt
ltFoundation.Core.ModelElement
.namegtc__customerlt/Foundation.Core.ModelElement.na
megt
ltFoundation.Core.ModelElement.visibility
xmi.value"public"/gt
ltFoundation.Core.ModelElement.isSpecificati
on xmi.value"false"/gt
ltFoundation.Core.GeneralizableElement.isR
oot xmi.value"false"/gt
ltFoundation.Core.GeneralizableElement.is
Leaf xmi.value"false"/gt
ltFoundation.Core.GeneralizableElement.i
sAbstract xmi.value"true"/gt
ltFoundation.Core.Class.isActive
xmi.value"false"/gt
ltFoundation.Core.ModelElement.namespacegt

ltFoundation.Core.Namespace xmi.idref"xmi.15"/gt

lt/Foundation.Core.ModelElement.namespacegt
ltFoundation.Core.Class
ifier.feature/gt
ltFoundation.Core.GeneralizableElement.specializa
tiongt
ltFoundation.Core.Generalization
xmi.idref"xmi.21"/gt
ltFoundation.Core.Generalization
xmi.idref"xmi.32"/gt
lt/Foundation.Core.GeneralizableElement.spec
ializationgt
lt/Foundation.Core.Classgt
39
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/Set
  • No events / Simple events / Bubbled events
  • Accessor methods vs. public fields
  • Documentation

40
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 _at_param value new
element value / public void
setCustomerID(String _value) / Method
getCustomerID. Get value of property customerID
_at_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

41
Type checks
  • Generates code for type checks into access
    methods.
  • /
  • Method setProductNo. Set value of property
    productNo
  • _at_param value new field value
  • /
  • public void setProductNo(String _value)
  • if (_value null)?
  • throw new IllegalArgumentException(
  • ModelMessages.getString("Argument.no
    t_null", "productNo"))
  • if (!TypeCheck.isString(_value))?
  • throw new IllegalArgumentException(
  • ModelMessages.getString("Argument.no
    nXML_characters","productNo"))
  • if (!TypeCheck.isNMTOKEN(_value))?
  • throw new IllegalArgumentException(
  • ModelMessages.getString("Argument.in
    valid_type_pattern","productNo","NMTOKEN"))
  • productNo _value

42
Constraints and Contracts
  • Explicit constraints are checked on demand.
  • / Constraint validateConstraint1
    amount gt 0 _at_throws com.bdaum.aoModeling.runtim
    e.ConstraintException /public void
    validateConstraint1() throws ConstraintException
    if (!(getAmount() gt 0)) throw new
    ConstraintException( ModelMessages.getStr
    ing("Constraint.violated", "amount gt 0"))
  • Contracts are checked before and after
    operations.
  • / Operation deliver. _at_param _sender
    - the sender instance of this message /public
    void deliver(AomObject _sender) assert
    getClient().getMerchandise().containsKey(getProduc
    t().getProductId())
    "Product
    client/merchandise" performOperation(OP_delive
    r, _sender)


43
Events
  • Three types of event notification
  • none
  • simple
  • bubbled
  • /
  • Method setAmount. Set value of property amount
  • _at_param value new field value
  • /
  • public void setAmount(int _value)
  • if (_value amount)?
  • return
  • int oldStockedWith_amount amount
  • amount _value
  • fireIfValueChanged(this,oldStockedWith_amount,_v
    alue,PackageInterface.StockedWith_amount)

44
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_NAMESP
    ACE)
  • out.setPrefix("xsi", PackageInterface._XSI_NAMESPA
    CE)
  • out.startTag(null, "Shop")
  • out.attribute(PackageInterface._XSI_NAMESPACE,
    "schemaLocation", PackageInterface._DEFAULT_NAMESP
    ACE " Shop.xsd")
  • toXML(out)
  • out.endTag(null, "Shop")
  • out.flush()

45
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_DOCU
    MENT)?
  • throw new XmlPullParserException(ModelMessages.get
    String(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_DOCUME
    NT)throw new XmlPullParserException(ModelMessages
    .getString(ErrorMessages.END_DOCUMENT_EXPECTED,
    String.valueOf(xpp.getLineNumber())))
  • return instance

46
Instrumentation
  • Aspects can be dynamically connected to asset
    classes.
  • A Main class with default instrumentation is
    generated.
  • /--com.bdaum.aoModeling.generator.java/instrument
    ation operation /
  • public static void attachMainOperationInstrumentat
    ion()
  • 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)

47
Aspects
  • Four types of standard aspects are currently
    generated
  • Operation (Custom Business logic)?
  • Logging (for debugging purposes)?
  • XML (for xsany 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/poin
    t OP_init
  • case Shop.OP_init
  • //TODO Implement operation Shop.OP_init
  • break
  • //--com.bdaum.aoModeling.generator.java/poin
    t OP_processOrders

48
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.

49
What next?
  • Generators for JPA, WebServices and GUIs
  • Other constraint languages (OCL?, XPath 2.0?)?
  • Better integration into RCP-framework
  • And then Process modeling?

50
Thank you
www.aoModeling.org
Write a Comment
User Comments (0)
About PowerShow.com