edmiRemoteConvertModels


 

 

EdmiError edmiRemoteConvertModels(SdaiServerContext serverContextId,
                                    SdaiString         remoteSourceModelsNames,   
                                    SdaiString         remoteSchemaMapName, 
                                    SdaiString         remoteTargetModelName, 
                                    SdaiString         declarationsToLog, 
                                    SdaiString         sourceLinesToLog, 
                                    SdaiString         logFile, 
                                    SdaiInteger        maxLogFileSize, 
                                    SdaiString         userOutputFile, 
                                    SdaiInteger        nFileMappings, 
                                    SdaiFileMapping    fileMapping[],
                                    SdaiInteger        options, 
                                    SdaiInteger        *userDefinedStatus,
                                    SdaiInteger        *nbWarnings, 
                                    SdaiInteger        *nbErrors,
                                    SdaiInvocationId   *edmiInvocationId, 
                                    SdaiInteger        numberOfParameters, 
                                   /* For each user parameter: [SdaiPrimitiveType parameterDataType, parameterValue] */ 
                                    ...); 


Converts one or more existing data models (source models) in the remote EDMdatabase by invoking the EDMmodelConverter. By default, the result of the conversion will populate a new data model (target model) in the remote EDMdatabase. Optionally the result of this operation may be added to an existing data model, thereby enabling merging of models. The following preconditions must be met before invoking the EDMmodelConverter.

  1. The Target Express Schema, i.e the underlying schema of the target model, must be compiled to generate a dictionary model in the remote EDMdatabase.
  2. The Express-X Mapping Schema that defines the conversion process must be compiled to generate an Express-X dictionary model in the remote EDMdatabase

The function edmiRemoteDefineSchema may be used to create the dictionary models. The source model will not be changed by the conversion process. The EDMmodelConverter uses the EDMexpressVM to perform the conversion process. To facilitate debugging of the conversion, this function offer a broad variety of options for tracing the process and for logging events. Express-X may be used as a programming language for creating, manipulating, and deleting data within data models in the remote EDMdatabase. Hence, Express-X Schema may be successfully executed without creating a target data model. An optional filter controls the logging of the conversion process. This filter is controlled by the arguments <declarationsToLog>, <sourceLinesToLog> and <options>. Together, these three arguments define which events to log in which parts of the Express-X schema. It is suggested that an appropriate logging filter be specified to avoid extensive usage of disk space when logging to file.

Arguments


1TypeNameComment
2 

serverContextId

Context identification, from edmiDefineServerContext

3 

remoteSourceModelsNames

The name of one or more source models. Each model name must be dot-qualified with the name of the repository in which it belongs. In case of multiple source models, the qualified model names must be delimited by commas. Example:
"MyRep.MyMod,YourRep.YourMod,OurRep.OurMod"

4 

remoteSchemaMapName

The name of the Express-X Mapping Schema. This schema must be compiled to generate an Express-X dictionary model in the remote EDMdatabase

5 

remoteTargetModelName

The name of the target model. The model name must be dot-qualified with the name of the repository in which it shall be created or already exists. Example:
"MyRepository.MyTargetModel"

6 

declarationsToLog

The Express-X declarations to log. Valid Express-X declarations are STATEMENT, MAP and COMPOSE. An Express-X declaration may be specified by its name or by its line number within the Express-X Mapping Schema where the construct is declared. The names of Express-X constructs are case insensitive.
Any number of Express-X declarations may be specified. White space or comma must be used as delimiter between each declaration in this argument. The order of the declarations in the input field is insignificant.
If none of the arguments <declarationsToLog> and <sourceLinesToLog> is set, all parts of the Express-X Mapping Schema will be logged.

7 

sourceLinesToLog

The Express-X Mapping Schema source line intervals to log. A source line interval may by specified as;
The name of a declaration of type: MAP, COMPOSE, STATEMENT, FUNCTION and PROCEDURE.
A single line number.
The first and the last line number separated by a hyphen '-'.
Any number of source line intervals may be specified. The intervals must be separated by commas. The order of the intervals is not significant. Example:
"10, 20-30, 200 – 220, 99, Man2Woman"
If the argument <declarationsToLog> is set, logging of the specified line numbers will only happen when the lines listed herein is called from a declaration exquisitely listed in the argument <declarationsToLog>.
If none of the arguments <declarationsToLog> and <sourceLinesToLog> is set, all parts of the Express-X Mapping Schema will be logged.

8 

logFile

The name of the file that will receive the log information. This file may be either an existing or a non-existing file on the local file system. The default file extension is ".log".
This argument has no effect unless combined with the option LOG_TO_FILE.

9 

maxLogFileSize

The maximum allowed size of the <logFile> in bytes. When this size is exceeded, the <logFile> will be closed. A zero value means no file size limitation.
This argument has no effect unless combined with the option LOG_TO_FILE.

10 

userOutputFile

The name of the file that will receive the output from calls to the functions xpxPrintf and xpxOutputValue within the Express-X Mapping Schema. This file may be either an existing or a non-existing file on the local file system. The default file extension is ".txt".
This argument has no effect unless combined with the option USER_OUTPUT_TO_FILE.
If this argument is NULL or an empty string, the output from the functions xpxPrintf and xpxOutputValue will be written to the EDMinterface current output device

11 

nFileMappings

Currently not used.

12 

fileMapping

Currently not used.

13 

options

See description of available options below.
Options may be joined by using the bitwise OR operator.

14 

userDefinedStatus

A variable that will receive a user defined termination status from the conversion process. The termination status may be used to communicate the reason for terminating the conversion process to the calling application.
The termination status may be set within the Express-X Mapping Schema by the xpxTerminateMapping function.

15 

nbWarnings

A variable that will receive the number of warnings encountered during the execution of this function.

16 

nbErrors

A variable that will receive the number of errors encountered during the execution of this function.

17 

edmiInvocationId

Currently not used.

18 

numberOfParameters

The number of parameters that will be supplied to the actual conversion process in the variable argument list of this function. For each parameter, a <parameterDataType> and a <parameterValue> argument must be supplied.

19 

parameterDataType

The data type of the succeeding argument <parameterValue>. This argument may only take one of the following values:
sdaiINTEGER, sdaiREAL, sdaiBOOLEAN, sdaiLOGICAL, sdaiSTRING, sdaiBINARY, sdaiENUMERATION, sdaiAGGR, sdaiINSTANCE or sdaiSELECT.

20 

parameterValue

The value of the parameter.  The arguments <parameterDataType> and <parameterValue> must be supplied in pairs for each of the <numberOfParameters> parameters.

Return Value


Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_r_EDMInterface'.

 

Options


  

OptionComment

DELETING_EXISTING_MODEL

Delete the target model from the remote EDMdatabase, if it already exists.

USE_EXISTING_TARGET_MODEL

Add the target convertion data to an existing data model in the remote EDMdatabase.

LOG_MAPPING_SCHEMA_ONLY

Log the declarations within the mapping schema only. This option will suppress logging of the evaluation of derived attributes in the source and target schemas.

USER_OUTPUT_TO_FILE

The output from the Express-X functions xpxPrintf and xpxOutputValue will be written to the file specified in the <userOutputFile> argument.

USER_OUTPUT_TO_STDOUT

The output from the Express-X functions xpxPrintf and xpxOutputValue will be written to the _EDMinterface_ current output device.

LOG_WARNINGS

Any warning event encountered in the conversion process will be logged.

LOG_AGGREGATE_CONTENTS

The value of all aggregate elements will be written in the log record. If this option is not used, only the aggregateID will be written to the actual log record.
Note: this option may generate huge data log files.

LOG_TO_STDOUT

Log records will be written to the _EDMinterface_ current output device.  The options LOG_TO_FILE and LOG_TO_STDOUT may be combined.

LOG_ASSIGNMENTS

The execution of assignment statements will be logged.

LOG_EXPRESSIONS

The evaluation of all Express-X expressions will be logged.

LOG_INSTANCE_CREATION

Creation of instances within the conversion process will be logged.

LOG_TO_FILE

Log records will be written to the file specified in the <logFile> argument. The options LOG_TO_FILE and LOG_TO_STDOUT may be combined.

LOG_ERRORS

Error events encountered within the conversion process will be logged.

LOG_ITERATIONS

Iterations will be logged.

LOG_FUNCTIONS

The execution of user defined functions and procedures will be logged.

LOG_PREDEF_FUNCTIONS

The execution of built-in Express-X functions and procedures will be logged.

LOG_CONDITIONS

The evaluation of logical expressions in the Express-X Mapping Schema will be logged.

FULL_LOG

Activates all logging options except LOG_AGGREGATE_CONTENTS.

 

Example


 

 EdmiError rstat, error;
 SdaiInteger nErr, nWrn, userStatus;
 SdaiServerContext myContext;
  
 /* Define Remote Server Context */
 rstat = edmiDefineServerContext("MyRemoteServerContext",
 "Johnny", "Supervisor", "cf37ftr", 
 "TCP", "9090", "MyServerHost", 
 NULL, NULL, NULL, NULL, NULL, &myContext); 
  
 /* Compile the Express Source Schema */
 rstat = edmiRemoteDefineSchema(myContext, EXPRESS_SCHEMA_TYPE,
 "c:/data/myschema_v1.exp", "c:/temp/myschema_v1.dia", 
 "MYSCHEMA_V1", DELETING_EXISTING_SCHEMAS, 
 &nWrn, &nErr, NULL); 
  
 /* Compile the Express Target Schema */
 rstat = edmiRemoteDefineSchema(myContext, EXPRESS_SCHEMA_TYPE,
 "c:/data/myschema_v2.exp", "c:/temp/myschema_v2.dia", 
 "MYSCHEMA_V2", DELETING_EXISTING_SCHEMAS, 
 &nWrn, &nErr, NULL); 
  
 /* Compile the Express-X Mapping Schema */
 rstat = edmiRemoteDefineSchema(myContext,
 EXPRESS_X_SCHEMA_TYPE, "c:/data/myschema_v1_to_v2.xpx",  
 "c:/temp/myschema_v1_to_v2.dia", "MYSCHEMA_V1_TO_V2",  
 DELETING_EXISTING_SCHEMAS, &nWrn, &nErr, NULL); 
  
 /* Import the source model from p21 file */
 rstat = edmiRemoteReadStepFile(myContext, "DataRepository",
 "MYMODEL_V1", NULL, NULL, "c:/data/MyModel_v1.stp",
 "c:/temp/MyModel_v1.dia", "MYSCHEMA_V1", NULL,
 0, &nWrn, &nErr, &error, NULL); 
  
 /* Convert the source model to comply 
 with version 2 of mychema. Supply 
 two parameters. One boolean and 
 one integer */ 
 rstat = edmiRemoteConvertModels(myContext, "DataRepository.MYMODEL_V1",
 "MYSCHEMA_V1_TO_V2", "DataRepository.MYMODEL_V2", 
 NULL, NULL, "c:/temp/myschema_v1_to_v2.dia", 104857600, 
 "c:/temp/myschema_v1_to_v2.out", 0, NULL, 
 FULL_LOG | LOG_TO_FILE, &userStatus, &nWrn, &nErr, NULL, 2, 
 sdaiBOOLEAN, sdaiTRUE, sdaiINTEGER, 128); 
  
 /* Export the target model to a p21 file */
 rstat = edmiRemoteWriteStepFile(myContext, "DataRepository",
 "MYMODEL_V2", NULL, NULL, "c:/data/MyModel_v2.stp",
 "c:/temp/MyModel_v2.dia", NULL, 0, 6,
 &nWrn, &nErr, &error, NULL); 
 . . .

 

See also

Filter by label

There are no items with the selected labels at this time.