Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagecpp
themeConfluence
EdmiError edmiRemoteValidateGlobalRule (SdaiServerContext  serverContextId, 
                                         SdaiString         remoteRepositoryName, 
                                         SdaiString         remoteMmodelName, 
                                         SdaiString         remoteGlobalRuleName, 
                                         SdaiInteger        nFileMappings, 
                                         SdaiFileMapping    fileMapping[], 
                                         SdaiInteger        options,
                                         SdaiString         remoteRuleSchemaName, 
                                         SdaiLogDescription logDescription, 
                                         SdaiInteger        numberOfParameters,
                                         SdaiSelect         parameters[],
                                         SdaiSelect         userReturnedValue,
                                         SdaiLogical        *result,
                                         SdaiInvocationId   *edmiInvocationId);


Invokes the EDMmodelChecker to validate a data model against a specified global rule in a remote EDMdatabase

...

. The global rule must be defined within the dictionary model of the data model to validate. It may be defined in the data models underlying Express Schema or in any EDMruleSchema that has been compiled to extend the data models dictionary model.

...

  The expressions logging can be used to trace the execution of the global rule in the EDMexpressVM

...

. The EDMsupervisor

...

and the interactive EDMdebugger

...

may be used for testing and debugging global rules as well as for getting detailed information from the validation process.

...

Arguments

...

TypeNameComment
SdaiServerContext

serverContextId

Context identification, from edmiDefineServerContext

SdaiString

remoteRepositoryName

The name of the repository in the remote _remote  EDMdatabase _ that contains the model to be validated. Repository names are case sensitive.

SdaiString

remoteMmodelName

The name of the remote model to be validated. Model names are case sensitive. The combination of the <remoteRepositoryName> and <remoteModelName> arguments uniquely identifies a model in a remote _EDMdatabase{_}remote  EDMdatabase .

SdaiString

remoteGlobalRuleName

The remote global rule to validate. Global rule names are case insensitive.

SdaiInteger

nFileMappings

Currently not used.

SdaiFileMapping

fileMapping

Currently not used.

SdaiInteger

options

Currently not used.

SdaiString

remoteRuleSchemaName

The name of the Rule Schema in which the global rule is defined. Rule Schema names are case insensitive and unique within the scope of an Express Schema.

SdaiLogDescription

logDescription

An SdaiLogDescription structure containing the specifications for the logging of the validation process.

SdaiInteger

numberOfParameters

The number of parameters in the <parameters> argument.

SdaiSelect

parameters

Buffer of pointers to locally allocated tSdaiSelect structures. Each tSdaiSelect structure defines the type and value of an input parameter to the validation process.

SdaiSelect

userReturnedValue

Pointer to a locally allocated tSdaiSelect structure that may be used by the global rule to communicate a user defined status with the calling application.

SdaiLogical

result

An SdaiLogical variable that will receive the result of the global rule validation. The returned logical values means;
sdaiTRUE: No global rules were violated.
sdaiFALSE: One or more global rules were violated
sdaiUNKNOWN: Undetermined status due to unset values or error in operation.

SdaiInvocationId

edmiInvocationId

Currently not used.

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:
/*
 

...

Insert excerpt
US:_r_EDMInterface
US:_r_EDMInterface
nopaneltrue

 

Options

...

  

 

Example

...

 

Code Block
languagecpp
 /*
 - --------------------------------------

...

 
 - File: c:/data/furniture.

...

exp 
 - --------------------------------------

...

 
 SCHEMA Furniture;

...

 
 TYPE tScrewType = ENUMERATION OF (PHILIPS, ALLEN, FLAT); END_TYPE;

...

 
 ENTITY Screw;

...

 
 Id : STRING;

...

 
 Typ : tScrewType;

...

 
 Len : REAL;

...

 
 Dia : REAL;

...

 
 END_ENTITY;

...

 
 ENTITY Dining_Table;

...

 
 Name : STRING;

...

 
 Legs : INTEGER;

...

 
 Len : REAL;

...

 
 Width : REAL;

...

 
 Height : REAL;

...

 
 Screws : BAG OF Screw;

...

 
 END_ENTITY;

...

 
 END_SCHEMA;

...

 
  
 - --------------------------------------

...

 
 - File: c:/data/furniture_rule.rex.

...

 
 - --------------------------------------

...

 
 RULE_SCHEMA Furniture_Rule FOR Furniture;

...

 
  
 - GLOBAL RULE: 
 - At least N tables in stock, where N 
 - is an input parameter to the rule. 
 RULE globalRule FOR (Dining_Table);

...

 
 LOCAL 
 nTables : INTEGER; 
 END_LOCAL;

...

 
 xpxGetUserParameter(1, nTables);

...

 
 WHERE 
 w_nTables : SIZEOF(Dining_Table) > nTables;

...

 
 END_RULE;

...

 
  
 - LOCAL RULE: 
 - A dining table must have 4 legs 
 ENTITY Dining_Table; 
 WHERE 
 w_nLegs : Legs = 4; 
 END_ENTITY; 
  
 END_RULE_SCHEMA;

...

 
 */

...


  
 EdmiError rstat, error;

...


 SdaiInteger nErr, nWrn;

...


 SdaiServerContext myContext;

...


 SdaiRuleSchema rexSchemaId;

...


 tSdaiSelect sel[2];

...


 SdaiSelect param[1] = {&sel[0]};

...


 SdaiSelect retVal = &sel[1];

...


 SdaiLogical result;

...


 tSdaiLogDescription logDescr = {

...


 FULL_LOG | LOG_TO_FILE,

...

  
 NULL, NULL,

...

 
 "c:/temp/globalRule.dia",

...

 
 "c:/temp/globalRule.out",

...

 
 104857600 };

...

 
  
 /* Define Remote Server Context */

...


 rstat = edmiDefineServerContext("MyRemoteServerContext",

...


 "Johnny", "Supervisor", "cf37ftr",

...

 
 "TCP", "9090", "MyServerHost",

...

 
 NULL, NULL, NULL, NULL, NULL, &myContext);

...

 
  
 /* Compile the Express Schema */

...


 rstat = edmiRemoteDefineSchema(myContext, EXPRESS_SCHEMA_TYPE,

...


 "c:/data/furniture.exp", "c:/temp/furniture.dia",

...

  
 "Furniture", 0, &nWrn, &nErr, NULL);

...

 
  
 /* Compile the Rule Schema */

...


 rstat = edmiRemoteDefineSchema(myContext, RULE_SCHEMA_TYPE,

...


 "c:/data/furniture_rule.rex", "c:/temp/furniture_rule.dia",

...

 
 "Furniture_Rule", 0, &nWrn, &nErr, NULL);

...

 
  
 /* Import the product catalogue from a

...

 p21 file 
 into the model Products in the DataRepository */ 
 rstat = edmiRemoteReadStepFile(myContext, "DataRepository",

...

  
 "Products", NULL, NULL, "c:/data/furniture.stp",

...

 
 "c:/temp/furniture.stp.dia", "Furniture", NULL,

...

 
 0, &nWrn, &nErr, &error, NULL);

...

 
  
 /* Get the Rule Schema Id */

...


 rstat = edmiRemoteGetRuleSchema(myContext, "Furniture",

...


 "Furniture_Rule", &rexSchemaId, NULL);

...

 
 printf("\nRule Schema Id = %d", rexSchemaId);

...


  
 /* Validate the globalRule */

...


 /* At least 5 dining tables */

...


 param[0]->nTypes = 0;

...


 param[0]->type = sdaiINTEGER;

...


 param[0]->typeList = NULL;

...


 param[0]->value.intVal = 5;

...


 rstat = edmiRemoteValidateGlobalRule(myContext, "DataRepository",

...


 "Products", "globalRule", 0, NULL, LOG_TO_FILE,

...

 
 "Furniture_Rule", &logDescr, 1, param, retVal,

...

 
 &result, NULL);

...

  
  
 /* Check the validation result */

...


 switch(result) {

...


 case sdaiFALSE:

...

  
 printf("\nError: To few dining tables in the stock");

...

 
 break;

...

 
 case sdaiUNKNOWN:

...

 
 printf("\nError: Undetermined status");

...

 
 break;

...

 
 case sdaiTRUE:

...

 
 printf("\nThe stock is rule compliant");

...

 
 break;

...

 
 }
 . . .

 

See also

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "model" and parent = "6062220"