Introducing the Metanorma collection, through the SI Brochure
Metanorma now supports Metanorma collections, a feature that allows a set of Metanorma documents to be published in flexible configurations.
Summary
The Metanorma collection functionality is a new feature used by complex standards published using Metanorma.
In this blog post we will use the SI Brochure, published by the BIPM, as an example of how it is used.
This post will illustrate how to compile the BIPM SI Brochure using the collection sub-command.
What's in a Collection?
Standards are typically published as individual documents. However, there are standards that are a lot more complex:
- the ISO 10303 series of standards is published as a collection known as the STEP Module and Resource Library (SMRL), with interlinking links and embedded computer-readable EXPRESS models;
- the BIPM SI Brochure is composed of multiple documents, including the main content, CGPM and CIPM outcomes in both French and English, all cross-linked, together with over 20 mise en pratique documents, where each of these components can be individually published.
The SI Brochure
The SI Brochure is the authoritative document detailing the now ubiquitous International System of Units (SI) (Wikipedia), commonly called the "SI system".
The SI system is established and maintained by the General Conference on Weights and Measures / Conférence générale des poids et mesures (CGPM), which was established by the Metre Convention (Wikipedia) of 1875.
The SI Brochure is offered under the Creative Commons 3 license.
The Metanorma team has been tasked by BIPM to develop a machine-readable form of the BIPM SI Brochure, of which the workings is worthy of several blog posts.
In this blog post, we use the BIPM SI Brochure to illustrate how to compile a Metanorma collection.
SI Brochure in Metanorma
The SI Brochure is structured as a Metanorma collection.
Specifically, it is published in 3 forms:
- A French-English bilingual version
- A French version
- An English version
cols="a,a,a"]
===
| .Metanorma-generated SI Brochure (bilingual) image::/assets/blog/2022-07-11-si-brochure.png[]
| .Metanorma-generated SI Brochure (French) image::/assets/blog/2022-07-11-si-brochure-fr.png[]
| .Metanorma-generated SI Brochure (English) image::/assets/blog/2022-07-11-si-brochure-en.png[]
===
In Metanorma, the French and English versions are independent documents. The bilingual version, on the other hand, is a composite document that is directly composed of the combination of the French and English documents.
Can't we just "concatenate the two documents and slap on a new cover page"?
It is actually a lot more complex than this:
- The French and English versions contain cross-references to each other. In the bilingual composite version, these links become internal links, and the corresponding references in the bibliography are also considered internal within the collection (since both parts are given in the same document)
- The metadata of the individual documents and the metadata of the bilingual collection differ but both need to be reflected.
- The document elements shared between the French and English documents, such as figures, resolution outcomes and bibliographic references, should not be duplicated in the bilingual collection.
- The bilingual collection allows the generation (or extraction) of its source components, namely, the French and English documents in their desired form and respective cover pages.
Ultimately, this structure allows us to retain only a single source of truth without duplication while keeping the document components independent.
Compiling the collection
As mentioned, the SI Brochure is offered under the Creative Commons 3 license so there should not be licensing concerns in performing this exercise.
The draft version of the machine-readable SI Brochure is available at:
Once you have installed Metanorma, you are ready to do the actual compilation of the document.
The commands that follow have been tested to work on Windows, macOS and Linux.
Clone the repository with your favorite Git application. We recommend either using the git command or GitHub Desktop.
If using the git command, you could do:
<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>g</mi><mi>i</mi><mi>t</mi><mi>c</mi><mi>l</mi><mi>o</mi><mi>n</mi><mi>e</mi><mi>h</mi><mi>t</mi><mi>t</mi><mi>p</mi><mi>s</mi><mo>:</mo><mi mathvariant="normal">/</mi><mi mathvariant="normal">/</mi><mi>g</mi><mi>i</mi><mi>t</mi><mi>h</mi><mi>u</mi><mi>b</mi><mi mathvariant="normal">.</mi><mi>c</mi><mi>o</mi><mi>m</mi><mi mathvariant="normal">/</mi><mi>m</mi><mi>e</mi><mi>t</mi><mi>a</mi><mi>n</mi><mi>o</mi><mi>r</mi><mi>m</mi><mi>a</mi><mi mathvariant="normal">/</mi><mi>b</mi><mi>i</mi><mi>p</mi><mi>m</mi><mo>−</mo><mi>s</mi><mi>i</mi><mo>−</mo><mi>b</mi><mi>r</mi><mi>o</mi><mi>c</mi><mi>h</mi><mi>u</mi><mi>r</mi><mi>e</mi><mo><</mo><mi mathvariant="normal">/</mi><mi>c</mi><mi>o</mi><mi>d</mi><mi>e</mi><mo>></mo><mo><</mo><mi mathvariant="normal">/</mi><mi>p</mi><mi>r</mi><mi>e</mi><mo>></mo><mo><</mo><mi mathvariant="normal">/</mi><mi>d</mi><mi>i</mi><mi>v</mi><mo>></mo><mo><</mo><mi>p</mi><mo>></mo><mi>G</mi><mi>e</mi><mi>n</mi><mi>e</mi><mi>r</mi><mi>a</mi><mi>t</mi><mi>e</mi><mi>t</mi><mi>h</mi><mi>e</mi><mi>s</mi><mi>o</mi><mi>u</mi><mi>r</mi><mi>c</mi><mi>e</mi><mi>M</mi><mi>e</mi><mi>t</mi><mi>a</mi><mi>n</mi><mi>o</mi><mi>r</mi><mi>m</mi><mi>a</mi><mi>d</mi><mi>o</mi><mi>c</mi><mi>u</mi><mi>m</mi><mi>e</mi><mi>n</mi><mi>t</mi><mi>s</mi><mi>i</mi><mi>n</mi><mi>t</mi><mi>o</mi><mo><</mo><mi>c</mi><mi>o</mi><mi>d</mi><mi>e</mi><mo>></mo><mi>s</mi><mi>i</mi><mi>t</mi><mi>e</mi><mi mathvariant="normal">/</mi><mi>d</mi><mi>o</mi><mi>c</mi><mi>u</mi><mi>m</mi><mi>e</mi><mi>n</mi><mi>t</mi><mi>s</mi><mo><</mo><mi mathvariant="normal">/</mi><mi>c</mi><mi>o</mi><mi>d</mi><mi>e</mi><mo>></mo><mo>:</mo><mo><</mo><mi mathvariant="normal">/</mi><mi>p</mi><mo>></mo><mo><</mo><mi>d</mi><mi>i</mi><mi>v</mi><mi>c</mi><mi>l</mi><mi>a</mi><mi>s</mi><mi>s</mi><mo>=</mo><mi mathvariant="normal">"</mi><mi>c</mi><mi>o</mi><mi>d</mi><mi>e</mi><mo>−</mo><mi>b</mi><mi>l</mi><mi>o</mi><mi>c</mi><mi>k</mi><mi mathvariant="normal">"</mi><mi>d</mi><mi>a</mi><mi>t</mi><mi>a</mi><mo>−</mo><mi>c</mi><mi>o</mi><mi>d</mi><mi>e</mi><mo>−</mo><mi>b</mi><mi>l</mi><mi>o</mi><mi>c</mi><mi>k</mi><mo>></mo><mo><</mo><mi>p</mi><mi>r</mi><mi>e</mi><mo>></mo><mo><</mo><mi>c</mi><mi>o</mi><mi>d</mi><mi>e</mi><mi>c</mi><mi>l</mi><mi>a</mi><mi>s</mi><mi>s</mi><mo>=</mo><mi mathvariant="normal">"</mi><mi>l</mi><mi>a</mi><mi>n</mi><mi>g</mi><mi>u</mi><mi>a</mi><mi>g</mi><mi>e</mi><mo>−</mo><mi>s</mi><mi>h</mi><mi mathvariant="normal">"</mi><mo>></mo></mrow><annotation encoding="application/x-tex">git clone https://github.com/metanorma/bipm-si-brochure</code></pre></div><p>Generate the source Metanorma documents into <code>site/documents</code>:</p><div class="code-block" data-code-block><pre><code class="language-sh"></annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">i</span><span class="mord mathnormal">t</span><span class="mord mathnormal">c</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span><span class="mord mathnormal">o</span><span class="mord mathnormal">n</span><span class="mord mathnormal">e</span><span class="mord mathnormal">h</span><span class="mord mathnormal">ttp</span><span class="mord mathnormal">s</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">//</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">i</span><span class="mord mathnormal">t</span><span class="mord mathnormal">h</span><span class="mord mathnormal">u</span><span class="mord mathnormal">b</span><span class="mord">.</span><span class="mord mathnormal">co</span><span class="mord mathnormal">m</span><span class="mord">/</span><span class="mord mathnormal">m</span><span class="mord mathnormal">e</span><span class="mord mathnormal">t</span><span class="mord mathnormal">an</span><span class="mord mathnormal" style="margin-right:0.0278em;">or</span><span class="mord mathnormal">ma</span><span class="mord">/</span><span class="mord mathnormal">bi</span><span class="mord mathnormal">p</span><span class="mord mathnormal">m</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.7429em;vertical-align:-0.0833em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.7335em;vertical-align:-0.0391em;"></span><span class="mord mathnormal">b</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">oc</span><span class="mord mathnormal">h</span><span class="mord mathnormal">u</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel"><</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">/</span><span class="mord mathnormal">co</span><span class="mord mathnormal">d</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">><</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">/</span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">><</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">/</span><span class="mord mathnormal">d</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.0359em;">v</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">><</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7335em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">></span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7335em;vertical-align:-0.0391em;"></span><span class="mord mathnormal">G</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.0278em;">er</span><span class="mord mathnormal">a</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord mathnormal">t</span><span class="mord mathnormal">h</span><span class="mord mathnormal">eso</span><span class="mord mathnormal">u</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">ce</span><span class="mord mathnormal" style="margin-right:0.109em;">M</span><span class="mord mathnormal">e</span><span class="mord mathnormal">t</span><span class="mord mathnormal">an</span><span class="mord mathnormal" style="margin-right:0.0278em;">or</span><span class="mord mathnormal">ma</span><span class="mord mathnormal">d</span><span class="mord mathnormal">oc</span><span class="mord mathnormal">u</span><span class="mord mathnormal">m</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span><span class="mord mathnormal">t</span><span class="mord mathnormal">s</span><span class="mord mathnormal">in</span><span class="mord mathnormal">t</span><span class="mord mathnormal">o</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel"><</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7335em;vertical-align:-0.0391em;"></span><span class="mord mathnormal">co</span><span class="mord mathnormal">d</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">></span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">i</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord">/</span><span class="mord mathnormal">d</span><span class="mord mathnormal">oc</span><span class="mord mathnormal">u</span><span class="mord mathnormal">m</span><span class="mord mathnormal">e</span><span class="mord mathnormal">n</span><span class="mord mathnormal">t</span><span class="mord mathnormal">s</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel"><</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">/</span><span class="mord mathnormal">co</span><span class="mord mathnormal">d</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">>:<</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">/</span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">><</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">d</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.0359em;">v</span><span class="mord mathnormal">c</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span><span class="mord mathnormal">a</span><span class="mord mathnormal">ss</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7778em;vertical-align:-0.0833em;"></span><span class="mord">"</span><span class="mord mathnormal">co</span><span class="mord mathnormal">d</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.7778em;vertical-align:-0.0833em;"></span><span class="mord mathnormal">b</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span><span class="mord mathnormal">oc</span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span><span class="mord">"</span><span class="mord mathnormal">d</span><span class="mord mathnormal">a</span><span class="mord mathnormal">t</span><span class="mord mathnormal">a</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.7778em;vertical-align:-0.0833em;"></span><span class="mord mathnormal">co</span><span class="mord mathnormal">d</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.7335em;vertical-align:-0.0391em;"></span><span class="mord mathnormal">b</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span><span class="mord mathnormal">oc</span><span class="mord mathnormal" style="margin-right:0.0315em;">k</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">><</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7335em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span><span class="mord mathnormal" style="margin-right:0.0278em;">r</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">><</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">co</span><span class="mord mathnormal">d</span><span class="mord mathnormal">ec</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span><span class="mord mathnormal">a</span><span class="mord mathnormal">ss</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord">"</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span><span class="mord mathnormal">an</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">u</span><span class="mord mathnormal">a</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">e</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.7335em;vertical-align:-0.0391em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">h</span><span class="mord">"</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">></span></span></span></span> metanorma site generate -c brochure.yml --agree-to-terms-c brochure.yml flag is used to only generate necessary files for the bilingual SI Brochure; it does not compile any MEP documents.Once it is finished you will be able to see compilation results under site/documents.
--output-dir argument.Then generate the bilingual collection documents with:
$ metanorma collection collection.yml -w collection -x xml,pdf -c sources/collection_cover.html --agree-to-terms --no-continue-without-fontsThe resulting document will be generated in the directory collection. You should see these files generated:
- Bilingual SI Brochure (PDF):
collection.pdf - Language-specific SI Brochure (PDF)
- English SI Brochure
collection_en.pdf - French SI Brochure
collection_fr.pdf
- English SI Brochure
- Metanorma XML files
- Metanorma Semantic XML
collection.xml - Metanorma Presentational XML
collection.presentation.xml
- Metanorma Semantic XML
The machine-readable versions of the SI Brochure are in the XML files. The semantic version provides full semantic encoding of content, where the presentational version provides rendering-oriented structured content.
If you are curious of the inner workings of the Metanorma collection, have a look at collection.yml which provides instructions to Metanorma on how to process the input files.
Conclusion
Metanorma provides a flexible collection compilation functionality for standards. The bilingual SI Brochure can be technically generated just with one line of command (or two!).
We will likely follow up with more articles on how a collection works. Stay tuned!