This function invokes the EDMmodelChecker to validate all instances in the specified data model against the rules and constraints specified in the <options> argument.
The result of the validation can be a text report, a population of the Express schema EDM_Validation_Result_Schema or both. A population of the EDM_Validation_Result_Schema enables the caller to make his own diagnostic report in his own format.
There exist two options that will influence the amount of information in the validation report produced by this function: NO_PRINT_OUTPUT and FULL_OUTPUT
A standard validation report will be produced when none of these options are set in the <options> argument. A validation report with all available detailed information is produced when the FULL_OUTPUT option is set. No validation report will be produced when the NO_PRINT_OUTPUT option is enabled. The validation result would then normally be in a population of the EDM_Validation_Result_Schema.
When validating data model against rules specified in an EDMruleSchema, only he following validation options are effective: FULL_VALIDATION, GLOBAL_RULES, LOCAL_RULES, UNIQUENESS_RULES. FULL_VALIDATION means in this context: GLOBAL_RULES | LOCAL_RULES | UNIQUENESS_RULES .
This operation is the same as the edmiValidateModelBN except that the actual application can supply arguments to the validation process, hence making the validation process parameterized. The validation process can return additional information to the application through the <returnValue> argument.
This function is only applicable to data models.
The data model that holds the instance to validate must be open before this operation can be successfully performed.
The expressions logging can be used to log (trace) the execution of the validation process in the EDMexpressVM. The EDMsupervisor and the interactive EDMdebugger can be used for testing and debugging the rules as well as getting detailed information of a validation process.
Related functions: edmiValidateModel, edmiValidateModelBN, edmiValidateModelWithParameters, edmiValidateInstanceType , edmiValidateInstanceTypeBN , edmiValidateInstanceTypeWithParameters, edmiValidateInstanceTypeWithParametersBN, edmiValidateInstance , edmiValidateInstanceWithParameters, edmiValidateGlobalRule , edmiValidateGlobalRuleBN , edmiValidateGlobalRuleWithParameters, edmiValidateGlobalRuleWithParametersBN, edmiValidateWhereRule , edmiValidateWhereRuleBN, edmiValidateWhereRuleWithParameters, edmiValidateWhereRuleWithParametersBN
Header:
#include "sdai.h"
Prototype:
EdmiError edmiValidateModelWithParametersBN(SdaiRepository repositoryId,
SdaiString modelName,
SdaiString diagnosticFile,
SdaiInteger options,
SdaiString ruleSchemaName,
SdaiString userOutputFile,
SdaiInstance *validationErrorId,
SdaiPrimitiveType *returnValueDatatype,
void *returnValue,
SdaiInteger numberOfParameters,
/* For each user parameter: [SdaiPrimitiveType parameterDataType, parameterValue] */
... );
Arguments:
repositoryId |
A numeric repositoryID that uniquely identifies the repository in the EDMdatabase that holds the model of interest. |
modelName |
Specifies the name of the data model to validate. Model names are case sensitive. The combination of the arguments <repository> and <modelName> uniquely identifies a model in the EDMdatabase. |
diagnosticFile |
Specifies the file name for diagnostic information generated by this function. If no file name is supplied, i.e. the <diagnosticFile> argument is set to NULL, all diagnostic information will be written to the EDMinterface current output device. The EDMinterface current output device can be defined by the edmiDefineOutputFunction operation. |
options |
Specifies the enabled options used by the EDMmodelChecker in the current invocation. The <options> value is specified as a bitwise OR between the enabled options. All option names are defined in the header file sdai.h . |
ruleSchemaName |
Specifies the name of the EDMruleSchema to use in the validation operation. Rule schema names are case insensitive. |
userOutputFile |
Specifies the name of a file that will be used to receive the result of executing the xpxPrintf and xpxOutputValue function during the validation operation. The specified file can be an existing file or the name of a file that will be created by the EDMmodelChecker. The default file extension is ".txt". |
validationErrorId |
The address of a variable of type SdaiInstance that will receive a numeric instanceID that uniquely identifies an instance of type validation_error in a population of the EDM_Validation_Result_Schema that contains all details of the violations detected in the last invocation of the EDMmodelChecker. |
returnValueDatatype |
Address of a variable of type SdaiPrimitiveType that is used both as an input argument and an output argument: |
returnValue |
Address of variable that will receive the value from the actual validation process. The actual value must be specified by invoking the xpxReturnValueToCaller procedure in the validation process in the EDMexpressVM |
numberOfUserParameters |
Specifies the number of parameters supplied in the actual invocation of the operation. |
parameterDataType |
The datatype of the actual parameter value specified as a SdaiPrimitiveType value. |
parameterValue |
Actual parameter value. |
Option Description
FULL_VALIDATION |
Specifies that the actual data model will be validated against all rules and constrains that are defined in the appropriate dictionary model (Express schema) or optionally defined in the EDMruleSchema specified in the <ruleSchemaName> argument. |
LOCAL_RULES |
UNIQUENESS_RULES |
GLOBAL_RULES |
Specifies that the specified data model will be validated against all global rules defined in the appropriate dictionary model (Express schema) or defined in the specified EDMruleSchema. |
||
LOCAL_RULES |
Specifies that the specified data model will be validated against all local rules (Where rules) defined in the appropriate dictionary model (Express schema) or defined in the specified EDMruleSchema. |
||
INVERSE_RULES |
Specifies that the specified data model will be validated against all Inverse constraints defined in the appropriate dictionary model (Express schema). |
||
UNIQUENESS_RULES |
Specifies that the specified data model will be validated against all uniqueness rules defined in the appropriate dictionary model (Express schema) or defined in the specified EDMruleSchema. |
||
REQUIRED_ATTRIBUTES |
Specifies that all mandatory attributes, i.e., all Explicit attributes that is not declared as OPTIONAL will be checked for an assigned value, i.e., checked that the attribute values are set. |
||
ATTRIBUTE_DATA_TYPE |
Specifies that all attribute values in the specified data model will be checked for legal data type. |
||
AGGREGATE_DATA_TYPE |
Specifies that all element values in all aggregates in the specified data model will be checked for legal data type. |
||
AGGREGATE_SIZE |
Specifies that the number of elements in all aggregates in the specified data model are according to the related aggregate declarations. |
||
ARRAY_REQUIRED_ELEMENTS |
Specifies that all elements in arrays in the specified data model, that are not declared as OPTIONAL, will be checked for an assigned value, i.e., checked that no unset elements exists. |
||
AGGREGATE_UNIQUENESS |
Specifies that all aggregates in the specified data model will be validated for uniqueness violation. Aggregates that have an uniqueness constraint are all SET aggregates, and ARRAY and LIST aggregates that are declared with the optional keyword UNIQUE. |
||
OUTPUT_STEPID |
Specifies that the stepID corresponding to the instanceID will be written to the validation report when the actual correspondence exists in a STEP Identifier model. |
||
FULL_OUTPUT |
Specifies that all available information about the source of the errors will be recorded in the diagnostic report from this command. |
||
STOP_ON_FIRST_ERROR |
Specifies that the validation process should terminate when the first error is detected. |
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;
SdaiRuleSchema ruleSchemaId;
SdaiRepository repositoryId;
SdaiInstance validationErrorId;
SdaiAggr errorsId, warningsId;
SdaiInteger errors, warnings;
SdaiAppInstance returnedInstance;
. . .
if (rstat = edmiValidateModelWithParametersBN(
repositoryId,
"Building_AZX09857YTR_32",
"/usr/hkd/ifc/data/validation_result.text",
FULL_VALIDATION | UNSET_DERIVE_ATTRIBUTES |
FULL_OUTPUT,
0,
"/usr/hkd/ifc/data/validation_print.text",
&validationErrorId,
sdaiINSTANCE,
(void *) &returnedInstance,
2,
sdaiSTRING, "NORWEGIAN_RULES",
sdaiINTEGER, 9900487)) {
/* Error in operation */
printf("\nError: %s in edmiValidateModelWithParametersBN\n",
edmiGetErrorText(rstat));
goto error;
}
printf("\nReturned instance from edmiValidateModelWithParametersBN: %lu",
returnedInstance);
/* Test for errors and warnings during validation operation */
sdaiGetAttrsBN(validationErrorId, 2, "Errors" , sdaiAGGR, &errorsId,
"Warnings", sdaiAggr, &warningsId);
if (errorsId) {
errors = sdaiGetMemberCount(errorsId); /* errors = number of errors */
. . .
}
if (waningsId) {
warnings = sdaiGetMemberCount(waningsId); /* Get number of warnings */
. . .
}
. . .