Package org.iirds.dita.ot.plugin.contrib

# Class SubjectSchemeDataMetadataHandler

java.lang.Object
org.iirds.dita.ot.plugin.contrib.SubjectSchemeDataMetadataHandler

All Implemented Interfaces:
  `IirdsMetadataHandler`

public class SubjectSchemeDataMetadataHandler extends Object implements IirdsMetadataHandler
Metadata handler code implementation that extracts metadata from `data` elements in the `prolog` or `topicmeta` area.

The data elements must reference a subject definition via `keyref` attribute. From the target subject definition metadata information gets pulled.

E.g., snippet from topic :

          <prolog>
            <metadata>
              <data keyref="iirds.Disposal"/>
            </metadata>
          </prolog>

Snippet from subject scheme map:

        <subjectdef keys="iirds.ProductMetadata">
          <topicmeta>
            <navtitle>productMetadata</navtitle>
            <shortdesc>information about a product or component</shortdesc>
            <resourceid appid="http://iirds.tekom.de/iirds#ProductMetadata" appname="class-iri"/>
          </topicmeta>
         <subjectdef keys="iirds.ProductLifeCyclePhase">
            <topicmeta>
               <navtitle>phase of product lifecycle</navtitle>
               <shortdesc>defined period in the evolution of a product from the conceptual idea to its ultimate disposal</shortdesc>
               <resourceid appid="http://iirds.tekom.de/iirds#ProductLifeCyclePhase"
               appname="class-iri"/>
            </topicmeta>
            <subjectdef keys="iirds.AfterUse">
               <topicmeta>
            <navtitle>after use</navtitle>
            <shortdesc>product life cycle phase that follows the active use of the product</shortdesc>
            <resourceid appid="http://iirds.tekom.de/iirds#AfterUse" appname="class-iri"/>
               </topicmeta>
           <subjectdef keys="iirds.Disposal">
            <topicmeta>
               <navtitle>disposal</navtitle>
               <shortdesc>product life cycle phase spanning the process of elimination of a product or component</shortdesc>
               <resourceid appid="http://iirds.tekom.de/iirds#Disposal" appname="instance-iri"/>
            </topicmeta>
               </subjectdef>
          </subjectdef>

In this example, the `data` element references the `subjectdef` element via its key `iirds.Disposal`. The `subjectdef` elements surrounding this element provide the class hierarchy from the iiRDS scheme .

Author:
  Martin Kreutzer, Empolis Information Management GmbH
See Also:
  - `SubjectDef`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `(package private) static final String`
  `CLASS_IRI`
  `(package private) static final String`
  `INSTANCE_IRI`
  `(package private) static org.slf4j.Logger`
  `logger`
  `(package private) static final String`
  `PROP_SUBJECTSCHEME`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SubjectSchemeDataMetadataHandler()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addToModel(ToCNode root, org.apache.jena.rdf.model.Model model)`
  Adds extracted metadata of a topic or map to the iiRDS RDF model.
  `void`
  `extractMetadata(ToCNode node, Document document)`
  Extract metadata from an XML DOM of a topic or map.
  `(package private) static SubjectDef`
  `findClassOf(SubjectDef subjectdef)`
  `String`
  `getName()`
  The name this metadata handler can be activated by from the `dita` command via parameters
  `(package private) static boolean`
  `isClass(SubjectDef subjectdef)`
  `(package private) boolean`
  `isType(SubjectDef clazz, String classUri)`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.iirds.dita.ot.plugin.spi.IirdsMetadataHandler

  `completeModel`

- ## Field Details

  - ### logger

    static org.slf4j.Logger logger

  - ### PROP_SUBJECTSCHEME

    static final String PROP_SUBJECTSCHEME
    See Also:
      - Constant Field Values

  - ### INSTANCE_IRI

    static final String INSTANCE_IRI
    See Also:
      - Constant Field Values

  - ### CLASS_IRI

    static final String CLASS_IRI
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SubjectSchemeDataMetadataHandler

    public SubjectSchemeDataMetadataHandler()

- ## Method Details

  - ### getName

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

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### extractMetadata

    public void extractMetadata(ToCNode node, Document document)
    Description copied from interface: `IirdsMetadataHandler`
    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.
    Specified by:
      `extractMetadata` in interface `IirdsMetadataHandler`
    Parameters:
      `node` - the ToC node context
      `document` - the DOM to extract from

  - ### isClass

    static boolean isClass(SubjectDef subjectdef)

  - ### findClassOf

    static SubjectDef findClassOf(SubjectDef subjectdef)

  - ### isType

    boolean isType(SubjectDef clazz, String classUri)

  - ### addToModel

    public void addToModel(ToCNode root, org.apache.jena.rdf.model.Model model)
    Description copied from interface: `IirdsMetadataHandler`
    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()`
    Specified by:
      `addToModel` in interface `IirdsMetadataHandler`
    Parameters:
      `root` - the ToC node context
      `model` - the RDF model (graph) to work with and update