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 Next »


 
This function invokes the EDMmodelChecker to validate all instances of the specified instance type in the specified data model. Optionally also all instances in the same data model that are subtype instances of the specified instance type will be validated.
The result of the validation can be a text report, a population of the Express schema EDM_Validation_Result_Schema or both. The latter case 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 an instance against rules specified in an EDMruleSchema, only he following validation options are effective: FULL_VALIDATION, GLOBAL_RULES, LOCAL_RULES, and UNIQUENESS_RULES. FULL_VALIDATION means in this context: GLOBAL_RULES | LOCAL_RULES | UNIQUENESS_RULES .
This operation is the same as the edmiValidateInstanceType 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 application instances.
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 :edmiValidateInstanceTypeWithParametersBN, edmiValidateInstanceType, edmiValidateInstanceTypeBN , edmiValidateModel , edmiValidateModelBN , edmiValidateModelWithParameters, edmiValidateModelWithParametersBN, edmiValidateInstance , edmiValidateInstanceWithParameters, edmiValidateGlobalRule , edmiValidateGlobalRuleBN , edmiValidateGlobalRuleWithParameters, edmiValidateGlobalRuleWithParametersBN, edmiValidateWhereRule , edmiValidateWhereRuleBN , edmiValidateWhereRuleWithParameters, edmiValidateWhereRuleWithParametersBN
Header:
#include "sdai.h"
Prototype:
EdmiError edmiValidateInstanceTypeWithParameters(SdaiModel         dataModelId, 
                                                  SdaiEntity        entityId, 
                                                  SdaiString        diagnosticFile, 
                                                  SdaiInteger       options, 
                                                  SdaiRuleSchema    ruleSchemaId, 
                                                  SdaiString        userOutputFile, 
                                                  SdaiInstance      *validationErrorId, 
                                                  SdaiPrimitiveType *returnValueDatatype, 
                                                  void              *returnValue, 
                                                  SdaiInteger       numberOfParameters, 
                                                  /* For each user parameter: [SdaiPrimitiveType parameterDataType, parameterValue] */ 
                                                   ... ); 
Arguments:

dataModelId

A numeric modelID that uniquely identifies the model that holds the instances to be validated.
The modelID is returned from the functions: sdaiCreateModel , sdaiCreateModelBN , sdaiOpenModelBN, edmiGetModel , edmiGetModelBN , sdaiGetInstanceModel

entityId

A numeric entityID that uniquely identifies an entity definition (instance type) in a dictionary model in the EDMdatabase . This entity definition must be defined in the underlying schema of the actual model specified by the <dataModelId> argument.
All instances of the type defined by this entity definition and optionally all instances that is a subtype of this particular instance type, located in the same data model, will be validated.
The entityID is returned by the sdaiGetEntity function.

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.
No diagnostics report will be produced by this function when the NO_PRINT_OUTPUT option is set.

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 .
See detailed descriptions of the available options below.

ruleSchemaId

A numeric ruleSchemaID that uniquely identifies the rule schema instance in the EDMdatabase that defines the rules to be validated in this operation.
The ruleSchemaID can be retrieved by the edmiGetRuleSchema operation.

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".
The output from the xpxPrintf and xpxOutputValue function during the validation process will be written to the EDMinterface current output device when the <userOutputFile> is set to NULL. The EDMinterface current output device can be defined by the edmiDefineOutputFunction operation.

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.
No population of the EDM_Validation_Result_Schema will be produced when the <validationErrorId> argument is NULL on input.

returnValueDataType

Address of a variable of type SdaiPrimitiveType that is used both as an input argument and an output argument:
Input: specifies the expected datatype of the value returned in the <returnValue> argument. The returned value must be type compatible with the datatype specified in the <returnValueDataType> argument.
Output: actual data type of the return value <returnValue>. When no value is returned the <returnValueDatatype> is set to sdaiINDETERMINATE.

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.

numberOfParameters

Specifies the number of parameters supplied in the actual invocation of the operation.
For each parameter the following two arguments must be specified in this order:

parameterDataType

The datatype of the actual parameter value specified as a SdaiPrimitiveType value.

parameterValue

Actual parameter value.

Option Description

SUBTYPES

Specifies that in addition to all the instances of the type specified by the < entityId> argument, all instances in the actual data model that are a subtype of the <entityId> instance type will be validated as well.

FULL_VALIDATION

Specifies that the actual instances will be validated against all rules and constrains that is applicable for this particular instance types.
When the argument <ruleSchemaId> is specified unequal to zero, this options means the following options:
GLOBAL_RULES

LOCAL_RULES

UNIQUENESS_RULES

GLOBAL_RULES

Specifies that all global rules appropriate for the specified instance types will be validated. These global rules are defined in the appropriate dictionary model (Express schema) or defined in the specified EDMruleSchema.

LOCAL_RULES

Specifies that all local rules (Where rules) appropriate for the specified instance types will be validated. These local rules are defined in the appropriate dictionary model (Express schema) or defined in the specified EDMruleSchema.

INVERSE_RULES

Specifies that all Inverse constraints defined for the actual instance types will be validated.
This option is not applicable when the argument <ruleSchemaId> is set unequal zero.

UNIQUENESS_RULES

Specifies that all Uniqueness rules defined for the actual instance will be validated.

REQUIRED_ATTRIBUTES

Specifies that all mandatory attributes, i.e., all explicit attributes that are not declared to be OPTIONAL, of the instance will be checked for an assigned value, i.e., checked that the attribute values are set.
This option is not applicable when the argument <ruleSchemaId> is set unequal zero.

ATTRIBUTE_DATA_TYPE

Specifies that all attribute values of the instance will be checked for legal data type.
This option is not applicable when the argument <ruleSchemaId> is set unequal zero.

AGGREGATE_DATA_TYPE

Specifies that all element values in all aggregates owned by the specified instance will be checked for legal data type.
This option is not applicable when the argument <ruleSchemaId> is set unequal zero.

AGGREGATE_SIZE

Specifies that the number of elements in all aggregates owned by the specified instance is according to the related aggregate declarations.
This option is not applicable when the argument <ruleSchemaId> is set unequal zero.

ARRAY_REQUIRED_ELEMENTS

Specifies that all elements in arrays, that are not declared as OPTIONAL, owned by the instance, will be checked for an assigned value, i.e., checked that no unset elements exists.
This option is not applicable when the argument <ruleSchemaId> is set unequal zero..

AGGREGATE_UNIQUENESS

Specifies that all aggregates owned by the specified instance 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.
This option is not applicable when the argument <ruleSchemaId> is set unequal zero.

UNSET_DERIVE_ATTRIBUTES

Specifies that warnings will be issued if unset derived attributes are found.
This option is not applicable when the argument <ruleSchemaId> is set unequal zero.

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;
SdaiModel dataModelId;
SdaiEntity entityId;
SdaiRuleSchema ruleSchemaId;
SdaiString *returnedText;
. . .
if (rstat = edmiValidateInstanceTypeWithParameters (
dataModelId, 
entityId, 
"/usr/hkd/ifc/data/validation_result.text", 
FULL_VALIDATION | UNSET_DERIVE_ATTRIBUTES | 
FULL_OUTPUT | SUBTYPES, 
ruleSchemaId,
"/usr/hkd/ifc/data/validation_print.text", 
NULL, 
(void *) returnedText, 
sdaiSTRING, 
3, 
sdaiBOOLEAN, sdaiTRUE, 
sdaiSTRING, "any_string", 
sdaiREAL, 12345.6789)) { 
/* Error in operation */ 
printf("\nError: %s in edmiValidateInstanceTypeWithParameters\n", 
edmiGetErrorText(rstat)); 
goto error; 
}
printf("\nReturned text from edmiValidateInstanceTypeWithParameters: %s",
returnedText); 
/* The result of the validation will be in the file
"/usr/hkd/ifc/data/validation_result.text" */ 
. . .

  • No labels