Framework EDI Reference. SEFManager Utility
.SEMREFS Section

This topic:

 

Overview

The .SEMREFS section lists all semantic rules in the SEF file, each showing the semantic object that it is attached to.  The semantic objects can be a data segment, composite element or data element that are used within the context of an ASC/X12 Transaction Set or UN/EDIFACT Message.  The state of these semantic objects can dynamically change depending on how the semantic rule that is attached to the object is satisfied.

For an example in ASC/X12, if the following semantic rule states:

if element 309 in segment TAX at 070 is equal to "M" then segment CTP at 090 must be used

The semantic object that is affected by the semantic rule is clearly "segment CTP at 090".  The semantic object  is attached to the semantic rule and, regardless of what the default state is of the semantic object, if the condition "element 309 in segment TAX at 070 is equal to M" is satisfied then the semantic object "segment CTP at 090" inherits the state "must be used".

In the .SEMREFS section, the semantic rule may be represented as follows:

850/8///=[TaxVar'EQ'M:USAGE:0:]

Where:

 

The Semantic Rule Syntax

The syntax of the semantic rule consists of:

  1. A condition clause statement.
  2. An action statement.

The form of the entire semantic rule syntax:

 

The Conditional Clause

The conditional clause is made up of a series of logical statements, the result, if true, would invoke the action statement.   A single logical statement follows the syntax:

logical statement := <Object Variable> <Operator> <Literal Value>

Where:

Using the example above, the following condition of the semantic rule states that the value referenced by the object variable "TaxVar" is equal to the literal value "M".

TaxVar'EQ'M

Where:

 

Multiple Conditional Clause

If multiple logical statements are required in the conditional clause then they are separated by the "&" or "|" boolean type operator for "AND" or "OR" respectively.

<conditional clause> := <logical statement> [ "&" | "|" <conditional clause>]

For example,

TaxVar'EQ'M|CurVar'EQ'U&RefVar'NE'ABC

which means: TaxVar is equal to "M" OR CurVar is equal to "U" AND RefVar is not equal to "ABC".  In a semantic rule, the conditional clause always precedes the action statement.

TaxVar'EQ'M|CurVar'EQ'U&RefVar'NE'ABC:USAGE:0:

 

The Action Statement

The action statement indicates what action to take if the result of the conditional clause is true.  Currently, only the following types of actions are possible:

The program name is the program identifier of the interface and the method name to execute, followed by any parameters.

"COMEXIT" ":" <program name> ":" <parameters>

Example,

COMEXIT:FrediTester.Sample.Test:1,2,3,ABC

Where:

 

Determining the Value

The value of a semantic object is captured by an object variable that is attached to semantic object.  The object variable contains a variable name and the location of the object in the implementation guideline.  The value resolved in the object variable is determined by locating the corresponding object in the document and extracting the data.  This value is then used to compare to the literal value in the conditional expression of the semantic rule.  The value determined for each of the semantic object is as follows:

 

Value Comparisons

When the value in the object variable is compared with the literal value, it either does a string comparison or a numeric comparison.  A string comparison compares the a character in the first value to its corresponding character in the second value in the string starting with the leftmost character.  In a string comparison, the string value "04" is greater than the string value "004".  In a numeric comparison, the numeric value of both string values are compared.  In this case, the value "04" is equal to the value "004".  The inherent nature of data retrieved from the document is always a string, and if a numeric comparison is involved then a string to numeric conversion must takes place.  For a successful numeric conversion, the string must contain only numeric values (0 to 9), but it is possible that a string containing alphabetic character can be involved in the conversion.  If this is the case, starting from the left, a string is converted to a number character by character until a non-numeric character is encountered.  For example, the string "123.1B2" is converted to 123.1; the string "12B3" to 12; the string "B123" to zero; etc.  Note how the alphabet "B" stops the conversion.

The values in the conditional clause are compared depending on the semantic object:

 

Existence and Non-Existence

The semantic rule also tests for the existence or non-existence of a semantic object.  This is the case when the operator "exists" or "does not exist" is present in the conditional clause of the semantic rule.  For example,

if data segment REF04 exists then segment MEA must be used

if data segment SAC07 does not exist then segment FOB is not used

The existence or non-existence of an object is interpreted as follows:

 

See Also