Chapter 3 Getting Started with Objects Manipulation Using Scripts


Mapping Objects Using Scripts

You can use scripting to map objects from heterogeneous models.

You create or reuse a mapping for an object using the following method on the DataSource object and on the ClassifierMap object: CreateMapping(ByVal Object As BaseObject) As BaseObject.

Example

Given the following example where an OOM (oom1) contains a class (class_1) with two attributes (att1 and att2) and a PDM (pdm1) contains a table (table_1) with two columns (col1 and col2). To map the OOM class and attributes to the PDM table and columns, you have to do the following:

set ds = oom1.datasources.createnew

ds.AddSource pdm1

set map1 = ds.CreateMapping(class_1)

map1.AddSource table_1

set attmap1 = map1.CreateMapping(att1)

attmap1.AddSource col1

set attmap2 = map1.CreateMapping(att2)

attmap.AddSource col2

You can also get the mapping of an object using the following method on the DataSource object and on the ClassifierMap object: GetMapping(ByVal Object As BaseObject) As BaseObject.

Set mymap = ds.GetMapping (class_1)

Set mymap = map1.GetMapping (att1)

For more information about objects mapping, see the "Mapping objects"section in the "Working with" chapter in the OOM, the PDM and the XSM user's guides.

 


Copyright (C) 2007. Sybase Inc. All rights reserved.