240 likes | 373 Views
MODELOG – Model-Oriented Development with Executable Logical Object Generation. Franklin Ramalho Universidade Federal de Campina Grande - UFCG Jacques Robin Universidade Federal de Pernambuco - UFPE. ORCAS Group. Outline.
E N D
MODELOG – Model-Oriented Development with Executable Logical Object Generation Franklin Ramalho Universidade Federal de Campina Grande - UFCG Jacques Robin Universidade Federal de Pernambuco - UFPE ORCAS Group
Outline MODELOG: Model-Oriented Development with Executable Logical Object Generation 1.1 Motivation 1.2 Methodological and representational basis • UML and OCL • Model-Driven Engineering • Sequential Transaction Frame Logic • Approach • Case Study 1.4 Envisioned contributions 1.5 Current status
MODELOG motivation: new roles for UML • Initial role of UML (Unified Modeling Language) • Visual notation for high-level blueprints in Object-Oriented Software Engineering (OOSE); • Standard, intuitive, expressive, extensible, many CASE tools available. • New roles for UML: • Model-Driven Engineering: • Abstract visual syntax for meta-modeling; • Low-level specification language for fully automated code generation; • Formal specification language for formal verification. • Knowledge-level representation language for: • Autonomous agents and multi-agent systems (MAS) • Data integration, warehousing and mining for business intelligence (CWM) • Semantic web for knowledge management and intelligent information retrieval
Extensions to the UML: OCL (Object Constraint Language); MOF (Meta-Object Facility); XMI (XML Metadata Interchange); ASL (Action Semantics Language); UML Profiles; Formal Semantics for UML and OCL; AUML (Agent UML). MODELOG motivation: gaps in UML extensions for new roles • Missing building blocks: • Complete UML and OCL formal semantics; • UML inference engines; • UML model transformation engines; • UML model compilers to source code.
OCL UML MODELOG • MODELOG: attempt to tackle all 4 missing blocks with single approach Target language: STFL MODELOG • Single target language • All diagrams linked together • OCL
MODELOG’s representational basis:Object Constraint Language (OCL) • UML itself does not specify appropriately integrity constraints and application model rules within models. • OMG incorporated from UML 1.4 version the OCL. • Most logical and imperative constructs • Comprehensive built-in types • Intuitive object-oriented programming syntax • Expresses: • Class and interface invariants • Values to derived properties • Method and operation body, preconditions and post-conditions • Behavioral diagrams nodes and transitions expressions
Object Constraint Language - OCL [Warmer and Kleppe, 2002]
Abstraction Scale Model Transformation definitions UML/OCL Requirements Profiled UML/OCL Realization PSM Source Code Virtual Machine Code Binary Code UML/OCL Specification PIM Executability Scale MDE OOSE Tomorrow: UML Programming
MODELOG’s representational basis:Sequential Transaction Frame Logic (STFL) • Attempt to overcome most limitations of ISO Prolog for: • Formal knowledge representation • Define, manipulate and query data and meta-data • Declarative programming • Addresses: • Theoretically avoidable termination problems • Inefficiencies due to redundant computations • Negation as failure semantics • Logical, declarative, meta-level programming and queries • Logical, declarative updates, including transactions • Logical, declarative representation of inherently procedural knowledge • Intuitive, concise representation of taxonomic knowledge
- class::superclass[...attri typOpi typei,..., methj(...,paramjk,...) typOpj typej...]- object:class[...attri assignOp1 valuei, ...,methj(...,paramjk,...) assignOpj valuej ...] OO atoms Equality High Order Meta-atoms • p(X) (y, z) • or W(y, z) Structural Diagram Frame Logic p1 ... pn c HiLog First Order Horn Logic Sequential Transaction Frame Logic OCL SequentialTransaction Logic p1 ... pn c1 ... cn p(y, z) Connectives: , Predicates: delete, insert Behavioral Diagram Sequential Transaction Frame Logic (STFL) First Order Predicate Logic
fpj1(...,X,...) ... fpjn(...,X,...) fpn0(...,X,...) fnj1(...,X,...) ... fnjn(...,X,...) fnn0(...,X,...) fmj1(...,X,...) ... fmjn(...,X,...) fmn0(...,X,...) Cm Cn Cp Ani: Cnq Api: Cpk Ami: Cmr Opi Omj Opmk Mmj: Mnj: Mpj: Api: Opk Ami: Omr Ami: Omr Object-Oriented Logical Paradigm Class Hierarchy Object Base
Flora Frame Logic Transaction Logic HiLog Flora • Knowledge organized in Classes Hierarchy • Objects • Objects identity • Taxonomy Knowledge Representation • Inheritance • Polymorphism • Path expressions • Updates in Fact Base integrated to backtrack • Procedural Knowledge representation • Superior Order Syntax • 1a order Semantics • Meta-programming • Meta-queries to schema Flora Compiler • Termination is guaranteed in many more cases • Negation as failure under well founded declarativesemantics XSB tabled Prolog
Flora code: • Class hierarchy definition clauses • Class signature definition clauses • Method definition clauses • Object creation clauses • Constraint definition clauses Approach • UML • Class diagrams • Activity diagrams • Object diagrams • OCL constraints • Fully linked together Automated Mapping
Approach • Systematic mapping: • Structural diagrams • Behavioral diagrams • OCL derive specifications • OCL body specifications • OCL constraints to be verified • Metamodels • OMG metamodels for UML and OCL: • Complex Flora metamodel has been constructed • Transformations • ATL specifications (Model) • Flora implementation (Program)
Approach ATL Flora UML OCL Flora
Flora Metamodel customer[name *=> string].
ATL Transformation module AttributeTransformations; create OUT : Flora from IN : UML helper …; rule Attribute2Flora{ from a : UML!Attribute to att : Flora!AttributeSignatureSpecification ( feature.oclAsType(Constant).name <- a.name, host.oclAsType(Constant).name <- a.owner.name, inheritable <- true, multiplicity <- a.getMultiplicity(), type.oclAsType(Constant).name <- a.type), ... }
Generated Flora Code – Class Diagram loyaltyProgram[customer *=>> customer, enroll(customer) *=> void, getNumberOfCustomers() *=> integer]. customer[name *=> string, age *=> integer, title *=> string, isMale *=> boolean, programs *=>> loyaltyProgram].
Generated Flora Code - OCL Self[getNumberOfCustomers() -> Result] :- Self:loyaltyProgram and size(collectbag{Col | Self[customer ->> Col]}, Size) and Result = Size. Self[#enroll(C)] :- Self:loyaltyProgram and C:customer and tnot includes (collectbag{Col | Self[customer ->> Col]} , C) and btinsert{Self[customer ->> C]}.
Generated Flora Code - OCL Self[title -> DerivedValue] :- Self:customer and if Self.isMale = true then DerivedValue = 'Mr' else DerivedValue = 'Ms'. #violated_ageConstraint(Self) :- Self:customer and tnot (Self.age > 18 and Self.age < 65).
Violates the invariant Generated Flora Code – Object Diagram c1:customer[isMale -> true, age -> 20]. c2:customer[isMale -> false, age -> 70]. p1:loyaltyProgram. p2:loyaltyProgram. c1:customer c2:customer p1:loyaltyProgram p2:loyaltyProgram isMale = true age = 20 isMale = false age = 70
General UML Application Area Model-Driven Software Engineering Formal Software Engineering • Model transformation • specification and execution language • Automatic generation of complete structural and behavioral code • Universal PSM for fast • prototyping • Integrated semantics for • UML and OCL • Verification of executable • formal model Semantic Web Agent-Oriented Software Engineering • how to combine strengths of • the previous AOSE methodologies • Automatic code generation • of agents • Combine UML/OCL and Flora to • SW representation • and reasoning Agile Development • Fast prototyping • Automatic structural and • behavioral code generation MODELOG: issues and applications KobrA • MODELOG enhances KobrA by: • - Verifying and Validating (V&V) UML models; • - Checking inter-diagram conformance; • Checking contracts (pre and post-conditions) • KobrA enhances MODELOG by: • Guiding the UML models to be transformed MODELOG through UML-OCL to Flora mapping
OCL to Flora Transformation Rule base: - Flora Metamodel Conceptual mapping - ATL formalization - Rule Base Implementation UML to Flora Transformation Rule base: - Flora Metamodel - Conceptual mapping - ATL formalization - Rule Base Implementation STFL program Verification Meta-rule base UML/OCL model diagrams UML editor UML+ OCL model Implementation as Flora program Complete and Complex Case study for intelligent agents UML + OCL Formal semantics as Flora specification Verified STFL implementation of UML model UML model In XMI/XOCL syntax MODELOG: architecture and status WiSME 2004 MoDELS 2005 To be submitted MoDELS 2006 OCL Mini-course in WMF 2003 Transformation engine Flora-2 STFL Theorem Prover SBLP and JUCS 2003 WMF and ENTCS 2003