1 / 68

Model Driven Development with ORM 2 and NORMA

Model Driven Development with ORM 2 and NORMA. Terry Halpin Neumont University terry@neumont.edu www.orm.net. © 2007 T. Halpin & Neumont University. ORM Features, History, and Tool Support The Data Modeling Process ORM’s Graphical Language Comparison with ER and UML Case Study

morrison
Download Presentation

Model Driven Development with ORM 2 and NORMA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Model Driven Developmentwith ORM 2 and NORMA Terry Halpin Neumont University terry@neumont.edu www.orm.net © 2007 T. Halpin & Neumont University

  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. 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. Object-Role Modeling (ORM) • A conceptualapproach 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). 1The OMG’s SBVR approach is also fact-oriented.

  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 (2nd generation ORM)

  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

  9. Data Use Cases • 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

  10. Analysis is a Joint Activity • 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 modelervalidates the model with the client by • Verbalizing the model in natural language • Populating the model with positive/negative examples

  11. Data(uninterpreted syntax) 571 The Patient with Patient# ‘571’ has a Temperature of 100 oF Fact (proposition taken to be true) Information = data + semantics

  12. Elementary Facts Anelementary factis 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

  13. A unary fact The Person named ‘Jack Smith’ smokes. A binary fact The Executive named ‘William Portals’ climbedthe Mountain named ‘Mt Rainier’. A ternary fact The Person named ‘Don Bradman’ played the Sport named ‘Cricket’ for the Country named ‘Australia’. Facts may also be of higher arity (4 or more roles).

  14. An Old but Fun Example 14

  15. Overall Procedure: Information systems life cycle • 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

  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. Conceptual schema design procedure

  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.

  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.

  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 modein 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. 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. 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. 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. Predicates (relationships) have one or more roles,each played by instances of a single object type. Predicate readings may be shown in mixfix notation1 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. smokes i.e. … smokes likes i.e. … likes … Roles may also be named.Duplicate predicate shapes are shadowed. 1Mixfix allows natural verbalization of predicates of any arity, and non-infix predicates (common in many foreign languages).

  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. 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. An elementary fact type may be objectified, resulting in another object type. e.g. • 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.

  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.

  31. e.g.

  32. Object Value Constraints Role Value Constraints

  33. Subset Constraints

  34. Equality Constraints

  35. Exclusion Constraints Exclusive-Or Constraints

  36. Subtyping

  37. Frequency Constraints

  38. Ring Constraints

  39. The previous constraints are all alethic (necessarily true for each state). ORM 2 also supports deontic versions of all these constraints

  40. Model Validation } Counter-example Uniqueness constraint on first role +ve form:EachMoonorbitsat most onePlanet. Illustrated by a satisfying fact population. -ve form:It is impossible that the sameMoonorbitsmore than onePlanet. Test with a counter-example.

  41. The absence of a uniqueness constraint on the second role may be verbalized using default form: It is possible that the samePlanetis orbited bymore than oneMoon. Illustrated by a satisfying fact population.

  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. In ORM 2, rules may be assigned different modalities Alethic: It is possible that more than onePatientis a husband ofthe samePatientand that more than onePatientis a wife ofthe samePatient. EachPatient, Patientcombination occurs at most once in the population ofPatientis a husband ofPatient. Deontic: It is obligatory that eachPatientis a husband ofat most onePatient. It is obligatory that eachPatientis a wife ofat most onePatient.

  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. 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. UML’s multiplicity notation is fine for binaries but not for n-aries e.g. can’t express as a multiplicity

  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. Semantic stability • 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.

  49. List titled people and their gender select SSN, gender from Person where title is not null üPerson --- has Title --- is ofüGender

  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

More Related