Invokes the EDMexpressXCompiler to compile an EDMruleSchema. The rule schema will be checked for syntactical and consistency errors. Optionally the result of the compilation will be stored as an increment to the appropriate dictionary model in the EDMdatabase.
Only rule schemas that are compiled without any errors will be stored in the belonging dictionary model. This default behavior can be overruled by an option in the <options> argument. See below for details.
A rule schema defines any business rules to an existing Express schema. Such business rules are defined as Where rules to entities and defined types and as global rules. This belonging Express schema must exist as a dictionary model in the EDMdatabase before this operation can be successfully performed.
There can be any number of rule schemas for each dictionary model (Express schema). The name of a rule schema must be unique within all rule schemas to the same dictionary model.
Each rule schema is independent, i.e., a rule schema can be deleted at any time independent of any other rule schema, query schema or data models.
When the belonging dictionary model is deleted, then all belonging rule schemas will be deleted as well.
Related functions: edmiDeleteRuleSchema , edmiGetRuleSchema , edmiValidateGlobalRule , edmiValidateGlobalRuleBN , edmiValidateInstance , edmiValidateInstanceType , edmiValidateInstanceTypeBN , edmiValidateModel , edmiValidateModelBN , edmiValidateWhereRule , edmiValidateWhereRuleBN , edmiDefineExpressionsLog
Header:
#include "sdai.h"
Prototype:
EdmiError edmiDefineRuleSchema(SdaiString ruleSchemaFile,
SdaiString diagnosticFile,
SdaiInteger options,
SdaiInteger *nWarnings,
SdaiInteger *nErrors);
Arguments:
ruleSchemaFile |
Specifies the name of one or more files, each containing one or more EDMruleSchema. If more than one file is specified, delimit each file name with a comma. The wild card symbol "*" is also a permitted character in a filename. The default file extension is ".rex". |
diagnosticFile |
Specifies the file name for diagnostic information generated by the EDMexpressXCompiler during this operation. 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 current EDMexpressXCompiler options. The <options> value should be specified as a bitwise OR of the EDMexpressXCompiler options to enable. See descriptions below for more details. |
nWarnings |
Address of a variable that receives the number of warnings detected by the EDMexpressXCompiler during operation. |
nErrors |
Address of a variable that receives the number of errors detected by the EDMexpressXCompiler during operation. |
Option Description
DELETING_EXISTING_SCHEMAS |
If an EDMruleSchema with the same name for the same dictionary model, already exists in the EDMdatabase, this existing query schema will be deleted and replaced by the actual compiled version. |
PARSE_ONLY |
Specifies that the EDMruleSchema will be checked for syntax errors only. No update of the related dictionary model will be done. |
NO_DICTIONARY_MODEL |
Enforces the EDMexpressXCompiler to update the belonging dictionary model even though errors are detected during compilation time. |
CONTINUE_STORING_ON_ERROR |
Enforces the EDMexpressXCompiler to update the belonging dictionary model even though errors are detected during compilation time. |
HTML_ERROR_LISTING |
Specifies that compilation diagnostics will be written in HTML format on files in the directory defined by the system variable EDMS_TMP_DIR. The diagnostic report is ready to be displayed by an Internet browser. There are three or four HTML diagnostic files with the following names: |
MakeExpressXlongForm |
Create EXPRESSX long form |
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;
SdaiInteger nWarnings, nErrors;
. . .
if (rstat = edmiDefineRuleSchema (
"/usr/hkd/queries/product_document.rex",
"usr/hkd/queries/query.diag",
DELETING_EXISTING_SCHEMAS,
&nWarnings,
&nErrors)) {
/* Error in operation */
printf("\nError in edmiDefineRuleSchema: %s\n",
edmiGetErrorText(rstat));
goto error;
}
printf("\nWarnings during compilation: %ld", nWarnings);
printf("\nErrors during compilation..: %ld", nErrors);
. . .