Skip to content

Introduction

Relaton YAML is the primary serialization format for the Relaton Information Model. It provides a human-readable, human-writable representation of bibliographic items that can be used for interchange, configuration, and embedding in document authoring workflows.

Relaton YAML is used by:

  • Metanorma for representing bibliographic entries in documents
  • relaton-cli for import/export operations
  • Relaton flavor gems for storing and retrieving bibliographic data

This specification defines the YAML encoding of the Relaton BibliographicItem model, mapping the XML schema defined in relaton-models to YAML objects.

NOTE

The full canonical reference for the Relaton YAML hash structure is maintained in the relaton-bib documentation.

Scope

This specification defines the YAML serialization of BibliographicItem objects as implemented by the Relaton library. It covers:

  • The mapping rules from the Relaton XML schema to YAML
  • The representation of all BibliographicItem attributes
  • The handling of cardinality, nesting, and mixed content

This specification does not cover:

  • Flavour-specific extensions (bibdata/ext), which are defined by individual flavor gems
  • The XML or BibTeX serializations (see Serializations)
  • Processing semantics (fetching, caching, rendering)

Terms and definitions

YAML serialization

representation of a BibliographicItem using YAML markup, following the rules defined in this specification

content key

YAML key named content that holds the text content of an element that also carries XML attributes

element cardinality

number of occurrences of a child element within its parent, as defined by the Relaton XML schema

bibitem

YAML root object representing a single BibliographicItem

bibdata

bibliographic item with flavour-specific extension data, used for standards document metadata

Mapping principles

General

The Relaton YAML serialization follows these principles:

Simplicity:: YAML structures should be intuitive and minimal. Unnecessary nesting is avoided.

Flexibility in cardinality:: Elements with cardinality of "many" can be represented as arrays, single hashes, or plain strings interchangeably.

Attribute transparency:: XML element attributes are promoted to YAML keys at the same level as content.

XML attributes to YAML keys

When an XML element has both attributes and text content, the content is represented with a content key:

xml
<title type="main">Geographic information</title>
yaml
title:
  type: main
  content: Geographic information

Cardinality flexibility

Elements with a cardinality of "many" can be represented as arrays, single hashes, or single strings:

yaml
# Array of hashes
title:
  - type: main
    content: Geographic information
  - type: title-part
    content: Part 1

# Single hash
title:
  type: main
  content: Geographic information

# Array of strings
language:
  - en
  - fr

# Single string
language: en

Reserved words

In YAML, on is a reserved word and cannot be used as a key. The key value is used as a synonym for on in date elements.

Element reference

Top-level attributes

A BibliographicItem in YAML is a mapping with the following top-level keys:

KeyTypeDescription
idstringBibliographic item anchor, used to cross-reference within document
fetchedstring (date)Date record was created
titlearray or hashTitles with mandatory type and content
typestringDocument type (e.g. standard)
docidarray or hashDocument identifiers with type and id
docnumberstringDocument number
editionstringEdition number
languagearray or stringLanguages (ISO 639 codes)
scriptarray or stringScripts (ISO 15924 codes)
versionhashContains revision_date and draft
biblionotearray or hashNotes with type and content
docstatushashDocument status with stage, substage, iteration
datearray or hashDates with type and value/from/to
abstractarray or hashAbstracts with content and optional language, script, format
contributorarrayContributors (organization or person with role)
copyrighthashCopyright with owner, from, and optional to
linkarray or hashURIs with type and content
relationarrayRelations to other bibliographic items
seriesarray or hashSeries information
mediumhashMedium with form, size, and scale
placearray or hashPlaces of publication
extenthashExtent information with locality
accesslocationarray of stringsAccess locations
classificationarray or hashClassification with type and value
validityhashValidity period with begins, ends, revision
keywordarray of strings or hashesKeywords
licensestringLicense identifier

Title

Titles contain type, content, and optional language, script, and format:

yaml
title:
  - type: main
    content: Geographic information
  - type: subtitle
    content: Geographic information subtitle
    language: en
    script: Latn
    format: text/plain

Document identifiers

Document identifiers contain a mandatory type and id:

yaml
docid:
  type: ISO
  id: TC211

Date

Dates are an array with a mandatory type, and either a value or a from/to range:

yaml
date:
  - type: issued
    value: '2014'
  - type: published
    from: '2014-04'
    to: '2014-05'
  - type: accessed
    value: '2015-05-20'

Contributor

Contributors are an array of entity/role pairs, where entity is either person or organization:

yaml
contributor:
  - organization:
      name: International Organization for Standardization
      url: www.iso.org
      abbreviation: ISO
    role:
      type: publisher
  - person:
      name:
        completename:
          content: A. Bierman
          language: en
    role: author

Organization attributes: name, url, abbreviation, subdivision, contacts, identifiers, logo.

Person name attributes: abbreviation, surname, completename, initial, forename, additions, prefixes.

Copyright consists of an owner (organization fields), a from date, and an optional to date:

yaml
copyright:
  owner:
    name: International Organization for Standardization
    abbreviation: ISO
    url: www.iso.org
  from: '2014'
  to: '2020'

Relation

Relations are an array of type, bibitem, locality, source_locality, and optional description:

yaml
relation:
  - type: updates
    bibitem:
      formattedref: ISO 19115:2003
    locality:
      locality_stack:
        type: page
        reference_from: '7'
        reference_to: '10'
  - type: partOf
    bibitem:
      title:
        type: main
        content: Book title

Series

Series contain a title, optional type, place, organization, abbreviation, from, to, number, and partnumber:

yaml
series:
  - type: main
    title:
      type: original
      content: ISO/IEC FDIS 10118-3
    abbreviation:
      content: ABVR
    from: '2009-02-01'
    number: serie1234
    partnumber: part5678

Complete example

The following is a complete Relaton YAML example demonstrating all supported fields:

yaml
id: ISO/TC211
fetched: '2019-06-30'
title:
  - type: main
    content: Geographic information
  - type: subtitle
    content: Geographic information subtitle
    language: en
    script: Latn
    format: text/plain
type: standard
docid:
  type: ISO
  id: TC211
docnumber: '211'
edition: '1'
language:
  - en
  - fr
script:
  Latn
version:
  revision_date: '2019-04-01'
  draft: draft
biblionote:
  type: bibnote
  content: >
      Mark set a major league
      home run record in 1998.
docstatus:
  stage:
    value: '30'
    abbreviation: CD
  substage:
    value: '00'
  iteration: final
date:
  - type: issued
    value: '2014'
  - type: published
    from: '2014-04'
    to: '2014-05'
  - type: accessed
    value: '2015-05-20'
abstract:
  - content: >
      ISO 19115-1:2014 defines the schema required for ...
  - content: >
      L'ISO 19115-1:2014 définit le schéma requis pour ...
    language: fr
    script: Latn
    format: text/plain
contributor:
  - organization:
      name: International Organization for Standardization
      url: www.iso.org
      abbreviation: ISO
    role:
      type: publisher
  - person:
      name:
        completename:
          content: A. Bierman
          language: en
    role: author
copyright:
  owner:
    name: International Organization for Standardization
    abbreviation: ISO
    url: www.iso.org
  from: '2014'
  to: '2020'
link:
  - type: src
    content: https://www.iso.org/standard/53798.html
  - type: obp
    content: https://www.iso.org/obp/ui/#!iso:std:53798:en
relation:
  - type: updates
    bibitem:
      formattedref: ISO 19115:2003
    locality:
      locality_stack:
        type: page
        reference_from: '7'
        reference_to: '10'
series:
  - type: main
    title:
      type: original
      content: ISO/IEC FDIS 10118-3
    abbreviation:
      content: ABVR
    number: serie1234
    partnumber: part5678
medium:
  form: medium form
  size: medium size
  scale: medium scale
place:
  - bib place
  - city: Geneva
    region:
      - name: Region
    country:
      - iso: CH
        name: Switzerland
extent:
  locality:
    type: section
    reference_from: '7'
    reference_to: '10'
accesslocation:
  - accesslocation1
  - accesslocation2
classification:
  type: type
  value: value
validity:
  begins: '2010-10-10 12:21'
  ends: '2011-02-03 18:30'
  revision: '2011-03-04 09:00'
keyword:
  - Keyword
  - Key Word
license: License

See this example in other formats →

An open source project of Ribose