Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.uka.ipd.consensus.foundation.ontology
Interface ImportHandler

All Known Implementing Classes:
  XTMImportHandler

public interface ImportHandler

The interface for modules that can import (and optionally merge) ontologies from a certain file format.

An ImportHandler can be registered with `OntologyManager.addImportHandler()`. However, it's easier just to declare all import handlers (their fully qualified classes) as a comma separated list under the "`cf.importhandler`" key in the `ConsensusFoundation.properties` configuration file.

The declared import handlers will be loaded by `OntologyManager.init()`. Instantiation will only be successful if one of the following constructors is available (the first one that matches will be used):

- `MyImportHandler(Properties config, LoggingManager log, OntologyManager om)`
- `MyImportHandler(LoggingManager log, OntologyManager om)`
- `MyImportHandler(OntologyManager om)`
- `MyImportHandler()`

The `Properties` parameter contains all entries from `ConsensusFoundation.properties`.

Version:
  2006-06-14
Author:
  Thomas Much
See Also:
  `OntologyManager`, `ExportHandler`

Method Summary
`boolean` | `canMerge()` Signals whether this handler can not only load (import), but also merge ontologies
`String` | `getDescription()` Returns a short description about this import handler.
`String` | `getExtension()` Returns the file extensions of the ontology format that this handler can load, e.g.
`void` | `importOntology(InputStream in)` Imports an ontology from the given InputStream.
`void` | `mergeOntology(InputStream in, Collection errors)` If this handler supports ontology merging, this method can be called by an application to merge an ontology into the existing ontology.

Method Detail

### importOntology

    public void importOntology(InputStream in)
                        throws IOException,
                               OntologyManagerException

  Imports an ontology from the given InputStream. This method will be called from the OntologyManager during startup of the application, it replaces an existing ontology.

  This method is responsible for closing the stream!

  Parameters:
    `in` - the InputStream to read the ontology from
  Throws:
    `IOException` - if an IO error occurrs while reading the stream
    `OntologyManagerException` - if the ontology cannot be loaded for logical reasons

### mergeOntology

    public void mergeOntology(InputStream in,
                              Collection errors)
                       throws IOException

  If this handler supports ontology merging, this method can be called by an application to merge an ontology into the existing ontology.

  This method is responsible for closing the stream!

  Parameters:
    `in` - the InputStream to read the ontology from
    `errors` - an empty collection provided by the caller, into which the method can put all exceptions that happen during the merge
  Throws:
    `IOException` - if an IO error occurrs while reading the stream
  See Also:
    `canMerge()`

### canMerge

    public boolean canMerge()

  Signals whether this handler can not only load (import), but also merge ontologies

  Returns:
    `true` if the handler can merge ontologies, `false` otherwise
  See Also:
    `mergeOntology(InputStream, Collection)`

### getExtension

    public String getExtension()

  Returns the file extensions of the ontology format that this handler can load, e.g. "xtm".

  Returns:
    the file extension for the handlers ontology file format

### getDescription

    public String getDescription()

  Returns a short description about this import handler.

  Returns:
    a description about this handler

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD