EDMmethods and Examples

EDMmethods are executable methods that are written in EDMexpressX and wrapped in one of the  three basic Express Data Manager application schemata types, EDMruleSchema, EDMquerySchema and EDMmappingSchema

The major advantage with programming functionality with EDMexpressX in EDMmethods is that these methods will be compiled into the EDMdatabase as extensions to the underlying EXPRESS Schema used for your populations. Above all, this give increased performance.

EDMmethods are compiled with the EDMexpressXcompiler, which is not available with any of the EDMsdk Basic products. However, they are executed by the EDMexpressVM which is available with all EDMsdk products. Hence, if you need to write your own EDMmethods and have them compiled, you will need to upgrade your EDMsdk Basic to EDMsdk Advanced. But since EDMexpressVM is available in EDMsdk Basic, you may still execute EDMmethods as long as they have been compiled by others and installed in the EDMdatabase.

Anything that may be written in EDMexpressX and implemented as an EDMmethods may also be implemented by using any of the ordinary EDMInterface language bindings, but this approach may, if not done correctly, involve a significant performance catch. The transaction oriented stateless nature of the EDMremoteInterface, used for communicating with an EDMsixServer, wraps each remote function call into a separate transaction. Calls to compiled EDMmethods are handled as single transactions. Hence, tasks that would require numerous invocations of EDMremoteInterface API functions, require only a single invocation of the EDMremoteInterface if implemented as EDMmethods. This reduces the execution overhead, improves performance and simplifies transaction handling drastically.

An other advantage with EDMmethods is that the various EDMusers and EDMgroups may be granted access to them individually. This makes it possible to install EDMmethods in the EDMdatabase that will be available for any member of the HVAC group, but that will not even be visible to members of the ARCHITECT group. Hence, an EDMmodelServer administrator achieves full control over who is allowed to do what with the populations.

The EDMmodelServer administrator decides which EDMmethods to install on his EDMmodelServer, who is allowed to invoke these methods and also, by installing certified EDMmethods, he ensures that the actions taken by these EDMmethods are correct and with high quality standards.

Execution of an EDMMapMethod

An EDMexpressX specification consists of one mapping schema defined in the EDMexpressX language. This mapping schema defines how the source data set should be converted to the specified target data set. These data sets are called the Source Model and the Target Model respectively. The structures of the Source Model and the Target Model are defined in the EXPRESS language in the Source Schema and in the Target Schema respectively. Normally the Source Schema and the Target Schema are different schemata. A legal special case is when the source and target schemas are the same.


When the EDMmodelConverter process an EDMexpressX mapping schema the sequence of execution will be as follows:
All global identifiers will be initialized. This includes the creation of persistent instances in the target model when the GLOBAL declaration contains identifier of an instance type that is initialized by an entity constructor.
All MAP, COMPOSE. And STATEMENTS declarations will be executed in exactly the same order as they occurs in the mapping schema.


Expression Logging with EDMmethods

The EDMvirtualMachine executes the EDMexpressX statements within the EDMmethods. The EDMvirtualMachine has an expression logging feature that allows detailed tracing of the execution of the EDMexpressX statements within the EDMmethods.

Do not use expression logging unless you are debugging the execution of your EDMmethods. Expression Logging not only generates huge amounts of data. It is also a performance killer.

For EDMmethods, the expression log will be written to a file which name must be specified as input parameter to the EDMmethod. The tracing level may be specified by a a set of options. The logging options makes it possible to be very specific on which expressions to log, but for EDMmethods, the following are normally what is needed.

Option

Description

LOG_WARNINGS

Log warnings from EDMvirtualMachine when executing the EXPRESS-X statements. Use this option when a full log is not required

LOG_ERRORS

Log errors from EDMvirtualMachine when executing the EXPRESS-X statements. Use this option when a full log is not required

LOG_AGGREGATE_CONTENTS

The only option that is not implicitly set by specifyingFULL_LOG. It has to be set separately because the iterating over aggregates may produce great amounts of tracing data

FULL_LOG

Activates all logging options except theLOG_AGGREGATE_CONTENTS

Logging Samples

This samples shows how to specify EDMvirtualMachine expression logging with the EDMremoteInterface C API.

Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_icon_C(30px)'.

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

Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_icon_C(30px)'.

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

Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'US:_icon_C(30px)'.

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

Handling EDMmethod Error Conditions

When executing an EDMmethod from an EDMInterface language binding, error conditions may occur in three different levels;

  • EDMInterface error conditions
  • EDMmethod error conditions
  • EDMvirtualMachine error conditions

To check if the execution of an EDMmethod from an EDMInterface language binding was successful, all three error condition levels must be checked. The table below explains the difference between the error levels and what may cause each of them

Error Level

Description

EDMInterface

EDMInterface errors. Errors at this level occur when there is a problem with executing of the EDMmethod. Such problems could be that the method specified is not found in the EDMdatabase or your login user does not have access to executing the EDMmethod.

EDMmethodEDMmethod errors are conditions that are legal but still considered illegal by the EDMmethod. Such conditions could be if one of the input parameters to the EDMmethod is out of range or the EDMmethod evaluates a population and conclude that it is not consistent.
EDMvirtualMachineEDMvirtualMachine errors are error conditions that are discovered at the lowest EDMmethod execution level. Such errors could be due to trying to read a string into a number attribute. To thoroughly investigate the underlying cause of an EDMvirtualMachine error condition, you may need to use EDMvirtualMachine Expression Logging to generate a detailed report.

Error Handling Samples

This samples shows how to check for errors in all three levels with EDMremoteInterface C API.