Download presentation
Presentation is loading. Please wait.
Published byDarren Norman Modified over 9 years ago
1
1 Model Driven Development with ORM 2 and NORMA © 2007 T. Halpin & Neumont University Terry Halpin Neumont University terry@neumont.edu www.orm.net
2
2 ORM Features, History, and Tool Support The Data Modeling Process ORM’s Graphical Language Comparison with ER and UML Case Study Relational Mapping and Tool Demos
3
3 ORM Features, History, and Tool Support The Data Modeling Process ORM’s Graphical Language Comparison with ER and UML Case Study Relational Mapping and Tool Demos Temporal aspects of Data Modeling
4
4 A conceptual approach for modeling, querying, and transforming data Fact-oriented (attribute-free). All facts are modeled as relationships (unary, binary, ternary …) 1 Semantic stability (no remodeling or requerying to talk about an attribute) Facilitates validation by verbalization & population Richly expressive graphical constraint language (compared with industrial ER, or UML class diagrams). Object-Role Modeling (ORM) 1 The OMG’s SBVR approach is also fact-oriented.
5
5 Modeling Approach = Modeling Procedure(s) + Modeling Language(s) ORM includes procedures for conceptual modeling and for mapping (transforming) ORM models and queries to attribute-based models (e.g. Relational, OO, ER, UML, XSD, OWL). ORM includes graphical and textual modeling languages and a textual query language.
6
ORM History and Tool Support Originated in 1970s in Europe Various flavors (NIAM2007, ORM 2, FCO-IM etc.) First ORM tools developed at Control Data labs in Brussels (IAST, RIDL*) USA tools: InfoDesigner, InfoModeler, ActiveQuery, ORM Source Model solution in Microsoft Visio for Enterprise Architects Current European tools: CaseTalk, Infagon, CogNIAM ORM 2 tool under development: NORMA (open source plug-in to Visual Studio.NET) This presentation focuses on ORM 2 (2 nd generation ORM) 6
7
7 ORM Features, History, and Tool Support The Data Modeling Process ORM’s Graphical Language Comparison with ER and UML Case Study Relational Mapping and Tool Demos Temporal aspects of Data Modeling
8
Going from a process use case to a data model 8
9
For data modeling, we need DATA use cases (cases of data being used), e.g. –Sample reports –Sample input forms –Sample queries How to go from a data use case to a data model? –Have the domain expert verbalize the data –Rephrase this as unambiguous, elementary facts –Add and validate the business rules constraining the data Data Use Cases 9
10
The domain expert best understands the business domain The modeler elicits and formalizes this understanding The modeler assists the domain expert to identify the business rules related to the data (constraints or derivation rules) The modeler validates the model with the client by –Verbalizing the model in natural language –Populating the model with positive/negative examples Analysis is a Joint Activity 10
11
11 Patient#Temperature 571100 Data (uninterpreted syntax) The Patient with Patient# ‘571’ has a Temperature of 100 o F Fact (proposition taken to be true) Information = data + semantics 571
12
12 An elementary fact is an assertion that an object has a property * or one or more objects participate in a relationship ** where the fact cannot be split into simpler facts with the same objects (without info-loss) * plays a role by itself ** play different roles in the same association Elementary Facts
13
13 The Person named ‘Jack Smith’ smokes. A unary fact A binary fact The Executive named ‘William Portals’ climbed the Mountain named ‘Mt Rainier’. Facts may also be of higher arity (4 or more roles). A ternary fact The Person named ‘Don Bradman’ played the Sport named ‘Cricket’ for the Country named ‘Australia’.
14
An Old but Fun Example 4…1020 QLDPot NSWMiddy, TenPint WAShetland PonyMiddy, TenPot …………… 14
15
15 Feasibility study Requirements analysis Conceptual design ( data, process) Logical design ( data, process) External design (data, process) Prototyping Internal design and implementation Testing, validation, and maintenance Large projects are often developed iteratively Overall Procedure: Information systems life cycle
16
16 Conceptual analysis usually involves: high level service (essential business process) modeling information modeling For large applications: divide the UoD into manageable sub-sections prioritize the order in which sub-sections will be modeled apply the Conceptual Schema Design Procedure ( CSDP ) to each sub-section integrate the subschemas into a global conceptual schema Many applications build on existing applications: reverse-engineer the existing model(s) to a conceptual model refine the conceptual model to fit the new business needs
17
17 Conceptual schema design procedure 1Transform familiar examples into elementary facts and apply quality checks 2Draw the fact types and apply a population check 3Check for entity types that should be combined and note any arithmetic derivations 4Add uniqueness constraints and check arity of fact types 5Add mandatory role constraints and check for logical derivations 6Add value, set comparison, and subtyping constraints 7Add other constraints and perform final checks
18
18 ORM Features, History, and Tool Support The Data Modeling Process ORM’s Graphical Language Comparison with ER and UML Case Study Relational Mapping and Tool Demos
19
ORM 2 Graphical Modeling Language Object = Entity or Value Entity = Object that is identified by a definite description. Entities typically change their state over time. Entities may be concrete or abstract. e.g.The Country that has CountryCode ‘AU’. The President named ‘Abraham Lincoln’. The Course with course code ‘CS542’. Entity types are depicted as named, soft rectangles. As a configuration option, soft rectangles may be replaced by hard rectangles or ellipses. 19
20
Value = Lexical Constant (typically a character string or number). Values are literal and cannot change their state. e.g.The CountryCode ‘AU’. The PresidentName ‘Abraham Lincoln’. The CourseCode ‘CS542’. The RoomNumber ‘207’. The SerialNumber 1090. Value Types are depicted as named, dashed rectangles. Optionally, ellipses or hard rectangles may be used instead. 20
21
21 Many entities are identified by their relationship to a simple value. If this is true for all instances of their entity type, the reference (identification) scheme for their entity type may be displayed as a reference mode in parenthesis. The reference mode may be popular, unit-based, or general. A popular reference mode has a corresponding value type that is used to identify entities of one type only, and is preceded by a dot. e.g. The value type name appends the reference mode name to the entity type name, with a user-definable format that may include a separator e.g.CountryCodeCourseCodePresidentName etc. Country_CodeCourse_CodePresident_Name etc.
22
22 A unit-based (or measurement ) reference mode uses a unit based on some unit dimension (whose display is often suppressed) 1. A colon “:” is appended to the unit e.g. The value type name appends “Value” to the reference mode name (if the language is English) with a user-definable format e.g. cmValueUSDValue cm_ValueUSD_Value If desired, the unit type may be displayed after the colon, e.g. 1 Support for unit-based reference etc. is expected by end 2007
23
23 Different units based on the same unit dimension are permitted in the same model, e.g. General reference modes have the same name as their value type. The value type may be used to reference multiple entity types e.g.
24
24 An independent object type may have instances that exist in the model without participating in any other relationships. Independent object types have a “!” placed after their name e.g. If an object type shape is duplicated in the diagram (either on the same page or on different pages) this is shown by a shadow e.g. An external object type is defined in another model. The display notation “^” is tentative e.g.
25
25 Predicates (relationships) have one or more roles, each played by instances of a single object type. Predicate readings may be shown in mixfix notation 1 using … as an object placeholder, e.g. … introduced … to … For unary and binary predicates with no leading or trailing text, the placeholder may be omitted e.g.smokesi.e. … smokes likesi.e. … likes … Roles may also be named. Duplicate predicate shapes are shadowed. 1 Mixfix allows natural verbalization of predicates of any arity, and non-infix predicates (common in many foreign languages).
26
26 For binary predicates, forward and inverse readings may be shown separated by “/”. Alternatively, arrow tips may be used. Combining a predicate with its object type(s) forms an elementary or compound fact type. An elementary fact can’t be split into smaller facts with the same objects, without information loss e.g.
27
27 A compound fact type includes two or more fact types, and if used in a model must be declared to be derived e.g. An existential fact (or reference) simply asserts the existence of an object e.g. There exists a Country that has CountryCode ‘US’. Existential fact types are displayed either using a reference mode or an explicit relationship, e.g. This includes constraints (see later).
28
28 e.g. An elementary fact type may be objectified, resulting in another object type. A fact type may be: asserted (base fact type) fully derived derived and stored semi-derived
29
Uniqueness constraints require instances of their role or role sequence to be unique in the role or role sequence population. Internal uniqueness constraints apply to a single predicate and are depicted by bar(s) over the constrained role(s). External uniqueness constraints apply to roles from different predicates and are depicted by circled bars connected to the roles. If the constraint applies to role(s) used to provide the preferred identification scheme for an object type, a double-bar is used. 29
30
A simple mandatory role constraint requires its role to be played by all instances of its object type’s population and is shown by a solid dot at either end of the role-type connector. An inclusive-or (or disjunctive mandatory role) constraint requires at least one of its roles to be played by all instances of its object type’s population and is shown by a circled, solid dot connected to the roles. 30
31
31 e.g.
32
32 Object Value Constraints Role Value Constraints
33
33 Subset Constraints
34
34 Equality Constraints
35
35 Exclusion Constraints Exclusive-Or Constraints
36
Subtyping 36
37
Frequency Constraints 37
38
Ring Constraints 38
39
The previous constraints are all alethic (necessarily true for each state). ORM 2 also supports deontic versions of all these constraints 39
40
40 Uniqueness constraint on first role +ve form: Each Moon orbits at most one Planet. Illustrated by a satisfying fact population. -ve form: It is impossible that the same Moon orbits more than one Planet. Test with a counter-example. PhobosMars DeimosMars IoJupiter IoMars } Counter-example Model Validation
41
41 The absence of a uniqueness constraint on the second role may be verbalized using default form : It is possible that the same Planet is orbited by more than one Moon. Illustrated by a satisfying fact population. PhobosMars DeimosMars IoJupiter
42
42 Sample screenshot showing automated verbalization (+ve plus some default) for some selected aspects. Currently about 80% of constraints are verbalized. The rest should be implemented in a few months.
43
43 Alethic: It is possible that more than one Patient is a husband of the same Patient and that more than one Patient is a wife of the same Patient. Each Patient, Patient combination occurs at most once in the population of Patient is a husband of Patient. Deontic: It is obligatory that each Patient is a husband of at most one Patient. It is obligatory that each Patient is a wife of at most one Patient. In ORM 2, rules may be assigned different modalities
44
44 ORM Features, History, and Tool Support The Data Modeling Process ORM’s Graphical Language Comparison with ER and UML Case Study Relational Mapping and Tool Demos
45
45 ER and UML class diagrams are attribute-based, leading to more compact diagrams that are closer to implementation schemas. UML also includes many other diagram types to deal with process modeling etc. ORM’s attribute-free nature facilitates validation by verbalization and population and semantic stability. ORM’s graphic language is far richer for data modeling than that of ER and UML, and its textual languages are far easier for non-technical users to understand than UML’s OCL. ORM’s graphical language is also orthogonal and unambiguous (unlike UML).
46
46 UML’s multiplicity notation is fine for binaries but not for n-aries e.g. can’t express as a multiplicity
47
47 UML’s xor is defined between associations, not association roles, so this is ambiguous. ORM correctly defines the constraint between roles and treats it as a combination of exclusion and inclusive-or.
48
48 ORM models are immune to changes that reshape attributes as entity types or relationships. The meaning of a query is not changed if we change a constraint or add a new fact type. ORM queries respect this principle and hence facilitate schema evolution. ER and OO queries do not: such changes can cause attributes to be remodeled; hence, existing queries need to be reformulated. Semantic stability
49
49 List titled people and their gender Person --- has Title --- is of Gender select SSN, gender from Person where title is not null
50
50 List titled people and their gender Person --- has Title --- is of Gender select Person.SSN, gender from Person join PersonTitle on Person.SSN = PersonTitle.SSN
51
51 Have your cake and eat it too by using ORM for conceptual analysis and mapping it to ER or UML views as desired. It is expected that the NORMA tool will provide automatic, live generation of both ER and UML views by the end of 2008.
52
52 ORM Features, History, and Tool Support The Data Modeling Process ORM’s Graphical Language Comparison with ER and UML Case Study Relational Mapping and Tool Demos
53
Specify an ORM schema for this report from a book publisher.
55
Model this report from the same business domain.
57
Model this final report from the same business domain.
59
The full schema
60
60 ORM Features, History, and Tool Support The Data Modeling Process ORM’s Graphical Language Comparison with ER and UML Case Study Relational Mapping and Tool Demos
61
61 Conceptual Schema Relational Schema Rmap procedure generates 5 th normal form by default. Relational Mapping
62
62 PatientAllergy patientNrpatientNamesmokes 1025 1056 Ann Jones John B. Smith true false patientNrdrugName 1025 Penicillin Codeine External (forms) and Logical (relational) schemas provide different structures for grouping elementary (conceptual) facts.
63
63 Tool Demos (1) Microsoft Visio ORM Source Model Solution (2) NORMA
64
64 Microsoft Visio for Enterprise Architects supports: Entry of ORM 1 schemas Forward engineering of ORM schemas to relational schemas Forward engineering of ORM updates to relational updates Direct entry of relational schemas Multiple styles for relational schemas (pure relational, IDEF1X, …) Reverse engineering of relational schemas to ORM schemas Report generation
65
NORMA 1 is the first tool to support ORM 2 Coded in C#, XML and XSLT Open source plug-in to Microsoft Visual Studio.NET 2005, utilizing Microsoft’s Domain Specific Language (DSL) toolkit. Supports entry of ORM 2 models Automated live error checking and verbalization Automatic transformation to implementation artifacts Can import ORM models from Visio (via free Orthogonal Toolbox) Currently pre-beta. A usable version for industry is expected in 2008 1 Public version downloadable from http://sourceforge.net/projects/orm. A newer build will soon be provided. See NORMA Labs 1-5 to start. NORMA (Neumont ORM Architect) 65
66
66 NORMA supports mappings to various implementation artifacts
67
67 Main current limitations of NORMA Forward engineering to new schemas only (generation of incremental schema updates is coming) Verbalization of only about 75% of constraints (full verbalization expected early 2008) No reverse engineering (we have a basic prototype. RevEng expected in a 2008 release) Constraint code generation only for basics (ma, unique, value) (full code generation of graphic constraints expected late 2008) (code generation for formal textual constraints expected later) Future plans include complete application generation (including forms) ER, UML etc. views (editable) multi-model support (including model component reuse) integration with conceptual process modeling
68
68 www.orm.net -- my ORM website www.ORMFoundation.net-- ORM Foundation website www.inConcept.com -- Journal of Conceptual Modeling, … www.ORMcentral.com -- COM API details for VEA, … www.objectrolemodeling.com/-- Orthogonal Toolbox, … www.brcommunity.com/-- Business Rules Journal articles Halpin, T. 2001, Information Modeling and Relational Database Design, Morgan Kaufmann. Halpin, T. et al. 2003, Database Modeling with Microsoft Visio for Enterprise Architects, Morgan Kaufmann. Further resources
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.