Package org.iirds.dita.ot.plugin.spi

# Interface IirdsMetadataHandler

All Known Implementing Classes:
  `AudienceMetadataHandler`, `AudiencePropertyHandler`, `ComponentMetadataHandler`, `CompositeMetadataHandler`, `CopyrightMetadataHandler`, `CritdatesMetadataHandler`, `ProdnameMetadataHandler`, `ProductPropertyHandler`, `ShortdescMetadataHandler`, `SubjectSchemeDataMetadataHandler`

public interface IirdsMetadataHandler
Gets metadata from DITA content and updates the iiRDS RDF model with the found metadata.

There are three stages:

1. Extract metadata from DITA and store it temporarily: `extractMetadata(ToCNode, Document)`
2. Set the metadata to the iiRDS information unit after all metadata ahndlers have doen their extraction job: `addToModel(ToCNode, Model)`
3. Perform any metadata manipulations and completion of the iiRDS model after all handlers have extracted and set their metadata to the RDF model: `completeModel(ToCNode, Model)`

Metadata handlers might extract and set metadata or even just run any post-processing to finalize the iiRDS RDF model.

Implementations should not store any state related information concerning an exctraction in the instance. The instance must be re-usable for different extractions. Store any state information in the `ToCNode` provided in the instance methods called.

Author:
  Martin Kreutzer, Empolis Information Management GmbH

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addToModel(ToCNode node, org.apache.jena.rdf.model.Model model)`
  Adds extracted metadata of a topic or map to the iiRDS RDF model.
  `default void`
  `completeModel(ToCNode root, org.apache.jena.rdf.model.Model model)`
  Perform any post-processes on the iiRDS RDF model, after all metadata handlers have done their extraction and model update jobs.
  `void`
  `extractMetadata(ToCNode node, Document document)`
  Extract metadata from an XML DOM of a topic or map.
  `String`
  `getName()`
  The name this metadata handler can be activated by from the `dita` command via parameters

- ## Method Details

  - ### getName

    String getName()
    The name this metadata handler can be activated by from the `dita` command via parameters
    Returns:
      the unique name, should be short and comprehensible to users of the DITA OT.

  - ### extractMetadata

    void extractMetadata(ToCNode node, Document document)
    Extract metadata from an XML DOM of a topic or map. Implementations should store the extracted metadata via `ToCNode.setProperty(String, Object)`. The key of the property should reflect the element / attribute where the metadata come form in order to achieve unique keys for the properties.
    Parameters:
      `node` - the ToC node context
      `document` - the DOM to extract from

  - ### addToModel

    void addToModel(ToCNode node, org.apache.jena.rdf.model.Model model)
    Adds extracted metadata of a topic or map to the iiRDS RDF model. Implementations shall access the extracted metadata via `ToCNode.getProperty(String)`. The iiRDS `InformationUnit` has already been created when this method gets called and is accessible via `ToCNode.getInformationUnit()`
    Parameters:
      `node` - the ToC node context
      `model` - the RDF model (graph) to work with and update

  - ### completeModel

    default void completeModel(ToCNode root, org.apache.jena.rdf.model.Model model)
    Perform any post-processes on the iiRDS RDF model, after all metadata handlers have done their extraction and model update jobs. It should be used to complete the model, e.g. in the case mandatory metadata are missing. The default implementation does nothing. This method gets called only for the root node (usually the document). The implementation is free to `access` and manipulate any child nodes.
    Parameters:
      `root` - the ToC node context
      `model` - the RDF model (graph) to work with