Search Posts

Views: 624

JP PINT 正誤表

Nobuyuki SAMBUICHI
ISO/TC295 Audit data services/SG1 Semantic model Convener

1. Rounding amount

説明文が改悪されています。

fig9 1
— Peppol BIS Standard Invoice JP PINT Version 1.0
Syntax binding

IBT-114 Rounding amount (丸めるための金額)

Ver 0.9.3
The amount to be added to the invoice total to round the amount to be paid.
支払金額に丸めるために請求書の合計金額に追加される金額。

だった記述が次の内容に

Ver 1.0
Syntax required attribute, value must equal invoice document currency (ibt-005)

これは@currencyIDの説明文なので、元の記述が正しい。

2. @currencyID

Semantic datatype が Amount の Business Trem に対応するXML要素には@currencyID属性が必須であり、それぞれが invoice document currency (ibt-005)なのか Tax currency code (ibt-006)なのかが説明されている。

Syntax required attribute, value must equal invoice document currency (ibt-005)

Syntax required attribute, value must equal invoice Tax currency code (ibt-006)

IBT-176 Terms amount(支払条件金額)の@currencyIDが定義されておらず、説明されていない。
IBT-180 Paid amount(支払済金額)も@currencyIDが定義されておらず、説明されていない。

3. Syntax binding

Syntax bindingが表示するXML属性のページにそのXML属性が定義されているXML要素が対応しているBusiness Termも表示されています。
このため次の画面では、@schemeIDが対応するBusiness Termが2つあるという表示になっています。

正しい対応関係を表示するのであれば、次の画面では、@schemeIDが対応するBusiness Termは、
IBT-018-1 – The identification scheme identifier of the Invoiced object identifier.
だけです。

XML属性のページにそのXML属性が定義されているXML要素が対応しているBusiness Termも表示するのであれば、その旨の説明がBIS文書中になければ読者は理解できません。

fig1 1
— Peppol BIS Standard Invoice JP PINT Version 1.0
Syntax binding

それぞれに対応するXPathと合わせて表示すると次のようになっています。

IBT-018 – Invoiced object identifier
/Invoice/cac:AdditionalDocumentReference[cbc:DocumentTypeCode=’130′]/cbc:ID

IBT-018-1 – The identification scheme identifier of the Invoiced object identifier.
/Invoice/cac:AdditionalDocumentReference[cbc:DocumentTypeCode=’130′]/cbc:ID/@schemeID

IBT-018-1も含めて、次の属性がXML要素の対応先と合わせて表示されているが、これらは、XML属性の対応先に限定しないと正しいSyntax bindingの記載ではありません。

IBT-125 – Attached document
IBT-125-1 – Attached document Mime code

IBT-125 – Attached document
IBT-125-2 – Attached document Filename

IBT-034 – Seller electronic address
IBT-034-1 – Scheme identifier

IBT-029 – Seller identifier
IBT-029-1 – Scheme identifier

IBT-030 – Seller legal registration identifier
IBT-030-1 – Scheme identifier

IBT-049 – Buyer electronic address
IBT-049-1 – Scheme identifier

IBT-046 – Buyer identifier
IBT-046-1 – Scheme identifier

IBT-047 – Buyer legal registration identifier
IBT-047-1 – Scheme identifier

IBT-060 – Payee identifier
IBT-060-1 – Scheme identifier

IBT-061 – Payee legal registration identifier
IBT-061-1 – Scheme identifier

IBT-071 – Deliver to location identifier
IBT-071-1 – Scheme identifier

IBT-083 – Remittance information
IBT-083-1 – Scheme identifier

IBT-084 – Payment account identifier
IBT-084-1 – Scheme identifier

IBT-128 – Invoice line object identifier
IBT-128-1 – Scheme identifier

IBT-157 – Item standard identifier
IBT-157-1 – Scheme identifier

IBT-158 – Item classification identifier
IBT-158-1 – Scheme identifier

IBT-158 – Item classification identifier
IBT-158-2 – Scheme version identifier

なお、次のXML属性については、対応するBusiness Termとして記載されているのは、それぞれ一つだけです。
公開されているページの記載内容についての規定が文書として公開されておらず、このページを表示するだけでは標準仕様とはなりません。

IBT-082 – Payment means text

IBT-130 – Invoiced quantity unit of measure code

IBT-150 – Item price base quantity unit of measure code

XML属性の対応先をXML要素の対応先と合わせて表示するのであれば、次の表示とすべき。

ibt-081 – Payment means type code
ibt-082 – Payment means text
/Invoice/cac:PaymentMeans/cbc:PaymentMeansCode
/Invoice/cac:PaymentMeans/cbc:PaymentMeansCode/@name

ibt-129 – Invoiced quantity
ibt-130 – Invoiced quantity unit of measure code
/Invoice/cac:InvoiceLine/cbc:InvoicedQuantity
/Invoice/cac:InvoiceLine/cbc:InvoicedQuantity/@unitCode

ibt-149 – Item price base quantity
ibt-150 – Item price base quantity unit of measure code
/Invoice/cac:InvoiceLine/cac:Price/cbc:BaseQuantity
/Invoice/cac:InvoiceLine/cac:Price/cbc:BaseQuantity/@unitCode

4. IBT-018 Invoiced object identifier (請求するオブジェクトID) の欧州規格 EN 16931-1からの引用

fig2 1
— EN 16931-1 Electronic invoicing – Part 1: Semantic data model of the core elements of an electronic invoice
Table 2 — Semantic data model of the core elements of an electronic invoice

Table 2 — Semantic data model of the core elements of an electronic invoice

ID Level Card. Business Term Description Usage Note

BT-18

+

0..1

Invoiced object identifier

An identifier for an object on which the invoice is based, given by the Seller.

It may be a subscription number, telephone number, meter point, vehicle, person etc., as applicable.

0..1

Scheme identifier

The identification scheme identifier of the Invoiced object identifier.

If it may be not clear for the receiver what scheme is used for the identifier, a conditional scheme identifier should be used that shall be chosen from the UNTDID 1153 code list [6] entries.

— EN 16931-1 Electronic invoicing – Part 1: Semantic data model of the core elements of an electronic invoice
Table 2 — Semantic data model of the core elements of an electronic invoice

Syntax bindingのページの説明文は、EN 16931-1 Table 2 Usage Note欄からの引用です。文章中の”the UNTDID 1153 code list [6] entries”は、規格の Bibriographyの文献を参照しています。

fig3 1
— EN 16931-1 Electronic invoicing – Part 1: Semantic data model of the core elements of an electronic invoice
Bibriography

BIS Billing 3.0は、EN 16931-1に準拠していると宣言していましたので、[6]が規格の Bibriographyの文献を参照していても読者は理解できましたが、PINTは、EN 16931シリーズの規格ではなく、まだ存在しない”Peppol International model”に準拠しているそいうですので、[6]でEN 16931-1 のBibriographyの文献を参照したままなのはいかがなものでしょうか。EN 16931シリーズの規格との関連を明確に規定すべきです。

This specification is based on the Peppol International model.

— Peppol International (PINT) model for Billing
Introduction

CEN/TS 16931-3-2 Electronic invoicing – Part 3-2: Syntax binding for ISO/IEC 19845 (UBL 2.1) invoice and credit note がSyntax biunding の欧州規格です。EN 16931-1では、BT-18にまとめてTable 2に記載されていましたが、Syntax biunding の対応付けは、XML要素とXML属性に分けてそれぞれBT-18およびBT-18-1の対応を定義しています。

fig4 1
— CEN/TS 16931-3-2 Electronic invoicing – Part 3-2: Syntax binding for ISO/IEC 19845 (UBL 2.1) invoice and credit note
4.3 Mapping the Invoice model Table 3 — Semantic model to UBL invoice syntax elements mapping (normative)
fig5 1
— CEN/TS 16931-3-2 Electronic invoicing – Part 3-2: Syntax binding for ISO/IEC 19845 (UBL 2.1) invoice and credit note
4.3 Mapping the Invoice model TTable 4 — UBL invoice syntax elements to semantic model mapping (informative)

Table 3 — Semantic model to UBL invoice syntax elements mapping (normative)では、BT-18のRules欄に with cbc:DocumentTypeCode = 130 の説明文を記載していますが、人が読んで理解して対応変換処理をプログラミングすることを期待しているようです。このように文章で表現するよりも、XMLが標準提供している XPathで次のように記述してあれば、機械的に変換処理を実装可能となります。

IBT-018 – Invoiced object identifier
/Invoice/cac:AdditionalDocumentReference[cbc:DocumentTypeCode=’130′]/cbc:ID

IBT-018-1 – The identification scheme identifier of the Invoiced object identifier.
/Invoice/cac:AdditionalDocumentReference[cbc:DocumentTypeCode=’130′]/cbc:ID/@schemeID

JP PINTでwith cbc:DocumentTypeCode = 130 の説明文がないのは、BIS Billing 3.0も同様なのでibt-018 Invoiced object identifier (請求するオブジェクトID)のcbc:DocumentTypeCodeに’130’以外も使用可能としたのか、単なる記述もれか判断に苦しむところです。

fig6 1
— Peppol BIS Standard Invoice JP PINT Version 1.0
Syntax binding

次のSharedルールで、cbc:DocumentTypeCode = ‘130’ を条件としているのは、ibt-018 Invoiced object identifier (請求するオブジェクトID)のcbc:DocumentTypeCodeが’130’であることが前提とされているからだと思います。

ibr-071 – An invoice should not include an AdditonalDocumentReference (ibg-24) simultaneously referring an Invoice Object Identifier (ibt-018) and an Attachment (ibt-125). +

Flag

fatal

Context

/ubl:Invoice

Test

not(//cac:AdditionalDocumentReference[cbc:DocumentTypeCode = ‘130’]/cac:Attachment)

— Peppol BIS Standard Invoice JP PINT Version 1.0
Shared PINT rules ibr-071

ibg-24 ADDITIONAL SUPPORTING DOCUMENTS(添付書類)には、次のSelector条件が指定されています。
cbc:DocumentTypeCode != 130

この条件をふまえると、ibt-125 Attached document(添付書類)は次のXPathです。
/Invoice/cac:AdditionalDocumentReference[not(cbc:DocumentTypeCode=’130′)]/cac:Attachment/cbc:EmbeddedDocumentBinaryObject

こうしたことから、単なる記述漏れと思われます。

ibt-018 Invoiced object identifier (請求するオブジェクトID)とibg-24 ADDITIONAL SUPPORTING DOCUMENTS(添付書類)はどちらも、
/Invoice/cac:AdditionalDocumentReference
を使用します。
文書参照では、国連のコードリスト1001 UN/EDIFACT 1001 Document name code (Code specifying the document name.) から選択したコードを cbc:DocumentTypeCode の値として指定することで、どのような種類の文書を参照しているのか指定します。

インボイスのDocument name code 380もこのコードリスト1001で定義されており、130は次の定義です。

130 Invoicing data sheet
Document/message issued within an enterprise containing data about goods sold, to be used as the basis for the preparation of an invoice.
請求書作成の基礎として使用される、販売された商品に関するデータを含む、企業内で発行される文書/メッセージ。

— United Nations Directories for Electronic Data Interchange for Administration UN/EDIFACT
Commerce and Transport

その後、調べなおしたところ次のページに記載されていました。

fig11 1
— Peppol BIS Standard Invoice JP PINT Version 1.0
Syntax binding
fig12 1
— Peppol BIS Standard Invoice JP PINT Version 1.0
Syntax binding

「他の場所に記載されています。」ではなく、IBT-018のページにXPathで説明していただきたいと思います。

/Invoice/cac:AdditionalDocumentReference[cbc:DocumentTypeCode=’130′]/cbc:ID

5. 不正確なSelector条件

XMLでインスタンス文書中のXML要素や属性を選択する表現がXPathです。

XML Path Language (XPath) 2.0 (Second Edition)
W3C Recommendation 14 December 2010 (Link errors corrected 3 January 2011; Status updated October 2016)

PINTにおけるSelector指定には、このXPathを理解しているのか疑問になる表現がいくつも残っています。

『JP PINT 解体新書2 JP PINTは適格請求書?』で紹介したJapan PINT Invoice UBL Example1-minimum.xmlに対して、XML編集ソフト XML SpyでXPathを実行した結果を次の図で示します。

fig10 1
— Peppol BIS Standard Invoice JP PINT Version 1.0
Syntax binding

cac:TaxTotal の Selector が cac:TaxTotal/TaxAmount/@currency = cbc:DocumentCurrencyCode とされています。

/Invoice/cac:TaxTotal[cac:TaxTotal/TaxAmount/@currency = cbc:DocumentCurrencyCode] と指定しても、The expression did not return any items. で何も見つかりません。

fig8 1
  • cac:TaxTotal についての選択条件指定は、その子孫要素からはじめるか文書のルートから始めます。同じ要素であるcac:TaxTotalから条件指定を始めてはいけません。

  • @currency でなく @currencyID です。

  • cbc:DocumentCurrencyCodeは、cac:TaxTotalの子孫要素ではありません。

正しいSelector条件は、

cbc:TaxAmount/@currencyID=/*/cbc:DocumentCurrencyCode

です。

/Invoice/cac:TaxTotal[cbc:TaxAmount/@currencyID=/*/cbc:DocumentCurrencyCode] と指定すると目的のcac:TaxTotalが見つかります。

fig7 1

Selector条件は、読者になんとなくわかってもらうためのものでなく、ソフトウエアが正しく処理するための条件とすべきです。 人が読んで何となく分かったようでもプログラムでは処理できません。+
XPathを正しく理解したうえで公開前に十分なテストを行うことが必要ではないでしょうか。

次の表は、Syntax bindingで記載されているUBL element と Selector とその改善ポイントです。

ID

Business Term

UBL element

Selector

A syntax required class in which the invoice object identifier (IBT-018) is nested.

cac:AdditionalDocumentReference

cbc:DocumentTypeCode = 130

[Revised] cac:AdditionalDocumentReference[cbc:DocumentTypeCode=’130′]

[XPath] /Invoice/cac:AdditionalDocumentReference[cbc:DocumentTypeCode=’130′]

[指摘] cbc:DocumentTypeCodは、数値項目ではなく文字項目なので’ ‘で括らなくてはいけません。

IBG-24

ADDITIONAL SUPPORTING DOCUMENTS

cac:AdditionalDocumentReference

cbc:DocumentTypeCode != 130

[Revised] cac:AdditionalDocumentReference[not(cbc:DocumentTypeCode=’130′)]

[XPath] /Invoice/cac:AdditionalDocumentReference[not(cbc:DocumentTypeCode=’130′)]

[指摘] cbc:DocumentTypeCodは、数値項目ではなく文字項目なので’ ‘で括らなくてはいけません。
cbc:DocumentTypeCodeが定義されていないものを許容するのであれば、not( )としなければならない。

A syntax required class in which the Unique banking reference identifier (IBT-090) is nested.

cac:PartyIdentification

cac:ID/@schemeID = “SEPA”

[Revised] Revised cac:PartyIdentification[cbc:ID/@schemeID=’SEPA’]

[XPath] /Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyIdentification[cbc:ID/@schemeID=’SEPA’]

[指摘] cac:IDは間違い。正しくは、cbc:ID。

A syntax required class in which the Seller’s TAX identifier (IBT-031) is nested.

cac:PartyTaxScheme

cac:TaxScheme = “VAT”

[Revised] cac:PartyTaxScheme[cac:TaxScheme/cbc:ID=’VAT’]

[XPath] /Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID=’VAT’]

[指摘] cac:TaxSchemeは、cmplexTypeなのでXML要素を下位に持つことはできるが、値を持つことはできません。cac:TaxScheme/cbc:IDが値を持つ要素です。

A syntax required class in which the local identification (defined by the Seller’s address) of the Seller for tax purposes or a reference (IBT-032) is nested.

cac:PartyTaxScheme

cac:TaxScheme != “VAT”

[Revised] cac:PartyTaxScheme[cac:TaxScheme/cbc:ID!=’VAT’]

[XPath] /Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID!=’VAT’]

[指摘] cac:TaxSchemeは、cmplexTypeなのでXML要素を下位に持つことはできるが、値を持つことはできません。cac:TaxScheme/cbc:IDが値を持つ要素です。

IBG-20

DOCUMENT LEVEL ALLOWANCES

cac:AllowanceCharge

cbc:ChargeIndicator = false

[Revised] cac:AllowanceCharge[cbc:ChargeIndicator=false()]

[XPath] /Invoice/cac:AllowanceCharge[cbc:ChargeIndicator=false()]

[指摘] cbc:ChargeIndicatorはbool型なので、 比較は真偽値 false() と比較する。
文字列としての’false’と比較するなら normalize-space(string(cbc:ChargeIndicator))=’false’とする。

IBG-21

DOCUMENT LEVEL CHARGES

cac:AllowanceCharge

cbc:ChargeIndicator = true

[Revised] cac:AllowanceCharge[cbc:ChargeIndicator=true()]

[XPath] /Invoice/cac:AllowanceCharge[cbc:ChargeIndicator=true()]

[指摘] cbc:ChargeIndicatorはbool型なので、 比較は真偽値 true() と比較する。
文字列としての’true’と比較するなら normalize-space(string(cbc:ChargeIndicator))=’true’とする

A syntax required class in which the total TAX amount for the Invoice (IBT-110) is nested.

cac:TaxTotal

cac:TaxTotal/TaxAmount/@currency = cbc:DocumentCurrencyCode

[Revised] cac:TaxTotal[cbc:TaxAmount/@currencyID=/Invoice/cbc:DocumentCurrencyCode]

[XPath] /Invoice/cac:TaxTotal[cbc:TaxAmount/@currencyID=/Invoice/cbc:DocumentCurrencyCode]

[指摘] cac:TaxTotalはcac:TaxTotalの子要素ではない。
TaxAmountは間違い。正しくはcac:TaxAmount
cbc:DocumentCurrencyCodeは、cac:TaxTotalの子要素ではないので、/Invoice/cbc:DocumentCurrencyCodeとする。

IBG-37

DOCUMENT TOTALS IN TAX ACCOUNTING CURRENCY

cac:TaxTotal

cac:TaxTotal/TaxAmount/@currency = cbc:TaxCurrencyCode

[Revised] cac:TaxTotal[cbc:TaxAmount/@currencyID=/Invoice/cbc:TaxCurrencyCode]

[XPath] /Invoice/cac:TaxTotal[cbc:TaxAmount/@currencyID=/Invoice/cbc:TaxCurrencyCode]

[指摘] cac:TaxTotalはcac:TaxTotalの子要素ではない。
TaxAmountは間違い。正しくはcac:TaxAmount
cbc:TaxCurrencyCodeは、cac:TaxTotalの子要素ではないので、/Invoice/cbc:TaxCurrencyCodeとする。

IBG-36

LINE DOCUMENT REFERENCE

cac:DocumentReference

cbc:DocumentTypeCode != 130

[Revised] cac:DocumentReference[not(cbc:DocumentTypeCode=’130′)]

[XPath] /Invoice/cac:InvoiceLine/cac:DocumentReference[not(cbc:DocumentTypeCode=’130′)]

[指摘] cbc:DocumentTypeCodは、数値項目ではなく文字項目なので’ ‘で括らなくてはいけません。
cbc:DocumentTypeCodeが定義されていないものを許容するのであれば、not( )としなければならない。

A syntax required class in which the the identifier for an object (IBT-128) is nested.

cac:DocumentReference

cbc:DocumentTypeCode = 130

[Revised] cac:DocumentReference[cbc:DocumentTypeCode=’130′]

[XPath] /Invoice/cac:InvoiceLine/cac:DocumentReference[cbc:DocumentTypeCode=’130′]

[指摘] cbc:DocumentTypeCodは、数値項目ではなく文字項目なので’ ‘で括らなくてはいけません。

IBG-27

INVOICE LINE ALLOWANCES

cac:AllowanceCharge

cbc:ChargeIndicator = false

[Revised] cac:AllowanceCharge[cbc:ChargeIndicator=false()]

[XPath] /Invoice/cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=false()]

[指摘] cbc:ChargeIndicatorはbool型なので、 比較は真偽値 false() と比較する。
文字列としての’false’と比較するなら normalize-space(string(cbc:ChargeIndicator))=’false’とする。

IBG-28

INVOICE LINE CHARGES

cac:AllowanceCharge

cbc:ChargeIndicator = true

[Revised] cac:AllowanceCharge[cbc:ChargeIndicator=true()]

[XPath] /Invoice/cac:InvoiceLine/cac:AllowanceCharge[cbc:ChargeIndicator=true()]

[指摘] cbc:ChargeIndicatorはbool型なので、 比較は真偽値 true() と比較する。
文字列としての’false’と比較するなら normalize-space(string(cbc:ChargeIndicator))=’true’とする。

なお、明細行のIBT-147 Item price discount 品目単価値引(税抜き)を含むcac:AllowanceChargeは、cbc:ChargeIndicatorがfalse()に制限されていますので、cac:AllowanceCharge[cbc:ChargeIndicator=false()]がSelector条件に必要ではないでしょうか。

また、IBT-029 Seller identifierにはSelectorが定義されていないが、/Invoice/cac:PartyIdentificationは、IBT-090 Bank assigned creditor identifier も同じ要素を使用しているので、区別するためにSelectorが必要ではないでしょうか。

cac:PartyIdentification[cbc:ID/@schemeID!=’SEPA’]

ID Business Term UBL element Selector

A syntax required class in which the Unique banking reference identifier (IBT-090) is nested.

cac:PartyIdentification

cbc:ID/@schemeID = ‘SEPA’

A syntax required class in which the identification of the Seller (IBT-029) is nested.

cac:PartyIdentification

cbc:ID/@schemeID != ‘SEPA’