WSMX

D27v0.1 EDI Ontology

WSMX Working Draft 21 June 2005

This version:
http://www.wsmo.org/TR/d27/v0.1/20050621/
Previous version:
http://www.wsmo.org/TR/d27/v0.1/20050505
Latest version:
http://www.wsmo.org/TR/d27/v0.1/
Editors:
douglas foxvog
Authors:

Copyright 2004, 2005 DERI, All Rights Reserved. DERI liability, trademark, document use, and software licensing rules apply.


Table of contents

1. Introduction
1.1 Document Overview
2. Advantages and Disadvantages of EDI
3. Ontologizing EDI
3.1 Ontologizing Syntax
3.2 Issues for Ontologizing Semantics
3.3 Steps for Ontologizing Semantics
4. Current Status
5. Conclusions and Future Work
6. Acknowledgements
7. References

Appendices
I WSML Ontology
I.a WSML Ontology for X12 Syntax
I.b Sample WSML Syntax Encodings
I.c Sample WSML Message Encoding
II OWL- Ontology
II.a OWL- Ontology for X12 Syntax
II.b Sample OWL- Syntax Encodings
III CycL Ontology
III.a CycL Ontology for X12 Syntax
III.b Sample CycL Syntax Encodings
III.c Sample CycL Message Encoding
IV TRIPLE Ontology
IV.a TRIPLE Ontology for X12 Syntax
IV.b Sample TRIPLE Syntax Encodings
V FLORA-2 Ontology
V.a FLORA-2 Ontology for X12 Syntax
V.b Sample FLORA-2 Syntax Encodings


1. Introduction

Electronic document standards first appeared in the 1970's. These standards define the structure of business messages, with the promise of making business transactions more efficient.

The standard organizations have generalized the various message types to be able to cover the needs of every industry. As a result, no industry, much less company, uses a complete EDI standard. Each user uses only a limited set of message types and only a subset of the permissible forms of those messages which it does use.

However, since the X12 and EDIFACT messages have been defined only syntactically, setting up new communications takes developers a long time to agreee on both the subset of EDI to use and the precise meaning of message content. For example, they must agree upon whether "shipping date" means the date the goods are loaded on a truck, the date the truck departs the premises, or something else.

By ontologizing EDI standards definitional problems can be solved, intersections of subsets can be more easily calculated, and transformations between different standards can be rationalized.

1.1 Document Overview

Section 2 discusses advantages and disadvantages of traditional EDI systesm. Section 3 discusses the process of ontologizing both the syntax and the smantics of one EDI standard (ANSI ASC X12). Section 4 describes the current state of the effort. Section 5 concludes the document.

2. Advantages and Disadvantages of EDI

Advantages

Hundreds of thousands of companies that use X12, EDIFACT, or both find EDI advantageous because it obviates a lot of paperwork and speeds up transactions, with computer programs processing documents received from business partners and generating such documents for transmission. EDI documents provide a legal record of business communications [13]. In addition to the expensive value-added networks (VANs) which were required in the past, EDI users are now able to transmit their data encrypted over the Internet at the far lower Internet connection rates via new EDIINT [2] standards for email (AS1), HTTP/HTTPS (AS2), and ftp (AS3).

Disadvantages

The X12 standard is so large and general -- in order to cover all possible message types used by any company or industry -- that different industries and corporations have defined different subsets of the standard to cover those message types and variations of message formats which they use. The use of different standards is so prevalent that when two corporations wish to start up EDI communications they must negotiate a technical agreement to define exactly what subset of EDI they will use [8].

These EDI variants define some optional EDI components as mandatory and others as forbidden, specify additional inter-component restrictions, identify a subset of codes within used code sets that will be accepted and used, may add additional codes, and restrict the transaction sets that will be used.

The lack of semantic rigor in the meanings of various components of EDI messages can become an issue [7]. If business partners do not formally agree upon mutually acceptable definitions, problems may arise later. For example, they must mutually decide if a shipping date is the date a product leaves the supplier's warehouse, the date that it is loaded onto the transport vehicle, the date that it leaves the supplier's premises, or the date on which it is placed on an international transport vehicle (e.g. ship or plane).

For these reasons, among others, there is a high start-up cost for adding EDI to a business system with significant additional costs for initiating new relationships which has kept many small and mid-sized companies from adopting EDI messaging [1,4,5,6].

Without being semantically-enabled, EDI messages are unable to be interfaced with Semantic Web Services [11]. Semantic Web Service mediators [10] would not be able to generate EDI messages from semantic requests as long as the semantics of EDI messages is undefined.

3. Ontologizing EDI

Ontologizing EDI involves ontologizing both the format (syntax) and the semantics of the messages and their components. The discussion below refers specifically to ontologizing the ANSI ASC X12 [9] standard, but most of the points apply to EDIFACT [3] as well.

Ontologizing syntax defines and encodes a vocabulary for specifying formats of transaction sets, data segment groups, data segments, composite data elements, simple data elements, data element codes, and code sets. Inter-component restrictions are part of the syntax which are specified by relations. Using this vocabulary, the syntax of each of the components is defined.

Ontologizing these formats allows the formats to be described in a machine-readable form. Inter-element restrictions can also be encoded in a formal way instead of via English prose. Subsets of the standard can be expressed in such a way that intersections between subsets can be simply calculated.

Ontologizing the syntax provides a basis for ontologizing the semantics of messages and for converting to other messaging systems using different syntax.

A second ontological phase involves specifying the semantics of each transaction set, data segment group, data segment, composite data element, simple data element, and code in each code set of a chosen X12 subset. Each transaction set and data segment group can be mapped into a set of statement templates. Each data segment and composite data element will map into a statement template or relation. Each data element and code in each code set will be defined as a corresponding class, relation, or individual.

The same ontology may be encoded in different ontology languages. In order to allow the EDI ontology to be available to different systems, we encode it in multiple ontology languages.

3.1 Ontologizing EDI Syntax

The first step in ontologizing EDI syntax is determining the major concepts and relations used for encoding EDI and defining the vocabulary for specifying the entities. For X12, the major data chunks are

  • Transaction Set -- A message type is deemed a "transaction set". Each transaction set is composed of a list of possibly repeating components, with each component being either mandatory or optional and given a maximum number of possible repetitions. The components may be either Data Segments or loops of Data Segments.
  • Data Segment -- A Data Segment is effectively a "line" of a transaction set. It is composed of a list of possibly repeating Data Elements, with each data Element being either mandatory or optional and given a maximum number of possible repetitions.
  • Complex Data Element -- A Complex Data Element is similar to a Data Segment in that it is composed of a list of possibly repeating Data Elements, but those Data Elements may not themselves by complex; they must be simple.
  • Simple Data Element -- A simple Data Element is an indivisible part of a message, being filled with a single number, string, or code value. The type of number or string or the Code Set from which the code value is to be found as well as the minimum and maximun number of characters for the element defines the simple Data Element's syntax. Although nothing prevents a string from being parsed, e.g., a time being parsed into hour and minute, such subdivisions of a string are not designated in the X12 format.
  • Code Set -- A fixed set of codes that are permitted as values for a simple Data Element. The code values in the set are normally from one to four characters in length.
  • The basic relations used for modelling X12 syntax are

  • hasFormat -- a component has the specified format. Because formats are quite different for simple Data Elements and other components, a separate version of hasFormat, hasDataElementFormat is distinguished.
  • hasFormatRestriction -- a specified restriction holds between subcomponents of the indicated component. Because types of restriction are different for Data Segments and Transaction Sets, separate versions are used for these two purposes.
  • For languages which only allow binary relations, additional relations and concepts are necessary. The added relations designate the argument positions in higher arity relations and the additional concepts cover the situation when a higher-arity relation obtains if more than one such relation may hold for a given term. The new concepts include Format Descriptor and Segment-Element Restriction, while the new relations include such attributes as formats8thComponent, formatsFor8thComponent, minLength, and restrictionLine1.

    3.2 Issues for Ontologizing EDI Semantics

    The first issue with ontologizing EDI semantics is the number of terms to ontologize. There are 36,730 data element codes in the 5010 version of X12, whose meanings must be arranged in complex directed acyclic graphs (DAGs) of classes since many are subclasses of several others, however not all of them represent classes. A few thousand of these codes have duplicate names, but each such pairing needs to be examined to determine whether both codes with the same name actually have the same meaning.

    The meanings of 1410 simple Data Elements, whose values may be numbers, dates, members of one of the code sets, or possibly free text, must be ontologized. The meaning of a Data Element in a message may be affected by which of 34 Composite Data Element types and 1019 Data Segment types it occurs within. Even though an instantiation of a type of Data Segment normally is a complete statement, its meaning depends upon the context in which it appears within a message (for which there are 317 types of Transaction Sets).

    The standard also includes 650 external code sets that are not described in the standard. A large number of these are not public and would need to be purchased and their associated licensing issues dealt with. We do not yet know if the average size of these code sets is 20, 50, 200, or more codes. It is possible that the task of ontologizing these code sets would be greater than that for the rest of the X12 standard.

    Another issue is that EDI terms are not formally defined. Their meanings must be deduced from their English names. Different companies and industries may use the same Data Segment or Data Element with different meanings (e.g., is shipping date when product leaves its warehoused location, leaves warehouse itself, is loaded onto transport vehicle, or when vehicle departs?).

    3.3 Steps for Ontologizing EDI Semantics

    Ontologizing EDI semantics is a massive task, but can show benefits long before being completed.

    Because EDI is designed to be able to express all kinds of business messages for all existing industries, it is possible and useful to create separate ontologies for different Transaction Sets or groups of Transaction Sets, as well as associated Data Segments, Data Elements, and Code Sets.

    Few companies would need to transmit student records, patient records, and US Customs documents, as well as voter registration documents -- all of which are defined in the X12 standard. Thus it is appropriate to create different ontologies for these diverse topics.

    The ontologist must be aware that the same Data Elements and/or Data Segments may occur in several unrelated Transaction Sets. In such cases, the semantics of such components should be defined in more general ontologies that can be referenced by or imported to the appropriate Transaction Set group ontologies.

    Once the classes of Transaction Sets are defined, an initial group of Transaction Sets is selected and ontologies for those Transaction Sets and their components are created.

    Classes or Individuals are created for each Data Element Code that is applicable for the chosen group of Transaction Sets. Classes or Relations are created for each applicable Data Element. Relations or rules (sentence templates) are created for each Data Segment. Rules are created for each Data Segment group, including Transaction Sets.

    This process may proceed bottom-up (from Data Element Codes to Transaction Sets), top-down (starting with Transaction Sets), or in a mixed fashion. Care must be taken when creating the terms for the codes that codes from different Code Sets may have the same meaning but different names and that codes with the same name from different codes sets have different meanings.

    The classes created from the Data Codes and Data Elements must be carefully arranged hierarchically into directed acyclic subconcept/superconcept graphs. The created individuals must be assigned to their most specific classes. Auxiliary classes, being a generalization of a group of represented classes or individuals, may well be suggested even though they are not explicitly encoded in the standard. Such classes should be created.

    4. Current Status

    We are in the midst of specifying X12 EDI format in multiple ontological languages. We encode the formats initially in one language and convert the encodings to other languages mostly through editor scripts. The X12 format source documents are provided as HTML files, but in most cases (except for Transaction Sets) sets of editor scripts can be used to translate the HTML versions into an ontology language.

    We have created the vocabulary for specifying X12 formats and inter-element restrictions, as well as for encoding the messages according to these formats, in WSML (see Appendix I), OWL- (OWL minus, RDF syntax) (see Appendix II), CycL (see Appendix III), TRIPLE (see Appendix IV), and FLORA-2 (see Appendix V).

    Each appendix presents the ontology for X12 syntax in the appropriate language and shows the definition of a Transaction Set, its format in terms of included Data Segments, the definition and format of one of its Data Segments in terms of Data Elements, and the definition and format of one of those Data Elements. Format restrictions on a more complex Data Segment and Transaction Set are also provided.

    Using this vocabulary, we have encoded the formats of all 1410 Data Elements, all 34 Composite Data Elements, all 1019 Data Segments, and an initial 136 of the 317 Transaction Sets defined in the 5010 version of the ANSI ASC X12 standard. All 1565 inter-Data Element restrictions defined in syntactic notes for Data Segments and Composite Data Elements have been encoded. The encoded Transaction Sets had twenty syntactic notes restricting Data Elements on included Data Segments, all of which were encoded in the ontology languages. We specified all 36,730 valid codes which were associated with the included Code Sets. We have included the codes for only for two (countries and currencies) of the 650 external Code Sets.

    No effort has yet gone into systematically ontologizing the semantics of the ANSI X12 terms. However, the countries and currencies encoded from the external code sets have been identified as such and the associations between currencies and their respective countries were ontologized in passing.

    5. Conclusions and Future Work

    We have by now encoded the formats of each of the (version 5010) X12 Transaction Sets used in the fields of information science and electronics devices. We are now starting a parallel effort ontologizing their meanings, along with those of their component Data Segments, Data Elements, and codes in their associated Code Sets following the method described in Section 3.3, while continuing to encode the formats of the remaining X12 Transaction Sets.

    Along with this effort, we will investigate ontologizing the syntax and semantics of the various XML-based systems, such as RosettaNet and UBL, so as to enable translations between them and the traditional EDI systems.

    6. Acknowledgement

    The work is funded by the European Commission under the projects DIP, Knowledge Web, and SWWS and by Science Foundation Ireland under the DERI-Lion and M3PE project.

    7. References

    [1] ADX Corporation, Distribution Giant Hughes Supply Selects ADX to Electronically Connect Entire Supply Base, www.adx.com/news/index.php?z=pressrelease&ID=135, Newark, CA, USA, 2002.
    [2] A. Adshead and D.Thomas, Web EDI forces suppliers to change tactics, Computer Weekly, July 2003.
    [3] Berge, J., The EDIFACT Standards. Manchester, England, NCC Blackwell, 1991.
    [4] Business.GOV, eCommerce FAQs, www.business.gov/phases/growing/use_technology/ecommerce_faq-3.html, November, 2004.
    [5] A. Crede, Electronic Commerce and the Banking Industry: The Requirement and Opportunities for New Payment Systems Using the Internet, Journal of Computer-Mediated Communication, Vol. 1, No. 3, December 1995.
    [6] E. Grygo, "STC, Tibco boost transaction software with XML", InfoWorld, Volume 21, Issue 51 (December 18, 1999), page 12.
    [7] C. Huemer, Defining Electronic Data Interchange Transactions with UML, Proceedings of HICSS-34, Maui, January 2001, p. 7031.
    [8] ISO, Open-EDI Reference Model, ISO/IEC JTC 1/SC30 ISO Standard 14662, 1997.
    [9] F. Lehmann, Machine-negotiated Ontology-based EDI (Electronic Data Interchange), Electronic Commerce: Current Research Issues and Applications, Springer, Berlin, 1996, pp. 27-45.
    [10] H.Lin, T. Risch T. Katchaounov, Adaptive Data Mediation Over XML Data, Journal of Applied System Studies (JASS), Cambridge International Science Publishing, 2001.
    [11] D. Roman, H. Laursen, and U. Keller, eds., Web Service Modeling Ontology, WSMO Working Draft, 2004, www.wsmo.org/2004/d2/v1.0.
    [12] M. Rowell, OAGIS - A Canonical Business Language: Providing both Vertical and Horizontal Requirements, Open Applications Group, Incorporated Document Number 20020429, 2002.
    [13] Ruh, J., The Internet and Business: A Lawyers Guide to the Emerging Legal Issues, Fairfax, VA, 1996.

    Appendix I. WSML Ontology

    Appendix I.a WSML Ontology for X12 Syntax

    namespace <<http://deri.org/ont/x12_Format>>
      x12: <<http://deri.org/ont/x12_Format>>
      dc: <<http://purl.org/dc/elements/1.1#>>
      xsd: <<http://www.w3.org/2001/XMLSchema#>> 
      
    targetNamespace: <<http://deri.org/ont/x12>>
    
    ontology X12
    
    nonFunctionalProperties 
        dc:title hasValue "X12 Format Vocabulary WSML version" 
        dc:subject hasValue "ANSI X12 EDI Vocabulary" 
        dc:description hasValue "Description of Vocabulary for ANSI X12 EDI Vocabulary"
        dc:contributor hasValue <<http://foxvog.org/doug./>> 
        dc:date hasValue "2004-11-15" 
        dc:type hasValue <<http://www.wsmo.org/2004/d2/v1.0/#ontologies>> 
        dc:format hasValue "text/plain" 
        dc:language hasValue "en-US" 
        dc:rights hasValue <<http://www.deri.org/privacy.html>> 
        version hasValue "$Revision: 0.01 $" 
    endNonFunctionalProperties 
    
    
    concept X12SegmentElementRestriction
    
    concept X12DataStructure
      nonFunctionalProperties
        dc:description hasValue "Data structures for ANSI X12"
      endNonFunctionalProperties
    
    concept X12CompositeDataStructure subConceptOf X12DataStructure
      nonFunctionalProperties
        dc:description hasValue "Structures of multiple X12 Data Segments or 
            Data Elements.  This includes Transaction Sets, loops of segments
            within Transaction Sets,  and Data Segments."
      endNonFunctionalProperties
      hasFormatDescriptor ofType X12FormatDescriptor
      formatRestriction ofType X12FormatRestriction
    
    concept X12MultiDataSegment subConceptOf X12CompositeDataStructure
      nonFunctionalProperties
        dc:description hasValue "Structures of multiple X12 Data Segments.
    	This includes Transaction Sets and loops of segments within
    	Transaction Sets"
      endNonFunctionalProperties
      hasFormatDescriptor ofType X12MDSFormatDescriptor
      segmentElementRestriction ofType X12SegmentElementRestriction
    
    concept X12TransactionSetPart subConceptOf X12CompositeDataStructure
      nonFunctionalProperties
        dc:description hasValue "Substructures of X12 Multi Data Segments.
    	This includes Data Segments and loops of Data Segments within
    	Transaction Sets"
      endNonFunctionalProperties
    
    concept X12TransactionSet subConceptOf X12MultiDataSegment
      nonFunctionalProperties
        dc:description hasValue "Data structures for messages as defined in X12 Standard"
      endNonFunctionalProperties
      tsCode ofType xsd:String
    
    concept X12DataSegmentLoop subConceptOf {X12MultiDataSegment, X12TransactionSetPart}
      nonFunctionalProperties
        dc:description hasValue "Loops of Data Segments within Transaction Sets"
      endNonFunctionalProperties
    
    concept X12MultiDataElement subConceptOf X12CompositeDataStructure
      nonFunctionalProperties
        dc:description hasValue "Structures of multiple X12 Data Elements.
    	This includes Data Segments and Composite Data Elements."
      endNonFunctionalProperties
    
    concept X12DataSegment subConceptOf {X12MultiDataElement, X12TransactionSetPart}
      nonFunctionalProperties
        dc:description hasValue "Data structures as defined in X12 Standard"
      endNonFunctionalProperties
    
    concept X12DataElement subConceptOf X12DataStructure
      nonFunctionalProperties
        dc:description hasValue "Data structures as defined in X12 Standard"
      endNonFunctionalProperties
    
    concept X12SimpleDataElement subConceptOf X12DataElement 
      nonFunctionalProperties
        dc:description hasValue "Simple data structures as defined in X12 Standard"
      endNonFunctionalProperties
      hasCode ofType xsd:string
      minLength ofType xsd:integer
      maxLength ofType xsd:integer
      hasDataElementFormat ofType X12TextStringType
    
    concept X12ComplexDataElement subConceptOf {X12DataElement, X12MultiDataElement}
      nonFunctionalProperties
        dc:description hasValue "Data structures as defined in X12 Standard"
      endNonFunctionalProperties
    
    
    concept X12Optionality
    
    concept X12FormatCode
      optionality ofType X12Optionality
      maxRepeats ofType xsd:integer
    
    instance Mandatory memberOf X12Optionality
    
    instance Optional memberOf X12Optionality
      nonFunctionalProperties
        dc:description hasValue "A component my be Optional in one case and 
    	either Mandatory or NotUsedByConvention in a narrower context.  Thus a
    	component can have two different optionalities so long as one is 
    	Optional.  In such a case, the other optionality takes precedence."
      endNonFunctionalProperties
    
    instance NotUsedByConvention memberOf X12Optionality
      nonFunctionalProperties
        dc:description hasValue "NotUsedByConvention is not given as an optionality 
    	in the ANSI X12 standard.  But in subsets of the standard, certain 
    	optional elements are not permitted.  This is for use in such cases.
            it is also used for distinguishing differences between different 
    	versions of the complete X12 standard."
      endNonFunctionalProperties
    
    concept X12FormatDescriptor
      hasFormat ofType X12Format
      formats1stComponent ofType X12DataStructure
      formats2ndComponent ofType X12DataStructure
      formats3rdComponent ofType X12DataStructure
      formats4thComponent ofType X12DataStructure
      formats5thComponent ofType X12DataStructure
      formats6thComponent ofType X12DataStructure
      formats7thComponent ofType X12DataStructure
      formats8thComponent ofType X12DataStructure
      formats9thComponent ofType X12DataStructure
      formats10thComponent ofType X12DataStructure
      formats11stComponent ofType X12DataStructure
      formats12ndComponent ofType X12DataStructure
      formats13rdComponent ofType X12DataStructure
      formats14thComponent ofType X12DataStructure
      formats15thComponent ofType X12DataStructure
      formats16thComponent ofType X12DataStructure
      formats17thComponent ofType X12DataStructure
      formats18thComponent ofType X12DataStructure
      formats19thComponent ofType X12DataStructure
      formats20thComponent ofType X12DataStructure
      formats21stComponent ofType X12DataStructure
      formats22ndComponent ofType X12DataStructure
      formats23rdComponent ofType X12DataStructure
      formats24thComponent ofType X12DataStructure
      formats25thComponent ofType X12DataStructure
      formats26thComponent ofType X12DataStructure
      formats27thComponent ofType X12DataStructure
      formats28thComponent ofType X12DataStructure
      formats29thComponent ofType X12DataStructure
      formats30thComponent ofType X12DataStructure
      formats31thComponent ofType X12DataStructure
      formats32ndComponent ofType X12DataStructure
      formats33rdComponent ofType X12DataStructure
      formats34thComponent ofType X12DataStructure
      formats35thComponent ofType X12DataStructure
      formats36thComponent ofType X12DataStructure
      formats37thComponent ofType X12DataStructure
      formats38thComponent ofType X12DataStructure
      formats39thComponent ofType X12DataStructure
      formats40thComponent ofType X12DataStructure
      formats41stComponent ofType X12DataStructure
      formats42ndComponent ofType X12DataStructure
      formats43rdComponent ofType X12DataStructure
      formats44thComponent ofType X12DataStructure
      formats45thComponent ofType X12DataStructure
      formats46thComponent ofType X12DataStructure
      formats47thComponent ofType X12DataStructure
      formats48thComponent ofType X12DataStructure
      formats49thComponent ofType X12DataStructure
    
    concept X12Format
      formatFor1stComponent ofType X12FormatCode
      formatFor2ndComponent ofType X12FormatCode
      formatFor3rdComponent ofType X12FormatCode
      formatFor4thComponent ofType X12FormatCode
      formatFor5thComponent ofType X12FormatCode
      formatFor6thComponent ofType X12FormatCode
      formatFor7thComponent ofType X12FormatCode
      formatFor8thComponent ofType X12FormatCode
      formatFor9thComponent ofType X12FormatCode
      formatFor10thComponent ofType X12FormatCode
      formatFor11thComponent ofType X12FormatCode
      formatFor12thComponent ofType X12FormatCode
      formatFor13thComponent ofType X12FormatCode
      formatFor14thComponent ofType X12FormatCode
      formatFor15thComponent ofType X12FormatCode
      formatFor16thComponent ofType X12FormatCode
      formatFor17thComponent ofType X12FormatCode
      formatFor18thComponent ofType X12FormatCode
      formatFor19thComponent ofType X12FormatCode
      formatFor20thComponent ofType X12FormatCode
      formatFor21stComponent ofType X12FormatCode
      formatFor22ndComponent ofType X12FormatCode
      formatFor23rdComponent ofType X12FormatCode
      formatFor24thComponent ofType X12FormatCode
      formatFor25thComponent ofType X12FormatCode
      formatFor26thComponent ofType X12FormatCode
      formatFor27thComponent ofType X12FormatCode
      formatFor28thComponent ofType X12FormatCode
      formatFor29thComponent ofType X12FormatCode
      formatFor31stComponent ofType X12FormatCode
      formatFor32ndComponent ofType X12FormatCode
      formatFor33rdComponent ofType X12FormatCode
      formatFor34thComponent ofType X12FormatCode
      formatFor35thComponent ofType X12FormatCode
      formatFor36thComponent ofType X12FormatCode
      formatFor37thComponent ofType X12FormatCode
      formatFor38thComponent ofType X12FormatCode
      formatFor39thComponent ofType X12FormatCode
      formatFor40thComponent ofType X12FormatCode
      formatFor41stComponent ofType X12FormatCode
      formatFor42ndComponent ofType X12FormatCode
      formatFor43rdComponent ofType X12FormatCode
      formatFor44thComponent ofType X12FormatCode
      formatFor45thComponent ofType X12FormatCode
      formatFor46thComponent ofType X12FormatCode
      formatFor47thComponent ofType X12FormatCode
      formatFor48thComponent ofType X12FormatCode
      formatFor49thComponent ofType X12FormatCode
    
    concept X12FormatRestrictionType
    
    instance X12_FR_C memberOf X12FormatRestrictionType
    instance X12_FR_E memberOf X12FormatRestrictionType
    instance X12_FR_L memberOf X12FormatRestrictionType
    instance X12_FR_P memberOf X12FormatRestrictionType
    instance X12_FR_R memberOf X12FormatRestrictionType
    
    concept X12FormatRestriction
      nonFunctionalProperties
        dc:description hasValue "valid restriction types are: 
    	'C' - Conditional - if first then rest 
    	'E' - Exclusive Use - only one of set may be included
    	'L' - List Conditional - if first then at least one other 
    	'P' - Paired - if any then all
    	'R' - Required - at least one required 
         for segments, this is restriction between data elements
         for segment-element restrictions, first # is segment #,
                         second is element # within segment
      endNonFunctionalProperties
      restrictionType ofType X12FormatRestrictionType
      restrictionLine1 ofType xsd:integer
      restrictionLine2 ofType xsd:integer
    
    
    concept X12SegmentElementRestriction
      segmentNumber ofType xsd:integer
      elementNumber ofType xsd:integer
      restrictionType ofType X12FormatRestrictionType
    
    

    I.b Sample WSML Syntax Encodings

    // define a Transaction Set with given Format Descriptor
    instance X12_TS_997 memberOf x12:TransactionSet
        nonFunctionalProperties
          dc:description hasValue "Functional Acknowledgement Transaction Set"
        endNonFunctionalProperties
        hasFormatDescriptor hasValue X12_TS_997FD
    
    // define format for the five components of the Format Descriptor 
    instance X12_TS_997FD memberOf x12:FormatDescriptor
        hasFormat hasValue X12_TS_997F
        formats1stComponent hasValue ds:X12_ST_DS
        formats2ndComponent hasValue ds:X12_AK1_DS
        formats3rdComponent hasValue X12_AK2_Loop
        formats4thComponent hasValue ds:X12_AK9_DS
        formats5thComponent hasValue ds:X12_SE_DS
    
    // define format for the five components of the Format
    instance X12_TS_997F memberOf x12:Format
    	  formatFor1stComponent hasValue fc:X12_FC_M1 
    	  formatFor2ndComponent hasValue fc:X12_FC_M1 
    	  formatFor3rdComponent hasValue fc:X12_FC_O1 
    	  formatFor4thComponent hasValue fc:X12_FC_M1 
    	  formatFor5thComponent hasValue fc:X12_FC_M1 
    // define a Data Segment and relate it to its Format Descriptor
    instance X12_AK1_DS memberOf x12:DataSegment
        hasFormatDescriptor hasValue X12_AK1_DSFD
    // define format for the three components of the DSs Format Descriptor
    instance X12_AK1_DSFD memberOf x12:FormatDescriptor
        hasFormat hasValue X12_AK1_DSF
        formats1stComponent hasValue de:X12_DE_479
        formats2ndComponent hasValue de:X12_DE_28
        formats3rdComponent hasValue de:X12_DE_480
    
    instance X12_DE_479 memberOf x12:DataElement
        hasDataElementFormat hasValue x12:IDString
        minLength hasValue 2
        maxLength hasValue 2
    
    instance X12_FC_M1 memberOf x12:X12FormatCode
        optionality hasValue x12:Mandatory
        maxRepeats hasValue 1
    
    instance X12_CUR_DS memberOf x12:X12DataSegment
    	formatRestriction hasValue fr:X12_FR_C1110 
    	formatRestriction hasValue fr:X12_FR_L101112
    
    instance X12_FR_C1110  memberOf x12:X12FormatRestriction
    	restrictionType hasValue x12:X12_FR_C 
    	restrictionLine1 hasValue 11
    	restrictionLine2 hasValue 10  
    
    instance X12_TS_855 memberOf x12:X12TransactionSet
    	formatRestriction hasValue fr:X12_FR_TS855a 
    
    instance X12_FR_TS855a  memberOf x12:X12SegmentElementRestriction
    	restrictionType hasValue x12:X12_FR_E 
    	segmentNumber hasValue 17
    	elementNumber hasValue 1 
    
    

    I.c Sample WSML Message Encoding

    
    instance TS12345 memberOf x12:BusinessMessage
             componentType ts:X12_TS_997
             firstComponent ST-12345 
    	 secondComponent AK1-12345
             thirdComponent AK2Loop-12345
         	 fourthComponent AK9-12345
         	 fifthComponent SE-12345 
    instance ST-12345 memberOf x12:DataSegmentInstance
         	 componentType ds:X12_ST_DS
         	 firstComponent 997
         	 secondComponent 12345
    instance AK1-12345 memberOf x12:DataSegmentInstance
         	 componentType ds:X12_AK1_DS
         	 firstComponent "HS"
             secondComponent 123
    instance AK2Loop-12345
             memberOf x12:DataSegmentLoopInstance
         	 componentType ts:X12_997_Loop_AK2
         	 repeats 1
             firstComponent AK2-12345
             secondComponent x12:Absent
             thirdComponent AK5-12345
    instance AK2-12345 memberOf x12:DataSegmentInstance
         	 componentType ds:X12_AK2_DS
         	 firstComponent 270
             secondComponent 12321
    instance AK5-12345 memberOf x12:DataSegmentInstance
         	 componentType ds:X12_AK5_DS
         	 firstComponent "A"
    instance AK9-12345 memberOf x12:DataSegmentInstance
         	 componentType ds:X12_AK9_DS
         	 firstComponent "A"
             secondComponent 1
             thirdComponent 1
             fourthComponent 1
    instance SE-12345 memberOf x12:DataSegmentInstance
         	 componentType ds:X12_SE_DS
         	 firstComponent 6
             secondComponent 12345 
    
    
    
    

    Appendix II. OWL- Ontology

    Appendix II.a OWL- Ontology for X12 Syntax

    
    <rdf:RDF
      xmlns="http://www.deri.org/ont/x12/x12_Format#"
      xmlns:x12="http://www.deri.org/ont/x12/x12_Format#"
      xmlns:de="http://www.deri.org/ont/x12/x12_data_elements#"
      xmlns:cde="http://www.deri.org/ont/x12/x12_composite_data_elements#"
      xmlns:ds="http://www.deri.org/ont/x12/x12_data_segments#"
      xmlns:ts="http://www.deri.org/ont/x12/x12_transaction_sets#"
      xmlns:owl="http://www.w3.org/2002/07/owl#"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:rdf="http://www.w3.org/1999/01/22-rdf-syntax-ns#"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      >
    
    <owl:Class rdf:ID="DataStructure">
    </owl:Class>
    
    <owl:Class rdf:ID="MultDataSegment">
      <owl:subclassOf rdf:resource="#DataStructure" />.
    </owl:Class>
    
    <owl:Class rdf:ID="TransactionSet">
      <owl:subclassOf rdf:resource="#MultDataSegment" />
    </owl:Class>
    
    <owl:ObjectProperty rdf:ID="tsCode">
      <owl:domain rdf:resource="#TransactionSet" />
      <owl:range rdf:resource="&xsd;string" />
    </owl:ObjectProperty>
    
    <owl:Class rdf:ID="DataSegmentLoop">
      <owl:subclassOf rdf:resource="#MultDataSegment" />.
    </owl:Class>
    
    <owl:Class rdf:ID="MultDataElement">
      <owl:subclassOf rdf:resource="#DataStructure" />.
    </owl:Class>
    
    <owl:Class rdf:ID="DataSegment">
      <owl:subclassOf rdf:resource="#MultDataElement" />.
    </owl:Class>
    
    <owl:Class rdf:ID="DataElement">
      <owl:subclassOf rdf:resource="#DataStructure" />
    </owl:Class>
    
    <owl:ObjectProperty rdf:ID="hasCode">
      <owl:domain rdf:resource="#DataElement" />
      <owl:range rdf:resource="&xsd;string" />
    </owl:ObjectProperty>
    
    <owl:Class rdf:ID="CompositeDataElement">
      <owl:subclassOf rdf:resource="#DataElement" />.
      <owl:subclassOf rdf:resource="#MultDataElement" />.
    </owl:Class>
    
    <owl:Class rdf:ID="Format">
    </owl:Class>
    
    <owl:Class rdf:ID="FormatDescriptor">
    </owl:Class>
    
    <owl:Class rdf:ID="FormatRestriction">
    </owl:Class>
    
    <owl:Class rdf:ID="SegmentElementRestriction">
    </owl:Class>
    
    
    <owl:Class rdf:ID="Optionality">
    </owl:Class>
    
    <Optionality rdf:ID="#Mandatory" />
    <Optionality rdf:ID="#Optional" />
    <Optionality rdf:ID="#Depreciated" />
    <Optionality rdf:ID="#NotUsedByConvention" />
    
    <owl:Class rdf:ID="FormatCode">
    </owl:Class>
    
    <owl:ObjectProperty rdf:ID="optionality">
      <owl:domain rdf:resource="#FormatCode" />
      <owl:range rdf:resource="#Optionality" />
    </owl:ObjectProperty>
    
    <owl:ObjectProperty rdf:ID="maxRepeats">
      <owl:domain rdf:resource="#FormatCode" />
      <owl:range rdf:resource="&xsd;integer" />
    </owl:ObjectProperty>
    
    
    <owl:ObjectProperty rdf:ID="hasFormatDescriptor">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#FormatDescriptor" />
    </owl:ObjectProperty>
    
    <owl:ObjectProperty rdf:ID="formatRestriction">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#FormatRestriction" />
    </owl:ObjectProperty>
    
    
    <owl:ObjectProperty rdf:ID="hasFormat">
      <owl:domain rdf:resource="#FormatDescriptor" />
      <owl:range rdf:resource="#Format" />
    </owl:ObjectProperty>
    
    <owl:ObjectProperty rdf:ID="hasSegmentElementRestriction">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#SegmentElementRestriction" />
    </owl:ObjectProperty>
    
    
    
    <owl:ObjectProperty rdf:ID="formats1stComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats2ndComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats3rdComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats4thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats5thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats6thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats7thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats8thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats9thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats10thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats11stComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats12ndComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats13rdComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats14thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats15thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats16thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats17thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats18thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats19thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats20thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats21stComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats22ndComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats23rdComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats24thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats25thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats26thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats27thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats28thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats29thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats30thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats31thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats32ndComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats33rdComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats34thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats35thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats36thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats37thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats38thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats39thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats40thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats41stComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats42ndComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats43rdComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats44thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats45thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats46thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats47thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats48thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formats49thComponent">
      <owl:domain rdf:resource="#DataStructure" />
      <owl:range rdf:resource="#DataStructure" />
    </owl:ObjectProperty>
    
    <owl:ObjectProperty rdf:ID:"formatFor1stComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor2ndComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor3rdComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor4thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor5thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor6thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor7thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor8thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor9thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor10thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor11thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor12thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor13thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor14thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor15thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor16thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor17thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor18thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor19thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor20thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor21stComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor22ndComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor23rdComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor24thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor25thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor26thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor27thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor28thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor29thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor31stComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor32ndComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor33rdComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor34thComponent">
     <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID:"formatFor35thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor36thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor37thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor38thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor39thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor40thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor41stComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor42ndComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor43rdComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor44thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor45thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor46thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor47thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor48thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    <owl:ObjectProperty rdf:ID="formatFor49thComponent">
      <owl:domain rdf:resource="#Format" />
      <owl:range rdf:resource="#FormatCode" />
    </owl:ObjectProperty>
    
    
    <owl:Class rdf:ID="FormatRestrictionType">
    </owl:Class>
    
    <FormatRestrictionType rdf:ID="#IfFirstThenRest" />
    <FormatRestrictionType rdf:ID="#IfFirstThenAtLeastOneOther" />
    <FormatRestrictionType rdf:ID="#ExclusiveOr" />
    <FormatRestrictionType rdf:ID="#IfAnyThanAll" />
    <FormatRestrictionType rdf:ID="#AtLeastOneRequired" />
    
    <owl:ObjectProperty rdf:ID:"restrictionType">
      <owl:domain rdf:resource="#FormatRestriction" />
      <owl:range rdf:resource="#FormatRestrictionType" />
    </owl:ObjectProperty>
    
    <owl:ObjectProperty rdf:ID:"restrictionLine1">
      <owl:domain rdf:resource="#FormatRestriction" />
      <owl:range rdf:resource="&xsd;integer" />
    </owl:ObjectProperty>
    
    <owl:ObjectProperty rdf:ID:"restrictionLine2">
      <owl:domain rdf:resource="#FormatRestriction" />
      <owl:range rdf:resource="&xsd;integer" />
    </owl:ObjectProperty>
    
    
    ; valid restriction types are: 
    ;	"C" - Conditional - if first then rest 
    ;	"E" - Exclusive Use - only one of set may be included
    ;	"L" - List conditional - if first then at least one other 
    ;	"P" - Paired - if any then all
    ;	"R" - Required - at least one required 
    ; for segments, this is restriction between data elements
    ; for multi-segments, first # is segment #,
    ;                     second is element # within segment
    ; Multi-segments use just "C" and "E".  Unclear if "L" exists.
    
    
    <owl:ObjectProperty rdf:ID:"segmentNumber">
      <owl:domain rdf:resource="#SegmentElementRestriction" />
      <owl:range rdf:resource="&xsd;integer" />
    </owl:ObjectProperty>
    
    <owl:ObjectProperty rdf:ID:"elementNumber">
      <owl:domain rdf:resource="#SegmentElementRestriction" />
      <owl:range rdf:resource="&xsd;integer" />
    </owl:ObjectProperty>
    
    <owl:ObjectProperty rdf:ID:"restrictedType">
      <owl:domain rdf:resource="#SegmentElementRestriction" />
      <owl:range rdf:resource="#FormatRestriction" />
    </owl:ObjectProperty>
    
    
    <owl:Class rdf:ID="DataElementFormat">
    </owl:Class>
    
    

    II.b Sample OWL- Syntax Encodings

    <x12:TransactionSet rdf:ID="X12_TS_997">
        <owl:comment> Functional Acknowledgement Transaction Set </owl:comment>
        <x12:hasFormatDescriptor rdf:resource="#X12_TS_997FD">
    </x12:TransactionSet>
    <x12:x12Format rdf:ID="X12_TS_997F" >
    	  <x12:formatFor1stComponent rdf:resource="&fc;X12_FC_M1" />
    	  <x12:formatFor2ndComponent rdf:resource="&fc;X12_FC_M1" />
    	  <x12:formatFor3rdComponent rdf:resource="&fc;X12_FC_O1" />
    	  <x12:formatFor4thComponent rdf:resource="&fc;X12_FC_M1" />
    	  <x12:formatFor5thComponent rdf:resource="&fc;X12_FC_M1" />
    </x12:x12Format>
    <x12:FormatDescriptor rdf:ID="X12_TS_997FD">
        <x12:hasFormat rdf:about="#X12_TS_997F"  />
        <x12:formats1stComponent rdf:resource="#X12_ST_DS" />
        <x12:formats2ndComponent rdf:resource="#X12_AK1_DS" />
        <x12:formats3rdComponent rdf:resource="#X12_AK2_Loop" />
        <x12:formats4thComponent rdf:resource="#X12_AK9_DS" />
        <x12:formats5thComponent rdf:resource="#X12_SE_DS" />
    </x12:FormatDescriptor>
    
    <x12:DataSegment rdf:ID="X12_AK1_DS">
        <x12:hasFormatDescriptor rdf:resource="X12_AK1_DSFD">
    </x12:DataSegment>
    <x12:FormatDescriptor rdf:ID="X12_AK1_DSFD">
        <x12:hasFormat rdf:resource="#X12_AK1_DSF" />
        <x12:formats1stComponent rdf:resource="#X12_DE_479" />
        <x12:formats2ndComponent rdf:resource="#X12_DE_28" />
        <x12:formats3rdComponent rdf:resource="#X12_DE_480" />
    </x12:FormatDescriptor>
    
    <x12:DataElement rdf:ID="X12_DE_479">
        <owl:comment> Functional Identifier Code </owl:comment>
        <x12:minDELength 2 />    <x12:maxDELength 2 />
        <hasDataElementFormat rdf:resource="x12;IDString" />
    </x12:DataElement>
    
    <x12:x12FormatRestriction rdf:resource="&ds;X12_CUR_DS" rdf:resource="#X12_CUR_DSFR" />
    <x12:FormatRestriction rdf:ID="X12_CUR_DSFR">
    	<form:restrictionType rdf:resource="&x12;X12_FR_C" />
    	<form:restrictionLine1 11^^xsd:Integer />
    	<form:restrictionLine2 10^^xsd:Integer />
    </x12:FormatRestriction>
    
    <x12:x12FormatRestriction rdf:resource="&ds;X12_TS_855" rdf:resource="#X12_TS_855a_FR" />
    <x12:FormatRestriction rdf:ID="X12_TS_855a_FR">
    	<form:restrictionType rdf:resource="&x12;X12_FR_E" />
    	<form:restrictionLine1 17^^xsd:Integer />
    	<form:restrictionLine2 1^^xsd:Integer />
    </x12:FormatRestriction>
    
    
    

    Appendix III CycL Ontology

    Appendix III.a CycL Ontology for X12 Syntax

    default mt: DERI_X12Mt.
    Constant: X12Format.
    isa: CompositeDataType ObjectType.
    genls: ComputerDataStructure Individual.
    
    Constant: X12FormatCode.
    isa: CompositeDataType ObjectType.
    genls: ComputerDataStructure Individual.
    comment: "The collection of all #$X12MultiDataElement data formats.".
    
    Constant: Optionality.
    in mt: DERIMt.
    isa: ObjectType.
    genls: AttributeValue.
    comment: "A specialization of #$AttributeValue.  Includes the values #$Optional and #$Mandatory.".
    cyclistNotes: "at some point create #$hasOptionality.".
    
    Constant: Optional.
    in mt: DERIMt.
    isa: Optionality.
    comment: "The attribute of being optional.".
    
    Constant: Mandatory.
    in mt: DERIMt.
    isa: Optionality.
    comment: "The attribute of being mandatory.".
    
    
    Constant: X12FormatCodeFn.
    isa: ReifiableFunction TernaryFunction.
    arg1Isa: NonNegativeInteger.
    arg2Isa: Optionality.
    arg3Isa: Integer.
    resultIsa: X12FormatCode.
    comment: "(#$X12FormatCodeFn NUM_ELEMENTS OPTIONALITY MAX_REPEATS) returns the
              #$X12FormatCode for NUM_ELEMENTS lines of a #$X12MultiDataElement 
              which have the same #$Optionality, OPTIONALITY, and a maximum of 
              MAX_REPEATS repeats.  If MAX_REPEATS is negative, the number of 
              repeats is unlimited.".
    
    Constant: x12FormatCodeFormat.
    isa: QuaternaryPredicate.
    arg1Isa: X12FormatCode.
    arg2Isa: NonNegativeInteger.
    arg3Isa: Optionality.
    arg4Isa: Integer.
    comment: "(#$x12FormatCodeFormat TS_FORMAT NUM_ELEMENTS OPTIONALITY MAX_REPEATS)
              means that TS_FORMAT is the #$X12FormatCode for NUM_ELEMENTS lines of
              a #$X12MultiDataElement which have the same #$Optionality,
              OPTIONALITY, and a maximum of MAX_REPEATS repeats.  If MAX_REPEATS
              is negative, the number of repeats is unlimited.".
    direction: forward.
    f: (x12FormatCodeFormat 
    	(X12FormatCodeFn ?NUM_ELEMENTS ?OPTIONALITY ?MAX_REPEATS)
    	?NUM_ELEMENTS ?OPTIONALITY ?MAX_REPEATS).
    
    
    Constant: X12FormatFn.
    isa: ReifiableFunction VariableArityFunction.
    argsIsa: X12FormatCode.
    arityMin: 1.
    resultIsa: X12Format.
    
    Constant: x12FormatIs.
    isa: VariableArityRelation Predicate.
    arg1Isa: X12Format.
    argAndRestIsa: (2 X12FormatCode).
    arityMin: 2.
    comment: "(#$x12FormatIs X12_FORMAT FORMAT_CODE_1 ... FORMAT_CODE_N) means that the
              format, #$X12FORMAT, is defined by the list of #$X12FormatCodes.".
    
    
    direction: forward.
    f: (x12FormatIs (X12FormatFn ?FC) ?FC).
    direction: forward.
    f: (x12FormatIs 
        (X12FormatFn ?FC1 ?FC2)
        ?FC1 ?FC2).
    direction: forward.
    f: (x12FormatIs 
        (X12FormatFn ?FC1 ?FC2 ?FC3)
        ?FC1 ?FC2 ?FC3).
    direction: forward.
    f: (x12FormatIs 
        (X12FormatFn ?FC1 ?FC2 ?FC3 ?FC4)
        ?FC1 ?FC2 ?FC3 ?FC4).
    direction: forward.
    f: (x12FormatIs 
        (X12FormatFn ?FC1 ?FC2 ?FC3 ?FC4 ?FC5)
        ?FC1 ?FC2 ?FC3 ?FC4 ?FC5).
    
    Constant: hasX12Format.
    isa: VariableArityRelation Predicate.
    arg1Isa: X12MultiDataElement.
    arg2Isa: X12Format.
    argAndRestIsa: (3 X12TransactionSetPart).
    arityMin: 3.
    comment: "(#$hasX12Format X12_STRUCTURE FORMAT TS_PART_1 ... TS_PART_N) means that the
              specified #$X12MultiDataElement structure includes the specified
              #$X12TransactionSetParts using the specified #$X12Format.".
    
    Constant: hasX12DataElementFormat.
    isa: QuaternaryPredicate.
    arg1Isa: X12DataElement.
    arg2Isa: SecondOrderCollection.
    arg3Isa: Integer.
    arg4Isa: Integer.
    comment: "(#$hasX12DataElementFormat DATA_ELEMENT TYPE MIN_CHARS MAX_CHARS) means that
              the #$X12DataElement is is of TYPE (one of #$CharacterString, #$IDString,
              #$Integer, #$Rational #$NonNegativeInteger) with the field of at least
              MIN_CHARS and at most MAX_CARS in length (ignoring any decimal point or
              minus sign).".
    
    
    Constant: X12FormatRestrictionType.
    isa: ObjectType.
    genls: AttributeValue.
    comment: "The collection of all types of X12 restrictions between data segments
              in a #$X12TransactionSet or #$X12CompositeDataElement.".
    
    Constant: X12FormatRestrictionType.
    isa: ObjectType.
    genls: AttributeValue.
    comment: "The collection of all types of X12 restrictions between data segments
              in a #$X12TransactionSet or #$X12CompositeDataElement.".
    
    Constant: X12-FR-Paired.
    isa: X12FormatRestrictionType AttributeValue.
    comment: "#$X12-FR-Paired indicates that if one of the indicated #$X12DataElements
              is present in the structure being restricted, they all must be.".
    
    Constant: X12-FR-Required.
    isa: X12FormatRestrictionType AttributeValue.
    comment: "#$X12-FR-Required indicates that at least one of the indicated #$X12DataElements
              is required in the structure being restricted.".
    
    Constant: X12-FR-ListConditional.
    isa: X12FormatRestrictionType AttributeValue.
    comment: "#$X12-FR-ListConditional indicates that if the first of the indicated
              #$X12DataElements is present in the structure being restricted,
              then at least one of the others must be present.".
    
    Constant: X12-FR-Conditional.
    isa: X12FormatRestrictionType AttributeValue.
    comment: "#$X12-FR-Conditional indicates that if the first of the indicated
              #$X12DataElements is present in the structure being restricted,
              then the second one is required.".
    
    Constant: X12-FR-ExclusiveUse.
    isa: X12FormatRestrictionType AttributeValue.
    comment: "#$X12-FR-ExclusiveUse indicates that only one of the indicated
              #$X12DataElements may be present in the structure being restricted.".
    
    
    Constant: x12FormatRestriction.
    isa: VariableArityRelation Predicate.
    arg1Isa: X12DataSegment.
    arg2Isa: X12FormatRestrictionType. 
    argAndRestIsa: (3 PositiveInteger).
    comment: "(#$x12FormatRestriction DATA_SEGMENT RESTRICTION N M ...) means that
              the specified #$X12FormatRestrictionType holds among the indicated
              data element positions in the #$X12DataSegment, DATA_SEGMENT.".
    
    Constant: x12TSFormatRestriction-MandatoryElement.
    isa: TernaryPredicate.
    arg1Isa: X12MultiDataSegment.
    arg2Isa: PositiveInteger.
    arg3Isa: PositiveInteger.
    comment: "(#$x12TSFormatRestriction-MandatoryElement TS SEGNUM ELNUM) means that
              if the SEGNUMth #$X12_DataSegment is filled in #$X12MultiDataSegment,
              TS, then its ELNUMth #$X12DataElement is #$Mandatory.".
    
    Constant: x12TSFormatRestriction-NotUsedByConventionElement.
    isa: TernaryPredicate.
    arg1Isa: X12MultiDataSegment.
    arg2Isa: PositiveInteger.
    arg3Isa: PositiveInteger.
    comment: "(#$x12TSFormatRestriction-NotUsedByConventionElement TS SEGNUM ELNUM) means that
              if the SEGNUMth #$X12DataSegment is filled in #$X12MultiDataSegment,
              TS, then its ELNUMth line is forbidden (#$NotUsedByConvention).".
    
    Constant: x12TSFormatRestriction-ElementFilledBy.
    isa: QuaternaryPredicate.
    arg1Isa: X12MultiDataSegment.
    arg2Isa: PositiveInteger.
    arg3Isa: PositiveInteger.
    arg4Isa: Tuple.
    comment: "(#$x12TSFormatRestriction-ElementFilledBy TS SEGNUM ELNUM VALUE) means that if
              the SEGNUMth #$X12DataSegment (counting loops as segments) is filled in
              #$X12MultiDataSegment, TS, then its ELNUMth #$X12DataElement must be set
              to VALUE.".
    
    Constant: x12TSFormatRestriction-SomeElementFilledBy.
    isa: QuaternaryPredicate.
    arg1Isa: X12MultiDataSegment.
    arg2Isa: PositiveInteger.
    arg3Isa: PositiveInteger.
    arg4Isa: Tuple.
    comment: "(#$x12TSFormatRestriction-SomeElementFilledBy TS SEGNUM ELNUM VALUE) means that
              if the SEGNUMth #$X12DataSegment (counting loops as segments) is filled in
              #$X12MultiDataSegment, TS, then its ELNUMth #$X12DataElement of one
              occurrance of the segment must be set to VALUE.".
    
    Constant: x12TSFormatRestriction-MandatoryLoopSegment.
    isa: TernaryPredicate.
    arg1Isa: X12MultiDataSegment.
    arg2Isa: PositiveInteger.
    arg3Isa: PositiveInteger.
    comment: "(#$x12TSFormatRestriction-MandatoryLoopSegment TS LNUM SEGNUM) means that if
              the LNUMth line is filled in #$X12MultiDataSegment, TS, then its SEGNUMth
              line either a X12DataSegment or X12MultiDataSegment) is #$Mandatory.".
    
    

    III.b Sample CycL Syntax Encodings

    (isa X12-TS-997 X12TransactionSet)
    (hasX12Format X12-TS-997 X12-FunctionalAcknowledgement-TSF 
    	X12-ST-DS X12-AK1-DS FunctionalAcknowledgement-Loop-AK2 
    	X12-AK9-DS X12-SE-DS)
    (comment X12-TS-997 Functional Acknowledgement Transaction Set)
    
    (isa X12-FunctionalAcknowledgement-TSF X12Format)
    (x12FormatIs X12-FunctionalAcknowledgement-TSF 
         (X12FormatCodeFn 2 Mandatory 1)
         (X12FormatCodeFn 1 Optional 1) 
         (X12FormatCodeFn 2 Mandatory 1))
    
    (isa X12-AK1-DS X12DataSegment)
    (comment X12-AK1-DS "Functional Group Response Header")
    (hasX12Format X12-AK1-DS
           (X12FormatFn (X12FormatCodeFn 2 Mandatory 1) 
                        (X12FormatCodeFn 1 Optional 1)) 
           X12-DE-479 X12-DE-28 X12-DE-480)
    
    (isa X12-DE-479 X12DataElement)
    (comment X12-DE-479 "Functional Identifier Code")
    (hasX12DataElementFormat X12-DE-479 IDString 2 2)
    
    (x12FormatRestriction X12-CUR-DS X12_FR_Conditional 11 10)
    (x12FormatRestriction X12-CUR-DS X12_FR_ListConditional 10 11 12)
    
    (x12TSFormatRestriction-NotUsedByConventionLine X12-TS-855 17 1)
    (x12TSFormatRestriction-LineFilledBy 
           PurchaseOrderAcknowledgement-Loop-PO1 31 1 1)
    (x12TSFormatRestriction-MandatoryLine 
           PurchaseOrderAcknowledgement-Loop-PO1 1 2)
    
    

    II.c Sample CycL Message Encoding

    (BusinessMessageFn X12-TS-997
                       (DataSegmentFn X12-ST-DS 997 "12345")
                       (DataSegmentFn X12-AK1-DS "HS" "123")
                       (DataSegmentLoopFn X12-997-Loop-AK2 1
                                          (DataSegmentFn X12-AK2-DS 270 "12321")
                                          AbsentDataSegment
                                          (DataSegmentFn X12-AK5-DS "A"))
                       (DataSegmentFn X12-AK9-DS "A" 1 1 1)
                       (DataSegmentFn X12-SE-DS 6 "12345"))
    
    
    
    
    

    Appendix IV TRIPLE Ontology

    Appendix IV.a TRIPLE Ontology for X12 Syntax

    rdf := 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'.
    rdfs := 'http://www.w3.org/2000/01/rdf-schema#'.
    subClassOf := rdf:type.
    
    x12CompositeDataStructure[subClassOf -> x12DataStructure].
    
    x12MultiDataSegment[subClassOf -> x12CompositeDataStructure].
    segmentElementRestriction[rdfs:domain -> x12MultiDataSegment;
    			  rdfs:range -> x12SegmentElementRestriction].
    
    x12TransactionSet[subClassOf -> x12MultiDataSegment].
    tsCode[rdfs:domain -> x12TransactionSet;
           rdfs:range -> xsd:String].
    
    x12TransactionSetPart[subClassOf -> x12CompositeDataStructure].
    x12DataSegmentLoop[subClassOf -> x12MultiDataSegment;
                       subClassOf -> x12TransactionSetPart].
    x12MultiDataElement[subClassOf -> x12CompositeDataStructure].
    x12DataSegment[subClassOf -> x12MultiDataElement;
                   subClassOf -> x12TransactionSetPart].
    
    x12DataElement[subClassOf -> x12DataStructure].
    
    x12SimpleDataElement[subClassOf -> x12DataElement].
    hasCode[rdfs:domain -> X12SimpleDataElement;
    	rdfs:range -> xsd:String;
    minLength[rdfs:domain -> X12SimpleDataElement;
    	  rdfs:range -> xsd:Integer;
    maxLength[rdfs:domain -> X12SimpleDataElement;
    	  rdfs:range -> xsd:Integer;
    
    x12ComplexDataElement[subClassOf -> x12DataElement;
                          subClassOf -> x12MultiDataElement].
    x12MDSFormatDescriptor[subClassOf -> x12FormatDescriptor].
    x12MDEFormatDescriptor[subClassOf -> x12FormatDescriptor].
    
    hasFormatDescriptor[rdfs:domain -> x12CompositeDataStructure;
                        rdfs:range -> x12FormatDescriptor].
    formats1stComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats2ndComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats3rdComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats4thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats5thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats6thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats7thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats8thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats9thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats10thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats11thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats12thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats13thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats14thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats15thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats16thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats17thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats18thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats19thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats20thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats21stComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats22ndComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats23rdComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats24thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats25thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats26thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats27thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats28thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats29thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats30thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats31stComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats32ndComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats33rdComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats34thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats35thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats36thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats37thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats38thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats39thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats40thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats41stComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats42ndComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats43rdComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats44thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats45thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats46thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats47thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats48thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    formats49thComponent[rdfs:domain -> x12CompositeDataStructure;
                          rdfs:range -> x12DataStructure].
    
    hasFormat[rdfs:domain -> x12FormatDescriptor;
              rdfs:range -> x12Format].
    formatFor1stComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor2ndComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor3rdComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor4thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor5thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor6thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor7thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor8thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor9thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor10thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor11thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor12thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor13thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor14thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor15thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor16thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor17thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor18thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor19thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor20thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor21stComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor22ndComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor23rdComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor24thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor25thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor26thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor27thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor28thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor29thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor30thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor31stComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor32ndComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor33rdComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor34thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor35thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor36thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor37thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor38thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor39thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor40thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor41stComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor42ndComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor43rdComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor44thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor45thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor46thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor47thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor48thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    formatFor49thComponent[rdfs:domain -> x12Format;
                          rdfs:range -> x12FormatCode].
    
    mandatory[elementOf -> x12Optionality].
    optional[elementOf -> x12Optionality].
    notUsedByConvention[elementOf -> x12Optionality].
    
    optionality[rdfs:domain -> x12FormatCode;
                rdfs:range -> x12Optionality].
    maxRepeats[rdfs:domain -> x12FormatCode;
                rdfs:range -> xsd:Integer].
    
    
    
    

    IV.b Sample TRIPLE Syntax Encodings

    
    x12_TS_810:x12TransactionSet[hasFormatDescriptor ->
    		             x12InvoiceFD:x12MDSFormatDescriptor].
    
    x12_ST_DS:x12DataSegment.
    x12_BIG_DS:x12DataSegment.
    x12_NTE_DS:x12DataSegment.
    x12_CUR_DS:x12DataSegment.
    x12_REF_DS:x12DataSegment.
    x12_NYQ_DS:x12DataSegment.
    x12_PER_DS:x12DataSegment.
    x12_810_N1_Loop:x12MultiDataElement.
    x12_ITD_DS:x12DataSegment.
    x12_DTM_DS:x12DataSegment.
    x12_FOB_DS:x12DataSegment.
    x12_PID_DS:x12DataSegment.
    x12_MEA_DS:x12DataSegment.
    x12_PWK_DS:x12DataSegment.
    x12_PKG_DS:x12DataSegment.
    x12_L7_DS:x12DataSegment.
    x12_BAL_DS:x12DataSegment.
    x12_INC_DS:x12DataSegment.
    x12_PAM_DS:x12DataSegment.
    x12_CRC_DS:x12DataSegment.
    x12_LM_Loop_B:x12MultiDataElement.
    x12_810_N9_Loop:x12MultiDataElement.
    x12_810_V1_Loop:x12MultiDataElement.
    x12_810_FA1_Loop:x12MultiDataElement.
    x12_810_ITI_Loop:x12MultiDataElement.
    x12_TDS_DS:x12DataSegment.
    x12_TXI_DS:x12DataSegment.
    x12_CAD_DS:x12DataSegment.
    x12_AMT_DS:x12DataSegment.
    x12_810_SAC_Loop:x12MultiDataElement.
    x12_810_ISS_Loop:x12DataSegment.
    x12_CTT_DS:x12DataSegment.
    x12_SE_DS:x12DataSegment.
    x12InvoiceFD[hasFormat -> x12InvoiceTSF:x12Format;
                 formats1stComponent -> x12_ST_DS;
                 formats2ndComponent -> x12_BIG_DS;
                 formats3ndComponent -> x12_NTE_DS;
                 formats4thComponent -> x12_CUR_DS;
                 formats5thComponent -> x12_REF_DS;
                 formats6thComponent -> x12_NYQ_DS;
                 formats7thComponent -> x12_PER_DS;
                 formats8thComponent -> x12_810_N1_Loop;
                 formats9thComponent -> x12_ITD_DS;
                 formats10thComponent -> x12_DTM_DS;
                 formats11thComponent -> x12_FOB_DS;
                 formats12thComponent -> x12_PID_DS;
                 formats13thComponent -> x12_MEA_DS;
                 formats14thComponent -> x12_PWK_DS;
                 formats15thComponent -> x12_PKG_DS;
                 formats16thComponent -> x12_L7_DS;
                 formats17thComponent -> x12_BAL_DS;
                 formats18thComponent -> x12_INC_DS;
                 formats19thComponent -> x12_PAM_DS;
                 formats20thComponent -> x12_CRC_DS;
                 formats21stComponent -> x12_LM_Loop;
                 formats22ndComponent -> x12_810_N9_Loop;
                 formats23rdComponent -> x12_810_V1_Loop;
                 formats24thComponent -> x12_810_FA1_Loop;
                 formats25thComponent -> x12_810_ITI_Loop;
                 formats26thComponent -> x12_TDS_DS;
                 formats27thComponent -> x12_TXI_DS;
                 formats28thComponent -> x12_CAD_DS;
                 formats29thComponent -> x12_AMT_DS;
                 formats30thComponent -> x12_810_SAC_Loop;
                 formats31stComponent -> x12_810_ISS_Loop;
                 formats32ndComponent -> x12_CTT_DS;
                 formats33rdComponent -> x12_SE_DS].
    
    
    
    x12InvoiceTSF[formatFor1stComponent ->
                            x12FormatFn(mandatory, 1);
                  formatFor2ndComponent ->
                            x12FormatFn(mandatory, 1);
                  formatFor3rdComponent ->
                            x12FormatFn(optional, 100);
                  formatFor4thComponent ->
                            x12FormatFn(optional, 1);
                  formatFor5thComponent ->
                            x12FormatFn(optional, 12);
                  formatFor6thComponent ->
                            x12FormatFn(optional, 10);
                  formatFor7thComponent ->
                            x12FormatFn(optional, 3);
                  formatFor8thComponent ->
                            x12FormatFn(optional, 200);
                  formatFor9thComponent ->
                            x12FormatFn(optional, -1);
                  formatFor10thComponent ->
                            x12FormatFn(optional, 10);
                  formatFor11thComponent ->
                            x12FormatFn(optional, 1);
                  formatFor12thComponent ->
                            x12FormatFn(optional, 200);
                  formatFor13thComponent ->
                            x12FormatFn(optional, 40);
                  formatFor14thComponent ->
                            x12FormatFn(optional, 25);
                  formatFor15thComponent ->
                            x12FormatFn(optional, 25);
                  formatFor16thComponent ->
                            x12FormatFn(optional, 1);
                  formatFor17thComponent ->
                            x12FormatFn(optional, -1);
                  formatFor18thComponent ->
                            x12FormatFn(optional, 1);
                  formatFor19thComponent ->
                            x12FormatFn(optional, -1);
                  formatFor20thComponent ->
                            x12FormatFn(optional, 1);
                  formatFor21stComponent ->
                            x12FormatFn(optional, 10);
                  formatFor22Component ->
                            x12FormatFn(optional, 1);
                  formatFor23rdComponent ->
                            x12FormatFn(optional, -1);
                  formatFor24thComponent ->
                            x12FormatFn(optional, -1);
                  formatFor25thComponent ->
                            x12FormatFn(optional, 200000);
                  formatFor26thComponent ->
                            x12FormatFn(mandatory, 1);
                  formatFor27thComponent ->
                            x12FormatFn(optional, -1);
                  formatFor28thComponent ->
                            x12FormatFn(optional, 1);
                  formatFor29Component ->
                            x12FormatFn(optional, -1);
                  formatFor30thComponent ->
                            x12FormatFn(optional, -1);
                  formatFor31stComponent ->
                            x12FormatFn(optional, -1);
                  formatFor32ndComponent ->
                            x12FormatFn(optional, 1);
                  formatFor33rdComponent ->
                            x12FormatFn(mandatory, 1)].
     
    x12_CUR_DS[formatRestriction ->
                 x12FormatRestrictionFn("C", [21, 19]),
               formatRestriction ->
                 x12FormatRestrictionFn("L", [10, 11, 12])].
    
    
    
    

    Appendix V FLORA-2 Ontology

    Appendix V.a FLORA-2 Ontology for X12 Syntax

    
    x12MultiDataSegment::x12DataStructure[
    	 segmentElementRestriction =>> x12SegmentElementRestriction].
    x12TransactionSet::x12MultiDataSegment[
    	tsCode => string].
    x12DataSegmentLoop::x12MultiDataSegment.
    x12MultiDataElement::x12DataStructure.
    x12DataSegment::x12MultiDataElement.
    
    x12AlphanumericString:x12DataElementFormat.
    x12IDString:x12DataElementFormat.
    x12IntegerString:x12DataElementFormat.
    x12RationalNumberString:x12DataElementFormat.
    x12NonNegativeIntegerString:x12DataElementFormat.
    
    x12DataElement::x12DataStructure[
    	hasCode =>> string].
    	minLength =>> integer,
    	maxLength =>> integer,
    	hasX12DataElementFormat => x12DataElementFormat].
    x12ComplexDataElement::x12DataElement.
    x12ComplexDataElement::x12MultiDataElement.
    x12MDSFormatDescriptor::x12FormatDescriptor.
    x12MDEFormatDescriptor::x12FormatDescriptor.
    
    mandatory:x12Optionality.
    optional:x12Optionality.
    notUsedByConvention:x12Optionality.
    requiredByConvention:x12Optionality.
    conditionalOptionality:x12Optionality.
    floatingOptionality:x12Optionality.
    depreciated:x12Optionality.
    
    x12FormatCode[optionality => x12Optionality, maxRepeats => integer].
    
    x12DataStructure[hasFormatDescriptor => x12FormatDescriptor,
                     formatRestriction =>> x12FormatRestriction,
    		 comment => string].
    x12MultiDataSegment[hasFormatDescriptor => x12MDSFormatDescriptor].
    x12FormatDescriptor[hasFormat =>> x12Format].
    x12MDSFormatDescriptor[formats1stComponent => x12DataSegment,
                           formats2ndComponent => x12DataSegment,
                           formats3rdComponent => x12DataSegment,
                           formats4thComponent => x12DataSegment,
                           formats5thComponent => x12DataSegment,
                           formats6thComponent => x12DataSegment,
                           formats7thComponent => x12DataSegment,
                           formats8thComponent => x12DataSegment,
                           formats9thComponent => x12DataSegment,
                           formats10thComponent => x12DataSegment,
                           formats11stComponent => x12DataSegment,
                           formats12ndComponent => x12DataSegment,
                           formats13rdComponent => x12DataSegment,
                           formats14thComponent => x12DataSegment,
                           formats15thComponent => x12DataSegment,
                           formats16thComponent => x12DataSegment,
                           formats17thComponent => x12DataSegment,
                           formats18thComponent => x12DataSegment,
                           formats19thComponent => x12DataSegment,
                           formats20thComponent => x12DataSegment,
                           formats21stComponent => x12DataSegment,
                           formats22ndComponent => x12DataSegment,
                           formats23rdComponent => x12DataSegment,
                           formats24thComponent => x12DataSegment,
                           formats25thComponent => x12DataSegment,
                           formats26thComponent => x12DataSegment,
                           formats27thComponent => x12DataSegment,
                           formats28thComponent => x12DataSegment,
                           formats29thComponent => x12DataSegment,
                           formats30thComponent => x12DataSegment,
                           formats31thComponent => x12DataSegment,
                           formats32ndComponent => x12DataSegment,
                           formats33rdComponent => x12DataSegment,
                           formats34thComponent => x12DataSegment,
                           formats35thComponent => x12DataSegment,
                           formats36thComponent => x12DataSegment,
                           formats37thComponent => x12DataSegment,
                           formats38thComponent => x12DataSegment,
                           formats39thComponent => x12DataSegment,
                           formats40thComponent => x12DataSegment,
                           formats41stComponent => x12DataSegment,
                           formats42ndComponent => x12DataSegment,
                           formats43rdComponent => x12DataSegment,
                           formats44thComponent => x12DataSegment,
                           formats45thComponent => x12DataSegment,
                           formats46thComponent => x12DataSegment,
                           formats47thComponent => x12DataSegment,
                           formats48thComponent => x12DataSegment,
                           formats49thComponent => x12DataSegment].
    
    x12MultiDataElement[hasFormatDescriptor => x12MDEFormatDescriptor].
    x12MDEFormatDescriptor[formats1stComponent => x12DataElement,
                           formats2ndComponent => x12DataElement,
                           formats3rdComponent => x12DataElement,
                           formats4thComponent => x12DataElement,
                           formats5thComponent => x12DataElement,
                           formats6thComponent => x12DataElement,
                           formats7thComponent => x12DataElement,
                           formats8thComponent => x12DataElement,
                           formats9thComponent => x12DataElement,
                           formats10thComponent => x12DataElement,
                           formats11stComponent => x12DataElement,
                           formats12ndComponent => x12DataElement,
                           formats13rdComponent => x12DataElement,
                           formats14thComponent => x12DataElement,
                           formats15thComponent => x12DataElement,
                           formats16thComponent => x12DataElement,
                           formats17thComponent => x12DataElement,
                           formats18thComponent => x12DataElement,
                           formats19thComponent => x12DataElement,
                           formats20thComponent => x12DataElement,
                           formats21stComponent => x12DataElement,
                           formats22ndComponent => x12DataElement,
                           formats23rdComponent => x12DataElement,
                           formats24thComponent => x12DataElement,
                           formats25thComponent => x12DataElement,
                           formats26thComponent => x12DataElement,
                           formats27thComponent => x12DataElement,
                           formats28thComponent => x12DataElement,
                           formats29thComponent => x12DataElement,
                           formats30thComponent => x12DataElement,
                           formats30thComponent => x12DataElement,
                           formats32ndComponent => x12DataElement,
                           formats33rdComponent => x12DataElement,
                           formats34thComponent => x12DataElement,
                           formats35thComponent => x12DataElement,
                           formats36thComponent => x12DataElement,
                           formats37thComponent => x12DataElement,
                           formats38thComponent => x12DataElement,
                           formats39thComponent => x12DataElement,
                           formats40thComponent => x12DataElement,
                           formats41stComponent => x12DataElement,
                           formats42ndComponent => x12DataElement,
                           formats43rdComponent => x12DataElement,
                           formats44thComponent => x12DataElement,
                           formats45thComponent => x12DataElement,
                           formats46thComponent => x12DataElement,
                           formats47thComponent => x12DataElement,
                           formats48thComponent => x12DataElement,
                           formats49thComponent => x12DataElement].
    x12Format[formatFor1stComponent =>> x12FormatCode,
               formatFor2ndComponent =>> x12FormatCode,
               formatFor3rdComponent =>> x12FormatCode,
               formatFor4thComponent =>> x12FormatCode,
               formatFor5thComponent =>> x12FormatCode,
               formatFor6thComponent =>> x12FormatCode,
               formatFor7thComponent =>> x12FormatCode,
               formatFor8thComponent =>> x12FormatCode,
               formatFor9thComponent =>> x12FormatCode,
               formatFor10thComponent =>> x12FormatCode,
               formatFor11thComponent =>> x12FormatCode,
               formatFor12thComponent =>> x12FormatCode,
               formatFor13thComponent =>> x12FormatCode,
               formatFor14thComponent =>> x12FormatCode,
               formatFor15thComponent =>> x12FormatCode,
               formatFor16thComponent =>> x12FormatCode,
               formatFor17thComponent =>> x12FormatCode,
               formatFor18thComponent =>> x12FormatCode,
               formatFor19thComponent =>> x12FormatCode,
               formatFor20thComponent =>> x12FormatCode,
               formatFor21stComponent =>> x12FormatCode,
               formatFor22ndComponent =>> x12FormatCode,
               formatFor23rdComponent =>> x12FormatCode,
               formatFor24thComponent =>> x12FormatCode,
               formatFor25thComponent =>> x12FormatCode,
               formatFor26thComponent =>> x12FormatCode,
               formatFor27thComponent =>> x12FormatCode,
               formatFor28thComponent =>> x12FormatCode,
               formatFor29thComponent =>> x12FormatCode,
               formatFor30thComponent =>> x12FormatCode,
               formatFor31stComponent =>> x12FormatCode,
               formatFor32ndComponent =>> x12FormatCode,
               formatFor33rdComponent =>> x12FormatCode,
               formatFor34thComponent =>> x12FormatCode,
               formatFor35thComponent =>> x12FormatCode,
               formatFor36thComponent =>> x12FormatCode,
               formatFor37thComponent =>> x12FormatCode,
               formatFor38thComponent =>> x12FormatCode,
               formatFor39thComponent =>> x12FormatCode,
               formatFor40thComponent =>> x12FormatCode,
               formatFor41stComponent =>> x12FormatCode,
               formatFor42ndComponent =>> x12FormatCode,
               formatFor43rdComponent =>> x12FormatCode,
               formatFor44thComponent =>> x12FormatCode,
               formatFor45thComponent =>> x12FormatCode,
               formatFor46thComponent =>> x12FormatCode,
               formatFor47thComponent =>> x12FormatCode,
               formatFor48thComponent =>> x12FormatCode,
               formatFor49thComponent =>> x12FormatCode].
    
    x12FormatRestriction[restrictionType => character,
                         restrictionLine1 => integer,
                         restrictionLine2 =>> integer].
    ; valid restriction types are: 
    ;	"C" - Causation - if first then rest 
    ;	"E" - Exclusive Or - only one of set may be included
    ;	"L" - 'Least one - if first then at least one other 
    ;	"P" - Package - if any then all
    ;	"R" - Required - at least one required 
    ; for segments, this is restriction between data elements
    ; for multi-segments, first # is segment #,
    ;                     second is element # within segment
    ; Multi-segments use just "C" and "E".  Unclear if "L" exists.
    
    
    x12SegmentElementRestriction:x12FormatRestriction[
    	restrictionValue =>> thing].
    
    

    V.b Sample FLORA-2 Syntax Encodings

    
    X12_TSF_997:x12Format[
        formatFor1stComponent ->> _:x12FormatCode[optionality -> mandatory, maxRepeats -> 1],
        formatFor2ndComponent ->> _:x12FormatCode[optionality -> mandatory, maxRepeats -> 1],
        formatFor3rdComponent ->> _:x12FormatCode[optionality -> optional, maxRepeats -> 1],
        formatFor4thComponent ->> _:x12FormatCode[optionality -> mandatory, maxRepeats -> 1],
        formatFor5thComponent ->> _:x12FormatCode[optionality -> mandatory, maxRepeats -> 1]].
    
    x12_TSFD_997:x12FormatDescriptor[
        hasFormat -> x12_TSF_997,
        formats1stComponent -> x12_ST_DS,
        formats2ndComponent -> x12_AK1_DS,
        formats3rdComponent -> x12_997_Loop_AK2,
        formats4thComponent -> x12_AK9_DS,
        formats5thComponent -> x12_SE_DS].
    
    x12_TS_997:x12TransactionSet[hasFormatDescriptor ->> x12_TSFD_997, tsCode -> "997" ]
    
    x12_AK1_DSFD:x12FormatDescriptor[
        hasFormat -> x12_AK1_DSF:x12Format[
          formatFor1stComponent ->> _:x12FormatCode[optionality -> mandatory, maxRepeats -> 2],
          formatFor2ndComponent ->> _:x12FormatCode[optionality -> mandatory, maxRepeats -> 2], 
          formatFor3rdComponent ->> _:x12FormatCode[optionality -> optional, maxRepeats -> 1]],
        formats1stComponent -> x12_DE_479,
        formats2ndComponent -> x12_DE_28,
        formats3rdComponent -> x12_DE_480].
    
    x12_AK1_DS:x12DataSegment[hasFormatDescriptor ->> x12_AK1_DSFD].
    
    x12_DE_479:x12DataElement[
        hasDataElementFormat -> x12IDString,
        minLength ->> 2, maxLength ->> 2].
    
    x12_CUR_DS[formatRestriction -> _:X12FormatRestriction[
          restrictionType -> ifFirstThanAnyOther,
          restrictionLine1 -> 10,
          restrictionLine2 ->> 11,
          restrictionLine2 ->> 12]].
    x12_CUR_DS[formatRestriction -> _:X12FormatRestriction[
          restrictionType -> ifFirstThenRest, 
          restrictionLine1 -> 11,
          restrictionLine2 ->> 10 ]].
    
    (x12TSFormatRestriction-NotUsedByConventionLine X12-TS-855 17 1)
    (x12TSFormatRestriction-LineFilledBy PurchaseOrderAcknowledgement-Loop-PO1 31 1 1)
    (x12TSFormatRestriction-MandatoryLine PurchaseOrderAcknowledgement-Loop-PO1 1 2)