Semantic Rules |
A semantic rule is a conditional statement that dynamically controls the value or usage of the following objects in a transaction set (ASC/X12) or message (UN/EDIFACT):
Semantic rules are present in implementation guidelines that allow the properties of these objects to change using the following methods:
Dynamically Setting a User Requirement for the Semantic Object
All data segments, composite elements, and data elements in the transaction set/message have requirement designators indicating the required presence of the object. These are generic properties specified by the published standard which are: mandatory, optional, conditional or relational. However, an implementation guideline shared among trading partners, industries, etc. can extend further the following custom requirements to specify the usage of objects according to their needs:
For example, the statement
Segment CTP at 090 is Not Used
means that regardless what the published requirement designation is for data segment CTP090, it must not be present in the EDI document for trading partners sharing the same implementation guideline. By using semantic rules, the usage of an object can be changed based on the presence of data or other objects in the same transaction set/message. For example, a semantic rule can change the previous example statement to
If element 309 in segment TAX at 070 is equal to M then segment CTP at 090 must be used
This means that if the
data element 309 at TAX070 has a value "M" then the data segment
CTP090 must be present; otherwise if the value is not "M" the data
segment CTP090 must not be present. If it so happens that data element
309 at TAX070 does not have a value "M" but the data segment
CTP090 is present anyway, then this is a situational error whereby it was
caused by not meeting a certain condition.
Dynamically Allow the Data Element to Reference a Value List
If the
condition of the semantic rule is satisfied then the value of a data element
can be constrained to a set of values called a value list. A value
list can also contain a regular expression that defines a pattern a value is
suppose to follow.
If the
condition of the semantic rule is satisfied then the value of a data element
can be constrained to a set of code values called a code set. Multiple
code sets can be defined for a data element each defining a set of values
that the data element can hold. If the code set specify a location in
a transaction set/message or dictionary where the code set can only be used,
it is said to be attached. Semantic rules can only reference code sets
that are not attached.
If the condition of the semantic rule is satisfied then execute a method in an ActiveX/COM component. The syntax of the method must follow the syntax:
- <return value> = <interface>.<method name>([<string parameter>])
- Where:
- Return value is a numeric value indicating the success or failure of the operation. The client is notified of this value in the EventNotifyInfo with event constant Event_Info_External_Operation_Result.
- Interface is the ActiveX/COM interface identified by the program identifier.
- Method name is the name of the method to execute.
- String parameter is an optional parameter to pass to the method.
In Framework EDI (FREDI), semantic rules are not programmed into the client code, but are specified in the implementation guideline file that follows the Standard Exchange Format (SEF) standard. (See .SEMREFS for complete syntax definition of semantic rules in a SEF file).
See Also