API Reference
API Reference
API Reference
Release 12.1
Legal Notices
This Documentation, which includes embedded help systems and electronically distributed
materials (hereinafter referred to as the “Documentation”), is for your informational pur-
poses only and is subject to change or withdrawal by Quest Software, Inc and/or its affiliates
at any time. This Documentation is proprietary information of Quest Software, Inc and/or its
affiliates and may not be copied, transferred, reproduced, disclosed, modified or duplicated,
in whole or in part, without the prior written consent of Quest Software, Inc and/or its affil-
iates
If you are a licensed user of the software product(s) addressed in the Documentation, you
may print or otherwise make available a reasonable number of copies of the Documentation
for internal use by you and your employees in connection with that software, provided that
all Quest Software, Inc and/or its affiliates copyright notices and legends are affixed to each
reproduced copy.
The right to print or otherwise make available copies of the Documentation is limited to the
period during which the applicable license for such software remains in full force and effect.
Should the license terminate for any reason, it is your responsibility to certify in writing to
Quest Software, Inc and/or its affiliates that all copies and partial copies of the Docu-
mentation have been returned to Quest Software, Inc and/or its affiliates or destroyed.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, QUEST SOFTWARE, INC. PROVIDES THIS
DOCUMENTATION “AS IS” WITHOUT WARRANTY OF ANY KIND, INCLUDING WITHOUT
LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NONINFRINGEMENT. IN NO EVENT WILL QUEST SOFTWARE, INC. BE LIABLE TO
YOU OR ANY THIRD PARTY FOR ANY LOSS OR DAMAGE, DIRECT OR INDIRECT, FROM THE
USE OF THIS DOCUMENTATION, INCLUDING WITHOUT LIMITATION, LOST PROFITS, LOST
INVESTMENT, BUSINESS INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF QUEST
SOFTWARE, INC. IS EXPRESSLY ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH LOSS OR
DAMAGE.
The use of any software product referenced in the Documentation is governed by the applic-
able license agreement and such license agreement is not modified in any way by the terms
of this notice.
The manufacturer of this Documentation is Quest Software, Inc and/or its affiliates.
Provided with “Restricted Rights.” Use, duplication or disclosure by the United States
Government is subject to the restrictions set forth in FAR Sections 12.212, 52.227-14, and
52.227-19(c)(1) - (2) and DFARS Section 252.227-7014(b)(3), as applicable, or their suc-
cessors.
Copyright © 2023 Quest Software, Inc and/or its affiliates All rights reserved. All trademarks,
trade names, service marks, and logos referenced herein belong to their respective com-
panies.
Contact erwin
Understanding your Support
Review support maintenance programs and offerings.
Registering for Support
Access the erwin support site and click Sign in or Sign up to register for product support.
Accessing Technical Support
For your convenience, erwin provides easy access to "One Stop" support for all editions of
erwin Data Modeler, and includes the following:
Online and telephone contact information for technical assistance and customer ser-
vices
Information about user communities and forums
Product and documentation downloads
erwin Support policies and guidelines
Other helpful resources appropriate for your product
For information about other erwin products, visit http://erwin.com/products.
Provide Feedback
If you have comments or questions, or feedback about erwin product documentation, you
can send a message to techpubs@erwin.com.
erwin Data Modeler News and Events
Visit www.erwin.com to get up-to-date news, announcements, and events. View video
demos and read up on customer success stories and articles by industry experts.
Contents
Introduction to API 16
Major Features 17
Typical Use Cases 18
Standalone Client 19
Add-in Component or Script 20
API Components 21
Overview 22
Application Tier 23
Model Directory Tier 25
Sessions Tier 26
Model Data Tier 27
Access to Model Data 29
Objects and Properties 31
Object Identifiers 32
Object Identifiers and Type Codes 33
Properties, Property Flags, and Value Facets 34
Scalar and Non-Scalar Property Values 36
Collections and Automation 37
_NewEnum Property of a Collection Object 39
Default Properties 40
Optional Parameter 41
The API Sample Client 42
Using the API Sample Client 43
Register the Add-in Component 44
Make a VB.NET Library COM Callable 44
erwin Spy 45
How the erwin Spy Application Works 46
API Tasks 51
API Environment 52
Creating the ISCApplication Object 53
Application Properties 54
ISCApplication Interface 55
ISCApplicationEnvironment 56
Accessing a Model 60
Using the API as an Add-in Tool 61
ISCApplication Interface 62
ISCPersistenceUnitCollection Interface 63
ISCPersistenceUnit Interface 64
Property Bag Members for a Persistence Unit 65
ISCPropertyBag Interface 67
Using the API as a Standalone Executable 69
Creating a Model 70
ISCPersistenceUnitCollection Interface 71
ISCPropertyBag Interface 72
Opening an Existing Model 74
ISCPersistenceUnitCollection Interface 75
Opening a Session 77
ISCSessionCollection Interface 78
ISCSession Interface 79
Accessing a Model Set 81
ISCPersistenceUnit Interface 82
ISCModelSet Interface 83
ISCModelSetCollection Interface 84
ISCSession Interface 85
Accessing Objects in a Model 88
ISCSession Interface 89
ISCModelObjectCollection Interface 90
ISCModelObject Interface 91
Accessing a Specific Object 94
ISCModelObjectCollection Interface 95
Filtering Object Collections 97
ISCModelObjectCollection Interface 98
Accessing Object Properties 105
Iteration of Properties 106
ISCModelObject Interface 107
ISCModelPropertyCollection Interface 108
ISCModelProperty Interface 109
ISCModelProperty Interface 111
Iterating Over Non-Scalar Property Values 114
ISCModelProperty Interface 115
ISCPropertyValueCollection Interface 116
ISCPropertyValue Interface 117
Accessing a Specific Property 121
ISCPropertyValueCollection Interface 122
Filtering Properties 124
ISCModelObject Interface 125
Modifying the Model Using Session Transactions 128
Begin Transaction 130
ISCSession Interface 131
Commit Transaction 133
ISCSession Interface 134
Creating Objects 135
ISCModelObjectCollection Interface 136
Setting Property Values 139
Setting Scalar Property Values 140
ISCModelProperty Interface 141
Setting Non-Scalar Property Values 143
ISCModelProperty Interface 144
Deleting Objects 146
ISCModelObjectCollection Interface 147
Deleting Properties and Property Values 148
ISCModelPropertyCollection Interface 149
ISCModelProperty Interface 150
Deleting Non-Scalar Property Values 151
Saving the Model 152
ISCPersistenceUnit Interface 153
Accessing Metamodel Information 155
ISCApplicationEnvironment Interface 156
ISCSession Interface 157
Closing the API 159
ISCSession Interface 160
ISCSessionCollection Interface 161
Clearing Persistence Units 163
ISCPersistenceUnitCollection Interface 164
Error Handling 165
ISCApplicationEnvironment 167
Advanced Tasks 170
Creating User-Defined Properties 171
History Tracking 175
ISCSession Interface 176
API Interfaces Reference 178
ISCApplication 179
API Interfaces 180
ISCApplicationEnvironment 181
ISCApplicationEnvironment::PropertyBag Arguments 182
ISCModelDirectory 183
ISCModelDirectory::DirectoryExists Arguments 185
ISCModelDirectory::DirectoryUnitExists Arguments 186
ISCModelDirectory::IsOfType Arguments 187
ISCModelDirectory::LocateDirectory Arguments 188
ISCModelDirectory::LocateDirectoryUnit Arguments 189
ISCModelDirectory::PropertyBag Arguments (Get Function) 190
ISCModelDirectory::PropertyBag Arguments (Set Function) 191
ISCModelDirectoryCollection 192
ISCModelDirectoryCollection::Add Arguments 193
ISCModelDirectoryCollection::Item Arguments 194
ISCModelDirectoryCollection::Remove Arguments 195
ISCModelDirectoryUnit 196
ISCModelDirectoryUnit::IsOfType Arguments 198
ISCModelDirectoryUnit::PropertyBag Arguments (Get Function) 199
ISCModelDirectoryUnit::PropertyBag Arguments (Set Function) 200
ISCModelObject 201
ISCModelObject::CollectProperties Arguments 203
ISCModelObject::IsInstanceOf Arguments 205
ISCModelObjectCollection 206
ISCModelObjectCollection::Add Arguments 208
ISCModelObjectCollection::Collect Arguments 209
ISCModelObjectCollection::Item Arguments 211
ISCModelObjectCollection::Remove Arguments 212
ISCModelProperty 213
ISCModelProperty::DataType Arguments 216
ISCModelProperty::RemoveValue Arguments 217
ISCModelProperty::Value Arguments (Get Function) 218
ISCModelProperty::Value Arguments (Set Function) 219
ISCModelProperty::GetValueFacetIds Arguments 220
ISCModelProperty::GetValueFacetNames Arguments 221
ISCModelProperty::SetValueFacets Arguments 222
ISCModelPropertyCollection 223
ISCModelPropertyCollection::Add Arguments 226
ISCModelPropertyCollection::HasProperty Arguments 227
ISCModelPropertyCollection::HasPropertyFacets Arguments 228
ISCModelPropertyCollection::Item Arguments 230
ISCModelPropertyCollection::Remove Arguments 231
ISCModelSet 232
ISCModelSet::PropertyBag Arguments (Get Function) 234
ISCModelSet::PropertyBag Arguments (Set Function) 235
ISCModelSetCollection 236
ISCModelSetCollection::Item Arguments 237
ISCPersistenceUnit 238
ISCPersistenceUnit::ApplyDataVault 240
ISCPersistenceUnit::CompleteCompare 242
ISCPersistenceUnit::PropertyBag Arguments (Get Function) 244
ISCPersistenceUnit::PropertyBag Arguments (Set Function) 245
ISCPersistenceUnit::Save Arguments 246
ISCPersistenceUnit::ReportDesigner 247
ISCPersistenceUnit::ReverseEngineer 249
ISCPersistenceUnit::ReverseEngineerScript 258
ISCPersistenceUnit::ForwardEngineer 262
ISCPersistenceUnitCollection 264
ISCPersistenceUnitCollection::Add Arguments 265
ISCPersistenceUnitCollection::Create Arguments 266
ISCPersistenceUnitCollection::Item Arguments 267
ISCPersistenceUnitCollection::Remove Arguments 268
ISCPropertyBag 269
ISCPropertyBag::Add Arguments 270
ISCPropertyBag::Name Arguments 271
ISCPropertyBag::Value Arguments (Get Function) 272
ISCPropertyBag::Value Arguments (Set Function) 273
ISCPropertyValue 274
ISCPropertyValue::ValueId Arguments 276
ISCPropertyValue::Value Arguments 277
ISCPropertyValueCollection 278
ISCPropertyValueCollection::Item Arguments 279
ISCPropertyValueCollection::Facet Arguments (Get Function) 280
ISCPropertyValueCollection::Facet Arguments (Set Function) 281
ISCPropertyValueCollection::RemoveFacet Arguments 282
ISCSession 283
ISCSession::BeginNamedTransaction Arguments 285
ISCSession::CommitTransaction Arguments 286
ISCSession::IsTransactionEmpty Arguments 287
ISCSession::Open Arguments 288
ISCSession::RollbackTransaction Arguments 289
ISCSessionCollection 290
ISCSessionCollection::Item Arguments 291
ISCSessionCollection::Remove Arguments 292
Enumerations 293
SC_ModelDirectoryFlags 294
SC_ModelDirectoryType 295
SC_ModelObjectFlags 296
SC_ModelPropertyFlags 297
SC_SessionFlags 298
SC_SessionLevel 299
SC_ValueTypes 300
Property Bag Reference 302
Property Bag for Application Environment 303
ISCApplicationEnvironment::PropertyBag 304
Category Parameter Contains an Empty String 305
Application Category 306
Application.API Category 307
Application.API.Features Category 308
Application.API.MessageLog Category 310
Application.Modeling Category 312
Application.Modeling.Physical Category 313
Application.Persistence Category 314
Application.Persistence.FileSystem Category 315
Application.Persistence.Mart 316
Property Bag for Model Directory and Model Directory Unit 317
Property Bag for Persistence Units and Persistence Unit Collections 321
ISCPersistenceUnit::PropertyBag Arguments (Get Function) 322
ISCPersistenceUnit::PropertyBag Arguments (Set Function) 323
Property Bag Contents for Persistence Unit and Persistence Unit Collection 324
Property Bag for Session 328
Location and Disposition in Model Directories and Persistence Units 329
Locator Property 330
Disposition Property 334
erwin DM Metamodel 336
Metadata Element Renaming 337
Metadata Organization 338
Metamodel Elements 339
Metadata Tags 339
Abstract Metadata Objects 343
Metamodel Classes 344
XML Schema 345
Introduction
Introduction to API
The Script Client API that is part of erwin DM provides advanced customization capabilities
that enable you to access and manipulate modeling data in memory at runtime, as well as
models persisted in files and in a mart. The API interfaces are automation-compatible and
provide extensive design and runtime facilities for third-party integrators as well as users of
script-based environments.
The API complements the original modeling tool with custom components when you use
scripts, add-ins, and COM-based API technologies. The API is flexible and promotes a seam-
less integration of the modeling tool in a client development cycle.
This section contains the following topics
Major Features
Typical Use Cases
Major Features
The API is a group of interfaces that includes the following features:
Standalone Client
One of the ways the API is used is as a standalone client. A third-party client activates the
API as an in-process server. The API component does not have visual representation, that is,
it does not expose a user interface. The API provides Active Model Directory facilities to spe-
cify a target model from a list of available models. Active Model Data Objects provide ses-
sion-based access to model data.
There are times when API clients can compete with other parties over access to model data.
Using erwin Data Modeler Workgroup Edition provides advanced model sharing facilities
to prevent other parties from accessing the model during your session.
API Components
This section contains the following topics
Overview
Access to Model Data
Objects and Properties
Collections and Automation
The API Sample Client
erwin Spy
Overview
The API is a collection of interfaces that represent erwin DM functionality. The application
exports the top-level interface, from which the client obtains lower-level interfaces as
needed. Interfaces are logically grouped into tiers, where each tier includes interfaces that
represent the functionality of the application. Each tier is represented in the following sec-
tions, with a table describing the interfaces grouped into that tier.
Application Tier
The Application Tier represents erwin DM functionality, establishes access to models in per-
sistent storage, and controls the exchange between models in memory and models in per-
sistent storage. The following table describes the interfaces of the Application Tier:
Interface Role
ISCApplication Represents application-wide functionality, and
serves as the entry point for the interface hierarchy
of the API. Holds a list of available persistence units
and connections between the client and persistence
units.
ISCApplicationEnvironment Provides information about the runtime envir-
onment.
ISCPersistenceUnitCollection Collects all active persistence units known to the
application.
ISCPersistenceUnit Represents an active persistence unit (such as a
erwin DM model) within the application. A per-
sistence unit groups data in the form of model sets.
Clients can connect to persistence units to manip-
ulate them and the data they contain.
ISCModelSetCollection Represents model sets associated with a per-
sistence unit.
ISCModelSet Represents a model set (such as EMX or EM2
classes of model data) within a single persistence
unit.
ISCPropertyBag Represents an array of properties for application
tier interface calls.
Interface Role
ISCModelDirectoryCollection Enumerates all top-level model directories avail-
able for the API client.
ISCModelDirectory Encapsulates information on a single model dir-
ectory entry.
ISCModelDirectoryUnit Encapsulates information on a single directory
unit.
Sessions Tier
The Sessions Tier establishes access to model data in memory. The following table describes
the interfaces of the Sessions Tier:
Interface Role
ISCSessionCollection Collects all active sessions between the API client and the per-
sistence units.
ISCSession Represents an active connection between the client and a
model. Clients create sessions, and then open them against
model sets of persistence units. An open session exposes a
single level (such as data, metadata, and so on) of a model set.
Interface Role
ISCModelObjectCollection Represents objects available for manipulation.
Membership in this collection can be limited by
establishing filter criteria.
ISCModelObject Accesses and manipulates a single object within
a model.
ISCModelPropertyCollection Represents a list of properties owned by a single
object. The list can be limited by using filters.
ISCModelProperty Accesses and manipulates a single property.
Properties may contain multiple values. Values
within a multi-valued property are accessed by
keys. The current multi-valued property imple-
mentation treats the value list as an array, and
the key is the array index.
ISCPropertyValueCollection Represents a list of single property values.
ISCPropertyValue Data and a key are contained within a single
value.
Levels are identified by long integer values. Values have symbolic definitions.
Object Identifiers
Each object must bear an identifier, which is a value that uniquely identifies the object
instance. Internally, object identifiers are 20 bytes long. They contain two components: a
GUID (also known as a UUID) in the first 16 bytes, and a 32-bit unsigned integer suffix in the
last 4 bytes.
A GUID contains the following components:
One 32-bit unsigned integer
Two 16-bit unsigned integers
Eight 8-bit unsigned integers (represented as unsigned characters)
These components total of 128 bits, or 16 bytes. Therefore, an object identifier contains an
extra 32-bit unsigned integer (the 4 byte suffix) at the end for a total of 160 bits, or 20 bytes.
To simplify working with object identifiers and due to COM automation limitations on data-
types, the API uses a string to represent object identifiers.
The following table lists aliases used in this guide and in the interface definitions:
The identifiers whose GUID component contains zero is one set of object identifiers that is
predefined. If the final 4 bytes of the identifier also contain zero, the identifier represents a
null identifier. Other values of the offset are reserved for future use.
Metadata information
Shows whether a property in the metadata is user-defined or contains a scalar
value.
Property state information
Shows whether or not a property is read-only.
Data source information
Shows whether or not a data source is calculated.
An individual property level flag is represented by a bit field in the property flag's value. The
flags are provided for information only and cannot be changed. More information about spe-
cific property flags is located in the Enumerations section.
The value level flags, or facets, convey additional data associated with property value such
as if a property value was 'hardened' and cannot be changed due to inheritance.
A property, either scalar or non-scalar, can have a special NULL value. The properties with a
NULL value have a SCD_MPF_NULL flag set.
The IEnumVARIANT interface provides a way to iterate through the items contained by a col-
lection. This interface is supported by an enumerator interface that is returned by the _
NewEnum property of the collection.
The IEnumVARIANT interface defines the following member functions:
Next
Retrieves one or more elements in a collection starting with the current element.
Skip
Skips over one or more elements in a collection.
Reset
Resets the current element to the first element in the collection.
Clone
Copies the current state of the enumeration so you can return to the current element
after using Skip or Reset.
The IEnumVARIANT collection implements a Rogue Wave Software, Inc. style advance and
return iteration. For this reason, they have the following life cycle:
When the iterator is created, it enters the Created state, and then forces itself into the
BeforeStart state. A successful advance drives the iterator into the InList state, while an
unsuccessful advance drives it into the AtEnd state. A Reset drives the iterator back to the
BeforeStart state, and deletion drives it into the Deleted state.
The iterator is positioned over a member of the collection (that is, associated
with a current member) only if it is in the InList state.
Default Properties
A default property for automation is the property that is accessed when the object is
referred to without any explicit property or method call. The property dispatch identifier is
DISPID_VALUE.
Optional Parameter
To support automation client requirements, all optional parameters are represented as
VARIANT. For that reason, a parameter type in an interface description is only to document
an expected type in the VARIANT structure.
erwin Spy
The erwin Spy application visualizes metadata information and provides intrinsic and model-
specific metadata. It demonstrates the API functionality and provides a set of useful fea-
tures to study how model data is stored. erwin Spy reads the erwin DM metamodel and sim-
plifies the task of comprehending the intricate details of any erwin DM model, which can be
a complicated net of model objects, properties, and cross-references. When you install
erwin DM, you can choose to install the optional erwin Spy utility.
There are two versions of the utility available in the erwin Spy.NET\bin folder, the stan-
dalone version, erwinSpy.NET.exe, and the add-in version, erwinSpy_AddIn.NET.dll.
These versions are identical in functionality and vary only in how you want to launch the
application. The standalone version runs without erwin DM present and can access models
stored in .erwin files, while the add-in version launches within erwin DM from the Tools
menu and can access models stored in either erwin DM memory or in .erwin files.
See the Add-In Manager online help for more information about defining an
add-in software application for the Tools, Add-Ins menu.
Ensure that you have added the erwin Spy application as a erwin DM
add-in application on the Tools, Add-Ins menu. See the Add-In Manager
online help for more information on defining an add-in software applic-
ation.
Select the top item on the Models menu in erwin Spy, which should be your empty
model.
Double-click the Model object in the left pane to expand it. You should see a picture
similar to the following illustration:
There are many objects listed by erwin Spy. Even though the model is empty, you still see
objects there that represent erwin DM defaults, such as Domains, Main Subject Area,
The first column shows property names, such as Name, Long ID, Type, Physical Name, and
so on.
The second column, DT, shows property datatypes, such as Str for a string, I4 for a number,
Bool for Boolean, Id for a reference to another object, and so on.
The third column, Value, displays the property value in native format.
NL
Displays properties with NULL/no value.
UD
Displays user-defined properties.
VC
Displays vector properties.
TL
Displays properties that are maintained by erwin DM and that cannot be changed dir-
ectly using the API.
RO
Displays read-only properties.
DR
Displays derived properties whose value was inherited (from a parent domain, for
example).
Facets True
Displays the facet value of a property that is set to True.
Facets False
Displays the facet value of a property that is set to False.
In the previous illustration, a primary key attribute named ATTR01 was added to Entity_1. It
was migrated to Entity_2 by creating an identifying relationship. When you double-click
Since the attribute for the Parent_Relationship_Ref property is a product of foreign key
migration, this property shows which relationship object is used to store data about it. The
value Id in the DT column shows that the property is a reference, which means that the
value is a unique ID of the involved relationship object.
Look at the name in the As String column or locate an object by its unique ID to traverse
back to the relationship object. To see object IDs, click Show Ids on the File, Options menu.
With this option enabled, when the cursor is positioned over an object in the left panel, that
object's unique ID is displayed in a popup window, as shown in the following illustration:
Now compare the Parent_Relationship_Ref property with the Parent_Attribute_Ref and the
Master_Attribute_Ref properties. The Master_Attribute_Ref property is read-only. This
means that it is displayed for informational purposes only and cannot be changed using the
API. As you build your model, you can expand objects in the model to see how erwin DM
uses their properties to represent different relationships in the model.
Use the erwin Spy utility to see and understand the details of the data in a erwin DM model
that is available through the API. If you need to learn how particular data is represented in a
erwin DM model, you can use the scenarios that were just described. Start with an empty
model, create the minimum model that is necessary to represent the feature in question,
and then use erwin Spy to look at the details of the data representation.
API Tasks
This chapter describes how to perform basic tasks using the API. Each task is documented
with a table that lists the interfaces and methods needed for that task. In most cases, the
table shows a subset of all the methods for that interface. A complete list of API interfaces
and their methods is located in the appendix API Interfaces Reference.
This section contains the following topics
API Environment
Creating the ISCApplication Object
Application Properties
Accessing a Model
Accessing Objects in a Model
Accessing Object Properties
Modifying the Model Using Session Transactions
Creating Objects
Setting Property Values
Deleting Objects
Deleting Properties and Property Values
Saving the Model
Accessing Metamodel Information
Closing the API
Error Handling
Advanced Tasks
API Environment
The API is packaged as a set of COM Dynamic Link Libraries (DLL) and works as a part of a
customer process. EAL.dll is responsible for launching the API environment. When erwin DM
is installed, EAL.dll and the rest of the API components are copied to the erwin Data
Modeler directory, and the installer registers the API with the System Registry.
To use the API in a development environment, use the API Type Library embedded as a
resource in the EAL.dll file. This operation is language specific. Consult your development
environment documentation for details.
The API works in two different modes, standalone mode and add-in mode.
The API is activated and controlled by a client application that hosts its own process in the
standalone mode.
In the add-in mode, the API is also activated and controlled by a client application, but the
client application is implemented as a COM DLL. The erwin DM executable owns a process
and all the client application DLLs run inside of that process. COM DLLs must be registered
with the System Registry and with the erwin DM Add-In Manager so that it can be available
for add-in mode activation.
Behavior of the API components in both modes is the same with a few exceptions that are
discussed further in this section.
The API is implemented as a tree of COM interfaces. The application exports the top-level
interface, from which the client fetches lower-level interfaces as needed.
The following example illustrates how to use Visual Basic .NET to create the ISCApplication
object:
Dim scApp As SCAPI.Application
scApp = New SCAPI.Application
// Or the alternative with the ProgId
Dim oApp As Object
oApp = CType(CreateObject("ewin9.SCAPI"), SCAPI.Application)
Application Properties
You can get information about the erwin DM application by using the following tables.
ISCApplication Interface
The following table contains information on the ISCApplication interface:
ISCApplicationEnvironment
The following table contains information on the ISCApplicationEnvironment interface:
Feature categories in the Category parameter of the PropertyBag property are hierarchical
and use a dot (.) to define feature subsets. For example, the Application category populates
The following example illustrates how to use the API to retrieve the Application Features
using Visual Basic .NET. It uses the Application object created in Example 1.
Public Sub GetApplicationFeatures(ByRef scApp As SCAPI.Ap-
plication)
Dim scBag As SCAPI.PropertyBag
' Retrieve all of application environment properties in one
call
scBag = scApp.ApplicationEnvironment.PropertyBag
' Retrieve values
PrintPropertyBag(scBag)
' Get an array with categories by using empty string as a
Accessing a Model
An API client accesses model data by working with a pool of available persistence units. A
persistence unit is the API concept that describes all data related to a single model. A per-
sistence unit can be accessed and saved to persistence storage, such as a file or a model in a
mart. A client manipulates persistence units by using the Persistence Units collection.
The existence of some persistence units in the application is dictated by a context in which
an instance of the application was created. For example, in standalone mode, none of the
units exist at launch time. Methods from the unit collection interface must be used to accu-
mulate units in the collection. In add-in component mode, the collection contains all the
units known to the erwin DM user interface at the time when the client component is activ-
ated.
When the client program is terminated, the arrangement for the persistence units in
memory for standalone mode is that all units are closed. In add-in component mode, after
the client program has ended, the units are still open and available in the erwin DM user
interface with the exception of those that were explicitly closed and removed from the per-
sistence unit collection before exiting the program.
For erwin DM, the collection is a snapshot. The collection includes only those
units that exist at the moment of collection construction (such as at the
moment when the PersistenceUnits method of the ISCApplication interface
was called). An exception to this is units added or deleted from the col-
lection-these changes are reflected. All new collections reflect the changes as
well.
ISCApplication Interface
The following table contains information on the ISCApplication interface:
ISCPersistenceUnitCollection Interface
The following table contains information on the ISCPersistenceUnitCollection interface:
ISCPersistenceUnit Interface
The following table contains information on the ISCPersistenceUnit interface:
ISCPropertyBag Interface
The following table contains information on the ISCPropertyBag interface:
Example 3
The following example illustrates how to use the API as an add-in tool to iterate through the
open models using C++. The example uses the Application object created in Example 1:
void IteratePersistenceUnits(ISCApplicationPtr & scAppPtr)
{
ISCPersistenceUnitCollectionPtr scPUnitColPtr;
scPUnitColPtr = scAppPtr->GetPersistenceUnits();
ISCPersistenceUnitPtr scPUnit = 0;
long lCnt = scPUnitColPtr->GetCount();
The following example illustrates how to use the API as an add-in tool to iterate through the
open models using Visual Basic .NET. The example uses the Application object created in
Example 1:
Public Sub IteratePersistenceUnits(ByRef scApp As SCAPI.Ap-
plication)
scPersistenceUnitCol = scApp.PersistenceUnits
propBag = scPUnit.PropertyBag("Locator")
Console.WriteLine( persUnit.Name ) ' name of model
Console.WriteLine( propBag.Value(0)) ' full path of model
' …
Next
End If
End Sub
Creating a Model
To create a new model using the API, you first need to create a new instance of ISCProp-
ertyBag. The ISCPropertyBag interface is a property bag that is used to hold the properties
of the new model. The following properties are used in creating a new model.
Once the property bag is created and populated, a new persistence unit must be created
within the persistence unit collection.
ISCPersistenceUnitCollection Interface
The following table contains information on the ISCPersistenceUnitCollection interface:
ISCPropertyBag Interface
The following table contains information on the ISCPropertyBag interface:
Example 4
The following example illustrates how to create a new persistence unit using C++. The
example uses the Application object created in Example 1:
ISCPersistenceUnitPtr CreateNewModel(ISCApplicationPtr & scAppPtr)
{
ISCPersistenceUnitCollectionPtr scPUnitColPtr;
scPUnitColPtr = scAppPtr->GetPersistenceUnits();
ISCPropertyBagPtr propBag;
HRESULT hr =propBag.CreateInstance(__uuidof(SCAPI::Prop-
ertyBag));
if (FAILED(hr))
return;
propBag->Add("Name", Test Model );
propBag->Add("ModelType", Logical );
ISCPersistenceUnitPtr scPUnitPtr = scPUnitColPtr->Create
(propBag,vtMissing);
return scPUnitPtr;
}
The following example illustrates how to create a new persistence unit using Visual Basic
.NET. The example uses the Application object created in Example 1:
Public Function CreateNewModel(ByRef scApp As SCAPI.Application)
As SCAPI.PersistenceUnit
Dim scPersistenceUnitCol as SCAPI.PersistenceUnits
scPersistenceUnitCol = scApp.PersistenceUnits
ISCPersistenceUnitCollection Interface
The following table contains information on the ISCPersistenceUnitCollection interface:
Example 5
The following example illustrates how to open an existing model using C++. The example
uses the Application object created in Example 1:
ISCPersistenceUnitPtr OpenModel(ISCApplicationPtr & scAppPtr,
CString & csFullPath)
{
ISCPersistenceUnitCollectionPtr scPUnitColPtr;
scPUnitColPtr = scAppPtr->GetPersistenceUnits();
ISCPersistenceUnitPtr scPUnitPtr = scPUnitColPtr- >Add
(COleVariant(csFullPath));
return scPUnitPtr;
}
The following example illustrates how to open an existing model using Visual Basic .NET. The
example uses the Application object created in Example 1:
Public Function OpenModel(ByRef scApp As SCAPI.Application, _
fullModelPath As String) As
OpenModel = scPersistenceUnitCol.Add(fullModelPath)
End Sub
Opening a Session
Before the objects of a model can be accessed using the API, an ISCSession instance must
first be established for the ISCPersistenceUnit of the model. To open a session for a per-
sistence unit, add a new ISCSession to the ISCSessionCollection, and then open the ISCPer-
sistenceUnit in the new session.
ISCSessionCollection Interface
The following table contains information on the ISCSessionCollection interface:
ISCSession Interface
The following table contains information on the ISCSession interface:
Example 6
The following example illustrates how to open a session using C++. The example uses the
Application object created in Example 1 and the CreateNewModel function from Example 4:
ISCSessionPtr OpenSession(ISCApplicationPtr & scAppPtr)
{
ISCSessionCollectionPtr scSessionColPtr = scAppPtr->GetSes-
sions();
ISCSessionPtr scSessionPtr = scSessionColPtr->Add(); // add
a new session
The following example illustrates how to open a session using Visual Basic .NET. The
example uses the Application object created in Example 1 and the CreateNewModel func-
tion from Example 4:
Public Function OpenSession(ByRef scApp As SCAPI.Application) As
SCAPI.Session
Dim scSessionCol As SCAPI.Sessions
Dim scPUnit As SCAPI.PersistenceUnit
scSessionCol = scApp.Sessions
OpenSession = scSessionCol.Add 'new session
ISCPersistenceUnit Interface
The following table contains information on the ISCPersistenceUnit interface:
ISCModelSet Interface
The following table contains information on the ISCModelSet interface:
ISCModelSetCollection Interface
The following table contains information on the ISCModelSetCollection interface:
For information about metadata class identifiers and names, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder.
ISCSession Interface
The following table contains information on the ISCSession interface:
Flags:
Empty Defaults to SCD_SF_
NONE.
SCD_SF_NONE Other sessions
can have access to the attached
persistence unit.
SCD_SF_EXCLUSIVE Other ses-
sions cannot have access to the
attached persistence unit.
Example 7
The following example illustrates how to open a session with the EM2 model of a per-
sistence unit using C++. The example uses the Application object created in Example 1 and
the CreateNewModel function from Example 4:
void OpenEM2(ISCApplicationPtr & scAppPtr)
{
ISCSessionCollectionPtr scSessionColPtr = scAppPtr->GetSes-
sions();
// …
}
The following example illustrates how to open a session with the EM2 model of a per-
sistence unit using Visual Basic .NET. The example uses the Application object created in
Example 1 and the CreateNewModel function from Example 4:
Public Sub OpenEM2(ByRef scApp As SCAPI.Application )
ISCSession Interface
The following table contains information on the ISCSession interface:
ISCModelObjectCollection Interface
The following table contains information on the ISCModelObjectCollection interface:
ISCModelObject Interface
The following table contains information on the ISCModelObject interface:
Example 8
The following example illustrates how to access model objects using C++. The example uses
the Application object created in Example 1 and the OpenSession function from Example 6:
void IterateObjects(ISCApplicationPtr & scAppPtr)
{
ISCSessionPtr scSessionPtr = OpenSession( scAppPtr ); //
From Example 6
//Make sure the Session Ptr is Open
if(!scSessionPtr->IsOpen())
{
AfxMessageBox("Session Not Opened");
return;
}
ISCModelObjectCollectionPtr scModelObjColPtr = scSessionPtr
>GetModelObjects();
IUnknownPtr _NewEnum = NULL;
IEnumVARIANT* ObjCollection;
The following example illustrates how to access model objects using Visual Basic .NET. The
example uses the Application object created in Example 1 and the OpenSession function
from Example 6:
Public Sub IterateObjects(ByRef scApp As SCAPI.Application)
Dim scSession As SCAPI.scSession
Dim scModelObjects As SCAPI.ModelObjects
Dim scObj As SCAPI.ModelObject
ISCModelObjectCollection Interface
The following table contains information on the ISCModelObjectCollection interface:
For information about valid object class names and identifiers, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder.
The following example illustrates how to access a specific object using Visual Basic .NET. The
example uses a Session object from Example 6:
Public Sub GetObject(ByRef scSession As SCAPI.Session, ByRef objID
As String)
Dim scObjCol as SCAPI.ModelObjects
Dim scObj as SCAPI.ModelObject
scObjCol = scSession.ModelObjects
scObj = scObjCol.Item(objID) ' retrieves object with given
object ID
End Sub
ISCModelObjectCollection Interface
The following table contains information on the ISCModelObjectCollection interface:
For information about valid object class names and identifiers, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder. More information
about SC_ModelObjectFlags is located in the appendix API Interfaces Refer-
ence.
The following sections show the code examples for the different filters.
Example 10
The following example illustrates the Object Type filter using C++. The example uses the Ses-
sion object from Example 6 and creates a collection of objects of csType type, owned by the
rootObj object:
void FilterObjects(ISCSessionPtr scSessionPtr, ISCModelObjectPtr &
rootObj,
CString & csType)
{
ISCModelObjectCollectionPtr scModelObjectsPtr;
scModelObjectsPtr = scSessionPtr->GetModelObjects()->Collect
(rootObj->GetObjectId(), COleVariant(csType));
// …
}
The following example illustrates the Object Type filter using Visual Basic .NET. The example
uses the Session object from Example 6 and creates a collection of objects of csType type,
owned by the rootObj object:
Public Sub FilterObjects(ByRef scSession As SCAPI.Session, _
ByRef rootObj As SCAPI.ModelObject, ByRef
objType as String)
Example 11
The following example illustrates the Depth filter using C++:
void FilterObjects(ISCSessionPtr scSessionPtr, ISCModelObjectPtr &
rootObj,
CString & csType, long depth)
{
ISCModelObjectCollectionPtr scModelObjectsPtr;
scModelObjectsPtr = scSessionPtr->GetModelObject()->
Collect(rootObj->GetObjectId(), COleVariant
(csType),depth);
// …
}
The following example illustrates the Depth filter using Visual Basic .NET:
Public Sub FilterObjects(ByRef scSession As SCAPI.Session, _
ByRef rootObj As SCAPI.ModelObject, ByRef classID As
String, depth As Integer)
Dim scModelObjects As SCAPI.ModelObjects
scModelObjects = scSession.ModelObjects.Collect(rootObj,
classID, depth)
End Sub
Example 12
The following example illustrates the MustBeOn/MustBeOff filter using C++. The example
uses the Session object from Example 6:
void FilterObjects(ISCSessionPtr scSessionPtr, ISCModelObjectPtr &
rootObj, long depth)
{
ISCModelObjectCollectionPtr scModelObjectsPtr;
scModelObjectsPtr = scSessionPtr->GetModelObjects()->
Collect(rootObj->GetObjectId(), vtMissing, depth, SCD_
MOF_USER_DEFINED);
The following example illustrates the MustBeOn/MustBeOff filter using Visual Basic .NET.
The example uses the Session object from Example 6:
Public Sub FilterObjects(ByRef scSession As SCAPI.Session, _
ByRef rootObj As SCAPI.ModelObject, depth As Integer)
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
fd.AllowMultiSelect = False
fd.Filters.Clear
strFileName = fd.SelectedItems.Item(1)
Else
Exit Sub
Set fd = Nothing
'strFileName = "C:\models\test03.erwin"
SCSession.Open (SCPUnit)
nTransId = SCSession.BeginNamedTransaction("Test")
oUserNote.Properties("Note_Importance").Value = "0"
'enum {0|1|2|3|4|5}
Next oEntObject
SCSession.CommitTransaction (nTransId)
SCSession.Close
SCApp.Sessions.Remove (SCSession)
SCApp.PersistenceUnits.Clear
SCPUnit = Null
SCSession = Null
End Sub
Iteration of Properties
This section describes the interfaces involved with the iteration of properties.
ISCModelObject Interface
The following table contains information on the ISCModelObject interface:
ISCModelPropertyCollection Interface
The following table contains information on the ISCModelPropertyCollection interface:
ISCModelProperty Interface
The following table contains information on the ISCModelProperty interface:
Example 13
The following example illustrates the iteration of properties using C++. The example uses a
Model Object object from Example 9:
void IterateObjectProperties(ISCModelObjectPtr & scObjPtr)
{
ISCModelPropertyCollectionPtr propColPtr = scObjPtr->GetProp-
erties();
_NewEnum = propColPtr->Get_NewEnum();
if (_NewEnum != NULL)
{
HRESULT hr = _NewEnum->QueryInterface(IID_IEnumVARIANT,
(LPVOID*) &propCollection);
if (!FAILED(hr))
{
COleVariant xObject;
The following example illustrates the iteration of properties using Visual Basic .NET. The
example uses a Model Object object from Example 9:
Public Sub IterateObjectProperties(ByRef scObj As SCAPI.ModelOb-
ject)
ISCModelProperty Interface
The following table contains information on the ISCModelProperty interface:
Example 14
The following example illustrates how to access scalar property values using C++. The
example uses a Model Property object from Example 13:
void GetScalarProperty(ISCModelPropertyPtr & scObjPropPtr)
{
if (scObjPropPtr->GetCount() <= 1)
{
_bstr_t bstrPropVal= scObjPropPtr->FormatAsString();
// …
}
}
The following example illustrates how to access scalar property values using Visual Basic
.NET. The example uses a Model Property object from Example 13:
Public Sub GetPropertyElement(ByRef scObjProp As SCAPI.ModelProp-
erty)
ISCModelProperty Interface
The following table contains information on the ISCModelProperty interface:
ISCPropertyValueCollection Interface
The following table contains information on the ISCPropertyValueCollection interface:
ISCPropertyValue Interface
The following table contains information on the ISCPropertyValue interface:
Example 15
The following example illustrates how to access non-scalar property values using Visual
Basic .NET. The example uses a Model Property object from Example 13:
Public Sub IterateNonScalarProperties(ByRef scObjProp As
SCAPI.ModelProperty)
Dim scPropValue as SCAPI.PropertyValue
ISCPropertyValueCollection Interface
The following table contains information on the ISCPropertyValueCollection interface:
For r7.3, erwin DM does not support naming of non-scalar property mem-
bers.
Example 16
The following example illustrates how to access a specific property using C++. The example
uses a Model Object object from Example 9:
// This function retrieves a specific value with the given index
from the property with the
// given name.
ISCPropertyValuePtr GetPropValue(ISCModelObjectPtr & scObjPtr,
CString & csName, int index)
{
ISCModelPropertyCollectionPtr propColPtr = scObjPtr->GetProp-
erties();
ISCModelPropertyPtr scObjPropPtr = propColPtr->GetItem
(COleVariant(csName));
ISCPropertyValueCollectionPtr propVals = scObjPropPtr-
>GetPropertyValues();
return propVals->GetItem(COleVariant(index));
}
Filtering Properties
Subsets of an instance of ISCModelPropertyCollection can be created by using its Col-
lectProperties method of ISCModelObject. The CollectProperties method creates a new
instance of ISCModelPropertyCollection based on the filtering criteria specified in the para-
meters of the method. By filtering the property collection, you can retrieve properties of a
certain class, properties with specified flags set, or properties that do not have specified
flags set. The filtering criteria is optional, and any number of combinations of criteria can be
used. More information about specific property flags is located in the Enumerations section.
For more information about identifiers used in property classes, see the
HTML document erwin Metamodel Reference, in the Metamodel Reference
Bookshelf located in the erwin Data Modeler installation folder.
ISCModelObject Interface
The following table contains information on the ISCModelObject interface:
VT_I4 SC_ModelObjectFlags
flags that must be off. Returns
the properties that do not have
the specified flags set.
Setting certain filter criteria can influence the effectiveness of data retrieving.
For example, setting the MustBeOn filter to SCD_MPF_DERIVED builds a col-
lection with only the calculated and derived properties. Requests to evaluate
the calculated and derived properties will reduce performance while iterating
over the collection. However, setting the MustBeOff filter to the same value,
SCD_MPF_DERIVED, which excludes the calculated and derived properties,
improves performance.
Example 17
The following example illustrates how to filter properties using C++. The example uses a
Model Object object from Example 9:
void GetProperties(ISCModelObjectPtr & scObjPtr)
{
ISCModelPropertyCollectionPtr propColPtr;
The following example illustrates how to filter properties using Visual Basic .NET. The
example uses a Model Object object from Example 9:
Public Sub( ByRef scObj As SCAPI.ModelObject )
Dim scObjProperties As SCAPI.ModelProperties
Nested transactions and rollbacks are supported with certain limitations. The
limitation is illustrated in the following state diagram:
After the beginning of an outer transaction, the API is in State I of the diagram. A new nes-
ted transaction can be opened or the outer transaction can be closed. Any operation other
than the open or close of a transaction, such as creating, modifying objects, properties, and
so on, will transfer the API to State II. In that state further modifications can continue, but
no new nested transactions are allowed. The API continues to be in that state until the cur-
rent transaction is committed or rolled back.
Use of nested transactions allows better control over modification flow. The following
examples describe the uses:
Begin Transaction
To indicate that a modification to the model is about to occur, either the BeginTransaction()
or the BeginNamedTransaction() must be called.
ISCSession Interface
The following table contains information on the ISCSession interface:
Example 18
The following example illustrates modifying the model using the Begin Transaction in C++.
The example uses a Session object from Example 6:
void OpenSession(ISCSessionPtr & scSessionPtr )
{
variant_t transactionId; // transaction ID for the session
VariantInit(&transactionId);
transactionId = scSessionPtr->BeginTransaction();
// …
}
The following example illustrates modifying the model using the Begin Transaction in Visual
Basic .NET. The example uses a Session object from Example 6:
Public Sub OpenSession( ByRef scSession As SCAPI.Session )
Dim m_scTransactionId As Variant
scTransactionId = scSession.BeginNamedTransaction("My
Commit Transaction
The CommitTransaction() is used to commit the modifications to the in-memory model.
The Commit only applies to the in-memory model while the API is running. To
persist the modifications, the model must be explicitly saved using the ISCPer-
sistenceUnit::Save() function.
ISCSession Interface
The following table contains information on the ISCSession interface:
Example 19
The following example illustrates modifying the model using the Commit Transaction in C++.
The example uses a Session object from Example 6:
void Transaction(ISCSessionPtr & scSessionPtr )
{
variant_t transactionId; // transaction ID for the session
VariantInit(&transactionId);
transactionId = scSessionPtr->BeginTransaction();
scSessionPtr->CommitTransaction(transactionId);
}
The following example illustrates modifying the model using the Commit Transaction in
Visual Basic .NET. The example uses a Session object from Example 6:
Public Sub Transaction(ByRef scSession As SCAPI.Session )
Dim scTransactionId As Variant
scTransactionId = scSession.BeginTransaction
' make modifications here …
scSession.CommitTransaction( scTransactionId )
End Sub
Creating Objects
The first step in creating a new object is to retrieve the ISCModelObject instance of the par-
ent of the new object. From the parent of the new object, retrieve its child objects in an
instance of ISCModelObjectCollection. Then, add the new object to the child objects col-
lection.
For information about valid object class names and identifiers, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder.
ISCModelObjectCollection Interface
The following table contains information on the ISCModelObjectCollection interface, which
is used when you create a new model object:
Example 20
The following example illustrates how to create objects using C++. The example uses a Ses-
sion object from Example 6:
The following example illustrates how to create objects using Visual Basic .NET. The example
uses a Session object from Example 6:
Public Sub AddNewObject(ByRef scSession As SCAPI.Session, _
ByRef parentObj As SCAPI.ModelObject, type As String)
Dim scObj as SCAPI.ModelObject
Dim scChildObjCol As SCAPI.ModelObjects
Dim transactionID as Variant
transactionID = scSession.BeginTransaction
scChildObjCol = scSession.ModelObjects.Collect(parentObj, , 1)
' child objects collection
scObj = scChildObjCol.Add(type) ' add new object to the
child object collection
scSession.CommitTransaction( transactionID )
End Sub
For more information, see the HTML document erwin Metamodel Reference,
in the Metamodel Reference Bookshelf located in the erwin Data Modeler
installation folder.
ISCModelProperty Interface
The following table contains information on the ISCModelProperty interface:
For information about valid property values, see the HTML document erwin
Metamodel Reference, in the Metamodel Reference Bookshelf located in the
erwin Data Modeler installation folder.
Example 21
The following example illustrates how to set scalar property values using C++. The example
uses a Model Object object from Example 9 and assumes that a transaction has opened:
//
The following example illustrates how to set scalar property values using Visual Basic .NET.
The example uses a Model Object object from Example 9 and assumes that a transaction has
opened:
'
For r7.3, erwin DM does not support naming non-scalar property members.
ISCModelProperty Interface
The following table contains information on the ISCModelProperty interface:
For information about valid property values, see the HTML document erwin
Metamodel Reference, in the Metamodel Reference Bookshelf located in the
erwin Data Modeler installation folder.
Example 22
The following example illustrates how to set non-scalar property values using C++. The
example uses a Model Object object from Example 9 and assumes that a transaction has
opened:
//
The following example illustrates how to set non-scalar property values using Visual Basic
.NET. The example uses a Model Object object from Example 9 and assumes that a trans-
action has opened:
'
Deleting Objects
You can delete an object by removing the ISCModelObject interface instance of the object
from the instance of ISCModelObjectCollection. You identify the object that you want to
delete either by its pointer to the interface or by its object identifier.
ISCModelObjectCollection Interface
The following table contains information on the ISCModelObjectCollection interface, which
is used to delete model objects:
Example 23
The following example illustrates how to delete objects in C++ if there is a model objects col-
lection and that a transaction has opened:
CString csID; // ID of object to be removed
// …
CComVariant bRetVal = scObjColPtr->Remove(COleVariant(csID));
The following example illustrates how to delete objects in Visual Basic .NET if there is a
model objects collection and that a transaction has opened:
bRetVal = scObjCol.Remove(objID)
For more information about valid property names and property identifiers,
see the HTML document erwin Metamodel Reference, in the Metamodel
Reference Bookshelf located in the erwin Data Modeler installation folder.
The following sections describe the interfaces used to delete model properties and model
property values.
ISCModelPropertyCollection Interface
The following table contains information on the ISCModelPropertyCollection interface:
ISCModelProperty Interface
The following table contains information on the ISCModelProperty interface:
Example 24
The following example illustrates how to delete scalar properties using C++ if there is a
model object and a transaction is open:
CString propName("Some Property Name");
// …
CComVariant bRetVal = scObjPtr->GetProperties()->Remove(COleVari-
ant(propName));
The following example illustrates how to delete scalar properties using Visual Basic .NET if
there is a model object and a transaction is open:
Dim propName As String
propName = "Some Property Name"
bRetVal = scObj.Properties.Remove(propName)
For r7.3, erwin DM does not support naming non-scalar property members.
Example 25
The following example illustrates how to delete non-scalar property values using C++ if
there is a model object and a transaction is open:
ISCModelPropertyCollectionPtr propColPtr = scObjPtr->GetProperties
();
CString csPropName = "Some Property Name";
ISCModelPropertyPtr scPropPtr = propColPtr->GetItem(COleVariant
(csPropName));
long index; // index of a member in a non-scalar property
index = 0; // Set to the first element
// …
bRetVal = scPropPtr->RemoveValue(index); // remove single value
from the property
The following example illustrates how to delete non-scalar property values using Visual
Basic .NET if there is a model object and a transaction is open:
Dim scProp As SCAPI.ModelProperty
scProp = scObj.Properties("Some Property Name")
bRetVal = scProp.RemoveValue(index) ' Remove single value from
the property
ISCPersistenceUnit Interface
The following table contains information on the ISCPersistenceUnit interface:
Example 26
The following example illustrates how to save a model using C++. The example uses a Per-
sistence Unit object from Example 5:
void Save( ISCPersistenceUnitPtr & scPUnitPtr )
{
ISCPropertyBagPtr propBag = scPUnitPtr->GetPropertyBag ("Loc-
ator");
long index = 0;
_bstr_t bstrFileName = propBag->GetValue(COleVariant(index));
// Change bstrFileName to a new location
scPUnitPtr->Save(bstrFileName);
}
The following example illustrates how to save a model using Visual Basic .NET. The example
uses a Persistence Unit object from Example 5:
Public Sum Save( scPUnit As SCAPI.PersistenceUnit )
Dim propBag as SCAPI.PropertyBag
propBag = scUnit.PropertyBag( Locator )
ISCApplicationEnvironment Interface
The following table contains information on the ISCApplicationEnvironment interface:
ISCSession Interface
The following table contains information on the ISCSession interface:
Example 27
The following example illustrates how to access an intrinsic metamodel using C++. The
example uses an Application object from Example 1:
void AccessMetaModel( ISCApplicationPtr & scAppPtr )
{
ISCSessionPtr scSessionPtr = scAppPtr->GetSessions()->Add();
// add a new
The following example illustrates how to access an intrinsic metamodel using Visual Basic
.NET. The example uses an Application object from Example 1:
Public Sub AccessMetaModel( ByRef scApp As SCAPI.Application )
Dim scBag As SCAPI.PropertyBag
Dim scSession As SCAPI.Session
ISCSession Interface
The following table contains information on the ISCSession interface:
ISCSessionCollection Interface
The following table contains information on the ISCSessionCollection interface:
Example 28
The following example illustrates how to close a session using C++. It assumes that there is a
Session object and the session is open. The examples use an Application object from
Example 1:
void CloseSessions( ISCApplicationPtr & scAppPtr )
{
ISCSessionCollectionPtr scSessionColPtr = scAppPtr->GetSes-
sions();
ISCSessionPtr scSessionPtr = scSessionColPtr->GetItem
(COleVariant(0L))
// close the sessions
scSessionPtr->Close(); // close a single session
scSessionColPtr->Clear(); // clear the collection of ses-
sions
}
The following example illustrates how to close a session using Visual Basic .NET. It assumes
that there is a Session object and the session is open. The examples use an Application
object from Example 1:
ISCPersistenceUnitCollection Interface
The following table contains information on the ISCPersistenceUnitCollection interface:
Example 29
The following example illustrates how to clear persistence units using C++. It assumes that
there is an Application object from Example 1:
// remove the persistence units
scAppPtr->GetPersistenceUnits()->Clear();
The following example illustrates how to clear persistence units using Visual Basic .NET. It
assumes that there is an Application object from Example 1:
scApp.PersistenceUnits.Clear
Error Handling
The API uses a generic COM error object to handle errors. Depending on the programming
environment, languages have their own protocols to retrieve errors from the generic error
object. For example, C++ and Visual Basic .NET use exception handling to handle errors. To
ensure a stable application, it is recommended that API clients use error handling to trap
potential errors such as attempting to access an object that was deleted, or attempting to
access an empty collection.
Example 30
The following example illustrates error handling using C++. It assumes that there is a Model
Object object from Example 9:
long GetObjectProperties(ISCModelObjectPtr & scObjPtr)
{
// Get the collection of Properties
ISCModelPropertyCollectionPtr scPropColPtr;
try
{
scPropColPtr = scObjPtr->GetProperties();
if (!scPropColPtr.GetInterfacePtr())
{
AfxMessageBox("Unable to Get Properties Col-
lection");
return FALSE;
}
// …
}
catch(_com_error &error)
{
AfxMessageBox(error.Description());
}
}
The following example illustrates error handling using Visual Basic .NET. It assumes that
there is a Model Object object from Example 9:
Try
scObjCol = scSession.ModelObjects
scObj = scObjCol.Item(objID) ' retrieves object with
given object ID
Catch ex As Exception
' Failed
Console.WriteLine(" API Failed With Error message :" +
ex.Message())
End Try
End Sub
In addition to the generic error object, the API provides an extended error handling mech-
anism with the Application Environment Message log. The message log can handle a
sequence of messages that is useful in a context of complex operations like transactions.
More information about the Application Environment Message log organization is located in
the Property Bag for Application Environment section.
ISCApplicationEnvironment
The following table contains information on the ISCApplicationEnvironment interface:
Example 32
The following example illustrates how to use the API to check messages from the API exten-
ded message log using C++. It assumes that there is an Application object from Example 1:
CString GetExtendedErrorInfo(ISCApplicationPtr & scAppPtr)
{
CString csExtendedErrors = "";
long index = 0;
long numErrors = 0;
VARIANT vValue = pArray[0]; // number of errors
if (vValue.vt == VT_I4)
numErrors = vValue.lVal;
// …
SafeArrayUnaccessData(val.parray);
}
}
}
The following example illustrates how to use the API to check messages from the API exten-
ded message log using Visual Basic .NET. It assumes that there is an Application object from
Example 1:
Public Sub GetExtendedErrorInfo( ByRef scApp As SCAPI.Application
)
Dim nSize As Integer
Dim nWarnings As Integer
Dim nErrors As Integer
Dim nIdx As Integer
Dim nMsgNumber As Integer
Dim aErrors() As Object
Advanced Tasks
The material in this section provides examples of some advanced tasks and how they can be
executed.
In this diagram an instance of the Property_Type object defines a UDP class, the Object_
Type object defines an object class with which the UDP is associated, and the Association_
Type object defines the association between object and property classes.
You are only required to create an instance of the Property_Type object to define a UDP.
erwin DM populates the rest of the necessary data. The following table describes the prop-
erties and tags of the Property_Type object:
Dim oPU
Dim oSession
SCD_SL_M1 = 1
Dim TransId
Dim oUDP
oUDP.Properties("tag_Is_Logical").Value = True
oUDP.Properties("tag_Udp_Data_Type").Value = 2
oUDP.Properties("tag_Udp_Default_Value").Value = "Text"
oUDP.Properties("tag_Order").Value = "1"
oUDP.Properties("tag_Udp_Owner_Type").Value = "Entity"
oUDP.Properties("tag_Is_Logical").Value = True
oUDP.Properties("tag_Udp_Data_Type").Value = 6
oUDP.Properties("tag_Udp_Values_List").Value = "1,2,3"
oUDP.Properties("tag_Udp_Default_Value").Value = "1"
oUDP.Properties("tag_Order").Value = "1"
oSession.CommitTransaction (TransId)
oSession.Close
oAPI.Sessions.Clear
History Tracking
Historical information can be saved for your model, entities, attributes, tables, and columns.
erwin DM uses History objects to store the information in the model.
The API provides functionality that allows you to customize the process of history tracking
without having to work with the History objects directly. The BeginNamedTransaction func-
tion of the ISCSession interface accepts a Property Bag instance populated with the history
tracking properties. The properties are in effect at the initiation of an outer transaction and
are confined to the scope of the transaction.
ISCSession Interface
The following table contains information on the ISCSession interface:
The following table describes the properties used in creating a new model:
Example 34
The following example illustrates how to mark history records for entities and attributes as
API events, and how to mark history records with the API History Tracking description using
Visual Basic .NET:
Public Sub Main()
Sub Main()
Dim oApi As New SCAPI.Application
Dim oBag As New SCAPI.PropertyBag
You can select the history options for the model objects for which you want to preserve his-
tory, as well as to control the type of events to track. This is done within the History Options
tab in the Model Properties dialog.
If the check box for API events is cleared (unchecked), then no historic events from the API
category are recorded. It is possible to control the status of that check box, as well as the
check boxes for model object types from the API, by controlling the value of properties in
the model where the status of these check boxes is stored.
ISCApplication
The ISCApplication interface is the entry point for the API client. Only one instance of the
component can be externally instantiated to activate the API. The client navigates the inter-
face hierarchy by using interface properties and methods to gain access to the rest of the
API functionality.
The following table contains the methods for the ISCApplication interface:
Method Description
BSTR ApiVersion() The API version.
ISCApplicationEnvironment * Reports attributes of runtime environment and
ApplicationEnvironment() available features, such as add-in mode, user
interface visibility, and so on.
ISCModelDirectoryCollection Collects model directories accessible from the
* ModelDirectories() current machine.
BSTR Name() Modeling tool application name.
ISCPersistenceUnitCollection Returns a collection of all persistence units
* PersistenceUnits() loaded in the application.
ISCSessionCollection * Ses- Returns a collection of sessions created within
sions() the application.
BSTR Version() Modeling tool application version.
BSTR ResolveMartModelPath Returns the path of the given model.
(BSTR modelLongId) Returns empty if no model exists with the given
details.
API Interfaces
This section describes each API interface, and the methods associated with them. Where
applicable, signatures and valid arguments are also described.
Some parameters contain an [optional] designation. This means that this par-
ticular part of the parameter is optional and not required.
ISCApplicationEnvironment
The ISCApplicationEnvironment interface contains the information about the runtime envir-
onment.
The following table contains the methods for the ISCApplicationEnvironment interface:
Method Description
ISCPropertyBag * Populates a property bag with one or more
PropertyBag(VARIANT Cat- property values as indicated by Category and
egory [optional], Name.
VARIANT Name [optional],
VARIANT AsString
[optional])
ISCApplicationEnvironment::PropertyBag Arguments
Here is the signature for the PropertyBag function:
ISCPropertyBag *PropertyBag(VARIANT Category, VARIANT Name,
VARIANT AsString)
The following table contains the valid arguments for the PropertyBag function:
ISCModelDirectory
The Model Directory encapsulates information on a single model directory entry. Examples
of the Model Directory are a file system directory or a mart library.
The following table contains the methods for the ISCModelDirectory interface:
Method Description
VARIANT_BOOL DirectoryExists( Returns TRUE if a specified directory exists.
BSTR Locator)
VARIANT_BOOL DirectoryUnitExists Returns TRUE if a specified directory unit exists.
( BSTR Locator)
SC_ModelDirectoryFlags Flags() Model Directory flags. A 32-bit property flag word.
VARIANT_BOOL IsOfType( Returns TRUE if Directory has the same type of con-
ISCModelDirectory * Directory) nection as self.
For example, directory entries from the same mart and
with the same login attributes, such as user, password,
and so on, are considered of the same type.
ISCModelDirectory * LocateDir- Starts enumeration over the directory sub-entries.
ectory (BSTR Locator, VARIANT Fil-
ter [optional])
ISCModelDirectory * LocateDir- Locates the next sub-entry in the directory enu-
ectoryNext() meration. Returns a NULL pointer if no more model dir-
ectory entries can be found.
ISCModelDirectoryUnit * LocateDir- Starts enumeration over the directory units.
ectoryUnit (BSTR Locator, VARIANT
Filter [optional])
ISCModelDirectoryUnit * LocateDir- Locates the next unit in the directory enumeration.
ectoryUnitNext()
BSTR Locator() Location of the directory including the absolute path
and parameters. Does not include password inform-
ation.
void PropertyBag( VARIANT List Accepts a pointer on a property bag with the directory
[optional], VARIANT AsString properties.
[optional], ISCPropertyBag* Prop-
erty Bag)
SC_ModelDirectoryType Type() Type of a directory.
ISCModelDirectory::DirectoryExists Arguments
Here is the signature for the DirectoryExists function:
VARIANT_BOOL DirectoryExists( BSTR Locator)
The following table contains the valid arguments for the DirectoryExists function:
ISCModelDirectory::DirectoryUnitExists Arguments
Here is the signature for the DirectoryUnitExists function:
VARIANT_BOOL DirectoryUnitExists( BSTR Locator)
The following table contains the valid arguments for the DirectoryUnitExists function:
ISCModelDirectory::IsOfType Arguments
Here is the signature for the IsOfType function:
VARIANT_BOOL IsOfType(ISCModelDirectory * Directory)
The following table contains the valid arguments for the IsOfType function:
ISCModelDirectory::LocateDirectory Arguments
Here is the signature for the LocateDirectory function:
ISCModelDirectory * LocateDirectory (BSTR Locator, VARIANT Filter)
The following table contains the valid arguments for the LocateDirectory function:
ISCModelDirectory::LocateDirectoryUnit Arguments
Here is the signature for the LocateDirectoryUnit function:
ISCModelDirectoryUnit * LocateDirectoryUnit (BSTR Locator, VARIANT
Filter)
The following table contains the valid arguments for the LocateDirectoryUnit function:
The following table contains the valid arguments for the PropertyBag (Get) function:
Information about valid property names for VT_BSTR is located in the Prop-
erty Bag for Model Directory and Model Directory Unit section.
The following table contains the valid arguments for the PropertyBag (Set) function:
ISCModelDirectoryCollection
The Model Directory Collection lists all top-level Model Directories available including the
one made available with the application user interface. A client can register new Model Dir-
ectories with this collection.
Method Description
IUnknown _NewEnum() Constructs an instance of the collection enu-
merator object.
ISCModelDirectory * Add Adds a new top-level directory on the list of
(BSTR Locator, VARIANT Dis- available directories.
position [optional])
VARIANT_BOOL Clear() Removes all the top-level directories from a
collection and disconnects the directories
from associated marts.
long Count() The number of ModelDirectory com-
ponents in the collection.
ISCModelObject * Item(long Returns an IUnknown interface pointer iden-
nIndex) tified by its ordered position.
VARIANT_BOOL Remove Removes a top-level directory from the list
(VARIANT Selector, of available directories.
VARIANT_BOOL Disconnect
[optional])
ISCModelDirectoryCollection::Add Arguments
Here is the signature for the Add function:
ISCModelDirectory * Add(BSTR Locator, VARIANT Disposition)
The following table contains the valid arguments for the Add function:
ISCModelDirectoryCollection::Item Arguments
Here is the signature for the Item function:
ISCModelDirectory * Item(long nIndex)
The following table contains the valid arguments for the Item function:
ISCModelDirectoryCollection::Remove Arguments
Here is the signature for the Remove function:
VARIANT_BOOL Remove(VARIANT Selector, VARIANT_BOOL Disconnect
[optional])
The following table contains the valid arguments for the Remove function:
ISCModelDirectoryUnit
The Model Directory Unit encapsulates information on a single directory unit. A file system
file and a model in a mart are examples of the Model Directory Unit.
The following table contains the methods for the ISCModelDirectoryUnit interface:
Method Description
SC_ModelDirectoryFlags Model directory unit flags. A 32-bit property
Flags() flag word.
VARIANT_BOOL IsOfType( Returns TRUE if directory has the same type
ISCModelDirectory * Dir- of connection as self.
ectory) For example, directory entries from the same
mart and with the same login attributes,
such as user, password, and so on, are con-
sidered of the same type.
BSTR Locator() Location of the directory unit including the
absolute path and parameters. Does not
include password information.
BSTR Name() Model directory unit name. For example, the
file system file name without path inform-
ation.
ISCPropertyBag* Prop- Returns a pointer on a property bag with the
ertyBag( VARIANT List directory unit properties.
[optional], VARIANT
AsString [optional]) A directory unit property is
present in the resulting bag only
if it has a value. If the property
does not have any value set, the
property bag will not have the
property listed.
ISCModelDirectoryUnit::IsOfType Arguments
Here is the signature for the IsOfType function:
VARIANT_BOOL IsOfType(ISCModelDirectory * Directory)
The following table contains the valid arguments for the IsOfType function:
The following table contains the valid arguments for the PropertyBag (Get) function:
Information about valid property names for VT_BSTR is located in the Prop-
erty Bag for Model Directory and Model Directory Unit section.
The following table contains the valid arguments for the PropertyBag (Set) function:
ISCModelObject
The ISCModelObject interface represents an object in a model.
The following table contains the methods for the ISCModelObject interface:
Method Description
SC_ModelObjectFlags Flags() Returns the flags of the object.
SC_CLSID ClassId() Returns the class identifier of the cur-
rent object.
BSTR ClassName() Returns the class name of the current
object.
ISCModelPropertyCollection * Col- Returns a property collection of the
lectProperties(VARIANT ClassIds type that you want. This method
[optional], VARIANT MustBeOn always returns a valid collection even
[optional], VARIANT MustBeOff if the collection is empty.
[optional])
ISCModelObject * Context() Passes back the context (parent) of
the object in the model's object tree.
Passes back NULL if the current
object is the tree root.
VARIANT_BOOL IsInstanceOf Returns TRUE if self is an instance of
(VARIANT ClassId) the passed class. This method
respects inheritance. If ClassId con-
tains an ancestor class, the method
returns TRUE.
VARIANT_BOOL IsValid() Returns TRUE if self is valid. This
method is used to detect if the ref-
erenced object is deleted.
BSTR Name() Returns the name or a string iden-
tifier of the current object.
SC_OBJID ObjectId() Uniquely identifies the current
ISCModelObject::CollectProperties Arguments
Here is the signature for the CollectProperties function:
ISCModelPropertyCollection * CollectProperties(VARIANT ClassIds,
VARIANT MustBeOn, VARIANT MustBeOff)
The following table contains the valid arguments for the CollectProperties function:
For information about valid property class identifiers and valid property class
names, see the HTML document erwin Metamodel Reference, in the
Metamodel Reference Bookshelf located in the erwin Data Modeler install-
ation folder. More information about SC_ModelObjectFlags is located in the
Enumerations section.
ISCModelObject::IsInstanceOf Arguments
Here is the signature for the IsInstanceOf function:
VARIANT_BOOL IsInstanceOf(VARIANT ClassId)
The following table contains the valid arguments for the IsInstanceOf function:
For information about valid object class names and identifiers, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder.
ISCModelObjectCollection
The ISCModelObjectCollection interface is a collection of objects in the model that is con-
nected to the active session. Membership in this collection can be limited by establishing fil-
ter criteria.
The following table contains the methods for the ISCModelObjectCollection interface:
Method Description
IUnknown _NewEnum() Constructs an instance of the collection enu-
merator object.
ISCModelObject * Add Adds an object of type Class to the model.
(VARIANT Class, VARIANT
ObjectId)
SC_CLSID * ClassIds() Returns a SAFEARRAY of class identifiers
(such as object type IDs).
Represents a value of the Model Object col-
lection attribute that limited the mem-
bership in the collection at the time when
this collection was created and can be used
for reference purposes.
ClassIds contains a list of acceptable class
identifiers (such as object types). If this list
is non-empty, the collection includes only
those objects whose class identifier
appears in the list. If the list is empty or
returns a NULL pointer, then all objects are
included.
BSTR * ClassNames() Similar to ClassIds except that it returns a
SAFEARRAY of class names (such as object
type names).
ISCModelObjectCollection * Creates a collection of Model Objects,
Collect(VARIANT Root, which represents a subcollection of itself.
For information about valid object class names and identifiers, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder.
ISCModelObjectCollection::Add Arguments
Here is the signature for the Add function:
ISCModelObject * Add(VARIANT Class, VARIANT ObjectId)
The following table contains the valid arguments for the Add function:
For information about valid object class names and identifiers, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder.
ISCModelObjectCollection::Collect Arguments
Here is the signature for the Collect function:
ISCModelObjectCollection * Collect(VARIANT Root, VARIANT ClassId,
VARIANT Depth, VARIANT MustBeOn, VARIANT MustBeOff)
The following table contains the valid arguments for the Collect function:
For information about valid object class names and identifiers, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder. More information
about SC_ModelObjectFlags is located in the Enumerations section.
ISCModelObjectCollection::Item Arguments
Here is the signature for the Item function:
ISCModelObject * Item(VARIANT nIndex, VARIANT Class)
The following table contains the valid arguments for the Item function:
For information about valid object class names and identifiers, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder.
ISCModelObjectCollection::Remove Arguments
Here is the signature for the Remove function:
VARIANT_BOOL Remove(VARIANT Object)
The following table contains the valid arguments for the Remove function:
ISCModelProperty
The ISCModelProperty interface represents a property of a given object.
The following table contains the methods for the ISCModelProperty interface:
Method Description
BSTR ClassName() Returns the class name of the property.
BSTR FormatAsString() Formats the property value as a string.
ISCPropertyValueCollection * Returns the collection of values for the model
PropertyValues() property
long Count() Contains the number of values in the property.
SC_CLSID ClassId() Returns the class identifier of the property.
SC_ModelPropertyFlags Flags Returns the flags of the property.
()
SC_ValueTypes DataType Passes back the identifier of the native value
(VARIANT ValueId [optional]) type for the indicated property value.
VARIANT_ Retrieves available property facet IDs.
BOOL GetValueFacetIds( FacetsTrueBasket is a SAFEARRAY of facet ID
Long* FacetsTrueBasket, numbers. The listed facets have TRUE as a
Long* FacetsFalseBasket) value.
FacetsFalseBasket is a SAFEARRAY of facet ID
numbers. The listed facets have FALSE as a
value.
The method returns FALSE if the property does
not have a value.
VARIANT_ Retrieves available property facet names.
BOOL GetValueFacetNames FacetsTrueBasket is a SAFEARRAY of facet name
(BSTR* Facet- strings. The listed facets have TRUE as a value.
sTrueBasket,BSTR* Facet- FacetsFalseBasket is a SAFEARRAY of facet -
sFalseBasket) name strings. The listed facets have FALSE as a
value.
For information about valid property class identifiers and valid property class
names, see the HTML document erwin Metamodel Reference, in the
Metamodel Reference Bookshelf located in the erwin Data Modeler install-
ation folder. More information about SC_ModelPropertyFlags is located in
ISCModelProperty::DataType Arguments
Here is the signature for the DataType function:
SC_ValueTypes DataType(VARIANT ValueId)
The following table contains the valid arguments for the DataType function:
ISCModelProperty::RemoveValue Arguments
Here is the signature for the RemoveValue function:
VARIANT_BOOL RemoveValue(VARIANT ValueId)
The following table contains the valid arguments for the RemoveValue function:
The following table contains the valid arguments for the Value (Get) function:
The following table contains the valid arguments for the Value (Set) function:
ISCModelProperty::GetValueFacetIds Arguments
Here is the signature for the GetValueFacetIds function:
VARIANT_BOOL GetValueFacetIds(Long* FacetsTrueBasket, Long* Facet-
sFalseBasket)
The following table contains the valid arguments for the GetValueFacetIds function:
ISCModelProperty::GetValueFacetNames Arguments
Here is the signature for the GetValueFacetNames function:
VARIANT_BOOL GetValueFacetNames(BSTR* FacetsTrueBasket, BSTR*
FacetsFalseBasket)
The following table contains the valid arguments for the GetValueFacetNames function:
ISCModelProperty::SetValueFacets Arguments
Here is the signature for the SetValueFacets function:
void SetValueFacets(VARIANT FacetsTrueBasket, VARIANT Facet-
sFalseBasket)
The following table contains the valid arguments for the SetValueFacets function:
ISCModelPropertyCollection
The ISCModelPropertyCollection interface is a collection of properties for a given model
object. Membership in this collection can be limited by establishing filter criteria.
The following table contains the methods for the ISCModelPropertyCollection interface:
Method Description
IUnknown _ Constructs an instance of the collection enumerator
NewEnum() object.
ISCModelProperty * Construct a new property for a bound model object if it
Add(VARIANT does not exist.
ClassId)
SC_CLSID * ClassIds Returns a SAFEARRAY of property class identifiers in the
() property collection.
Represents a value of the ModelProperties collection
attribute that limited the membership at the time when
this collection was created and can be used for ref-
erence purposes.
ClassIds contain an array of acceptable class identifiers
(such as property classes). If this list is non-empty, the
property collection includes only those properties
whose class identifier appears on the list. If the list is
empty or the caller supplies a NULL pointer, the col-
lection includes all the properties owned by the object.
BSTR * ClassNames() Same as the ClassIds property, but returns a
SAFEARRAY of property type names in the property col-
lection.
long Count() Number of properties in the collection.
VARIANT_BOOL Returns TRUE if the object owns a property of the
HasProperty passed class.
(VARIANT ClassId, Treats properties as absent if they fail to satisfy
For information about valid property class identifiers and valid property class
names, see the HTML document erwin Metamodel Reference, in the
Metamodel Reference Bookshelf located in the erwin Data Modeler install-
ation folder. More information about SC_ModelPropertyFlags is located in
the Enumerations section.
ISCModelPropertyCollection::Add Arguments
Here is the signature for the Add function:
ISCModelProperty * Add(VARIANT ClassId)
The following table contains the valid arguments for the Add function:
For information about valid property class identifiers and valid property class
names, see the HTML document erwin Metamodel Reference, in the
Metamodel Reference Bookshelf located in the erwin Data Modeler install-
ation folder.
ISCModelPropertyCollection::HasProperty Arguments
Here is the signature for the HasProperty function:
VARIANT_BOOL HasProperty(VARIANT ClassId, VARIANT MustBeOn,
VARIANT MustBeOff)
The following table contains the valid arguments for the HasProperty function:
For information about valid property class identifiers and valid property class
names, see the HTML document erwin Metamodel Reference, in the
Metamodel Reference Bookshelf located in the erwin Data Modeler install-
ation folder. More information about SC_ModelPropertyFlags is located in
the Enumerations section.
ISCModelPropertyCollection::HasPropertyFacets Arguments
Here is the signature for the HasPropertyFacets function:
VARIANT_BOOL HasPropertyFacets(VARIANT ClassId, VARIANT Flag-
sMustBeOn, VARIANT FlagsMustBeOff, VARIANT FacetsMustBeSet)
The following table contains the valid arguments for the HasPropertyFacets function:
For information about valid property class identifiers and valid property class
names, see the HTML document erwin Metamodel Reference, in the
Metamodel Reference Bookshelf located in the erwin Data Modeler install-
ation folder. More information about SC_ModelPropertyFlags is located in
the Enumerations section. More information about FacetsMustBeSet is loc-
ated in the Property Bag for Application Environment section.
ISCModelPropertyCollection::Item Arguments
Here is the signature for the Item function:
ISCModelProperty * Item(VARIANT Class)
The following table contains the valid arguments for the Item function:
For information about valid property class identifiers and valid property class
names, see the HTML document erwin Metamodel Reference, in the
Metamodel Reference Bookshelf located in the erwin Data Modeler install-
ation folder.
ISCModelPropertyCollection::Remove Arguments
Here is the signature for the Remove function:
VARIANT_BOOL Remove(VARIANT ClassId)
The following table contains the valid arguments for the Remove function:
For information about valid property class identifiers and valid property class
names, see the HTML document erwin Metamodel Reference, in the
Metamodel Reference Bookshelf located in the erwin Data Modeler install-
ation folder.
ISCModelSet
A Model Set component provides access to a member of a hierarchically organized col-
lection of model sets.
The following table contains the methods for the ISCModelSet interface:
Method Description
SC_MODELTYPEID ClassId Class identifier for metadata associated with
() the model set.
BSTR ClassName() Class name for metadata associated with the
model set.
VARIANT_BOOL DirtyBit() Returns a flag that indicates that the data has
changed in the model set.
void DirtyBit(VARIANT_ Sets the flag that indicates that the data in
BOOL ) the model set has changed.
SC_MODELTYPEID Passes back an identifier for the model set.
ModelSetId()
BSTR Name() Passes back a persistence unit name.
ISCModelSet * Owner() A pointer to the owner model set. Returns
NULL for the top model set in the persistence
unit.
ISCModelSetCollection * Provides a collection with directly owned
OwnedModelSets() model sets.
SC_MODELTYPEID Per- The identifier for the persistence unit that
sistenceUnitId() contains the model set.
ISCPropertyBag * Prop- Returns a property bag with the model set's
ertyBag(VARIANT List properties.
[optional], VARIANT A model set property is present in the res-
AsString [optional]) ulting bag only if it has a value. If the prop-
erty does not have any value set, the
property bag will not have the property lis-
For information about metadata class identifiers and names, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder.
The following table contains the valid arguments for the PropertyBag (Get) function:
More information about property names is located in the Property Bag for
Persistence Units and Persistence Unit Collections section.
The following table contains the valid arguments for the PropertyBag (Set) function:
ISCModelSetCollection
A Model Set Collection contains all model sets directly owned by an owner model set.
The following table contains the methods for the ISCModelSetCollection interface:
Method Description
IUnknown _NewEnum() Constructs an instance of a model set
enumerator object.
long Count() Number of model sets in the collection.
ISCPersistenceUnit * Item Passes back a pointer for a ModelSet
(VARIANT nIndex) component.
ISCModelSet * Owner() Returns a pointer to the owner model
set.
ISCModelSetCollection::Item Arguments
Here is the signature for the Item function:
ISCModelSet * Item(VARIANT nIndex)
The following table contains the valid arguments for the Item function:
For information about metadata class identifiers and names, see the HTML
document erwin Metamodel Reference, in the Metamodel Reference Book-
shelf located in the erwin Data Modeler installation folder.
ISCPersistenceUnit
A Persistence Unit encapsulates the information required to connect to an existing, outer
level persistence unit within an application.
The following table contains the methods for the ISCPersistenceUnit interface:
Method Description
VARIANT_BOOL DirtyBit() Returns a flag that indicates that the data
has changed in the persistence unit.
void DirtyBit(VARIANT_ Sets the flag that indicates that the data in
BOOL ) the persistence unit has changed.
VARIANT_BOOL HasSession Returns TRUE if a unit has one or more ses-
() sions connected.
VARIANT_BOOL IsValid() Returns TRUE if self is valid.
ISCModelSet * ModelSet() Passes back a pointer on the top model set
in the Persistence Unit.
BSTR Name() Passes back a persistence unit name.
SC_MODELTYPEID ObjectId Passes back an identifier for the persistence
() unit.
ISCPropertyBag * Prop- Returns a property bag with the persistence
ertyBag(VARIANT List unit's properties.
[optional], VARIANT A unit property is present in the resulting
AsString [optional]) bag only if it has a value. If the property does
not have any value set, the property bag will
not have the property listed.
void PropertyBag(VARIANT Sets a persistence unit with the properties in
List [optional], VARIANT the given property bag.
AsString [optional],
ISCPropertyBag * propBag)
VARIANT_BOOL Save Persists model data to external storage.
(VARIANT Locator Uncommitted transactions are ignored.
ISCPersistenceUnit::ApplyDataVault
Here is the signature for the ApplyDataVault function:
HRESULT ApplyDataVault([in]ISCPropertyBag * PropertyBag,
[in] VARIANT strModelPath,
[in] VARIANT strCSVPath);
The following table contains the valid arguments for the ApplyDataVault function:
Entity Component
Customer Hub
Cust_Sales Link
Customer_Info Satellite
Customer_Address Reference
Sales Hub
Sales_Employees Link
Employee Hub
Employee_Info Satellite
Record_PointInTime PIT
Record_Bridge Bridge
Apply Data Vault Sample Script:
ISCPersistenceUnit::CompleteCompare
Here is the signature for the CompleteCompare function:
HRESULT CompleteCompare([in] VARIANT CCLeftModelPath,
[in] VARIANT CCRightModelPath, [in] VARIANT CCOutputPath,
[in] VARIANT CCOptionSet, [in] VARIANT EventID,
[out, retval] VARIANT_BOOL *ppVal);
The following table contains the valid arguments for the CompleteCompare function:
The following table contains the valid arguments for the PropertyBag (Get) function:
More information about valid property names is located in the Property Bag
for Persistence Units and Persistence Unit Collections section.
The following table contains the valid arguments for the PropertyBag (Set) function:
ISCPersistenceUnit::Save Arguments
Here is the signature for the Save function:
VARIANT_BOOL Save(VARIANT Locator, VARIANT Disposition)
The following table contains the valid arguments for the Save function:
ISCPersistenceUnit::ReportDesigner
Here is the signature for the ReportDesigner function:
HRESULT ReportDesigner([in] VARIANT RDModelPath,
[in] VARIANT RDSolutionFilePath,
[in] VARIANT RDOutputPath,
[in] VARIANT RDExportFormat,
[out, retval] VARIANT_BOOL *ppVal);
The following table contains the valid arguments for the ReportDesigner function:
ISCPersistenceUnit::ReverseEngineer
Here is the signature for the ReverseEngineer function:
HRESULT ReverseEngineer ([in]ISCPropertyBag * PropertyBag,
[in]VARIANT
REoptionpath,[in] VARIANT REConnectionString,[in] VARIANT REPass-
word);
The following table contains the valid arguments for the ReverseEngineer function:
The following table contains the valid arguments for the PropertyBag parameter.
Default: False.
Remove_ VT_BOOL--True or Removes erwin generated triggers.
ERwin_Gen- False. True: Remove Include Generated Trig-
erated_Trig- Default: True. gers.
gers False: Do not remove Include Gen-
erated Triggers.
Force_Phys- VT_BOOL--True or Overrides the physical name property
ical_Name_ False. for all objects in logical/physical mod-
Option Default: Force els automatically during reverse engin-
eering.
True: Force physical name option.
False: Do not force physical name
option.
Connection String
Server=<Target Server type>:<MajorVersion>:<MinorVersion>
|AUTHENTICATION=<AuthenticationType>|USER=<UserName>|
Example:
SERVER-
R=16:10:0|AUTHENTICATION=4|USER=erwin|1=3|2=r8|3=127.0.0.1\\erwin_
mart01
The following table describes the valid values for a connection string.
For REDB-PureHive:
Call oPersistenceUnit.ReverseEngineer(oPropertyBag,, "SERVER-
R=19:2:1|AUTHENTICATION=4|USER=<hive-user>|1=2|5=<cloudera
dsn>|10=0|13=1", "<hive-password>")
For REDB-Metastore MySQL:
Call oPersistenceUnit.ReverseEngineer(oPropertyBag,, "SERVER-
R=19:2:1|AUTHENTICATION=4|USER=<mysql-user>|1=2|5=<mysql dsn>|10=0|13=2",
"<mysql-password>")
ISCPersistenceUnit::ReverseEngineerScript
Here is the signature for the ReverseEngineerScript function:
HRESULT ReverseEngineerScript ([in]ISCPropertyBag * PropertyBag,
VARIANT Locator,
VARIANT Disposition);
The following table contains the valid arguments for the ReverseEngineerScript function:
The following table contains the valid arguments for the PropertyBag parameter.
Default: False.
Remove_ VT_BOOL--True or False. Removes erwin generated triggers.
ERwin_Gen- Default: True. True: Remove Include Generated Triggers.
erated_Trig- False: Do not remove Include Generated Trig-
gers gers.
Force_Phys- VT_BOOL--True or False. Overrides the physical name property for all
ical_Name_ Default: Force objects in logical/physical models automatically
Option during reverse engineering.
True: Force physical name option.
False: Do not force physical name option.
Dim oPropertyBag
Set oPropertyBag = CreateObject("ERwin9.SCAPI.PropertyBag.9.0")
'Create LP model with Database as MongoDB
Call oPropertyBag.Add("Model_Type", "Combined")
Call oPropertyBag.Add("Target_Server", 1075859196)
Call oPropertyBag.Add("Target_Server_Version", 4)
'Create Persistence Unit
Dim oPUnitCol
Set oPUnitCol = oApi.PersistenceUnits
'Create Propertybag
Dim oPersistenceUnit
Set oPersistenceUnit = oPUnitCol.Create(oPropertyBag)
The following example refers to JSON models when the option is Blank Value:
The following example refers to JSON models when the option is Schema:
'Call oPersistenceUnit.ReverseEngineerScript(oPropertyBag,
"C:\ERWIN_PROJECT\Issue_Scripts\MongoDB_MCL\MongoDB_JSON2_4.json",
"Schema"))
ISCPersistenceUnit::ForwardEngineer
Here is the signature for the ForwardEngineer_DB function:
HRESULT FEModel_DB([in] VARIANT ConnectionInfo, [in] VARIANT Pass-
word,
[in] VARIANT OptionXML, [out, retval] VARIANT_BOOL *ppVal);
The following table contains the valid arguments for the ForwardEngineer function:
ISCPersistenceUnitCollection
The ISCPersistenceUnitCollection contains all outer level persistence units loaded in the
application. It contains one entry for each active data model.
The following table contains the methods for the ISCPersistenceUnitCollection interface:
Method Description
IUnknown _NewEnum() Constructs an instance of unit
enumerator object.
ISCPersistenceUnit * Add(VARIANT Loc- Adds a new persistence unit to
ator, VARIANT Disposition [optional]) the unit collection.
VARIANT_BOOL Clear() Purges all units from the col-
lection.
long Count() Number of persistence units in
the collection.
ISCPersistenceUnit * Create(ISCProp- Creates a new unit, and
ertyBag * PropertyBag, VARIANT registers the unit with the col-
ObjectId [optional]) lection.
ISCPersistenceUnit * Item(VARIANT nIn- Passes back an IUnknown
dex) pointer for a PersistenceUnit
component.
VARIANT_BOOL Remove(VARIANT Removes a persistence unit
Selector, VARIANT Save [optional]) from the collection.
ISCPersistenceUnitCollection::Add Arguments
Here is the signature for the Add function:
ISCPersistenceUnit * Add(VARIANT Locator, VARIANT Disposition)
The following table contains the valid arguments for the Add function:
ISCPersistenceUnitCollection::Create Arguments
Here is the signature for the Create function:
ISCPersistenceUnit * Create(ISCPropertyBag * Property Bag, VARIANT
ObjectId)
The following table contains the valid arguments for the Create function:
More information about property names and format is located in the Prop-
erty Bag for Persistence Units and Persistence Unit Collections section.
ISCPersistenceUnitCollection::Item Arguments
Here is the signature for the Item function:
ISCPersistenceUnit * Item(VARIANT nIndex)
The following table contains the valid arguments for the Item function:
ISCPersistenceUnitCollection::Remove Arguments
Here is the signature for the Remove function:
VARIANT_BOOL Remove(VARIANT Selector, VARIANT Save)
The following table contains the valid arguments for the Remove function:
Models should be closed prior to exiting the application. Add the following
line in your code to provide a call to explicitly close the model prior to exiting
your application:
...
SaveNewPersistenceUnit(ThePersistenceUnit, DefaultFileName)
TheApplication.PersistenceUnits.Remove(ThePersistenceUnit, False)
...
ISCPropertyBag
The ISCPropertyBag interface is used to set and access the properties of ISCAp-
plicationEnvironment, ISCPersistenceUnit, and ISCModelSet. The ISCPropertyBag is also used
to set the properties of a new persistence unit.
The following table contains the methods for the ISCPropertyBag interface:
Method Description
VARIANT_BOOL Adds a new property to the bag. Does not check for
Add(BSTR Name, duplicate names. Returns TRUE if the property was
VARIANT Value) added to the bag, otherwise, it is FALSE.
void ClearAll() Removes all properties from the bag.
long Count() Returns the number of properties.
BSTR Name(long Retrieves the indicated property name in the bag.
PropertyIdx)
VARIANT Value Retrieves the indicated property in the bag.
(VARIANT Prop-
erty)
void Value Sets the indicated property in the bag.
(VARIANT Prop-
erty, VARIANT
Val)
ISCPropertyBag::Add Arguments
Here is the signature for the Add function:
VARIANT_BOOL Add(BSTR Name, VARIANT Value)
The following table contains the valid arguments for the Add function:
ISCPropertyBag::Name Arguments
Here is the signature for the Name function:
BSTR Name(long PropertyIdx)
The following table contains the valid arguments for the Name function:
The following table contains the valid arguments for the Value (Get) function:
The following table contains the valid arguments for the Value (Set) function:
ISCPropertyValue
The ISCPropertyValue interface is a single value of a given property.
The following table contains the methods for the ISCPropertyValue interface:
Method Description
SC_ValueTypes * GetSup- Groups a list of supported value types for the
portedValueIdTypes() current value identifier and returns it as a
SAFEARRAY.
The GetValue method must be able to convert
the current value into any value type whose
code appears in the returned list. If the list is
empty, the value is available only in its native
(such as default) format. Reference properties
must return an empty list.
SC_ValueTypes * GetSup- Groups a list of supported value types and
portedValueTypes() returns it as a SAFEARRAY.
The GetValueId method must be able to con-
vert the current value into any value type
whose code appears in the returned list. If the
list is empty, then the current identifier is avail-
able only in its native (such as default) format.
SC_CLSID PropertyClassId() Returns the class identifier of the current prop-
erty.
BSTR PropertyClassName() Returns the class name of the current property.
VARIANT Value(VARIANT Converts the current value to the passed value
ValueType [optional]) type.
VARIANT ValueId(VARIANT Uniquely identifies the value in a non-scalar
ValueType [optional]) property.
SC_ValueTypes ValueIdType Passes back the default type of the ValueId that
() identifies the value within the non-scalar prop-
More information about value data types is located in the SC_ValueTypes sec-
tion.
ISCPropertyValue::ValueId Arguments
Here is the signature for the ValueId function:
VARIANT ValueId(VARIANT ValueType)
The following table contains the valid arguments for the ValueId function:
ISCPropertyValue::Value Arguments
Here is the signature for the Value function:
VARIANT Value(VARIANT ValueType)
The following table contains the valid arguments for the Value function:
ISCPropertyValueCollection
The ISCPropertyValueCollection interface is a collection of values for a non-scalar property.
The following table contains the methods for the ISCPropertyValueCollection interface:
Method Description
IUnknown _NewEnum() Constructs an instance of the collection
enumerator object.
long Count() Number of values in the collection.
ISCPropertyValue * Item Returns a single value from the prop-
(VARIANT ValueId) erty value collection.
VARIANT_BOOL Facet ( Retrieves a facet. It fails if the facet is
VARIANT Facet) not set.
Facet is either a facet ID or facet name.
void Facet ( VARIANT Facet, Sets a facet with the given value.
VARIANT_BOOL Val) Facet is either a facet ID or facet name.
VARIANT_BOOL RemoveFacet ( Removes a facet to non-set state.
VARIANT Facet) Facet is either a facet ID or facet name.
ISCPropertyValueCollection::Item Arguments
Here is the signature for the Item function:
ISCPropertyValue * Item(VARIANT ValueId)
The following table contains the valid arguments for the Item function:
The following table contains the valid arguments for the Facet (Get) function:
The following table contains the valid arguments for the Facet (Set) function:
ISCPropertyValueCollection::RemoveFacet Arguments
Here is the signature for the RemoveFacet function:
VARIANT_BOOL RemoveFacet (VARIANT Facet)
The following table contains the valid arguments for the RemoveFacet function:
ISCSession
The ISCSession interface is an active connection between the API client and a model.
The following table contains the methods for the ISCSession interface:
Method Description
VARIANT BeginTransaction Opens a transaction on the session. The method
() passes back a transaction identifier. Imple-
mentations use the identifier to scope Commit and
Rollback operations. If the application does not
support nested transactions, it passes back VT_
EMPTY.
Transaction nesting is implicit. If an API client
invokes BeginTransaction and a transaction is
already open, the new transaction is nested inside
the existing one.
VARIANT Opens a transaction on the session. Similar to
BeginNamedTransaction BeginTransaction with an option to provide a trans-
(BSTR Name, VARIANT action name and additional properties.
PropertyBag [optional])
VARIANT_BOOL ChangeAc- Changes the model access to the specified level.
cess(SC_SessionFlags
Flags)
VARIANT_BOOL Close() Disconnects self from its associated persistence
unit or model set.
VARIANT_BOOL Com- Commits the specified transaction and all nested
mitTransaction(VARIANT transactions contained within it.
TransactionId)
SC_SessionFlags Flags() Returns a set of flags associated with the session.
VARIANT_BOOL IsValid() Returns TRUE if self is valid.
VARIANT_BOOL IsTrans- TRUE if there was no data modification applied
ISCSession::BeginNamedTransaction Arguments
Here is the signature for the BeginNamedTransaction function:
VARIANT_BOOL BeginNamedTransaction(BSTR Name, VARIANT PropertyBag
)
The following table contains the valid arguments for the BeginNamedTransaction function:
ISCSession::CommitTransaction Arguments
Here is the signature for the CommitTransaction function:
VARIANT_BOOL CommitTransaction(VARIANT TransactionId)
The following table contains the valid arguments for the CommitTransaction function:
ISCSession::IsTransactionEmpty Arguments
Here is the signature for the IsTransactionEmpty function:
VARIANT_BOOL IsTransactionEmpty(VARIANT All)
The following table contains the valid arguments for the IsTransactionEmpty function:
ISCSession::Open Arguments
Here is the signature for the Open function:
VARIANT_BOOL Open(ISCPersistenceUnit * Unit, VARIANT Level,
VARIANT Flags)
The following table contains the valid arguments for the Open function:
ISCSession::RollbackTransaction Arguments
Here is the signature for the RollbackTransaction function:
VARIANT_BOOL RollbackTransaction(VARIANT TransactionId)
The following table contains the valid arguments for the RollbackTransaction function:
ISCSessionCollection
The Session Collection contains the active connections between the API client and the applic-
ation.
The following table contains the methods for the ISCSessionCollection interface:
Method Description
IUnknown _ Constructs an instance of a session enumerator object.
NewEnum()
ISCSession * Construct a new, closed Session object, and adds it to
Add() the collection.
VARIANT_ Removes all Session objects from the collection
BOOL Clear()
long Count() The number of sessions in the collection.
ISCSession * Passes back a session identified by its ordered position.
Item(long nIn-
dex)
VARIANT_ Removes a Session object from the collection. If the ses-
BOOL Remove sion is opened, it is closed before it is removed. All com-
(VARIANT Ses- mitted changes are saved in the persistence unit.
sionId)
ISCSessionCollection::Item Arguments
Here is the signature for the Item function:
ISCSession * Item(long Index)
The following table contains the valid arguments for the Item function:
ISCSessionCollection::Remove Arguments
Here is the signature for the Remove function:
VARIANT_BOOL Remove(VARIANT SessionId)
The following table contains the valid arguments for the Remove function:
Enumerations
This section contains information regarding the various enumerations for the API. The enu-
merations define valid values for various properties.
SC_ModelDirectoryFlags
The following table contains the properties and enumerations for SC_ModelDirectoryFlags:
SC_ModelDirectoryType
The following table contains the properties and enumerations for SC_ModelDirectoryType:
SC_ModelObjectFlags
The following table contains the properties and enumerations for SC_ModelObjectFlags:
SC_ModelPropertyFlags
The following table contains the properties and enumerations for SC_ModelPropertyFlags:
SC_SessionFlags
The following table contains the properties and enumerations for SC_SessionFlags:
SC_SessionLevel
The following table contains the properties and enumerations for SC_SessionLevel:
SC_ValueTypes
The following table contains the properties and enumerations for SC_ValueTypes:
ISCApplicationEnvironment::PropertyBag
The PropertyBag function from the ISCApplicationEnvironment interface populates a prop-
erty bag with one or more property values as indicated by Category and Name.
Here is the signature for the ISCApplicationEnvironment PropertyBag function:
ISCPropertyBag * PropertyBag(VARIANT Category, VARIANT Name,
VARIANT AsString)
The following table contains the valid arguments for the ISCApplicationEnvironment Prop-
ertyBag function:
Application Category
The following table describes the Application category, which describes the features asso-
ciated with the erwin DM tool:
Application.API Category
The following table describes the Application.API category, which describes the features
associated with the API:
Application.API.Features Category
The following table describes the Application.API.Features category, which summarizes the
level of support the API provides in its main set of operations:
Application.API.MessageLog Category
The following table describes the Application.API.MessageLog category, which provides
access to additional messages registered during API operations:
For information about object class identifiers and property class identifiers,
see the HTML document erwin Metamodel Reference, in the Metamodel
Reference Bookshelf located in the erwin Data Modeler installation folder.
More information about using the Model Set Identifier to locate a model set
is located in the Accessing a Model and Accessing a Model Set sections. More
information about using the Class Identifier to learn more about object types
and property types is located in the Accessing Metamodel Information sec-
tion. More information about using the Object Identifier to access the asso-
ciated model object is located in the Accessing Objects in a Model section.
Application.Modeling Category
The Application.Modeling category describes the features associated with the erwin DM
modeling engine:
Application.Modeling.Physical Category
The following table describes the Application.Modeling.Physical category, which describes
the features associated with physical modeling in erwin DM:
Application.Persistence Category
The Application.Persistence category describes the features associated with persistence sup-
port in erwin DM. There are no properties in this category.
Application.Persistence.FileSystem Category
The following table describes the Application.Persistence.FileSystem category, which
describes the features associated with the file system:
Application.Persistence.Mart
The following table describes the Application.Persistence.Mart category, which describes
the features associated with persistence support in erwin Data Modeler Workgroup Edi-
tion:
The following table lists the Property Bag properties and datatypes for the Model Directory
Unit:
The following table contains the valid arguments for the PropertyBag (Get) function:
The following table contains the valid arguments for the PropertyBag (Set) function:
Property Bag Contents for Persistence Unit and Persistence Unit Collection
The following table lists the Property Bag properties and datatypes recognized by erwin DM:
Branch_Log SAFEARRAY After Retrieves and sets the branch log of the persistence
(SC_ create unit identifiers. A persistence unit retains its log of
MODELTYPEID) identifiers.
erwin DM uses the branch logs of the persistence
units for extended identification match.
The API uses only the most current identifier for
searching in the Persistence Unit Collection.
Model_Type Long After Retrieves and sets the type of the persistence unit,
create such as logical, logical/physical, and physical models.
Can be set when a persistence unit is created; after
that the property becomes read-only.
Available values are:
The Target_Server property is a vector that consists of three members. The first member of
the vector contains a DBMS brand identifier, the second member is the major version value,
and the last member is the minor version value.
The following table lists DBMS brand identifiers for the Target_Server property. The table
also lists the brand names that are used when the identifier is presented as a string:
Locator Property
The following table describes the syntax supported by the Locator property:
Syntax Arguments
[provider://]pathinfo[?param=value[;param=value]…n] provider: This is a
type of persistence
storage. Use erwin
to specify file sys-
tem, and use mart
for a mart. If this is
skipped, erwin is
the default.
pathinfo: This is
the path to the
storage location,
which is either a
file path or the
mart path.
param: This is
either a parameter
name or a
keyword.
value: This is a text
string.
There are no param keywords defined for the file system persistence storage.
A list of Locator param keywords for use with the mart type of provider for models stored in
a mart is described in the following table.
There is a special arrangement for the erwin Data Modeler Workgroup Edi-
tion Locator. Part of the Locator string with params can be omitted if an
application has connections open with one or more mart repositories. In this
case, the params part of the Locator string can have only partial information
or not be present at all, as long as it is clear to which connection from the
available list it refers.
Currently, erwin Data Modeler Workgroup Edition allows only one open connection to a
mart repository at any given time. Therefore, it is possible, after establishing a connection,
to omit the params part of the Locator string completely and to provide the model path
information only.
The following table provides a list of Locator param keywords for use with the mart type of
provider for models stored in a mart:
The following table describes various scenarios in which you can use the Locator param
keyword along with the mart type of provider for models stored in a mart:
Sce- Description
nari-
o
erwi- Your Libraries/ Models are stored in the Mart under the catalog named Mart . Mart
n is the default name, you can change it. A library can contain a library. If a library that is
Data specified in path does not exist in the Mart, the library is created at the time of saving
Mo- the model and the model is stored in that library.
dele- If you have a model named MyModel located in MyLib, which is in an SSL secured
r Mart, you can use the following:
Wor-
mart://<Cat-
kgro-
logName>/<Library-
up
name>/<ModelMName>?VNO-
Edi-
=<ve-
tion
rsion-
no>;TRC-
=NO;SR-
V=<Serve-
erLocation>;PRT=<portno>;ASR=<ApplicationServerName>;SSL=<YES/NO>;UID= <user
id>;PSW=<password>
For example:
mart://Mart/MyLib/MyModel?VNO-
=1;TR-
C=NO;II-
S=NO;SR-
V=<Serve-
rLoca-
tion>;PRT=<portno>;ASR=<ApplicationServerName>;SSL=<YES>;UID=
<user id>;PSW=<password>
Loca-If you have a model called mod.erwin located in the models directory on the C drive,
Disposition Property
The Disposition parameter provides optional information for the API to access model data
specified by the Locator parameter.
The following table describes the syntax supported by the Disposition property:
Syntax Arguments
param=value[;param=value]…n param: This is either a parameter name
or a keyword.
value: Yes/No/specified values for some
params.
The following table lists Disposition param keywords for use with the erwin type of provider,
such as for models stored in the file system:
erwin DM Metamodel
This appendix lists information regarding the erwin DM metamodel.
For more information, see the HTML document erwin Metamodel Reference,
in the Metamodel Reference Bookshelf located in the erwin Data Modeler
installation folder.
Not included in this file are those metadata names where the only
change was the replacement of space characters with underscores,
since erwin DM's XML format already uses underscores in object type
names and property type names.
Metadata Organization
The metadata includes object and property classes, object aggregations, and property asso-
ciations.
Object classes
Define the type of objects that may occur within a model such as an entity class, an
attribute class, or a relationship class.
Property classes
Define the type of properties an object may have such as the Name property, Com-
ment property, or Parent_Domain_Ref property.
Object aggregations
Identify an ownership relationship between classes of objects, such as a model that
owns entities, or entities that own attributes, and so on.
Property associations
Define property usage by object classes. For example, the metadata includes property
associations for every object class that has the Name property.
Metamodel Elements
erwin DM organizes data as a group of linked model sets. The model sets are arranged in a
tree-like hierarchy with a single model set at the top.
The top model set contains the bulk of the modeling data. The API uses the abbreviation
EMX to identify the top model set.
The EMX model set owns a secondary model set, abbreviated as EM2, which contains user
interface settings and user options for erwin DM services such as Forward Engineering, Com-
plete Compare, and so on.
The API clients access the model data by constructing a session and connecting it to a model
set using the Session component.
A model set contains several levels of data. It contains the data the application manipulates,
such as entity instances, attribute instances, relationship instances, and so on.
The model set also contains metadata, a description of the objects and properties that may
occur within the application's data.
Metadata Tags
Each metadata object may include one or more tags. A tag is a metadata object property
that conveys certain descriptive meta information, such as if an object class is logical, phys-
ical, valid for a specific target DBMS, and so on.
A tag on an object aggregation overrides the identical tag set on the asso-
ciated owned object class. A tag on a property association overrides the
identical tag set on the associated property class.
Metamodel Classes
A unique metadata class identifies what type of metadata a model set contains.
XML Schema
You can use the XML schema provided with this product to view metadata descriptions.
An XML schema is a document or a set of documents that defines the XML file's structure
and legal elements. XML schemas can be used to ensure that an XML file is syntactically cor-
rect and conforms to the defined schema. erwin DM provides such a schema and uses the
schema to validate XML files when they are opened in the tool.
The erwin DM installation places the complete set of XML schema files necessary for an XML
file validation into the \Doc directory. The schema files have .xsd extensions and are
described in the following list:
erwinSchema.xsd is the top level schema file.
UDP.xsd is the schema file for UDP definitions.
EMX.xsd is the schema file for object hierarchy.
EM2.xsd is the schema file for non-transactional data.
EMXProps.xsd is the schema file for object properties and UDP instances.
XML schemas contain descriptions of model object and property classes and define property
containment by object classes. Schema definitions for EMX and EM2 classes are provided.
XML schemas do not include deprecated classes.
The following diagram illustrates the five erwin DM XML schema files:
The schema files under the \Doc directory are not database-specific and represent the
entire erwin DM metamodel. The schema contains all possible objects and properties for all
valid database targets. If you need database-specific schema, those files are located in the
Doc\DBMS_schemas directory. Within the Doc\DBMS_schemas directory, there is a folder
for each supported target database. The database-specific schema files are stored in that
folder and only consist of objects and properties that are valid for the given database target.
The XML schema that is in the \Doc directory is always used by erwin DM to
validate an XML file; the database-specific schema is not used. The database-
specific schemas are provided for documentation purposes and to assist
third-party tool integrators to determine the valid objects and properties for
a given database target. An external XML validation tool can be used to val-
idate an XML file against a database-specific schema.