Rule Sets
A rule set describes one standard an invoice can be produced under: the UBL fields it requires, those it requires under a condition, those it leaves optional, and the validation packs that check it. NomaUBL ships three sets, generated from the UBL reference data so they never drift from it. A document names its set; the validator then runs the packs of that set, and the mapping tab of the XSL editor shows, tag by tag, what the set expects — whatever the source system, JD Edwards, SAP, NetSuite or a custom ERP.
At a glance
The shipped sets
| Set | Fields | Customization id | Validation packs |
|---|---|---|---|
EN 16931 basic (en16931-basic) | 155 — the BASIC subset every French invoice carries | urn:cen.eu:en16931:2017 | EN 16931, Flux 2 (CIUS-FR), CPRO B2G, house rules |
EN 16931 (en16931) | 243 — the full EN 16931 model under the French CIUS | urn:cen.eu:en16931:2017 | EN 16931, Flux 2 (CIUS-FR), CPRO B2G, house rules |
France extended (CTC) (fr-extended-ctc) | 455 — EN 16931 plus the French extension (EXT-FR-FE fields) | urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended | Extended CTC-FR (in place of EN 16931), Flux 2, CPRO B2G, house rules |
Each field of a set has a status:
| Status | Meaning |
|---|---|
| required | The set requires the field on every invoice. |
| conditional | Required under a condition — a due date or payment terms when an amount is due (BR-CO-25), a tax point date or period code (BR-CO-03), the seller's identifiers (BR-CO-26)… The note gives the condition and the rule ids. |
| optional | Allowed, not required. |
| by default | Required, and filled by the UBL defaults when the mapping leaves it empty. |
| not in this set | The set does not know the field — for example the EXT-FR-FE tags under the two EN 16931 sets. |
A custom Schematron on the document still runs after the packs of the set.
Choosing the set of a document
On the UBL tab of the document, the Rule set field names the set:
- blank — Derived from the UBL defaults (customization id and profile): the behaviour of a document that names no set. The set follows the customization id the UBL defaults emit — France extended for the extended profiles, EN 16931 otherwise;
- a set — the validator runs the packs of that set in every pipeline: batch and single processing, the Process page, the invoice window's validation and the XSL editor's check.
The two EN 16931 sets and the France extended set list exactly the packs the derived choice applies, so naming the set of an existing document changes no finding. An unknown set id is reported as a warning and the derived choice applies.
In the XSL editor
The Variable Mapping tab of the XSL editor reads a rule set:
- Rule set — preselected on the set of the document, switchable to preview another one; the choice is remembered in the browser per file and changes nothing in the files;
- a badge per tag — required, conditional, optional, by default, not in this set — with the note of the condition in its tooltip;
- filters — All tags, Required and conditional, Missing required; the tags outside the set stay hidden unless Show tags outside the set is ticked, so the French extension tags appear only under the extended set;
- completeness per group — Required mapped 4 / 5: a required field counts when it has a source, a constant or a UBL default;
- Check mapping — lists the required fields of the set with no source and no default, then transforms the loaded sample with the mapping as edited and validates it with the packs of the set and the document's custom packs. The report groups the findings by field and highlights the tags concerned. Nothing is written to the database and nothing is sent.
Elsewhere in the application
- Invoice window — names the set the invoice was produced under, read from its archived UBL.
- UBL reference — a set filter shows the fields of a set with their status.
- Business rules — the same filter keeps the rules that touch a field of the set.
Adapting a set
The sets are bundled in the application and generated at build from the UBL reference data. An environment can override one with a file of the same name under <env>/config/rulesets/ (for example en16931.json), read before the bundled one. Other UBL-based standards — Peppol BIS Billing, XRechnung… — are added as bundled sets with their packs. National formats that are not UBL go through a post-transform.
Tips & best practices
- Name the set on every document. The derived choice works, but an explicit set states the standard the document is meant to meet and keeps the mapping tab on it.
- Run Check mapping with a real sample before the first batch on a new document: the missing required fields come first, then the findings by field.
- Use the Missing required filter while mapping. It shrinks the form to what still blocks the set.
- Keep a custom Schematron for the customer's own rules. The rule set covers the standard; customer-specific checks stay in the document's custom packs.