This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
1DRAFT 02-Feb-07
caAdapter Model Mapping Service Hands-On Training
(Course# 2040)
Session Date: TBD
Session Length: 90 minutes
Target Audience: caCORE Application Developers
caBIG Developers
Trainer: Charles Yaghmour
Developer Subject Matter Expert: Ye Wu
2DRAFT 02-Feb-07
Session Details
• Training Topic Statement: This training is designed to teach you about the caAdapter Model Mapping Service
• Target Audience: caCORE developers and caAdapter end-users
Use these buttons (or choose from the Actions menu) to communicate with the trainer and other attendees.
Example:Raise your hand to ask a question.
4DRAFT 02-Feb-07
Session Details:
Online Training Environment: Centra
You can adjust what you see on screen by choosing from the View menu or by scrolling with the slide bars.
5DRAFT 02-Feb-07
Session Details:
Online Training Etiquette
• Be an active learner! Ask questions, and avoid temptation to multi-task. Keep distractions away!
• When not asking a question or making a comment, please keep your phone on MUTE to minimize background noise.
• Please do not put your phone on HOLD – the music is distracting.
• When asking a question or making a comment, please state your name so we know who’s speaking.
6DRAFT 02-Feb-07
Session Details:
Session Goals
• By the end of this training, you will be able to:– Describe how caAdapter Model Mapping Service
supports the caCORE SDK process– Demonstrate the eight steps involved in using
caAdapter to map an object model to a data model– Use caAdapter to perform mapping for a variety of
complex object associations
7DRAFT 02-Feb-07
Session Details:
Lesson Plan
• Lesson 1: Introduction and Background• Lesson 2: Mapping Process Step-by-Step• Lesson 3: Advanced Mapping• Exercise I• Exercise II
8DRAFT 02-Feb-07
Lesson 1: Introduction and Background
Lesson Overview
• This lesson is about the caCORE model mapping process, the caAdapter Model Mapping Service, and other services provided by caAdapter
• Learning Objectives for this Lesson:– Review the current caCORE model mapping process– Show how caAdapter can make mapping easier – Show other uses of caAdapter
9DRAFT 02-Feb-07
Lesson 1: Introduction and Background
What are caCORE-compatible applications?
• Data management framework• Software infrastructure pattern• Characteristics of caCORE:
• Map the classes to the tables• Map the attributes to the columns• That’s the easy part…and it must be done first,
then we can do the association mapping….
• Associations are mapped to foreign key columns• Business rules guide the mapping of
associations
38DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
Scenario 1 – One-to-One Bidirectional
• Map classes & attributes
• Map association from child table’s class to the child table’s foreign key (ignore the other association)
Leave this unmapped
39DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
Scenario 2 – One-to-One Unidirectional
• Map association from child table’s class to the child table’s foreign key
• Note that FK column must be in the originating class’s table
40DRAFT 02-Feb-07
• Association on“one” end has a different color and is unmappable
• Map remaining association to table w/ foreign key
Lesson 3: Advanced Mapping
Scenario 3 – One-to-Many Bidirectional
Unmappable
class One to Many
bidirectional::Adv erseEv ent
- id: Integer- type: String
bidirectional::Adv erseEv entTherapy
- id: Integer- type: String
+adverseEvent
1+adverseEventTherapyCollection
1..*
41DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
Scenario 4 & 5 – 1:M & M:1 Unidirectional
• One-to-manymaps same asmany-to-one, except for fakedassociation
• See a pattern?• Map association in class with table with FK to FK
Ignore, unmappable
42DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
Not a Scenario – Many-to-One Bidirectional
• Note that many-to-one bidirectional is literally the same as one-to-many bidirectional
• No distinction in caAdapter• Not considered a separate scenario
class One to Many
bidirectional::Adv erseEv ent
- id: Integer- type: String
bidirectional::Adv erseEv entTherapy
- id: Integer- type: String
+adverseEvent
1
+adverseEventTherapyCollection
1..*
43DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
Scenario 6 – Many-to-Many Bidirectional
• ONLY time you map both associations
Make sure to map the X-Collection to the X_id
Intersection table does not need dependency mapping
44DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
Scenario 7 – Many-to-Many Unidirectional
• Back to normal pattern
• Map X-Collection to X_ID
45DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
Inheritance Mapping
• Map the attributes that are distinct to the subclass (as normal attribute mappings)
• For inherited attributes marked with the “(A – Derived)” label, only map if it’s the PK
• During validation, an “INFO” level message will be displayed
Mapped
Not mapped
46DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
Demonstration of Mapping Scenarios
Live Demonstration of the Mapping Scenarios
47DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
General Tips – Using XMI Versions
• Note that you must have a version of EA that can export XMI v1.1 (XMI v2.0 is optional)
• caAdapter can load both XMI v1.1 and v2.0 for mapping and tagging.
• XMI v1.1 is required by the Semantic Integration Workbench (SIW)
48DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
General Tips – Updating Data/Object Models
• Once a mapping has been created, you can go back and change the object or data model without having to redo the entire mapping
• If model(s) must be changed… – Edit model(s) in the original EA file– Export the .xmi file again– Either use the same .xmi file name or remove the old
file and use a new name– Open the .map file in caAdapter and select the
new .xmi file when it prompted– Continue mapping as needed
49DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
General Tips – Choose 1 Mapping Method
• In the current release of caAdapter, you can’t start the mapping manually and then continue it in caAdapter
• Note that you can’t view manually created mappings in caAdapter either
50DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
General Tips – Sharing Files
• Must provide both the .map and the original .xmi• The .map file contains a reference to the .xmi,
including a file path• Other user must put .xmi in same path as first
user, or edit the .map file and change the path• USE CAUTION if you edit the .map file!
.map.xmi +
51DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
General Tips – Other Modeling Tips…
• Follow general caCORE SDK guidelines for modeling
• Any association with unspecified directionality will be treated as bidirectional by caCORE SDK
• Can’t do 3-way intersection table in caCORE SDK (or more ways!)
• To map a one-to-one unidirectional association, for the object that has the association attribute, the corresponding table must have the foreign key.
52DRAFT 02-Feb-07
Lesson 3: Advanced Mapping
General Tips – Other Modeling Tips
• caAdapter adds a caCORE SDK-required tag on many-to-many associations, called “correlation-table” with value = name of intersection table (yes, this is on the object model whereas other tags are on data model)
• Other tags: “mapped-attribute”, “implements-association”, “inverse-of”
53DRAFT 02-Feb-07
• Explained how to handle 7 different association mapping scenarios & inheritance mapping
• Performed a live demonstration of the scenarios• Identified tips for working with the caAdapter
Model Mapping Service
• Questions?
Lesson 3: Advanced Mapping Review & Questions
54DRAFT 02-Feb-07
Exercises
Overview
• The exercises will help you get some practical, hands-on experience in working with the caAdapter Model Mapping Service within the caCORE SDK process.
• Learning Objectives for the Exercises:– Identify the difference between manual mapping and
caAdapter-based mapping– Perform basic and advanced mapping with a robust
example– Generate an XMI file for use with caCORE SDK and
1. Minimize Centra or CBR/WBT teaching environment (Do NOT close the window)
2. Launch a new web session
3. Access the application you are being trained on
4. Complete the hands-on exercises
5. Minimize the web session
6. Maximize Centra to rejoin training
56DRAFT 02-Feb-07
• When instructed, minimize the Centra Session
Exercises: Minimizing Centra
57DRAFT 02-Feb-07
Exercises: Launching a New Web Session
• Launch a new web session• Complete the hands-on exercise• Minimize the web session
58DRAFT 02-Feb-07
Exercises: Rejoining Training Module (e.g, Centra)
• Once hands-on exercises are complete and you have minimized the web session, rejoin the training by maximizing the training session.
• Locate the Centra window in your Task Bar and click to maximize it.
59DRAFT 02-Feb-07
Exercises
Exercise I – Basic Mapping
• Part 1: Review a manual mapping in EA – Explore object/table, attribute/column mappings
• Part 2: Use caAdapter to recreate the mapping – Open the .eap file in EA– Export the .xmi file (v1.1 or v2.0)– Start caAdapter & load .xmi in model mapping tab– Drag-n-drop object model elements onto data model– Validate model and view validation messages– Save the mappings to a .map file
60DRAFT 02-Feb-07
Exercises
Exercise II – Advanced Mapping & Generation
• Part 1: Map 1:M, M:M bidirectional associations – Open .map file that has been started for you– Map associations for StudySite to Participant &
AdverseEvent to AdverseEventTherapy– Click the Validate button or choose File > Validate
• Part 2: Generate the .xmi file for caCORE SDK– Continuing with current mapping file, map the
associations– Export the mapping to HBM– Export the mapping to XMI– Open EA, import the .xmi and view the mapping tags
61DRAFT 02-Feb-07
Exercises
Exercise I Files - In case you don’t finish a step
• Exercise I – Part 1 – manually completed mappings.eap – an EA file with the mapping already completed manually
• Exercise I – Part 2a – model without mappings.eap – an EA file with the same classes and tables but no mappings, from which the XMI file will be exported
• Exercise I – Part 2b – model without mappings.xmi – a successful export from EA containing classes and tables
• Exercise I – Part 2c – new caAdapter mappings.map – a valid map file generated by caAdapter with the classes & attributes mapped to the tables & columns
62DRAFT 02-Feb-07
Exercises
Exercise II Files - In case you don’t finish a step
• Exercise II – Part 1a – completed caAdapter mappings.map – a caAdapter map file with the 2 association mappings completed, ready for validation– Uses Exercise I – Part 2b – model without mappings.xmi as
the basis of the untagged original models
• Exercise II – Part 2a – completed caAdapter mappings_tagged.xmi – an XMI export from caAdapter with complete valid mappings
• Exercise II – Part 2b – caAdapter mappings reimported.eap – an EA file with the mapped classes and tables successfully re-imported
63DRAFT 02-Feb-07
Exercises
Download Files If You Haven’t Already
• The exercise instructions and files are available at the following URL:
http://<fill_in_URL_for_downloading_exercises>
• Please begin the exercises now• Ask questions as you need
64DRAFT 02-Feb-07
Session Summary:
Follow-On Training & Next Steps
• Training presentations available online at http://trials.nci.nih.gov/projects/infrastructureProject/caAdapter/HL7_Tutorial
– HL7 Version 3 and caAdapter Overview– caAdapter Fundamentals
• caCORE SDK training athttp://gforge.nci.nih.gov/docman/index.php?group_id=63&selected_doc_group_id=181&language_id=1
– caCORE SDK (Session 1: Semantic Interoperability)– caCORE SDK (Session 2: Code Generation)– Plus many other courses
65DRAFT 02-Feb-07
Session Summary:
Course Evaluation
• Please provide feedback so we can improve this training
• Training Evaluation Form is on the Training Portal athttp://ncicb.nci.nih.gov/NCICB/training/cadsr_training/EvaluationForm