OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

tag message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: Example of a potentially executable (XPath 2) Test Assertion for OASIS UBL XML Invoice


A bit more progress, comments welcome. I've been learning
quite a bit from this work which I could provide as feedback.

These TAs express some rules about invoice amounts for
OASIS UBL 2.0 which I'll send to the UBL-Dev list (then,
when more complete, to UBL TC as part of work for the
Human Interface SC).

I note the mix of both potentially executable TAs and prose
TAs since not all TAs seem feasible for execution. The issue
will be how to cater for both in an execution engine. Clearly
the latter will need a facility to pass in values as parameters.

Also there is the need to distinguish a prerequisite which is
just refering to another TA (or, indeed, perhaps a TA Set)
from a pure XPath prerequisite expression or a variable in the
prerequisite.

<?xml version="1.0" encoding="UTF-8"?>
<testAssertionSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:noNamespaceSchemaLocation="testAssertion-0-4.xsd"
id="des:sdg:ubl:2:ta:prototype:0-0-1" lg="xpath20">
    <header>
        <var name="ubl-invoice-2-0-schema">fn:doc(http://docs.oasis-open.org/ubl/os-UBL-2.0/xsd/common/UBL-CommonAggregateComponents-2.0.xsd)</var>
        <var name="ubl-invoice-2-0-instance">fn:doc(.)</var>
        <var name="count-tax-currency">count(distinct-values($ubl-invoice-2-0-instance/Invoice/cac:InvoiceLine/cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount/@currencyID))</var>
        <tag name="invoice"/>
    </header>
    <testAssertion id="INVTOT001">
        <normativeSource>
            <refSourceItem>$ubl-invoice-2-0-schema/xsd:schema/xsd:complexType[@name='MonetaryTotalType']/xsd:sequence[1]/xsd:element[1]/xsd:annotation[1]/xsd:documentation[1]/ccts:Component[1]/ccts:Definition[1]</refSourceItem>
        </normativeSource>
        <target>$ubl-invoice-2-0-instance/Invoice/cac:LegalMonetaryTotal[1]/cbc:LineExtensionAmount[1]</target>
        <prerequisite>$ubl-invoice-2-0-instance/Invoice/cac:InvoiceLine[1]/cbc:LineExtensionAmount[1]</prerequisite>
        <predicate>sum($ubl-invoice-2-0-instance/Invoice/cac:InvoiceLine/cbc:LineExtensionAmount)</predicate>
        <prescriptionLevel>preferred</prescriptionLevel>
        <tag name="invoice:total"/>
    </testAssertion>
    <testAssertion id="TAXINV001">
        <normativeSource></normativeSource>
        <target>$ubl-invoice-2-0-instance</target>
        <prerequisite>is-tax-invoice-001 = 'pass'</prerequisite>
        <predicate></predicate>
        <prescriptionLevel>mandatory</prescriptionLevel>
        <tag name="invoice:tax"/>
    </testAssertion>
    <testAssertion id="TAXINV002">
        <normativeSource><comment>general practice but no known
normative source</comment></normativeSource>
        <target>$count-tax-currency</target>
        <prerequisite>$count-tax-currency gt 0</prerequisite>
        <predicate>lt 2</predicate>
        <prescriptionLevel>mandatory</prescriptionLevel>
        <tag name="invoice:tax"/>
    </testAssertion>
    <testAssertion id="INVTAX003">
        <normativeSource>
            <refSourceItem></refSourceItem>
        </normativeSource>
        <target>sum($ubl-invoice-2-0-instance/Invoice/cac:TaxTotal/cbc:TaxAmount[1])</target>
        <prerequisite>is-tax-invoice-001 = 'pass' and TAXINV001 =
'pass' and TAXINV002 = 'pass'</prerequisite>
        <predicate>sum($ubl-invoice-2-0-instance/Invoice/cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount[1])</predicate>
        <prescriptionLevel>preferred</prescriptionLevel>
        <tag name="invoice:tax"/>
    </testAssertion>
    <testAssertionSet id="is-tax-invoice-001" definesNormativeProperty="true">
        <header>
            <normativePropertyTag>TaxInvoice</normativePropertyTag>
        </header>
        <testAssertion id="TAXINV001">
            <normativeSource><comment>general practice but no known
normative source</comment></normativeSource>
            <predicate>exists(ubl-invoice-2-0-instance//cbc:TaxAmount)</predicate>
            <prescriptionLevel>mandatory</prescriptionLevel>
            <tag name="invoice:tax"/>
        </testAssertion>
    </testAssertionSet>
    <testAssertionSet id="is-tax-invoice-002"
definesNormativeProperty="true" lg="en-us">
        <header>
            <normativePropertyTag>TaxInvoice</normativePropertyTag>
        </header>
        <testAssertion id="TAXINV002">
            <normativeSource><comment>is a tax invoice according to
most relevant tax rules</comment></normativeSource>
            <predicate>is a tax invoice</predicate>
            <prescriptionLevel>mandatory</prescriptionLevel>
            <tag name="invoice:tax"/>
        </testAssertion>
    </testAssertionSet>
</testAssertionSet>



Stephen D Green



2009/6/24 Stephen Green <stephen.green@documentengineeringservices.com>:
> Greetings
>
> Having fun with the markup. Here's an example I just sent to
> the UBL-Dev mail list for a potentially executable xpath2-bound
> test assertion for one of the calculation rules for a UBL 2.0
> Invoice. Looks very usable. Could see good take-up. Now starting
> to fully appreciate the TA progress. Thanks All. (Kind of feels
> like a eureka moment.)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <testAssertionSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  xsi:noNamespaceSchemaLocation="TestAssertionMarkup-0-4/testAssertion-0-4.xsd">
>   <testAssertion id="ta-example-001">
>       <var name="ubl-invoice-2-0-schema">http://docs.oasis-open.org/ubl/os-UBL-2.0/xsd/common/UBL-CommonAggregateComponents-2.0.xsd</var>
>       <normativeSource><refSourceItem>fn:doc($ubl-invoice-2-0-schema)/xsd:schema/xsd:complexType[64]/xsd:sequence[1]/xsd:element[1]/xsd:annotation[1]/xsd:documentation[1]/ccts:Component[1]/ccts:Definition[1]</refSourceItem></normativeSource>
>       <target>/default:Invoice/cac:LegalMonetaryTotal[1]/cbc:LineExtensionAmount[1]</target>
>       <prerequisite>/default:Invoice/cac:InvoiceLine[1]/cbc:LineExtensionAmount[1]</prerequisite>
>       <predicate>sum(/default:Invoice/cac:InvoiceLine/cbc:LineExtensionAmount)</predicate>
>       <prescriptionLevel>mandatory</prescriptionLevel>
>   </testAssertion>
>  <!--   <testAssertion id="ta-example-001">
>     <var name="ubl-invoice-2-0-schema">http://docs.oasis-open.org/ubl/os-UBL-2.0/xsd/common/UBL-CommonAggregateComponents-2.0.xsd</var>
>     <var name="ubl-invoice-2-0-instance">.</var>
>     <normativeSource>
>       <refSourceItem>fn:doc($ubl-invoice-2-0-schema)/xsd:schema/xsd:complexType[64]/xsd:sequence[1]/xsd:element[1]/xsd:annotation[1]/xsd:documentation[1]/ccts:Component[1]/ccts:Definition[1]</refSourceItem>
>     </normativeSource>
>     <target>fn:doc($ubl-invoice-2-0-instance)/default:Invoice/cac:LegalMonetaryTotal[1]/cbc:LineExtensionAmount[1]</target>
>     <prerequisite>fn:doc($ubl-invoice-2-0-instance)/default:Invoice/cac:InvoiceLine[1]/cbc:LineExtensionAmount[1]</prerequisite>
>     <predicate>sum(fn:doc($ubl-invoice-2-0-instance)/default:Invoice/cac:InvoiceLine/cbc:LineExtensionAmount)</predicate>
>     <prescriptionLevel>preferred</prescriptionLevel>
>   </testAssertion> -->
> </testAssertionSet>
>
>
> Best regards, Steve
>
> Stephen D Green
> Document Engineering Services Ltd
>


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]