Copyright © 2018 Crane Softwrights Ltd.
$Date: 2018/02/13 17:50:24 $(UTC)
Table of Contents
The OASIS Business Document Naming and Design Rules [OBDNDR] specification defines a set of rules used to confirm the contents of a CCTS [CCTS] model of a business document’s structure and convert that model into a sets of document validation artifacts. Some of the NDRs regard the values of some CCTS components compared to the values of other CCTS components. Some of the NDRs regard the expression of the components in the validation artefacts.
Crane’s tools for generating these validation artefacts presume that the CCTS model is expressed as a sparsely-populated table using the OASIS genericode specification[genericode]. For the convenience of users, the model component values can originate from an OASIS Open Document Format Spreadsheet that is maintained offline by an application and saved as an ODS file, or maintained online as a Google Spreadsheet and downloaded as an ODS file.
Beyond the concepts found in the NDR, Crane’s tools also support generating the schemas for a subset of a model based on a user’s specification of overriding cardinality values for each information item. Such a “subset schema” has two primary roles:
as a validation artefact used to quickly determine that an instance contains a modelled construct that is disallowed by the subset specification; and
as a directed-editing artefact used to inform an instance creation tool of the allowed components from which an author can chose.
Two examples of CCTS-based XML vocabularies following the OASIS Business Document NDR and with published validation artefacts created by earlier versions of these tools are:
Universal Business Language [UBL-2.1], in conjunction with the UBL Naming and Design Rules [UBL NDR 3.0]; and
Business Document Envelope [BDE-1.1].
Two tool set packages contain four programs used in the data flow depicted in Figure 1, “Business Document NDR model revision process”:
The focus of the process is to convert the genericode expression of the model (labeled [1] in the diagram) into a set of XSD files (labeled [2]) and optionally a CVA file.
The Crane-ods2obdgc[ods2obdgc] package includes the one tool of the same name (labeled [3]). This program converts an instance of ODS into an instance of genericode suitable for expressing an OASIS Business Document model. The package includes a pro-forma ODS instance with an empty row of each component type with which one can create a model from scratch.
The following three tools are in the Crane-gc2obdndr[gc2obdndr] package:
Crane-checkgc4obdndr (labeled [4]) is used to assess the conformance of the model-related MODxx and COMxx NDRs, optionally assessing backwards compatibility issues with another model;
Crane-gc2obdndr (labeled [5]) is used to create the XSD schemas and CVA file for XML and the JSON schemas for JSON; and
Crane-gc2obdsummary (labeled [6]) is used to create hyperlinked HTML summary reports of the CCTS model.
Two ODS files are depicted in the diagram to illustrate how the genericode expressions of two different revisions of a model, one an older version of the other. The process of creating artefacts for either version is the same. The Crane-checkgc4obdndr program can produce a report of the differences between the two revisions.
The use in the diagram of the online Google spreadsheet is optional. An ODS file can be maintained offline or it can be created as a download from Google Drive or by some other application. As a genericode file is suitable for interchange, there are no applications that directly manipulate the content of a genericode file.
Critical to the process is the tool configuration file written as XML. It has many sections:
<?xml version="1.0" encoding="UTF-8"?> <configuration xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <ndr> <name-abbreviations> <!--a list of abbreviations mapping a short string to a long string where the abbreviation is allowed in a component name--> <abbreviation short="CV2">Card Verification Value</abbreviation> </name-abbreviations> <den-abbreviations> <!--a list of abbreviations mapping a short string to a long string where the abbreviation is allowed in a dectionary entry name--> <abbreviation short="CV2">Card Verification Value</abbreviation> </den-abbreviations> <equivalences> <!--a list of equivalences between a primary noun and a rep. term--> <equivalence> <primary-noun>URI</primary-noun> <representation-term>Identifier</representation-term> </equivalence> </equivalences> <expected-maindoc-BIEs> <!--a list of required Document ABIE initial properties that may be aribrarily positioned or otherwise specifically positioned in an order based on the attribute--> <property-term type="BBIE" cardinality="0..1" order="1" >UBL Version Identifier</property-term> <property-term type="ASBIE" cardinality="0..n" >Signature</property-term> </expected-maindoc-BIEs> <types> <!--the list of CCTS primary and secondary representation terms from CCTS table 8-3: Permissible Representation Terms--> <type>Amount</type> </types> </ndr> <schema version="2.1"> <comment> The content of a metadata comment at the head of every file that is generated; the available string substitutions are: %% - a single percent sign %f - the module's configuration subdirectories and file name %n - the output ABIE name %t - the local time stamp for the file %z - the UTC (Zulu) time stamp for the file </comment> <copyright position="end"> The content of a copyright comment that can be positioned either at the start or the end of the generated file based on the mandatory position= attribute being "start" or "end". </copyright> <type-documentation> <ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2"> <!--the documentation to fill out for each component; the text value of the element is the compressed title of the CCTS spreadsheet column--> <ccts:ComponentType>ComponentType</ccts:ComponentType> </ccts:Component> </type-documentation> <!--the directory structure (using <dir>) of a single file (using <file>) or a set of document ABIE files (using <files>) to be realized in the generated results: name= - the name of the documented directory or file runtime-name= - the name of the runtime directory or file type= - CVA - context/value association file - DABIE - Document ABIE file or files - CABIE - common Library ABIE file - CBBIE - common BBIE file - AABIE - alternate Document ABIE file or files - XABIE - extension ABIE file or files - SABIE - supplemental Library ABIE files - SBBIE - supplemental Library BBIE files - QDT - qualified data type file - UDT - unqualified data type file - EXT - extension metadata file skeleton-uri= - the pro-forma CVA file with qualification data types prefix= - the namespace prefix to declare in the fragments for constructs in the given file namespace= - the namespace URI to declare in the fragments for constructs in the given file syntax= - indication of a non-XML syntax (e.g. "JSON") Specialized children of the <file> or <files> element type="{any}" <imports> = the list of <xsd:import> statements to add to the result type="XABIE" <elements> = the element declarations to add after all of the BBIE and ASBIE child elements of the extension ABIE have been declared type="EXT": <elements> = the extension element declaration at the start of every Document ABIE or alternate Document ABIE type="EXT", syntax="JSON": <declarations> = the extension declaration to be added at the start of every Document ABIE or alternate Document ABIE --> <dir name="{base directory name}"> <dir name="{subdirectory name}"> <!--file declarations--> </dir> </dir> </schema> </configuration>
The UBL 2.1 main configuration file is as follows:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration [ <!ENTITY versionDisplay "2.1 OS"> <!ENTITY versionDirectory "os-UBL-2.1"> <!ENTITY versionDate "04 November 2013"> ]> <configuration xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-- This is the configuration of the base schema fragments for UBL 2.1 --> <ndr> <name-abbreviations> <abbreviation short="CV2">Card Verification Value</abbreviation> <abbreviation short="ID">Identifier</abbreviation> <abbreviation short="URI">Uniform Resource Identifier</abbreviation> <abbreviation short="UNDG">United Nations Development Group</abbreviation> <abbreviation short="UBL">Universal Business Language</abbreviation> <abbreviation short="UUID">Universally Unique Identifier</abbreviation> <abbreviation short="XPath">XML Path Language</abbreviation> </name-abbreviations> <den-abbreviations> <abbreviation short="CV2">Card Verification Value</abbreviation> <abbreviation short="URI">Uniform Resource Identifier</abbreviation> <abbreviation short="UNDG">United Nations Development Group</abbreviation> <abbreviation short="UBL">Universal Business Language</abbreviation> <abbreviation short="UUID">Universally Unique Identifier</abbreviation> <abbreviation short="XPath">XML Path Language</abbreviation> </den-abbreviations> <equivalences> <equivalence> <primary-noun>URI</primary-noun> <representation-term>Identifier</representation-term> </equivalence> <equivalence> <primary-noun>UUID</primary-noun> <representation-term>Identifier</representation-term> </equivalence> </equivalences> <expected-maindoc-BIEs> <property-term type="BBIE" cardinality="0..1" order="1" >UBL Version Identifier</property-term> <property-term type="BBIE" cardinality="0..1" order="2" >Customization Identifier</property-term> <property-term type="BBIE" cardinality="0..1" order="3" >Profile Identifier</property-term> <property-term type="BBIE" cardinality="0..1" order="4" >Profile Execution Identifier</property-term> <property-term type="ASBIE" cardinality="0..n" >Signature</property-term> </expected-maindoc-BIEs> <types> <type>Amount</type> <type>Binary Object</type> <type>Code</type> <type>Date Time</type> <type>Date</type> <type>Graphic</type> <type>Identifier</type> <type>Indicator</type> <type>Measure</type> <type>Name</type> <type>Numeric</type> <type>Percent</type> <type>Picture</type> <type>Quantity</type> <type>Rate</type> <type>Sound</type> <type>Text</type> <type>Time</type> <type>Value</type> <type>Video</type> </types> </ndr> <schema version="2.1"> <comment> Library: OASIS Universal Business Language (UBL) &versionDisplay; http://docs.oasis-open.org/ubl/&versionDirectory;/ Release Date: &versionDate; Module: %f Generated on: %z Copyright (c) OASIS Open 2016. All Rights Reserved. </comment> <copyright position="end"> OASIS takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on OASIS's procedures with respect to rights in OASIS specifications can be found at the OASIS website. Copies of claims of rights made available for publication and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementors or users of this specification, can be obtained from the OASIS Executive Director. OASIS invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights which may cover technology that may be required to implement this specification. Please address the information to the OASIS Executive Director. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to OASIS, except as needed for the purpose of developing OASIS specifications, in which case the procedures for copyrights defined in the OASIS Intellectual Property Rights document must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by OASIS or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. </copyright> <type-documentation> <ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2"> <ccts:ComponentType>ComponentType</ccts:ComponentType> <ccts:DictionaryEntryName>DictionaryEntryName</ccts:DictionaryEntryName> <ccts:Version>Version</ccts:Version> <ccts:Definition>Definition</ccts:Definition> <ccts:Cardinality>Cardinality</ccts:Cardinality> <ccts:ObjectClassQualifier>ObjectClassQualifier</ccts:ObjectClassQualifier> <ccts:ObjectClass>ObjectClass</ccts:ObjectClass> <ccts:PropertyTermQualifier>PropertyTermQualifier</ccts:PropertyTermQualifier> <ccts:PropertyTerm>PropertyTerm</ccts:PropertyTerm> <ccts:AssociatedObjectClass>AssociatedObjectClass</ccts:AssociatedObjectClass> <ccts:RepresentationTerm>RepresentationTerm</ccts:RepresentationTerm> <ccts:DataTypeQualifier>DataTypeQualifier</ccts:DataTypeQualifier> <ccts:DataType>DataType</ccts:DataType> <ccts:AlternativeBusinessTerms >AlternativeBusinessTerms</ccts:AlternativeBusinessTerms> <ccts:Examples>Examples</ccts:Examples> </ccts:Component> </type-documentation> <dir name="cva"> <file type="CVA" name="UBL-DefaultDTQ-2.1.cva" skeleton-uri="UBL-2.1-CVA-Skeleton.cva"/> </dir> <dir name="xsd" runtime-name="xsdrt"> <dir name="common"> <file type="CABIE" name="UBL-CommonAggregateComponents-2.1.xsd" prefix="cac" namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"/> <file type="CBBIE" name="UBL-CommonBasicComponents-2.1.xsd" prefix="cbc" namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"/> <file type="QDT" name="UBL-QualifiedDataTypes-2.1.xsd" prefix="qdt" namespace="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataTypes-2"/> <file type="UDT" name="UBL-UnqualifiedDataTypes-2.1.xsd" prefix="udt" namespace="urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2"/> <file type="EXT" name="UBL-CommonExtensionComponents-2.1.xsd" prefix="ext" namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"> <elements> <xsd:element ref="ext:UBLExtensions" minOccurs="0" maxOccurs="1"> <xsd:annotation> <xsd:documentation>A container for all extensions present in the document.</xsd:documentation> </xsd:annotation> </xsd:element> </elements> </file> </dir> <dir name="maindoc"> <files type="DABIE" name="UBL-%n-2.1.xsd" namespace="urn:oasis:names:specification:ubl:schema:xsd:%n-2"> <element-documentation>This element MUST be conveyed as the root element in any instance document based on this Schema expression</element-documentation> </files> </dir> </dir> <dir name="json-schema"> <dir name="common"> <file type="CABIE" name="UBL-CommonAggregateComponents-2.1.json" syntax="JSON" namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"/> <file type="CBBIE" name="UBL-CommonBasicComponents-2.1.json" syntax="JSON" namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"/> <file type="QDT" name="UBL-QualifiedDataTypes-2.1.json" syntax="JSON" namespace="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDataTypes-2"/> <file type="UDT" name="UBL-UnqualifiedDataTypes-2.1.json" syntax="JSON" namespace="urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2"/> <file type="EXT" name="UBL-CommonExtensionComponents-2.1.json" syntax="JSON" namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"> <declaration> "UBLExtensions": { "title": "UBLExtensions", "description": "An optional set of extensions to the committee model", "items": { "$ref": "../common/UBL-CommonExtensionComponents-2.1.json#/definitions/UBLExtensions" }, "maxItems": 1, "minItems": 1, "additionalProperties": false, "type": "array" }, </declaration> </file> </dir> <dir name="maindoc"> <files type="DABIE" name="UBL-%n-2.1.json" syntax="JSON" namespace="urn:oasis:names:specification:ubl:schema:xsd:%n-2"/> </dir> </dir> </schema> </configuration>
The UBL 2.2 Signature Extension configuration file is as follows:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration [ <!ENTITY versionDisplay "2.1 OS"> <!ENTITY versionDirectory "os-UBL-2.1"> <!ENTITY versionDate "04 November 2013"> ]> <configuration xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <ndr> <name-abbreviations> <abbreviation short="CV2">Card Verification Value</abbreviation> <abbreviation short="ID">Identifier</abbreviation> <abbreviation short="URI">Uniform Resource Identifier</abbreviation> <abbreviation short="UNDG">United Nations Development Group</abbreviation> <abbreviation short="UBL">Universal Business Language</abbreviation> <abbreviation short="UUID">Universally Unique Identifier</abbreviation> <abbreviation short="XPath">XML Path Language</abbreviation> </name-abbreviations> <den-abbreviations> <abbreviation short="CV2">Card Verification Value</abbreviation> <abbreviation short="URI">Uniform Resource Identifier</abbreviation> <abbreviation short="UNDG">United Nations Development Group</abbreviation> <abbreviation short="UBL">Universal Business Language</abbreviation> <abbreviation short="UUID">Universally Unique Identifier</abbreviation> <abbreviation short="XPath">XML Path Language</abbreviation> </den-abbreviations> <equivalences> <equivalence> <primary-noun>URI</primary-noun> <representation-term>Identifier</representation-term> </equivalence> <equivalence> <primary-noun>UUID</primary-noun> <representation-term>Identifier</representation-term> </equivalence> </equivalences> <fields-allowing-excess-space> <field-name>Definition</field-name> <field-name>Examples</field-name> <field-name>EditorsNotes</field-name> </fields-allowing-excess-space> <types> <type>Amount</type> <type>Binary Object</type> <type>Code</type> <type>Date Time</type> <type>Date</type> <type>Graphic</type>t <type>Identifier</type> <type>Indicator</type> <type>Measure</type> <type>Name</type> <type>Numeric</type> <type>Percent</type> <type>Picture</type> <type>Quantity</type> <type>Rate</type> <type>Sound</type> <type>Text</type> <type>Time</type> <type>Value</type> <type>Video</type> </types> </ndr> <schema version="2.1"> <comment> Library: OASIS Universal Business Language (UBL) &versionDisplay; http://docs.oasis-open.org/ubl/&versionDirectory;/ Release Date: &versionDate; Module: %f Generated on: %z Copyright (c) OASIS Open 2013. All Rights Reserved. </comment> <copyright position="end"> OASIS takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on OASIS's procedures with respect to rights in OASIS specifications can be found at the OASIS website. Copies of claims of rights made available for publication and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementors or users of this specification, can be obtained from the OASIS Executive Director. OASIS invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights which may cover technology that may be required to implement this specification. Please address the information to the OASIS Executive Director. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to OASIS, except as needed for the purpose of developing OASIS specifications, in which case the procedures for copyrights defined in the OASIS Intellectual Property Rights document must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by OASIS or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. </copyright> <type-documentation> <ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2"> <ccts:ComponentType>ComponentType</ccts:ComponentType> <ccts:DictionaryEntryName>DictionaryEntryName</ccts:DictionaryEntryName> <ccts:Version>Version</ccts:Version> <ccts:Definition>Definition</ccts:Definition> <ccts:Cardinality>Cardinality</ccts:Cardinality> <ccts:ObjectClassQualifier>ObjectClassQualifier</ccts:ObjectClassQualifier> <ccts:ObjectClass>ObjectClass</ccts:ObjectClass> <ccts:PropertyTermQualifier>PropertyTermQualifier</ccts:PropertyTermQualifier> <ccts:PropertyTerm>PropertyTerm</ccts:PropertyTerm> <ccts:AssociatedObjectClass>AssociatedObjectClass</ccts:AssociatedObjectClass> <ccts:RepresentationTerm>RepresentationTerm</ccts:RepresentationTerm> <ccts:DataTypeQualifier>DataTypeQualifier</ccts:DataTypeQualifier> <ccts:DataType>DataType</ccts:DataType> <ccts:AlternativeBusinessTerms>AlternativeBusinessTerms</ccts:AlternativeBusinessTerms> <ccts:Examples>Examples</ccts:Examples> </ccts:Component> </type-documentation> <dir name="xsd" runtime-name="xsdrt"> <dir name="common"> <file type="XABIE" name="UBL-CommonSignatureComponents-2.1.xsd" abie="UBLDocumentSignatures" namespace="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2"/> <file type="SABIE" name="UBL-SignatureAggregateComponents-2.1.xsd" prefix="sac" namespace="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2"> <imports> <!-- ===== Incorporate W3C signature specification--> <xsd:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="UBL-xmldsig-core-schema-2.1.xsd"/> <!-- ===== Incorporate ETSI signature specifications--> <xsd:import namespace="http://uri.etsi.org/01903/v1.3.2#" schemaLocation="UBL-XAdESv132-2.1.xsd"/> <xsd:import namespace="http://uri.etsi.org/01903/v1.4.1#" schemaLocation="UBL-XAdESv141-2.1.xsd"/> </imports> <elements xmlns:ds="http://www.w3.org/2000/09/xmldsig#" abie="SignatureInformation"> <xsd:element ref="ds:Signature" minOccurs="0" maxOccurs="1"> <xsd:annotation> <xsd:documentation>This is a single digital signature as defined by the W3C specification.</xsd:documentation> </xsd:annotation> </xsd:element> </elements> </file> <file type="SBBIE" name="UBL-SignatureBasicComponents-2.1.xsd" prefix="sbc" namespace="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2"/> </dir> </dir> </schema> </configuration>
Consider the example of a return authorization request and response pair of business documents. These documents are not modeled as part of UBL, yet you might need such documents in your interactions with your trading partners. Using business objects from the UBL common library, say for example the identification of parties, will help in the construction of your additional documents so that your back end is dealing the same way with the same business objects found in all documents. Having schemas for these additional documents is as important as having schemas for the UBL documents. The Google spreadsheet at https://docs.google.com/spreadsheets/d/1HdkOhKBX5Guwyx5z4Ol6gjfY3QYQQ4uPxue36X5LilE/view has this CCTS model.
Consider also the example of the existing UBL invoice. When writing an invoice for a particular trading partner you may need to include the information from a timesheet. In the UBL 2.1 library there are no timesheet constructs. Yet when you submit your invoice, your trading partner is expecting to receive in that invoice a day-by-day and task-by-task breakdown of the hours incurred. An extension structure can be designed and implemented as a set of schema fragments in which this information can be captured for any UBL invoice (or any other UBL document for that matter). This non-standard structure is a descendant of the standardized extension point found at the beginning of the UBL document-level invoice structure (and the beginning of every document-level structure in UBL). The Google spreadsheet at https://docs.google.com/spreadsheets/d/1iEAfAF-JF_rkXI8epVF5sv7Qr5NOx7wq8EPwZqptTLU/view has this CCTS model.
The one trading partner expecting the timesheet information needs to be assured the
information supplied is correctly structured, thus they would incorporate the extension
schema fragments in their environment, ready to validate the incoming instances treating the
timesheet information as integral information and not foreign content. This is done simply
by adding a single <xsd:import>
statement of the extension schema into
the extension content data type schema fragment. Other trading partners have no interest in
such details, so they would not bother incorporating the schema fragments in their
environment. Nevertheless, they are already equipped to receive the augmented document as
the standardized structures blindly accept unrecognized foreign content that is correctly
used under the extension point.
The above examples of adding new documents to UBL and creating an extension for UBL are
in the ubl/
demonstration subdirectory. The Google spreadsheet at https://docs.google.com/spreadsheets/d/1u4LTxyFvJoc2YxNfNCGXBTlH7yndc0TP4fD2XpFMjM8/view has the CCTS model for UBL 2.1.
The bde/
demonstration subdirectory recreates the OASIS Business
Document Envelope set of schemas. The Google spreadsheet at https://docs.google.com/spreadsheets/d/1TQ597-7MBLr6RwDBg2kFLx8sgO51xk6K-wpTDUEN9Uc/view has the CCTS model for this vocabulary.
Finally, consider the example of an invoicing project that needs only the UBL invoice, not any of the other 64 document types. Moreover, it may need only part of the UBL invoice is needed. Creating a subset schema with only the desired components produces an artefact suitable for both validation and for constraining data entry. The Google spreadsheet at https://docs.google.com/spreadsheets/d/1wJFeWRQ8g70ZyYL_thao-4nSB0xeWGMgTcxnSnfvV6c/view has the “Subset Test” column populated with values indicating the cardinality of the item when used in the subset. Crane’s programs are invoked indicating that only the Invoice is to be created, the transformed name of the column “SubsetTest” for cardinalities, and the flag that unspecified cardinality implies the item is not included in the subset.
In command-line parameters transform the name of the column by removing all non-XML Name characters (e.g. spaces, punctuation) leaving only a contiguous string of letters and numbers.
The current version of this environment [gc2obdndr] unpacks to create the following files, starting with the stylesheet and the documentation in the base directory:
Crane-gc2obdndr/Crane-checkgc4obdndr.xsl Crane-gc2obdndr/Crane-gc2obdndr.xsl Crane-gc2obdndr/Crane-gc2obdsummary.xsl Crane-gc2obdndr/Crane-mergegc.xsl Crane-gc2obdndr/Crane-normalizegc.xsl Crane-gc2obdndr/CreatingSchemasWithOBDNDR.html Crane-gc2obdndr/obdrevprocess.png Crane-gc2obdndr/readme-Crane-checkgc4obdndr.txt Crane-gc2obdndr/readme-Crane-gc2obdndr.txt Crane-gc2obdndr/readme-Crane-gc2obdsummary.txt Crane-gc2obdndr/readme-Crane-mergegc.txt Crane-gc2obdndr/readme-Crane-normalizegc.txt
The support/
directory contains stylesheet fragments referenced by
the base stylesheets:
Crane-commonjson.xsl Crane-commonndr.xsl Crane-utilndr.xsl checkgc4obdndr-model.xsl checkgc4obdndr-report.xsl checkgc4obdndr-rules.xsl checkgc4obdndr-schema.xsl ndrSubset.xsl udt4html.xsl
The xsd/
directory contains pro-forma schema fragments available to
be used in new deployments:
Crane-gc2obdndr/xsd/OBD-UnqualifiedDataTypes.xsd Crane-gc2obdndr/xsd/CCTS_CCT_SchemaModule.xsd
The json/
directory contains pro-forma schema fragments available to
be used in new deployments:
Crane-gc2obdndr/xsd/OBD-UnqualifiedDataTypes.json Crane-gc2obdndr/xsd/CCTS_CCT_SchemaModule.json
Note that the saxon9he/
directory includes a copy of the free
saxon9he.jar
file and its necessary notices, downloaded from Saxon
[Saxon] Home Edition (HE) XSLT processor package at http://saxon.sf.net
:
Crane-gc2obdndr/saxon9he/saxon9he.jar Crane-gc2obdndr/saxon9he/notices/CERN.txt Crane-gc2obdndr/saxon9he/notices/JAMESCLARK.txt Crane-gc2obdndr/saxon9he/notices/LICENSE.txt Crane-gc2obdndr/saxon9he/notices/THAI.txt Crane-gc2obdndr/saxon9he/notices/UNICODE.txt
The ubl/
directory includes everything needed to recreate the UBL
schema constructs and to run the demonstration that creates an additional document schema
and a document extension schema:
Crane-gc2obdndr/ubl/config-myext.xml - extension generation configuration Crane-gc2obdndr/ubl/config-rar.xml - additional document generation configuration Crane-gc2obdndr/ubl/config-ubl-2.1-ext.xml - signature extension generation configuration Crane-gc2obdndr/ubl/config-ubl-2.1.xml - UBL 2.1 generation configuration Crane-gc2obdndr/ubl/createMyExt.bat - extension generation invocation for Windows Crane-gc2obdndr/ubl/createMyExt.sh - extension generation invocation for Unix Crane-gc2obdndr/ubl/createRAR.bat - document generation invocation for Windows Crane-gc2obdndr/ubl/createRAR.sh - document generation invocation for Unix Crane-gc2obdndr/ubl/createUBL.bat - UBL 2.1 generation invocation for Windows Crane-gc2obdndr/ubl/createUBL.sh - UBL 2.1 generation invocation for Unix Crane-gc2obdndr/ubl/doall.bat - demonstration invocation for Windows Crane-gc2obdndr/ubl/doall.sh - demonstration invocation for Unix Crane-gc2obdndr/ubl/UBL-2.1-CVA-Skeleton.cva - pro-forma CVA for UBL 2.1 code lists
The ubl/json-schema/common
directory includes the UBL JSON schema
fragments not generated by this environment:
CCTS_CCT_SchemaModule-2.1.json UBL-CommonExtensionComponents-2.1.json UBL-ExtensionContentDataType-2.1.json UBL-UnqualifiedDataTypes-2.1.json
The mod/
directory contains the serialization of the document models
in genericode, and the subdirectories contain the additional document and document extension
models in OpenOffice ODS format:
Crane-gc2obdndr/ubl/mod/mydoc/MyRARequestResponse.ods - additional document model spreadsheet Crane-gc2obdndr/ubl/mod/myext/MyTimesheetExtension.ods - extension document model spreadsheet Crane-gc2obdndr/ubl/mod/MyRARequestResponse-Entities.gc - additional document model in genericode Crane-gc2obdndr/ubl/mod/MyTimesheetExtension-Entities.gc - extension document model in genericode Crane-gc2obdndr/ubl/mod/UBL-Entities-2.0.gc - UBL 2.0 BIEs in genericode Crane-gc2obdndr/ubl/mod/UBL-Entities-2.1.gc - UBL 2.1 BIEs in genericode Crane-gc2obdndr/ubl/mod/UBL-Signature-Entities-2.1.gc - UBL signature BIEs in genericode
The val/
directory contains an environment with test instances and
invocations to validate the test instances (note that this is essentially the same as in the
UBL distribution except that the XSLT scripts invoke the saxon9he already part of this
distribution:
Crane-gc2obdndr/ubl/val/CatalogManager.properties - library for XSD validation Crane-gc2obdndr/ubl/val/Invoice.json - sample valid instance in JSON Crane-gc2obdndr/ubl/val/InvoiceBad.json - sample invalid instance in JSON Crane-gc2obdndr/ubl/val/InvoiceExt.xml - sample valid instance with custom extension Crane-gc2obdndr/ubl/val/InvoiceExtBad.xml - sample invalid instance with custom extension Crane-gc2obdndr/ubl/val/jsonvalidate.py - application for JSON schema validation Crane-gc2obdndr/ubl/val/MyRARequest.xml - sample valid custom document Crane-gc2obdndr/ubl/val/MyRARequestBad.xml - sample invalid custom document Crane-gc2obdndr/ubl/val/MyRAResponse.xml - sample valid custom document Crane-gc2obdndr/ubl/val/MyRAResponseBad.xml - sample invalid custom document Crane-gc2obdndr/ubl/val/resolver.jar - library for XSD validation Crane-gc2obdndr/ubl/val/test.bat - invocation of all validation in Windows Crane-gc2obdndr/ubl/val/test.sh - invocation of all validation in Unix Crane-gc2obdndr/ubl/val/UBL-DefaultDTQ-2.1.xsl - copy of UBL data type qualifications Crane-gc2obdndr/ubl/val/validate.bat - invocation of UBL validation in Windows Crane-gc2obdndr/ubl/val/validate.sh - invocation of UBL validation in Unix Crane-gc2obdndr/ubl/val/validatejson.bat - invocation of JSON validation in Windows Crane-gc2obdndr/ubl/val/validatejson.sh - invocation of JSON validation in Unix Crane-gc2obdndr/ubl/val/w3cschema-cygwin.sh - invocation of XSD validation in Cygwin Crane-gc2obdndr/ubl/val/w3cschema.bat - invocation of XSD validation in Windows Crane-gc2obdndr/ubl/val/w3cschema.sh - invocation of XSD validation in Unix Crane-gc2obdndr/ubl/val/xercesImpl.jar - library for XSD validation Crane-gc2obdndr/ubl/val/xjparse.jar - library for XSD validation Crane-gc2obdndr/ubl/val/xslt.bat - invocation of XSLT process in Windows Crane-gc2obdndr/ubl/val/xslt.sh - invocation of XSLT process in Unix
The SubsetTest/
directory contains three subdirectories. The
mod/
subdirectory has the serialization of the document models in
genericode and OpenOffice ODS format. The annotated/
subdirectory has
artefacts annotated with an indication of what has been removed from the model by
subsetting. The minimal/
subdirectory has artefacts without annotations
and so is the minimal expression of the subset model.
Crane-gc2obdndr/SubsetTest/config-ubl-2.1-test-no-ndr.xml - schema generation without NDR checking Crane-gc2obdndr/SubsetTest/config-ubl-2.1-test-no-schema.xml - NDR checking without schema generation Crane-gc2obdndr/SubsetTest/createSubsetTest.bat - demonstration invocation in Windows Crane-gc2obdndr/SubsetTest/createSubsetTest.sh - demonstration invocation in Unix Crane-gc2obdndr/SubsetTest/mod/SubsetTest-Entities.gc - subset BIEs in genericode Crane-gc2obdndr/SubsetTest/mod/Subset test of UBL 2.1.ods - subset BIEs spreadsheet Crane-gc2obdndr/SubsetTest/annotated/ - results with change annotations Crane-gc2obdndr/SubsetTest/minimal/ - results without change annotations
The xsd/
and xsdrt/
directories under each of the
ubl/
and SubsetTest/
contain copies of the UBL 2.1
schema fragments that are not created by this demonstration environment (note that a custom
version of the UBL-ExtensionContentDataType-2.1.xsd
file is included in
ubl/
, hand-crafted to point to the generated extension environment of
the demonstration):
CCTS_CCT_SchemaModule-2.1.xsd UBL-CommonExtensionComponents-2.1.xsd UBL-CommonSignatureComponents-2.1.xsd UBL-CoreComponentParameters-2.1.xsd UBL-ExtensionContentDataType-2.1-original.xsd UBL-ExtensionContentDataType-2.1.xsd UBL-QualifiedDataTypes-2.1.xsd UBL-SignatureAggregateComponents-2.1.xsd UBL-SignatureBasicComponents-2.1.xsd UBL-UnqualifiedDataTypes-2.1.xsd UBL-XAdESv132-2.1.xsd UBL-XAdESv141-2.1.xsd UBL-xmldsig-core-schema-2.1.xsd
The bde/
directory includes everything needed to recreate the
Business Document Envelope schema constructs:
Crane-gc2obdndr/bde/config-bde-1.1.xml - BDE generation configuration Crane-gc2obdndr/bde/createBDE.bat - demonstration invocation in Windows Crane-gc2obdndr/bde/createBDE.sh - demonstration invocation in Unix Crane-gc2obdndr/bde/mod/BDE-Entities-1.1.gc - BDE BBIEs in genericode
In ubl/
the createUBL.bat
and
createUBL.sh
invocations produce the base UBL validation artefacts
related to the business objects. The hand-crafted and UN/CEFACT schema fragments are not
recreated by this process, they are simply copied from the latest UBL 2.1
distribution.
One hand-crafted UBL schema artefact that needs to be modified, and has been modified in
this demonstration, is the one that imports all of the extension document apex schema
fragments. The original version is included in this package and shows only the
committee-standardized signature extension being imported. The modified fragment (using the
original fragment’s UBL-ExtensionContentDataType-2.1.xsd
file
name) contains an additional import directive for the timesheet extension. No other changes
are needed for this fragment, only the addition of import directives.
The createMyExt.bat
and createMyExt.sh
invocations
produce the document extension schema fragments.
The createRAR.bat
and createRAR.sh
invocations
produce the additional document schema fragments.
The doall.bat
and doall.sh
invocations run all
three creation and testing scripts.
The demonstration artefacts can then be generated and tested by the single invocation of
“doall
” from the ubl/
directory, based
on either being in a Windows environment:
cd ubl doall.bat
... or being in a Linux/BSD/Unix environment:
cd ubl sh doall.sh
The final test demonstrates that the artefacts were correctly created and engaged. This test shows the one error-free JSON instance and three error-free XML instances not to have errors, and the three invalid XML instances (named “Bad”) to have expected validation errors (note the test is run once with the fully-commented schemas and once with the runtime schemas):
############################################################ Validating InvoiceExt.xml ############################################################ ============== Phase 1: XSD schema validation ============== No schema validation errors. ============ Phase 2: XSLT code list validation ============ No code list validation errors. ############################################################ Validating InvoiceExtBad.xml ############################################################ ============== Phase 1: XSD schema validation ============== Attempting validating, namespace-aware parse Error:file:///T:/Crane-gc2obdndr-test/ubl/val/ InvoiceExtBad.xml:14:19:cvc-complex-type.2.4.a: Invalid content was found starting with element 'mxa:Taskx'. One of '{"urn:X-MyCompany:xsd:MyTimesheetExtension: AggregateComponents":Task}' is expected. Parse succeeded (1.653) with 1 error and no warnings. ############################################################ Validating MyRARequest.xml ############################################################ ============== Phase 1: XSD schema validation ============== No schema validation errors. ============ Phase 2: XSLT code list validation ============ No code list validation errors. ############################################################ Validating MyRARequestBad.xml ############################################################ ============== Phase 1: XSD schema validation ============== Attempting validating, namespace-aware parse Error:file:///T:/Crane-gc2obdndr-test/ubl/val/ MyRARequestBad.xml:15:29:cvc-complex-type.2.4.a: Invalid content was found starting with element 'rqb:RequestedQuantityx'. One of '{"urn:X-MyCompany:xsd: MyRARequestResponse:BasicComponents":RequestedQuantity}' is expected. Parse succeeded (1.622) with 1 error and no warnings. ############################################################ Validating MyRAResponse.xml ############################################################ ============== Phase 1: XSD schema validation ============== No schema validation errors. ============ Phase 2: XSLT code list validation ============ No code list validation errors. ############################################################ Validating MyRAResponseBad.xml ############################################################ ============== Phase 1: XSD schema validation ============== Attempting validating, namespace-aware parse Error:file:///T:/Crane-gc2obdndr-test/ubl/val/ MyRAResponseBad.xml:19:27:cvc-complex-type.2.4.a: Invalid content was found starting with element 'rsb:GrantedQuantityx'. One of '{"urn:X-MyCompany:xsd: MyRARequestResponse:BasicComponents":GrantedQuantity}' is expected. Parse succeeded (1.642) with 1 error and no warnings. ############################################################ Validating InvoiceExt.xml ############################################################ ============== Phase 1: XSD schema validation ============== No schema validation errors. ============ Phase 2: XSLT code list validation ============ No code list validation errors. ############################################################ Validating InvoiceExtBad.xml ############################################################ ============== Phase 1: XSD schema validation ============== Attempting validating, namespace-aware parse Error:file:///T:/Crane-gc2obdndr-test/ubl/val/ InvoiceExtBad.xml:14:19:cvc-complex-type.2.4.a: Invalid content was found starting with element 'mxa:Taskx'. One of '{"urn:X-MyCompany:xsd:MyTimesheetExtension: AggregateComponents":Task}' is expected. Parse succeeded (1.202) with 1 error and no warnings. ############################################################ Validating MyRARequest.xml ############################################################ ============== Phase 1: XSD schema validation ============== No schema validation errors. ============ Phase 2: XSLT code list validation ============ No code list validation errors. ############################################################ Validating MyRARequestBad.xml ############################################################ ============== Phase 1: XSD schema validation ============== Attempting validating, namespace-aware parse Error:file:///T:/Crane-gc2obdndr-test/ubl/val/ MyRARequestBad.xml:15:29:cvc-complex-type.2.4.a: Invalid content was found starting with element 'rqb:RequestedQuantityx'. One of '{"urn:X-MyCompany:xsd: MyRARequestResponse:BasicComponents":RequestedQuantity}' is expected. Parse succeeded (1.352) with 1 error and no warnings. ############################################################ Validating MyRAResponse.xml ############################################################ ============== Phase 1: XSD schema validation ============== No schema validation errors. ============ Phase 2: XSLT code list validation ============ No code list validation errors. ############################################################ Validating MyRAResponseBad.xml ############################################################ ============== Phase 1: XSD schema validation ============== Attempting validating, namespace-aware parse Error:file:///T:/Crane-gc2obdndr-test/ubl/val/ MyRAResponseBad.xml:19:27:cvc-complex-type.2.4.a: Invalid content was found starting with element 'rsb:GrantedQuantityx'. One of '{"urn:X-MyCompany:xsd: MyRARequestResponse:BasicComponents":GrantedQuantity}' is expected. Parse succeeded (1.272) with 1 error and no warnings. ############################################################ Validating Invoice.json ############################################################ No schema validation errors. ############################################################ Validating InvoiceBad.json ############################################################ Validation error: u'DateContent' is a required property validator: required path: deque([u'Invoice', 0, u'IssueDate', 0]) cause: None context: [] validator_value: [u'DateContent'] schema_path: deque([u'properties', u'Invoice', u'items', u'properties', u'IssueDate', u'items', u'required']) parent: None
A special note regarding the validation of the JSON test instance. At the time of
writing this, the library on which the Python application jsonvalidate.py
is based does not work on a Windows platform but does work on Unix platforms. It may be that
the Python distribution you are using includes a version of the library that does not fail
under Windows. There is a link in the Python source to the bug ticket reporting the
problem.
In SubsetTest/
the createSubsetTest.bat
and
createSubsetTest.sh
invocations produce the subsets of UBL 2.1.
Contrast the annotated and minimal versions of the XSD files and HTML reports to see how the absent content is documented in the artefacts.
OASIS genericode [genericode] is the specification of an XML vocabulary to express sparsely-populated tables. Originally developed to express the information associated with code lists (e.g. currency code lists, country code lists, etc.), genericode is ideally suited to express the sparsely-populated table of CCTS information associated with document models using the Business Document NDR.
Crane’s genericode translation package [ods2obdgc] (not included in the OBD NDR package) contains a skeleton OBD NDR spreadsheet in ODS format. The UBL committee has also published an online Google spreadsheet empty skeleton model with which to create CCTS models of documents. These tools were used to create the spreadsheets in the demonstration environment of this package.
If you choose to use any other means to model the OBD NDR information in your documents, the tools in this environment rely on you expressing the model contents in genericode XML so that this environment is independent of the original modeling expression. You must use the same genericode column value labels as the column headers used in the proforma ODS spreadsheet.
However the model’s genericode expression is created, it should be checked for
completeness before attempting to produce the runtime validation artefacts. The
Crane-checkgc4obdndr.xsl
stylesheet reads the same configuration file
and genericode inputs used for creating the artefacts. This stylesheet reports on any
inconsistencies or incomplete information that would be needed to produce a proper set of
outputs. When requested, this stylesheet will also output DocBook tables summarizing
differences beteen old and new revisions of a model.
See the OBD NDR checker stylesheet documentation for the invocation parameters available for processing.
When using OBD NDR, the runtime validation artefacts are W3C XML Schemas [XSD] for a document’s structural constraints and OASIS Context/value
Association files [CVA] for a document’s value constraints. The
Crane-gc2obdndr.xsl
stylesheet reads a configuration file and
genericode inputs and produces those validation artefacts related to the model (which are
not all of the artefacts needed to validate instances).
The schema generator does not validate that the model expressed in genericode is self consistent and conforms to the OBD NDR 3.0 rules. If there are errors in this expression of the model, there will be errors in the generated schemas. The corollary is that if you find errors in the generated schemas, these are likely to be caused by errors in the expression of the model. Of course if there are no corresponding errors in the model according to the running of the model checker, then there is a problem with the generator.
See the Translating genericode to OBD NDR stylesheet documentation for the invocation parameters available for processing.
The Crane-gc2obdsummary.xsl
stylesheet produces a hyperlinked HTML
report that gives users a quick method of perusing a CCTS model.
See the Summarizing OBD NDR stylesheet documentation for the invocation parameters available for processing.
The xsd/
directory includes the following two files:
CCTS_CCT_SchemaModule.xsd
a copy of the UN/CEFACT schema module declaring base core component types for CCTS 2.01; and
OBD-UnqualifiedDataTypes.xsd
a set of declarations of unqualified data types based on CCTS base core component types that:
leverage XSD data types for date and time, date, time and boolean values core component types; and
mandate the presence of the following attributes for supplementary components:
(AmountType)/@currencyID
,
(BinaryObjectType)/@mimeCode
,
(GraphicType)/@mimeCode
,
(PictureType)/@mimeCode
,
(SoundType)/@mimeCode
,
(VideoType)/@mimeCode
, and
(MeasureType)/@unitCode
.
The json/
directory includes JSON schema equivalents to these two
files.
The val/
directory contains a copy of the UBL validation tools, and six
test instances: two being a UBL sample invoice document with a (thematically irrelevant)
timesheet extension and four being a custom document exploiting the UBL common library
definition of a party. In each pair of documents, one of the documents has no constraint
violations and validates without error, while the other has misspelled element names in order
to trigger a validation error to prove the schemas are in play.
In each of these example instances, note the careful use of namespaces and their associated prefixes. Remember, of course, the prefixes chosen are inconsequential and need not be the same as the prefixes used in the schemas.
The test invoice documents InvoiceExt.xml
and
InvoiceExtBad.xml
begin with a timesheet extension that use both common
and foreign constructs:
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:mxd="urn:X-MyCompany:xsd:MyTimesheetExtension" xmlns:mxa="urn:X-MyCompany:xsd:MyTimesheetExtension:AggregateComponents" xmlns:mxb="urn:X-MyCompany:xsd:MyTimesheetExtension:BasicComponents"> <ext:UBLExtensions> <ext:UBLExtension> <!-- standardized extension metadata inserted here if desired --> <!-- followed by the extension content with a foreign apex construct --> <ext:ExtensionContent> <mxd:Timesheet> <cbc:StartDate>2011-10-01</cbc:StartDate> <cbc:EndDate>2011-10-31</cbc:EndDate> <mxa:TimesheetParty> <mxa:TimesheetEntry> <cbc:Date>2011-10-12</cbc:Date> <mxb:HoursNumeric>4</mxb:HoursNumeric> <mxa:Task> <cbc:Description>Teleconference</cbc:Description> <mxb:HoursNumeric>1</mxb:HoursNumeric> </mxa:Task> <mxa:Task> <cbc:Description>Development</cbc:Description> <mxb:HoursNumeric>3</mxb:HoursNumeric> </mxa:Task> </mxa:TimesheetEntry> <cac:Party> <cac:PartyIdentification> <cbc:ID>Ken</cbc:ID> </cac:PartyIdentification> </cac:Party> </mxa:TimesheetParty> </mxd:Timesheet> </ext:ExtensionContent> </ext:UBLExtension> </ext:UBLExtensions> <cbc:UBLVersionID>2.0</cbc:UBLVersionID> <!-- remaining invoice content continues here -->
The custom documents MyRARequest.xml
and
MyRARequestBad.xml
are short and contain both common and foreign
constructs:
<ReturnAuthorizationRequest xmlns="urn:X-MyCompany:xsd:MyReturnAuthorizationRequest" xmlns:rqa="urn:X-MyCompany:xsd:MyRARequestResponse:AggregateComponents" xmlns:rqb="urn:X-MyCompany:xsd:MyRARequestResponse:BasicComponents" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"> <rqb:RequestDate>2011-11-15</rqb:RequestDate> <rqa:RequestingParty> <cac:Contact> <cbc:ElectronicMail>joeBloggs@example.com</cbc:ElectronicMail> </cac:Contact> </rqa:RequestingParty> <rqa:ReturnRequested> <rqb:RequestedQuantity>3</rqb:RequestedQuantity> <cac:OrderLineReference> <cbc:LineID>1</cbc:LineID> <cac:OrderReference> <cbc:ID>20111110-0112</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> </rqa:ReturnRequested> </ReturnAuthorizationRequest>
<ReturnAuthorizationRequest xmlns="urn:X-MyCompany:xsd:MyReturnAuthorizationRequest" xmlns:rqa="urn:X-MyCompany:xsd:MyRARequestResponse:AggregateComponents" xmlns:rqb="urn:X-MyCompany:xsd:MyRARequestResponse:BasicComponents" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"> <rqb:RequestDate>2011-11-15</rqb:RequestDate> <rqa:RequestingParty> <cac:Contact> <cbc:ElectronicMail>joeBloggs@example.com</cbc:ElectronicMail> </cac:Contact> </rqa:RequestingParty> <rqa:ReturnRequested> <rqb:RequestedQuantityx>3</rqb:RequestedQuantityx> <cac:OrderLineReference> <cbc:LineID>1</cbc:LineID> <cac:OrderReference> <cbc:ID>20111110-0112</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> </rqa:ReturnRequested> </ReturnAuthorizationRequest>
The custom documents MyRAResponse.xml
and
MyRAResponseBad.xml
are short and contain both common and foreign
constructs:
<ReturnAuthorizationResponse xmlns="urn:X-MyCompany:xsd:MyReturnAuthorizationResponse" xmlns:rsa="urn:X-MyCompany:xsd:MyRARequestResponse:AggregateComponents" xmlns:rsb="urn:X-MyCompany:xsd:MyRARequestResponse:BasicComponents" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"> <cbc:ResponseDate>2011-11-15</cbc:ResponseDate> <rsb:ReturnGrantedIndicator>true</rsb:ReturnGrantedIndicator> <rsa:AuthorizingParty> <cac:PartyIdentification> <cbc:ID>EMP0987</cbc:ID> </cac:PartyIdentification> </rsa:AuthorizingParty> <rsa:RequestDocumentReference> <cbc:ID>17134</cbc:ID> </rsa:RequestDocumentReference> <rsa:ReturnGranted> <rsb:GrantedQuantity>2</rsb:GrantedQuantity> <rsa:ReturnRequested> <rsb:RequestedQuantity>3</rsb:RequestedQuantity> <cac:OrderLineReference> <cbc:LineID>1</cbc:LineID> <cac:OrderReference> <cbc:ID>20111110-0112</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> </rsa:ReturnRequested> </rsa:ReturnGranted> </ReturnAuthorizationResponse>
<ReturnAuthorizationResponse xmlns="urn:X-MyCompany:xsd:MyReturnAuthorizationResponse" xmlns:rsa="urn:X-MyCompany:xsd:MyRARequestResponse:AggregateComponents" xmlns:rsb="urn:X-MyCompany:xsd:MyRARequestResponse:BasicComponents" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"> <cbc:ResponseDate>2011-11-15</cbc:ResponseDate> <rsb:ReturnGrantedIndicator>true</rsb:ReturnGrantedIndicator> <rsa:AuthorizingParty> <cac:PartyIdentification> <cbc:ID>EMP0987</cbc:ID> </cac:PartyIdentification> </rsa:AuthorizingParty> <rsa:RequestDocumentReference> <cbc:ID>17134</cbc:ID> </rsa:RequestDocumentReference> <rsa:ReturnGranted> <rsb:GrantedQuantityx>2</rsb:GrantedQuantityx> <rsa:ReturnRequested> <rsb:RequestedQuantity>3</rsb:RequestedQuantity> <cac:OrderLineReference> <cbc:LineID>1</cbc:LineID> <cac:OrderReference> <cbc:ID>20111110-0112</cbc:ID> </cac:OrderReference> </cac:OrderLineReference> </rsa:ReturnRequested> </rsa:ReturnGranted> </ReturnAuthorizationResponse>
This environment will create an OASIS context/value association file [CVA] for every configuration file entry of type “CVA
”.
Typically there will be only zero or one such file in the configuration, as all such files
will perform the same analysis on the input genericode files.
When present, the CVA configuration file entry specifies the URI of a skeleton CVA file
used as a proforma output document. This skeleton file is schema-valid using the OASIS CVA XSD
schemas, however, the empty address=
attributes will be unacceptable to
downstream processing. Thus, the skeleton can only be used as a pro-forma to create the
production CVA. The skeleton is annotated with indications of which BBIEs of the model are to
have their XPath address included in the context, determined by their data type in the
<c:DataType xmlns:c="urn:X-Crane-gc2obdndr">
element. This environment
recognizes these annotations and replaces the address=
attributes with the
appropriate XSLT match pattern of XPath addresses, preserving the annotation as documentation
for the reader.
An example from UBL 2.1 found in ubl/UBL-2.1-CVA-Skeleton.cva
is for
the data type “Currency_ Code. Type”. The input skeleton CVA file contains the
element with the empty address=
attribute:
...xmlns:c="urn:X-Crane-gc2obdndr"... <Context values="Currency-2.0 Currency-2.1" metadata="cctsV2.01-code" address=""> <Annotation> <AppInfo> <c:DataType>Currency_ Code. Type</c:DataType> </AppInfo> </Annotation> </Context>
The output populated CVA file contains the corresponding element with a populated
address=
attribute:
<Context values="Currency-2.0 Currency-2.1" metadata="cctsV2.01-code" address="cbc:CurrencyCode | cbc:DocumentCurrencyCode | cbc:PaymentAlternativeCurrencyCode | cbc:PaymentCurrencyCode | cbc:PricingCurrencyCode | cbc:RequestedInvoiceCurrencyCode | cbc:SourceCurrencyCode | cbc:TargetCurrencyCode | cbc:TaxCurrencyCode"> <Annotation> <AppInfo> <c:DataType>Currency_ Code. Type</c:DataType> </AppInfo> </Annotation> </Context>
The creation of an XSLT stylesheet from the combination of a CVA file and its referenced
genericode files can be implemented using the Crane-cva2sch
package.
Many thanks to Stephen Green for identifying the need for this paper and the impetus to adapt an existing software project to accommodate these identified requirements.
[BDE-1.1] OASIS Business Document Envelope Version 1.1
[CCTS] Core Components Technical Specification Version 2.01 - 15 November 2003
[CVA] G. Ken Holman Context Value Association files
[ods2obdgc] Crane Softwrights Ltd. OpenOffice spreadsheet export to genericode
[gc2obdndr] Crane Softwrights Ltd. Genericode to UBL NDR artefacts
[genericode] Tony Coates genericode, OASIS Code List Representation Technical Committee repository
[Saxon] Michael Kay Saxon
[UBL NDR 3.0] UBL Naming and Design Rules Version 3.0 04 February 2015
[UBL-2.1] Universal Business Language Version 2.1 04 November 2013
[XSD] Henry S. Thomson, et al.XML Schema Part 1: Structures Second Edition 2004-03-18