edmiDefineSchema

EdmiError edmiDefineSchema(SdaiString  sourceFile,
                            SdaiString  diagnosticFile, 
                            SdaiString  schemaName, 
                            SdaiInteger options, 
                            SdaiInteger *warnings, 
                            SdaiInteger *errors); 


Invokes the EDMexpressCompiler to compile one or more files, each containing one or more Express schemata. For each input schema an Express syntax check, an Express schema consistency check and a dictionary model creation is available. This is specified through the <options> argument. Both short form and long form notation is fully supported. This function can create and populate a dictionary model for all schemata compiled (default when the <schemaName> argument is empty, i.e. = NULL), or for a specified set of Express Schemata compiled from the specified input file(s). The ISO 10303 Part 22 defines the standard for naming the dictionary models. The name of a dictionary model is equal to the name of the Express Schema with "_DICTIONARY_DATA" appended. The dictionary model names are all in uppercase and is case sensitive. Existing dictionary models can be removed from the database by the edmiDeleteSchema , edmiDeleteModelBN or sdaiDeleteModel function as long as there exist no data models and no associated Express-X dictionary models of the actual dictionary model. All dictionary models are by default write protected, as it is assumed that no dictionary models should be changed. An exception is when using edmiDefineComplexEntity function. Normally only Express schemata that are compiled without any errors can be stored as dictionary models in the EDMdatabase. This default rule can be overruled by enabling the CONTINUE_STORING_ON_ERROR option. This option should be used with care as manipulating data in the EDMdatabase that is defined by an erroneous dictionary model may lead to unpredictable exceptions, including system crash.  Express schemata that contain a lot of implicitly defined complex entities is recommended to be compiled with the NO_COMPLEX_ENTITIES option enabled to avoid filling the actual dictionary model with entity definition instances of unused entity types. The required complex entities should be defined when required by one of the following functions: edmiDefineComplexEntity , sdaiCreateInstance , sdaiCreateInstanceBN , sdaiGetEntity .
This operation is exactly the same operation as the edmiCompileFile function.

Arguments


TypeNameComment
SdaiString

sourceFile

Specifies the name of the file(s) containing Express schema(ta). 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 ".exp".

SdaiString

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.

SdaiString

schemaName

Specifies the name of the Express schema(ta) that will be stored as dictionary models by the current invocation of the EDMexpressCompiler. When the <schemaName> argument is empty, i.e., <schemaName> = NULL, then all compiled schemata will be stored as dictionary models.  If more than one schema name is specified in the <schemaName> argument, then each schema name should be separated by the comma character.

SdaiInteger

options

Specifies the current EDMexpressCompiler options. The <options> value should be specified as a bitwise OR of the EDMexpressCompiler options to enable. See descriptions below for more details. The name of all <options> are defined in the header file sdai.h

SdaiInteger

warnings

The address of a variable that will receive the number of warnings detected by the EDMexpressCompiler in the current invocation.

SdaiInteger

errors

The address of a variable that will receive the number of errors detected by the EDMexpressCompiler in the current invocation.

Return Value


Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_r_EDMInterface'.

 

Options


  

OptionComment

STORING_SOURCE

Specifies that the Express schema(ta) in its original form will be stored in the EDMdatabase. This Express source can later be retrieved and displayed by the EDMsupervisor command Schemata>ShowSchemata.  This option is automatically enabled in the operation independent of being set in the <options> argument or not. Hence the original source schemata will always be stored in the EDMdatabase.

DELETING_EXISTING_SCHEMAS

Specifies that the existing dictionary model(s) with the same name as the resulting dictionary model(s) from this compilation will be replaced by the new dictionary model(s) as long as there are no data models associated with this (these) existing dictionary model(s). Dictionary models with associated data models or associated Express-X dictionary models cannot be deleted before all the associated data models or associated Express-X dictionary models are deleted.

PARSE_ONLY

Specifies that the Express schema(ta) will be checked for syntax errors only. No dictionary models will be created when this option is enabled.

NO_DICTIONARY_MODEL

Specifies that no dictionary models will be created by the current invocation of the edmiDefineSchema operation.

CONTINUE_STORING_ON_ERROR

Enforces the EDMexpressCompiler to create and populate a dictionary model of erroneous schema(ta). Only schema(ta) compiled without any errors can be stored as a dictionary model(s) in the EDMdatabase when this option is unset.
NOTE: This option should be used with care as it may lead to unpredictable consequences, possibly fatal system failure!

LOG_SCHEMA_INTERFACE

Specifies that a log record will be written to the diagnostic report for each Express construct that is interfaced from one schema to another. This log record contains information such as the name of the interfaced construct, if it is explicit or implicit interfaced etc.

SDAI_WARNINGS

Activates EDMinterface/SDAI warnings relevant for the usage of EDMinterface functions on an instantiated data model of the actual schema.

ERRORS_ONLY

Warnings will be suppressed.

DIAGNOSTICS_FOR_LONGFORMS_ONLY

Specifies that only diagnostic related to schemata that will be stored as dictionary models will be written to the diagnostic report. Many errors can be reported when the compilation process implicitly makes a long form schema from short form schemata, i.e., resolves all Express schema interface declarations. These errors may not be relevant for the final dictionary model of the long form schema, hence the setting of this options prevent the issuing of these error messages.

IGNORE_EMPTY_SELECT

Specifies that no error message should be produced when the compiler detects that a SELECT definition with an empty selection list is interfaced from one schema to another.  Express constructions with expressions that refer to the empty select cannot be properly checked when this option is set. This option should never be set when compiling schemata that will be used as the underlying schema for a data model, i.e. no dictionary model should contain empty select.

HTML_ERROR_LISTING

Specifies that compilation diagnostics will be written in HTML 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:

  • On UNIX: s_main.html, s_err.html, s_exp0.html and optionally s_sch.html
  • On Windows: s_main.htm, s_err.htm, s_exp0.htm and optionally s_sch.htm

The file named s_main.htm or s_main.html is the main file, hence this file should be specified to the actual Internet browser when displaying the diagnostic report.

EDM_EXPRESS_EXTENSION

The compiler will accept EDM extensions to Express, currently there is one, namely xpxPrintf (see EDMassist Vol6).

TC2

Parse schema in accordance to Technical Corrigendum no.2

STANDARD_COMPLEX_HANDLING

Only explicit complex entity definitions, i.e. those specified by a SUPERTYPE statement, will be created in the appropriate dictionary model.

FULL_COMPLEX_HANDLING

All explicit and implicit complex entity definitions will be created in the appropriate dictionary model.

NO_COMPLEX_ENTITIES

No complex entity definitions are created in the appropriate dictionary model. This option will overrule the setting of the STANDARD_COMPLEX_HANDLING and the FULL_COMPLEX_HANDLING options. It is advised to use this option in order to allow dynamic definition of complex entities when required at run time.

NO_EXPRESSION_CHECKED

All expressions in the schema(ta) will only be parsed, i.e. only checked for syntactic correctness. This option implicitly sets the NO_EXPRESSION_STORED option as an unchecked expression cannot be stored in a dictionary model. Expressions can be found in the following Express constructs: CONSTANT, DERIVE attributes, AGGREGATE bound specification, WHERE, FUNCTION, PROCEDURE, RULE. Setting this option also set the NO_EXPRESSION_STORED NO_DERIVE_CHECKED, NO_DERIVE_STORED NO_RULE_CHECKED and NO_RULE_STORED options.

NO_EXPRESSION_STORED

None of the expressions described above will be stored in the resulting dictionary model(s).

NO_DERIVE_CHECKED

Specifies that the algorithm defining the value of a DERIVE attribute will only be parsed, i.e., only checked for syntactic correctness. Setting this option also set the NO_DERIVE_STORED option.

NO_DERIVE_STORED

Specifies that the algorithm defining the value of a DERIVE attribute will not be stored in the related dictionary model.

NO_RULE_CHECKED

Specifies that the logical expressions defining a global rule will only be parsed, i.e., only checked for syntactic correctness. Setting this option also set the NO_RULE_STORED option.

NO_RULE_STORED

Specifies that no global rule definitions will be stored in the related dictionary model.

 

Example


 

 SdaiInteger errors, warnings;
 EdmiError rstat;
 ...
 if (rstat = edmiDefineSchema (
 "/usr/users/hkd/AP214.exp", 
 "/usr/users/hkd/AP214.diag", 
 NULL, 
 DELETING_EXISTING_SCHEMAS | NO_COMPLEX_ENTITIES, 
 &warnings, 
 &errors)) { 
 /* Error in operation */ 
 printf("\nError in edmiDefineSchema: %s\n", 
 edmiGetErrorText(rstat)); 
 goto error; 
 }
 printf("\nNumber of warnings: %ld", warnings); 
 printf("\nNumber of errors: %ld", errors); 
 . . . 

 

See also

Filter by label

There are no items with the selected labels at this time.