edmiRemoteConvertModelsEx
Â
EdmiError edmiRemoteConvertModelsEx(SdaiServerContext serverContextId, SdaiInteger numberOfSources, SdaiSourceOrTarget sources[], SdaiString remoteSchemaMapName, SdaiInteger numberOfTargets, SdaiSourceOrTarget targets[], SdaiInteger nFileMappings, SdaiFileMapping fileMappings[], SdaiInteger numberOfParameters, SdaiSelect parameters[], SdaiOptions options, SdaiLogDescription logDescription, SdaiExecutionResult executionResult, SdaiSelect extensionsArgs, SdaiInvocationId *edmiInvocationId);
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.
- 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.
- 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
1 | Type | Name | Comment |
2 | Â SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
3 | Â SdaiInteger | numberOfSources | Number of source files in the <sources> argument. |
4 | Â SdaiSourceOrTarget | sources | Buffer of SdaiSourceOrTarget structures defining the source models of the conversion. |
5 | Â SdaiString | 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{_}. |
6 | Â SdaiInteger | numberOfTargets | Number of target files in the <targets> argument. |
7 | Â SdaiSourceOrTarget | targets | Buffer of SdaiSourceOrTarget structures defining the target models of the conversion. |
8 | Â SdaiInteger | nFileMappings | Currently not used. |
9 | Â SdaiFileMapping | fileMapping | Currently not used. |
10 | Â SdaiInteger | numberOfParameters | The number of parameters in the <parameters> argument. |
11 | Â SdaiSelect | parameters | Buffer of pointers to locally allocated tSdaiSelect structures. Each tSdaiSelect structure defines the type and value of an input parameter to the conversion process. |
12 |  SdaiOptions | options | See description of available options below. Options may be joined by using the bitwise OR operator. |
13 | SdaiLogDescription | logDescription | An SdaiLogDescription structure containing the specifications of the logging of the conversion process. |
14 | Â SdaiExecutionResult | executionResult | An SdaiExecutionResult structure that will receive information concerning the execution of the conversion process. |
15 | Â SdaiSelect | extensionsArgs | Currently not used. |
16 | Â SdaiInvocationId | edmiInvocationId | Currently not used. |
Return Value
Â
Options
 Â
Option | Comment |
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. |
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. |
PARAMETERS_IN_XML_STRING | The first and only parameter transferred to the schema map will be interpreted as an XML formatted list of parameters. |
PARAMETERS_IN_XML_FILE | The first and only parameter transferred to the schema map will be interpreted as the name of an XML formatted file on the local file system containing the all the input parameters. |
Â
Example
Â
 EdmiError rstat, error; SdaiServerContext myContext; SdaiInteger nErr, nWrn; /* 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); if (!rstat) { /* Convert the source model to comply with version 2 of mychema. Supply two parameters. One boolean and one integer */ SdaiString _sysOutFile = "c:/temp/myschema_v1_to_v2.dia"; SdaiString _usrOutFile = "c:/temp/myschema_v1_to_v2.out"; SdaiString _srcModel = "MyModel_v1"; SdaiString _tarModel = "MyModel_v2"; SdaiString _repName = "DataRepository"; tSdaiSourceOrTarget _srcTrg[2]; SdaiSourceOrTarget _source[1] = {&_srcTrg[0]}; SdaiSourceOrTarget _target[1] = {&_srcTrg[1]}; tSdaiExecutionResult _exeRes; tSdaiSelect _sel[2]; SdaiSelect _param[2] = {&_sel[0], &_sel[1]}; tSdaiLogDescription _logDescr; _logDescr.loggingOptions = FULL_LOG | LOG_TO_FILE; _logDescr.sourceLinesToLog = NULL; _logDescr.declarationsToLog = NULL; _logDescr.systemOutputFile = _sysOutFile; _logDescr.userOutputFile = _usrOutFile; _logDescr.maxLogFileSize = 104857600; _source[0]->repositoryName = _repName; _source[0]->modelName, "MyModel_v1"; _source[0]->options = REMOTE_MODEL; _target[0]->repositoryName = _repName; _target[0]->modelName, "MyModel_v2"; _target[0]->options = REMOTE_MODEL; _param[0]->nTypes = 0; _param[0]->type = sdaiBOOLEAN; _param[0]->typeList = NULL; _param[0]->value.boolVal = sdaiFALSE; _param[1]->nTypes = 0; _param[1]->type = sdaiINTEGER; _param[1]->typeList = NULL; _param[1]->value.intVal = 128; /* Convert between model versions */ rstat = edmiRemoteConvertModelsEx(myContext, 1, _source, "MYSCHEMA_V1_TO_V2", 1, _target, 0, NULL, 1, _param, DELETING_EXISTING_MODEL, &_logDescr, &_exeRes, NULL, NULL); /* Check execution result from the virtual machine */ printf("\nMyModel_v1 converted with:"); printf("\n %d warnings", _exeRes.nWarnings); printf("\n %d errors", _exeRes.nErrors); printf("\nUser def. status: %d", _exeRes.userDefinedStatus); printf("\nSdai Error Code : %d", _exeRes.sdaiError); /* 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.
Â
Â