Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


 
Invokes the EDMmodelConverter to convert one or more existing data models (source models) in the EDMdatabase. The result of the conversion will normally be a new data model (target model) in the EDMdatabase. Optionally the result of this operation can be added to an existing data model.
This operation can be used for model merging, i.e., merge more models to a new model or add the merge result to an existing model.
This function is similar to the edmiConvertModelsBN function, except that a possibility exists for the client application to supply a certain number of parameters to the conversion process to make the Express-X schema parameterized. From the conversion process the number of parameters is obtained by a call to the xpxGetNumberOfUserParameters function, and each of the parameters is obtained by a call to the xpxGetUserParameter function.
The underlying schema of the target model (target schema) must exist as a dictionary model in the EDMdatabase before the EDMmodelConverter is invoked by this function. Likewise the Express-X schema that defines the conversion process must exist as an Express-X dictionary model before this function can be successfully executed.
The function edmiDefineSchema can be used to create a dictionary model of an Express schema in the EDMdatabase and the function edmiDefineSchemaMap can be used to create an Express-X dictionary model in the EDMdatabase.
The source model will be unchanged when the conversion process is terminated.
The EDMmodelConverter is utilizing the EDMexpressVM to perform the conversion process. To facilitate debugging of the conversion process, many options to trace the conversion process and to log events during the conversion process have been included.
Express-X can be used as a programming language for creating, manipulating, and deleting data in any data model in the EDMdatabase that can be accessed by the caller, hence the specified Express-X schema can be successfully interpreted without creating in a new data model.
An optional filter controls the logging of the conversion process. This filter is defined by the <declarationsToLog>, <sourceLinesToLog> and <options> arguments. The filter defines the following:

  1. What should be logged
  2. Which part of the Express-X schema should be logged

It is normally important to specify an appropriate logging filter to avoid the log output to fill up your disk. 
Related functions: edmiDefineSchema ,edmiDefineSchemaMap, edmiConvertModelBN, edmiConvertModelsBN
Header:
#include "sdai.h"
Prototype:
EdmiError edmiConvertModelsWithParametersBN(SdaiString  sourceModelNames, 
                                             SdaiString  schemaMapName, 
                                             SdaiString  targetModelName, 
                                             SdaiString  declarationsToLog, 
                                             SdaiString  sourceLinesToLog, 
                                             SdaiString  logFile, 
                                             SdaiInteger maxLogFileSize, 
                                             SdaiString  userOutputFile, 
                                             SdaiInteger options, 
                                             SdaiModel   *targetModelId, 
                                             SdaiInteger *userDefinedStatus, 
                                             SdaiInteger *nbWarnings, 
                                             SdaiInteger *nbErrors, 
                                             SdaiInteger numberOfParameters, 
                                               /* One pair of primitive type and value for each of the parameters.
                                             SdaiPrimitiveType parameterDataType, 
                                             parameterValue, 
                                              */
                                               ...); 
Arguments:

sourceModelNames

Specifies the names of the source models in the following format: repositoryName.modelName. Such names are case sensitive. When more than one model names are specified, comma or white space should be used as delimiter between each model name.
The source models can be in an opened or closed state. The calling EDMuser must have at least read access to these models.
The order in which the source models are entered in this argument is significant, as the Express-X schema used will require a certain order to produce the expected results. The source models are mapped to the source schema instances in the same order as the declaration of the source schema instances in the GLOBAL declaration in the Express-X schema.

schemaMapName

Specifies the name of EXPRESS-X schema of interest. This EXPRESS-X schema must exist as an EXPRESS-X dictionary_model in the EDMdatabase. EXPRESS-X schema names are case insensitive. EXPRESS-X schema names are unique in an EDMdatabase.

targetModelName

Specifies the name of the target model to populate with the result from the conversion in the following format: repositoryName.modelName. Such model names are case sensitive.
There are tree states of the target model:

  1. Not existing – the target model will be created and populated.
  2. Existing – dependent of options, the result of the conversion will be added to the existing target model.
  3. Existing – dependent of options, the target model will be deleted and a new target model will be created and populated by the conversion process.
    The model name must start with a letter and the rest of the model name can be any mix of alphanumeric characters and the underscore character. Model names are case sensitive.

declarationsToLog

Specifies the Express-X declarations that should be executed when logging should be performed, I.e., the part of the schema defined in the <sourceLinesToLog> argument will only be logged when those parts are executed on behalf of the declarations specified in the <declarationsToLog> argument.
Legal Express-X declarations are: Map, Compose, Statements and Rule. An Express-X declaration can be specified by the name, i.e., map name, function name, etc., or by the line number in the source schema where the actual construct is declared. The names of the Express-X constructs are case insensitive.
Any number of declarations can be specified. White space and comma can be used as delimiter between each declaration in this argument. The order of the declarations in the input field is insignificant.
This argument and the <sourceLinesToLog> argument specifies that only the parts of the schema defined by these arguments should be logged, otherwise the complete schema would be logged when logging is enabled.
This argument can be set to NULL meaning that the part of the schema defined in the <sourceLinesToLog> argument should always be logged.

sourceLinesToLog

Specifies the Express-X source line intervals that should be logged during the conversion process. A source line interval is specified either as the name of a declaration of type: map, compose, statements, function and procedure, or by a single line number or by the first line number and the last line number separated by the hyphen '-' character. Any number of intervals can be specified, the intervals are separated by a comma. The order of the intervals is not significant.
Example: "10, 20-30, 2000 - 2200, 99, Man2Woman"
This argument and the <declarationsToLog> argument specifies that only the parts of the Express-X schema defined by these arguments should be logged, otherwise the complete schema would be logged when logging is enabled.
This argument can be set to NULL meaning that all part of the schema will be logged.

logFile

Specifies the name of the file that will hold the log information. This file can be an existing file or the name of a file that will be created by the conversion process. Default file extension is ".log".
This argument is only valid when the option [LOG_TO_FILE] is set.

maxLogFileSize

Specifies an integer value that is the maximum number of bytes the specified <logFile> can hold before the <logFile> is closed. Specifying the value 0 (zero) means that no size limit for the <logFile> is defined. This argument is only effective when the <logFile> argument is specified and the [LOG_TO_FILE] option is set.

userOutputFile

Specifies the name of a file that will be used to receive the result of executing the xpxPrintf and xpxOutputValue function in the actual Express-X schema. The specified file can be an existing file or the name of a file that will be created by the EDMmodelConverter. The default file extension is ".txt".
This argument is only effective when the [USER_OUTPUT_TO_FILE] option is set.

options

Specifies the EDMmodelConverter options enabled in the current invocation of the EDMmodelConverter. The <options> value should be defined as a bitwise OR between the options to enable. All the options names are defined in the header file sdai.h .
Default options are enabled when the value of <options> is set to zero.

targetModelId

The address of a variable that will receive the numeric instanceID that uniquely identifies the model (target model) in the EDMdatabase populated by the edmiConvertModelsBN operation.
The edmiConvertModelsBN operation can be successfully performed even though no target model is created during the conversion process.

userDefinedStatus

The address of a variable that will receive a "termination reason" from the actual conversion process. This "termination reason" can be used to communicate the "termination reason" of the actual conversion process to the calling application.
The "termination reason" is set in the Express-X schema by the xpxTerminateMapping function.

nbWarnings

Address of a variable that will receive the number of warnings detected during the conversion/merging of the specified model(s).

nbErrors

Address of a variable that will receive the number of errors detected during the conversion/merging of the specified model(s).

numberOfParameters

Specifies the number of parameters the function supplies to the actual conversion process.

parameterDataType

The data type of the corresponding parameter value. The value of this argument must be one of the following legal data types: sdaiINTEGER, sdaiREAL, sdaiBOOLEAN, sdaiLOGICAL, sdaiSTRING, sdaiBINARY, sdaiENUMERATION, sdaiAGGR, sdaiINSTANCE or sdaiSELECT.

parameterValue

The actual value of the parameter.
The arguments <parameterDataType> and <parameterValue> should be a pair of arguments for each parameter supplied to the conversion process.

Option Description

USER_OUTPUT_TO_FILE

Specifies that the result from the Express-X functions xpxPrintf and xpxOutputValue will be written to the file specified in the <userOutputFile> argument.
When none of the options [USER_OUTPUT_TO_FILE] or [USER_OUTPUT_TO_STDOUT] are set, then the output from these function will be written to the actual <logFile> when defined, else the output from these functions will be written to the EDMinterface current output device.

USER_OUTPUT_TO_STDOUT

Specifies that the result from the Express-X functions xpxPrintf and xpxOutputValue will be written to the EDMinterface current output device.
When none of the options [USER_OUTPUT_TO_FILE] or [USER_OUTPUT_TO_STDOUT] are set, then the output from this function will be written to the actual <logFile> when defined. Otherwise the output will be written to the EDMinterface current output device.

USE_EXISTING_TARGET_MODEL

The created target instances will be added to a model that exists already.

DELETING_EXISTING_MODEL

Delete the target model before operation, if it already exists.

FULL_LOG

Specifies that all logging options except [LOG_AGGREGATE_CONTENTS] should be activated during the conversion process.

LOG_CONDITIONS

Specifies that the evaluation of all logical conditions in the actual Express-X schema should be logged.

LOG_EXPRESSIONS

Specifies that the evaluation of all Express-X expressions should be logged.

LOG_PREDEF_FUNCTIONS

Specifies that the execution of all built-in Express-X functions and procedures should be logged.

LOG_FUNCTIONS

Specifies that the execution of all user defined functions and procedures should be logged.

LOG_ITERATIONS

Specifies that all iterations should be logged.

LOG_INSTANCE_CREATION

Specifies that all instance creation in the conversion process should be logged.

LOG_ASSIGNMENTS

Specifies that the execution of all assignment statements should be logged.

LOG_AGGREGATE_CONTENTS

Specifies that when the actual data type to be recorded is an aggregate, the value of all aggregate elements will be written in the log record, otherwise only the aggregateID would be written to the actual log record.
Note: this option may generate very much log information.

LOG_MAPPING_SCHEMA_ONLY

Log declarations in the mapping schema only, i.e. do not log evaluation of derived attributes in the source and target schemas.

LOG_ERRORS

Specifies that all error events detected in the actual conversion process should be logged.

LOG_WARNINGS

Specifies that all warning events detected in the actual conversion process should be logged.

LOG_TO_FILE

Specifies that the log records should be written to the file specified in the <logFile> argument.
The options [LOG_TO_FILE] and [LOG_TO_STDOUT] can be combined.

LOG_TO_STDOUT

Specifies that the log records should be written to the EDMinterface current output device.
The options [LOG_TO_FILE] and [LOG_TO_STDOUT] can be combined.

 
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0: Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an EDMinterface error code. Use edmiGetErrorText to get the error text corresponding to the error code.
EXAMPLE
EdmiError rstat;
SdaiModel targetModelId;
SdaiInteger userDefinedStatus;
SdaiInteger nbWarnings, nbErrors;
...
if (rstat = edmiConvertModelsWithParametersBN (
"ModelRepository.PDM_AABH9, PDMrepository.PDM_AXX98", 
"PDM2MetaPhase", 
"MetaPhase.MBCF91AH", 
NULL, 
NULL, 
"/usr/hkd/converter/xpx.log", 
0, 
"/usr/ hkd/converter/user_output.txt", 
LOG_TO_FILE | USER_OUTPUT_TO_FILE | LOG_ERRORS | LOG_WARNINGS, 
&targetModelId, 
&userDefinedStatus, 
&nbWarnings, 
&nbErrors, 
2, 
sdaiBOOLEAN, 
sdaiTRUE, 
sdaiSTRING, 
"/usr/hkd/mapping_data.text")) { 
/* Error in operation */ 
printf("\nError in edmiConvertModelsWithParametersBN: %s", 
edmiGetErrorText(rstat)); 
goto error; 
}
...

  • No labels