de.uka.ipd.consensus.impl
Class OntologyManagerImpl

java.lang.Object
  extended byde.uka.ipd.consensus.foundation.AbstractConsensusFoundationModule
      extended byde.uka.ipd.consensus.impl.OntologyManagerImpl
All Implemented Interfaces:
ConsensusFoundationManager, ConsensusFoundationModule, OntologyManager

public class OntologyManagerImpl
extends AbstractConsensusFoundationModule
implements OntologyManager

TODO

Version:
2006-06-14
Author:
Thomas Much

Field Summary
static String INTERNAL_TYPE_PREFIX
           
 
Constructor Summary
OntologyManagerImpl()
           
 
Method Summary
 void abortTransaction(Object scope, Object ta)
          This is a "quick rollback" for the transaction if no changes have been made to the ontology.
protected  void addAttribute(User adder, Topic topic, Attribute attr)
           
 void addExportHandler(ExportHandler handler)
          Registers an ExportHandler instance with the OntologyManager.
 void addImportHandler(ImportHandler handler)
          Registers an ImportHandler instance with the OntologyManager.
protected  Association addInstanceType(User adder, Topic topic, Topic type, boolean fire)
           
 void addOntologyListener(OntologyListener listener)
          Registers a new OntologyListener.
protected  Association addSuperclass(User adder, Topic topic, Topic superclass, boolean fire)
           
 Rateable checkInternalRateable(Rateable rateable)
          Checks the given rateable object if it is a special association that is usually wrapped inside a TypeInstance, SuperSubclass or Synonym.
 void commitTransaction(Object scope, Object ta)
          Commits the transaction for the given scope.
 Association createAssociation(User creator, String id, String name, Topic type)
          Creates an association of the given type.
 Attribute createAttribute(User creator, String id, String name, String value, Topic type)
          Creates an attribute of the given type.
 Topic createClassTopic(User creator, String id, String name, Topic cls)
          Creates a class topic as a subclass of the given superclass topic.
 Topic createInternalTopic(User creator, String id, String name, Topic type)
          Creates an internal topic that is not visible through the topic collections, only by id query.
protected  void createNewCreatedByAssociation(User creator, org.tm4j.topicmap.Topic creatableTopic)
           
protected  org.tm4j.topicmap.Topic createNewTopic(String id, String name, org.tm4j.topicmap.Topic type)
           
protected  void createSourceLocator(org.tm4j.topicmap.TopicMapObject tmo)
           
 Topic createTopic(User creator, String id, String name, Topic type)
          Creates a topic of the given type.
protected  void createTopicTypes()
           
 void deleteAssociation(Association assoc)
          Deletes an association permanently from the ontology.
 void deleteAttribute(Attribute attr)
          Deletes an attribute permanently from the ontology.
 void deleteTopic(Topic topic)
          Deletes a topic permanently from the ontology.
protected  void fireAssociationCreated(Association assoc, User creator)
           
protected  void fireAssociationTopicAdded(Association assoc, User adder, Topic topic)
           
protected  void fireAssociationTopicRemoved(Association assoc, User remover, Topic topic)
           
protected  void fireAttributeAdded(Attribute attr, User adder, Topic topic)
           
protected  void fireAttributeRemoved(Attribute attr, User remover, Topic topic)
           
protected  void fireAttributeValueChanged(Attribute attr, User changer, String oldValue)
           
protected  void fireConceptCommentChanged(Concept concept, User changer, String oldComment)
           
protected  void fireConceptNameChanged(Concept concept, User changer, String oldName)
           
protected  void fireConceptTypeChanged(Concept concept, User changer, Topic oldTopic)
           
protected  void fireOccurrenceChanged(Occurrence occ, User changer, Topic topic, String oldData)
           
protected  void fireOccurrenceCreated(Occurrence occ, User creator, Topic topic)
           
protected  void fireOccurrenceRemoved(Occurrence occ, User remover, Topic topic)
           
protected  void fireSynonymAdded(Synonym synonym, User adder)
           
protected  void fireSynonymRemoved(Synonym synonym, User remover)
           
protected  void fireTopicClassChanged(Topic topic, User changer, Topic oldTopic)
           
protected  void fireTopicCreated(Topic topic, User creator)
           
protected  Attributeable getAttributeable(org.tm4j.topicmap.Topic attributeableTopic)
           
protected  org.tm4j.topicmap.Topic getAttributeTopicType()
           
protected  org.tm4j.net.Locator getClassInstancePSI()
           
protected  org.tm4j.topicmap.Topic getClassInstanceTopicType()
           
protected  org.tm4j.net.Locator getClassPSI()
           
protected  org.tm4j.topicmap.Topic getClassTopicType()
           
protected  org.tm4j.topicmap.Topic getCommentTopicType()
           
protected  org.tm4j.topicmap.Topic getCreatedbyTopicType()
           
protected  User getCreator(org.tm4j.topicmap.Association assoc)
           
protected  User getCreator(org.tm4j.topicmap.Topic creatableTopic)
           
 ExportHandler getExportHandler(String format)
          Returns an export handler for a certain file format.
 int getExportHandlerCount()
          Returns the number of registered export handlers.
 Iterator getExportHandlers()
          Returns all export handlers.
protected  org.tm4j.topicmap.Association getFirstAssociation(org.tm4j.topicmap.Topic tmTopic, org.tm4j.topicmap.Topic tmAssocType)
           
protected  org.tm4j.topicmap.Topic getFirstPlayer(org.tm4j.topicmap.Association tmAssoc, org.tm4j.topicmap.Topic tmRoleType)
           
protected  org.tm4j.topicmap.Topic getFirstPlayer(org.tm4j.topicmap.Topic tmTopic, org.tm4j.topicmap.Topic tmAssocType, org.tm4j.topicmap.Topic tmRoleType)
           
 ImportHandler getImportHandler(String format)
          Returns an import handler for a certain file format.
 int getImportHandlerCount()
          Returns the number of registered import handlers.
 Iterator getImportHandlers()
          Returns all import handlers.
protected  org.tm4j.net.Locator getInstancePSI()
           
protected  org.tm4j.topicmap.Topic getInstanceTopicType()
           
protected  Collection getInternalTopics()
           
protected  org.tm4j.topicmap.Topic getInternalTopicType()
           
protected  Collection getMembersOfRole(org.tm4j.topicmap.Association assoc, org.tm4j.topicmap.Topic roleSpec)
           
 ImportHandler getMergeHandler(String format)
          Returns an import handler for a certain file format that can merge ontologies in this format.
 int getMergeHandlerCount()
          Returns the number of registered import handlers that can merge ontologies.
 Iterator getMergeHandlers()
          Returns all import handlers that can merge ontologies.
protected  org.tm4j.topicmap.Topic getNameTopicType()
           
protected  org.tm4j.topicmap.Topic getOrCreateTopicType(String id, String name, org.tm4j.topicmap.Topic type, org.tm4j.net.Locator psi)
           
protected  Collection getPlayers(org.tm4j.topicmap.Association tmAssoc, org.tm4j.topicmap.Topic tmRoleType)
           
protected  Collection getPlayers(org.tm4j.topicmap.Topic tmTopic, org.tm4j.topicmap.Topic tmAssocType, org.tm4j.topicmap.Topic tmRoleType)
           
 QueryEngine getQueryEngine()
          Returns the QueryEngine that is part of the OntologyManager.
protected  org.tm4j.net.Locator getSubclassPSI()
           
protected  org.tm4j.topicmap.Topic getSubclassTopicType()
           
protected  org.tm4j.topicmap.Association getSuperclassAssociation(org.tm4j.topicmap.Topic topic, org.tm4j.topicmap.Topic superclass)
           
protected  org.tm4j.net.Locator getSuperclassPSI()
           
protected  org.tm4j.net.Locator getSuperclassSubclassPSI()
           
protected  org.tm4j.topicmap.Topic getSuperclasssubclassTopicType()
           
protected  org.tm4j.topicmap.Topic getSuperclassTopicType()
           
protected  org.tm4j.net.Locator getSynonymousTermsPSI()
           
protected  org.tm4j.topicmap.Topic getSynonymoustermsTopicType()
           
protected  org.tm4j.net.Locator getSynonymPSI()
           
protected  org.tm4j.topicmap.Topic getSynonymTopicType()
           
 org.tm4j.topicmap.TopicMap getTopicMap()
           
protected  org.tm4j.net.Locator getTopicMapBase()
           
protected  org.tm4j.topicmap.TopicMapProvider getTopicMapProvider()
           
protected  String getTopicName(org.tm4j.topicmap.Topic topic)
           
protected  org.tm4j.topicmap.Association getTypeAssociation(org.tm4j.topicmap.Topic topic, org.tm4j.topicmap.Topic type)
           
protected  org.tm4j.topicmap.Topic getUserTopicType()
           
protected  org.tm4j.topicmap.Topic getValueTopicType()
           
 String getVersion()
          Returns a version string of the implementation of this module.
protected  org.tm4j.topicmap.Topic getVersionTopicType()
           
protected  boolean hasTopicName(org.tm4j.topicmap.Topic topic)
           
 void init(Properties config, LoggingManager logging, UserManager users)
          This method is called by the ConsensusFoundation constructor to initialize the OntologyManager.
 void initCompleted(Properties config, ConsensusFoundationManager cfm)
          This method is called by the ConsensusFoundation constructor after all available modules have been initialized (i.e. their init() method has been called).
protected  boolean isInternalTopicType(org.tm4j.topicmap.Topic tmTopic)
           
 Object openTransaction(Object scope)
          Opens a transaction for the ontology backend.
protected  void removeAttribute(User remover, Topic topic, Attribute attr)
           
 void removeOntologyListener(OntologyListener listener)
          Removes an OntologyListener, if it is registered with the OntologyManager (otherwise this call is ignored).
 boolean reorg()
          If the ontology needs reorganization from time to time, the implementation can clean up the ontology when an application calls this method.
 void rollbackTransaction(Object scope, Object ta)
          Rolls the transaction back for the given scope.
protected  void setTopicMap(org.tm4j.topicmap.TopicMap tm)
           
protected  void setTopicName(org.tm4j.topicmap.Topic topic, String name)
           
 void shutdown()
          Called by ConsensusFoundation.shutdown() when the application shuts down.
protected  boolean useClasses()
           
 
Methods inherited from class de.uka.ipd.consensus.foundation.AbstractConsensusFoundationModule
finalize, getConsensusFoundationManager, getDynamicRightsManager, getEvolutionManager, getIncentiveManager, getLoggingManager, getOntologyManager, getRatingManager, getUserManager
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.uka.ipd.consensus.foundation.ConsensusFoundationModule
getConsensusFoundationManager
 

Field Detail

INTERNAL_TYPE_PREFIX

public static final String INTERNAL_TYPE_PREFIX
See Also:
Constant Field Values
Constructor Detail

OntologyManagerImpl

public OntologyManagerImpl()
Method Detail

init

public void init(Properties config,
                 LoggingManager logging,
                 UserManager users)
          throws Exception
Description copied from interface: OntologyManager

This method is called by the ConsensusFoundation constructor to initialize the OntologyManager.

An implementation can use this method to restore an existing ontology from a persistent backend or to load a new ontology from a file (and replace an existing ontology). Import and export handlers should be initialized here, too.

Specified by:
init in interface OntologyManager
Parameters:
config - all entries from ConsensusFoundation.properties
logging - the successfully initialized LoggingManager instance
users - the the successfully initialized UserManager instance
Throws:
Exception - if any error occurs (startup of the application is aborted in this case)
See Also:
ConsensusFoundation.ConsensusFoundation()

initCompleted

public void initCompleted(Properties config,
                          ConsensusFoundationManager cfm)
                   throws Exception
Description copied from interface: ConsensusFoundationModule
This method is called by the ConsensusFoundation constructor after all available modules have been initialized (i.e. their init() method has been called). Here a module can perform some final initialization that is dependant on other modules.

Specified by:
initCompleted in interface ConsensusFoundationModule
Overrides:
initCompleted in class AbstractConsensusFoundationModule
Throws:
Exception

shutdown

public void shutdown()
Description copied from interface: ConsensusFoundationModule
Called by ConsensusFoundation.shutdown() when the application shuts down.

When implementing this method make sure that the shutdown code is executed only once even if this method is called multiple times.

Specified by:
shutdown in interface ConsensusFoundationModule
Overrides:
shutdown in class AbstractConsensusFoundationModule

getInternalTopics

protected Collection getInternalTopics()

createTopicTypes

protected void createTopicTypes()
                         throws OntologyManagerException
Throws:
OntologyManagerException

isInternalTopicType

protected boolean isInternalTopicType(org.tm4j.topicmap.Topic tmTopic)

getOrCreateTopicType

protected org.tm4j.topicmap.Topic getOrCreateTopicType(String id,
                                                       String name,
                                                       org.tm4j.topicmap.Topic type,
                                                       org.tm4j.net.Locator psi)
                                                throws Exception
Throws:
Exception

createSourceLocator

protected void createSourceLocator(org.tm4j.topicmap.TopicMapObject tmo)
                            throws org.tm4j.topicmap.DuplicateResourceLocatorException,
                                   org.tm4j.net.LocatorResolutionException
Throws:
org.tm4j.topicmap.DuplicateResourceLocatorException
org.tm4j.net.LocatorResolutionException

createNewTopic

protected org.tm4j.topicmap.Topic createNewTopic(String id,
                                                 String name,
                                                 org.tm4j.topicmap.Topic type)
                                          throws org.tm4j.topicmap.DuplicateObjectIDException,
                                                 PropertyVetoException,
                                                 org.tm4j.topicmap.DuplicateResourceLocatorException,
                                                 org.tm4j.net.LocatorResolutionException
Throws:
org.tm4j.topicmap.DuplicateObjectIDException
PropertyVetoException
org.tm4j.topicmap.DuplicateResourceLocatorException
org.tm4j.net.LocatorResolutionException

setTopicName

protected void setTopicName(org.tm4j.topicmap.Topic topic,
                            String name)
                     throws PropertyVetoException,
                            org.tm4j.topicmap.DuplicateObjectIDException
Throws:
PropertyVetoException
org.tm4j.topicmap.DuplicateObjectIDException

hasTopicName

protected boolean hasTopicName(org.tm4j.topicmap.Topic topic)

getTopicName

protected String getTopicName(org.tm4j.topicmap.Topic topic)

createNewCreatedByAssociation

protected void createNewCreatedByAssociation(User creator,
                                             org.tm4j.topicmap.Topic creatableTopic)
                                      throws org.tm4j.topicmap.DuplicateObjectIDException,
                                             org.tm4j.topicmap.DuplicateResourceLocatorException,
                                             PropertyVetoException,
                                             org.tm4j.net.LocatorResolutionException
Throws:
org.tm4j.topicmap.DuplicateObjectIDException
org.tm4j.topicmap.DuplicateResourceLocatorException
PropertyVetoException
org.tm4j.net.LocatorResolutionException

getFirstAssociation

protected org.tm4j.topicmap.Association getFirstAssociation(org.tm4j.topicmap.Topic tmTopic,
                                                            org.tm4j.topicmap.Topic tmAssocType)

getPlayers

protected Collection getPlayers(org.tm4j.topicmap.Topic tmTopic,
                                org.tm4j.topicmap.Topic tmAssocType,
                                org.tm4j.topicmap.Topic tmRoleType)

getPlayers

protected Collection getPlayers(org.tm4j.topicmap.Association tmAssoc,
                                org.tm4j.topicmap.Topic tmRoleType)

getFirstPlayer

protected org.tm4j.topicmap.Topic getFirstPlayer(org.tm4j.topicmap.Association tmAssoc,
                                                 org.tm4j.topicmap.Topic tmRoleType)

getFirstPlayer

protected org.tm4j.topicmap.Topic getFirstPlayer(org.tm4j.topicmap.Topic tmTopic,
                                                 org.tm4j.topicmap.Topic tmAssocType,
                                                 org.tm4j.topicmap.Topic tmRoleType)

getCreator

protected User getCreator(org.tm4j.topicmap.Topic creatableTopic)

getCreator

protected User getCreator(org.tm4j.topicmap.Association assoc)

getAttributeable

protected Attributeable getAttributeable(org.tm4j.topicmap.Topic attributeableTopic)

getMembersOfRole

protected Collection getMembersOfRole(org.tm4j.topicmap.Association assoc,
                                      org.tm4j.topicmap.Topic roleSpec)

getSuperclassAssociation

protected org.tm4j.topicmap.Association getSuperclassAssociation(org.tm4j.topicmap.Topic topic,
                                                                 org.tm4j.topicmap.Topic superclass)

getTypeAssociation

protected org.tm4j.topicmap.Association getTypeAssociation(org.tm4j.topicmap.Topic topic,
                                                           org.tm4j.topicmap.Topic type)

addSuperclass

protected Association addSuperclass(User adder,
                                    Topic topic,
                                    Topic superclass,
                                    boolean fire)
                             throws OntologyManagerException
Throws:
OntologyManagerException

addInstanceType

protected Association addInstanceType(User adder,
                                      Topic topic,
                                      Topic type,
                                      boolean fire)
                               throws OntologyManagerException
Throws:
OntologyManagerException

createTopic

public Topic createTopic(User creator,
                         String id,
                         String name,
                         Topic type)
                  throws OntologyManagerException,
                         DynamicRightsManagerException
Description copied from interface: OntologyManager
Creates a topic of the given type. If the implementation supports classes, the type must be a class topic.

Specified by:
createTopic in interface OntologyManager
Parameters:
creator - the user who wants to create the topic
id - the id (must not be empty) or (usually) null for an automatically computed id
name - the topic's name (must not be empty or null)
type - the type topic for the topic or null for a typeless topic
Returns:
the newly created topic
Throws:
DynamicRightsManagerException - if the user is not allowed to create topics of the given type
OntologyManagerException - if the topic could not be created
See Also:
Topic.isClassTopic(), DynamicRightsManager.mayCreateTopic(User, Topic)

createClassTopic

public Topic createClassTopic(User creator,
                              String id,
                              String name,
                              Topic cls)
                       throws OntologyManagerException,
                              DynamicRightsManagerException
Description copied from interface: OntologyManager
Creates a class topic as a subclass of the given superclass topic. Only supported if the implementation supports classes.

Topic.setClassTopic(true) is called after creation automatically.

Specified by:
createClassTopic in interface OntologyManager
Parameters:
creator - the user who wants to create the class topic
id - the id (must not be empty) or (usually) null for an automatically computed id
name - the topic's name (must not be empty or null)
cls - the superclass topic for the new class topic or null for a root class topic
Returns:
the newly created class topic
Throws:
OntologyManagerException - if the class topic could not be created
DynamicRightsManagerException - if the user is not allowed to create class topics of the given type
See Also:
Topic.isClassTopic(), Topic.setClassTopic(boolean), DynamicRightsManager.mayCreateClassTopic(User, Topic)

createInternalTopic

public Topic createInternalTopic(User creator,
                                 String id,
                                 String name,
                                 Topic type)
                          throws OntologyManagerException
Description copied from interface: OntologyManager
Creates an internal topic that is not visible through the topic collections, only by id query. If the implementation supports classes, the type must be a class topic.

If an id is given and an internal topic already exists with that id, the existing topic is returned instead of a newly created one.

Topic.setClassTopic(true) is called after creation automatically if the implementation uses classes.

Specified by:
createInternalTopic in interface OntologyManager
Parameters:
creator - the user who wants to create the internal topic
id - the id (must not be empty), null for an automatically computed id
name - the topic's name (must not be empty or null)
type - the type topic for the new topic or null for a typeless topic
Returns:
the newly created topic or an existing one with the given id
Throws:
OntologyManagerException - if the topic could not be created
See Also:
Topic.isClassTopic(), Topic.setClassTopic(boolean)

createAttribute

public Attribute createAttribute(User creator,
                                 String id,
                                 String name,
                                 String value,
                                 Topic type)
                          throws OntologyManagerException,
                                 DynamicRightsManagerException
Description copied from interface: OntologyManager
Creates an attribute of the given type. If the implementation supports classes, the type must be a class topic.

Specified by:
createAttribute in interface OntologyManager
Parameters:
creator - the user who wants to create the attribute
id - the id (must not be empty) or (usually) null for an automatically computed id
name - the attribute's name (must not be empty or null)
value - the attribute's value (null is treated as the empty string)
type - the type topic for the attribute or null for a typeless attribute
Returns:
the newly created attribute
Throws:
OntologyManagerException - if the attribute could not be created
DynamicRightsManagerException - if the user is not allowed to create attributes of the given type
See Also:
Attributeable.addAttribute(User, Attribute), Topic.isClassTopic(), DynamicRightsManager.mayCreateAttribute(User, Topic)

addAttribute

protected void addAttribute(User adder,
                            Topic topic,
                            Attribute attr)
                     throws OntologyManagerException
Throws:
OntologyManagerException

removeAttribute

protected void removeAttribute(User remover,
                               Topic topic,
                               Attribute attr)
                        throws OntologyManagerException
Throws:
OntologyManagerException

createAssociation

public Association createAssociation(User creator,
                                     String id,
                                     String name,
                                     Topic type)
                              throws OntologyManagerException,
                                     DynamicRightsManagerException
Description copied from interface: OntologyManager
Creates an association of the given type. If the implementation supports classes, the type must be a class topic.

Specified by:
createAssociation in interface OntologyManager
Parameters:
creator - the user who wants to create the association
id - the id (must not be empty) or (usually) null for an automatically computed id
name - the association's name (null is treated as the empty string)
type - the type topic for the association or null for a typeless association
Returns:
the newly created association
Throws:
DynamicRightsManagerException - if the user is not allowed to create associations of the given type
OntologyManagerException - if the association could not be created
See Also:
Topic.isClassTopic(), DynamicRightsManager.mayCreateAssociation(User, Topic)

checkInternalRateable

public Rateable checkInternalRateable(Rateable rateable)
Description copied from interface: OntologyManager
Checks the given rateable object if it is a special association that is usually wrapped inside a TypeInstance, SuperSubclass or Synonym. If it is, the association is wrapped and one of the three mentioned types is returned. Otherwise, the rateable object is returned unchanged.

Specified by:
checkInternalRateable in interface OntologyManager
Parameters:
rateable - the rateable object to be checked if it is a special internal association
Returns:
the wrapped association if it is a special internal one, or the unchanged parameter
See Also:
TypeInstance, SuperSubclass, Synonym

deleteTopic

public void deleteTopic(Topic topic)
                 throws OntologyManagerException
Description copied from interface: OntologyManager
Deletes a topic permanently from the ontology. This is done without other steps that might be necessary, for example deleting associations or other elements that are useless without this topic.

To delete topics in an application, use the EvolutionManager that keeps the ontology consistent and checks the user's rights. The EvolutionManager will then use this method to do the actual deleting.

Specified by:
deleteTopic in interface OntologyManager
Parameters:
topic - the topic to be deleted
Throws:
OntologyManagerException - if the topic cannot be deleted without making the ontology inconsistent
See Also:
EvolutionManager

deleteAssociation

public void deleteAssociation(Association assoc)
                       throws OntologyManagerException
Description copied from interface: OntologyManager
Deletes an association permanently from the ontology. This is done without other steps that might be necessary, for example deleting topics or other elements that are useless without this association.

To delete associations in an application, use the EvolutionManager that keeps the ontology consistent and checks the user's rights. The EvolutionManager will then use this method to do the actual deleting.

Specified by:
deleteAssociation in interface OntologyManager
Parameters:
assoc - the association to be deleted
Throws:
OntologyManagerException - if the association cannot be deleted without making the ontology inconsistent
See Also:
EvolutionManager

deleteAttribute

public void deleteAttribute(Attribute attr)
                     throws OntologyManagerException
Description copied from interface: OntologyManager
Deletes an attribute permanently from the ontology. This is done without other steps that might be necessary, for example deleting associations or other elements that are useless without this attribute.

To delete attributes in an application, use the EvolutionManager that keeps the ontology consistent and checks the user's rights. The EvolutionManager will then use this method to do the actual deleting.

Specified by:
deleteAttribute in interface OntologyManager
Parameters:
attr - the attribute to be deleted
Throws:
OntologyManagerException - if the attribute cannot be deleted without making the ontology inconsistent
See Also:
EvolutionManager

getQueryEngine

public QueryEngine getQueryEngine()
Description copied from interface: OntologyManager
Returns the QueryEngine that is part of the OntologyManager.

Note that the engine might be available only after initCompleted() has finished.

Specified by:
getQueryEngine in interface OntologyManager
Returns:
the QueryEngine instance

addOntologyListener

public void addOntologyListener(OntologyListener listener)
Description copied from interface: OntologyManager
Registers a new OntologyListener.

Specified by:
addOntologyListener in interface OntologyManager
Parameters:
listener - the OntologyListener to be added

removeOntologyListener

public void removeOntologyListener(OntologyListener listener)
Description copied from interface: OntologyManager
Removes an OntologyListener, if it is registered with the OntologyManager (otherwise this call is ignored).

Specified by:
removeOntologyListener in interface OntologyManager
Parameters:
listener - the OntologyListener to be removed

fireTopicCreated

protected void fireTopicCreated(Topic topic,
                                User creator)

fireAssociationCreated

protected void fireAssociationCreated(Association assoc,
                                      User creator)

fireConceptCommentChanged

protected void fireConceptCommentChanged(Concept concept,
                                         User changer,
                                         String oldComment)

fireConceptNameChanged

protected void fireConceptNameChanged(Concept concept,
                                      User changer,
                                      String oldName)

fireConceptTypeChanged

protected void fireConceptTypeChanged(Concept concept,
                                      User changer,
                                      Topic oldTopic)

fireTopicClassChanged

protected void fireTopicClassChanged(Topic topic,
                                     User changer,
                                     Topic oldTopic)

fireAssociationTopicAdded

protected void fireAssociationTopicAdded(Association assoc,
                                         User adder,
                                         Topic topic)

fireAssociationTopicRemoved

protected void fireAssociationTopicRemoved(Association assoc,
                                           User remover,
                                           Topic topic)

fireOccurrenceCreated

protected void fireOccurrenceCreated(Occurrence occ,
                                     User creator,
                                     Topic topic)

fireOccurrenceChanged

protected void fireOccurrenceChanged(Occurrence occ,
                                     User changer,
                                     Topic topic,
                                     String oldData)

fireOccurrenceRemoved

protected void fireOccurrenceRemoved(Occurrence occ,
                                     User remover,
                                     Topic topic)

fireAttributeAdded

protected void fireAttributeAdded(Attribute attr,
                                  User adder,
                                  Topic topic)

fireAttributeValueChanged

protected void fireAttributeValueChanged(Attribute attr,
                                         User changer,
                                         String oldValue)

fireAttributeRemoved

protected void fireAttributeRemoved(Attribute attr,
                                    User remover,
                                    Topic topic)

fireSynonymAdded

protected void fireSynonymAdded(Synonym synonym,
                                User adder)

fireSynonymRemoved

protected void fireSynonymRemoved(Synonym synonym,
                                  User remover)

openTransaction

public Object openTransaction(Object scope)
                       throws OntologyManagerException
Description copied from interface: OntologyManager
Opens a transaction for the ontology backend. Pass a suitable scope object, for example a HTTP request object.

The return value is a transaction object if this call started a new transaction or null if another transaction is already running for this scope. You'll have to pass the exact return value to the commit/rollback method.

Note that the implementation is not required to use the scope information if the backend does not support scoped transactions. If the backend does not support transactions at all, you'll always get null as the return value, which you can safely pass to the other transaction methods.

Specified by:
openTransaction in interface OntologyManager
Parameters:
scope - the scope how long the transaction will probably last
Returns:
a transaction object or null
Throws:
OntologyManagerException - if the transaction could not be opened

abortTransaction

public void abortTransaction(Object scope,
                             Object ta)
Description copied from interface: OntologyManager
This is a "quick rollback" for the transaction if no changes have been made to the ontology. Use with caution, especially if the implementation does not support scopes and other scopes might have changed the ontology.

Specified by:
abortTransaction in interface OntologyManager
Parameters:
scope - the scope for this transaction
ta - the return value from openTransaction()
See Also:
OntologyManager.openTransaction(Object)

commitTransaction

public void commitTransaction(Object scope,
                              Object ta)
                       throws OntologyManagerException
Description copied from interface: OntologyManager
Commits the transaction for the given scope. You must pass the exact return value from openTransaction() to this method.

Specified by:
commitTransaction in interface OntologyManager
Parameters:
scope - the scope for this transaction
ta - the return value from openTransaction()
Throws:
OntologyManagerException - if the transaction could not be committed successfully
See Also:
OntologyManager.openTransaction(Object)

rollbackTransaction

public void rollbackTransaction(Object scope,
                                Object ta)
                         throws OntologyManagerException
Description copied from interface: OntologyManager
Rolls the transaction back for the given scope. You must pass the exact return value from openTransaction() to this method.

Specified by:
rollbackTransaction in interface OntologyManager
Parameters:
scope - the scope for this transaction
ta - the return value from openTransaction()
Throws:
OntologyManagerException - if the transaction could not be rolled back successfully
See Also:
OntologyManager.openTransaction(Object)

getTopicMap

public org.tm4j.topicmap.TopicMap getTopicMap()

setTopicMap

protected void setTopicMap(org.tm4j.topicmap.TopicMap tm)

getTopicMapProvider

protected org.tm4j.topicmap.TopicMapProvider getTopicMapProvider()

getTopicMapBase

protected org.tm4j.net.Locator getTopicMapBase()

getSuperclassSubclassPSI

protected org.tm4j.net.Locator getSuperclassSubclassPSI()

getSuperclassPSI

protected org.tm4j.net.Locator getSuperclassPSI()

getSubclassPSI

protected org.tm4j.net.Locator getSubclassPSI()

getClassInstancePSI

protected org.tm4j.net.Locator getClassInstancePSI()

getClassPSI

protected org.tm4j.net.Locator getClassPSI()

getInstancePSI

protected org.tm4j.net.Locator getInstancePSI()

getSynonymousTermsPSI

protected org.tm4j.net.Locator getSynonymousTermsPSI()

getSynonymPSI

protected org.tm4j.net.Locator getSynonymPSI()

getInternalTopicType

protected org.tm4j.topicmap.Topic getInternalTopicType()

getUserTopicType

protected org.tm4j.topicmap.Topic getUserTopicType()

getCommentTopicType

protected org.tm4j.topicmap.Topic getCommentTopicType()

getCreatedbyTopicType

protected org.tm4j.topicmap.Topic getCreatedbyTopicType()

getNameTopicType

protected org.tm4j.topicmap.Topic getNameTopicType()

getAttributeTopicType

protected org.tm4j.topicmap.Topic getAttributeTopicType()

getValueTopicType

protected org.tm4j.topicmap.Topic getValueTopicType()

getVersionTopicType

protected org.tm4j.topicmap.Topic getVersionTopicType()

getSynonymoustermsTopicType

protected org.tm4j.topicmap.Topic getSynonymoustermsTopicType()

getSynonymTopicType

protected org.tm4j.topicmap.Topic getSynonymTopicType()

getSuperclasssubclassTopicType

protected org.tm4j.topicmap.Topic getSuperclasssubclassTopicType()

getSuperclassTopicType

protected org.tm4j.topicmap.Topic getSuperclassTopicType()

getSubclassTopicType

protected org.tm4j.topicmap.Topic getSubclassTopicType()

getClassInstanceTopicType

protected org.tm4j.topicmap.Topic getClassInstanceTopicType()

getClassTopicType

protected org.tm4j.topicmap.Topic getClassTopicType()

getInstanceTopicType

protected org.tm4j.topicmap.Topic getInstanceTopicType()

useClasses

protected boolean useClasses()

addExportHandler

public void addExportHandler(ExportHandler handler)
Description copied from interface: OntologyManager
Registers an ExportHandler instance with the OntologyManager. Usually you don't call this method explicitely but declare the handler classes in ConsensusFoundation.properties.

For each file format, only one export handler can be registered. Registering a format again replaces the older handler.

Specified by:
addExportHandler in interface OntologyManager
Parameters:
handler - the ExportHandler to be added to the OntologyManager's list of export handlers
See Also:
ExportHandler

getExportHandler

public ExportHandler getExportHandler(String format)
Description copied from interface: OntologyManager
Returns an export handler for a certain file format.

Specified by:
getExportHandler in interface OntologyManager
Parameters:
format - the required file format (e.g. "xtm")
Returns:
the ExportHandler or null if no export handler exists for the required format
See Also:
OntologyManager.addExportHandler(ExportHandler)

getExportHandlers

public Iterator getExportHandlers()
Description copied from interface: OntologyManager
Returns all export handlers.

Specified by:
getExportHandlers in interface OntologyManager
Returns:
an Iterator over all export handlers
See Also:
OntologyManager.addExportHandler(ExportHandler)

getExportHandlerCount

public int getExportHandlerCount()
Description copied from interface: OntologyManager
Returns the number of registered export handlers.

Specified by:
getExportHandlerCount in interface OntologyManager
Returns:
the number of export handlers
See Also:
OntologyManager.addExportHandler(ExportHandler)

addImportHandler

public void addImportHandler(ImportHandler handler)
Description copied from interface: OntologyManager
Registers an ImportHandler instance with the OntologyManager. Usually you don't call this method explicitely but declare the handler classes in ConsensusFoundation.properties.

For each file format, only one import handler can be registered. Registering a format again replaces the older handler.

Specified by:
addImportHandler in interface OntologyManager
Parameters:
handler - the ImportHandler to be added to the OntologyManager's list of import and merge handlers
See Also:
ImportHandler

getImportHandler

public ImportHandler getImportHandler(String format)
Description copied from interface: OntologyManager
Returns an import handler for a certain file format.

Specified by:
getImportHandler in interface OntologyManager
Parameters:
format - the required file format (e.g. "xtm")
Returns:
the ImportHandler or null if no import handler exists for the required format
See Also:
OntologyManager.addImportHandler(ImportHandler)

getMergeHandler

public ImportHandler getMergeHandler(String format)
Description copied from interface: OntologyManager
Returns an import handler for a certain file format that can merge ontologies in this format.

Specified by:
getMergeHandler in interface OntologyManager
Parameters:
format - the required file format (e.g. "xtm")
Returns:
the ImportHandler or null if no import handler exists that can merge ontologies in the required format
See Also:
OntologyManager.addImportHandler(ImportHandler)

getImportHandlers

public Iterator getImportHandlers()
Description copied from interface: OntologyManager
Returns all import handlers.

Specified by:
getImportHandlers in interface OntologyManager
Returns:
an Iterator over all import handlers
See Also:
OntologyManager.addImportHandler(ImportHandler)

getMergeHandlers

public Iterator getMergeHandlers()
Description copied from interface: OntologyManager
Returns all import handlers that can merge ontologies.

Specified by:
getMergeHandlers in interface OntologyManager
Returns:
an Iterator over all import handlers that can merge ontologies
See Also:
OntologyManager.addImportHandler(ImportHandler)

getImportHandlerCount

public int getImportHandlerCount()
Description copied from interface: OntologyManager
Returns the number of registered import handlers.

Specified by:
getImportHandlerCount in interface OntologyManager
Returns:
the number of import handlers
See Also:
OntologyManager.addImportHandler(ImportHandler)

getMergeHandlerCount

public int getMergeHandlerCount()
Description copied from interface: OntologyManager
Returns the number of registered import handlers that can merge ontologies.

Specified by:
getMergeHandlerCount in interface OntologyManager
Returns:
the number of import handlers that can merge ontologies
See Also:
OntologyManager.addImportHandler(ImportHandler)

reorg

public boolean reorg()
              throws OntologyManagerException
Description copied from interface: OntologyManager
If the ontology needs reorganization from time to time, the implementation can clean up the ontology when an application calls this method. The implementation should try to reorganize the ontology asynchronously and not to pause the running application.

Specified by:
reorg in interface OntologyManager
Returns:
true if the reorganization was started due to this call or false if an older reorganization is still running
Throws:
OntologyManagerException - if the reorganization could not be finished successfully

getVersion

public String getVersion()
Description copied from interface: ConsensusFoundationModule
Returns a version string of the implementation of this module.

Specified by:
getVersion in interface ConsensusFoundationModule
Returns:
the version of the module's implementation