Abstract Documents Module

This module handles the concretion of documents, i.e., the substitution of variant elements with specific elements. The flow in which this concretion is carried is very similar to the Notation Module.

Variant Collection

The code here handles the collection of possible targets, for replacing a variant element.

Target variant sources:

  • F - collect all elements from a specified file.
  • Doc - collect elements from the input document, but only those that are before and left of the variant element.
  • V - collect elements inside the variant element.
  • EC - collect referenced elements in the ec attribute of the input element. This works in the same way as in the notation collection.

Variant Sorting

The same code (Context/Tag? collectors and sources) is also used for the variant sorting. See Rendering Sorting for detailed overview.

Concretion

The concretion is done with the VariantContractor class. The workflow is similar to the RendererFactory in the rendering case. Example code:

// create collectors and load with sources
VariantCollector vcoll = new VariantCollector();
ContextCollector ccoll = new ContextCollector();
TagCollector tcoll = new TagCollector();

VariantSorter sorter = new VariantSorter(vcoll, tcoll, ccoll);
VariantContractor contractor = new VariantContractor(sorter, true);
contractor.contract(input);  // contract variants in input