de.uka.ipd.consensus.foundation.schema
Interface Topic

All Superinterfaces:
Attributeable, Commentatable, Comparable, Concept, Createable, Rateable, Serializable, Versionable
All Known Implementing Classes:
TopicImpl

public interface Topic
extends Concept, Attributeable, Serializable, Comparable

This interface repesents a topic, the main element of the ontology.

Version:
2006-06-14
Author:
Thomas Much
See Also:
OntologyManager.createTopic(User, String, String, Topic), OntologyManager.createClassTopic(User, String, String, Topic), OntologyManager.createInternalTopic(User, String, String, Topic)

Method Summary
 Occurrence addOccurrence(User adder, String data, Topic type)
          Creates an occurrence for this topic with the given type and value (data).
 SuperSubclass addSuperclass(User adder, Topic cls)
          Adds a superclass to this topic.
 Synonym addSynonym(User adder, Topic synonym)
          Adds another topic as a synonym to this topic (and vice versa).
 TypeInstance addType(User adder, Topic type)
          Adds a type to this topic.
 Collection getAssociations(User user)
          Returns a collection of Association objects in which this topic plays a role.
 Collection getInstances(User user)
          Returns a collection of TypeInstance objects containing the instances of this type (class) topic.
 Occurrence getOccurrence(User user, String id)
          Queries an occurrence of this topic with the given id.
 Collection getOccurrences(Topic type)
          Returns a collection of all Occurrence objects of a certain type for this topic.
 Collection getOccurrences(User user)
          Returns a collection of all Occurrence objects for this topic.
 Collection getSubclasses(User user)
          Returns a collection of SuperSubclass objects containing the subclasses of this class topic.
 SuperSubclass getSuperclass(User user, String id)
          Queries a superclass of this topic with the given id.
 Collection getSuperclasses(User user)
          Returns a collection of SuperSubclass objects containing the superclasses of this class topic.
 Synonym getSynonym(User user, String id)
          Queries a synonym of this topic with the given id.
 Collection getSynonyms(User user)
          Returns a collection of all Synonym objects for this topic.
 TypeInstance getType(User user, String id)
          Queries a type with the given id of this instance topic.
 Collection getTypes(User user)
          Returns a collection of TypeInstance objects containing the types of this instance topic.
 boolean isClassTopic()
          Checks if this topic is a class topic.
 boolean isSynonymous(Topic topic)
          Checks if the given topic is synonymous with this topic.
 void removeOccurrence(User remover, Occurrence occ)
          Removes an occurrence from this topic.
 void removeSuperclass(User remover, Topic cls)
          Removes a superclass from this class topic.
 void removeSynonym(User remover, Topic synonym)
          Removes a synonymous topic from this topic (and vice versa).
 void removeType(User remover, Topic type)
          Removes a type from this topic.
 void setClassTopic(boolean isclass)
          Controls the class flag, i.e. if the topic is a class or an instance topic.
 
Methods inherited from interface de.uka.ipd.consensus.foundation.schema.Concept
getId, getName, isOfType, setName
 
Methods inherited from interface de.uka.ipd.consensus.foundation.schema.Versionable
getVersion
 
Methods inherited from interface de.uka.ipd.consensus.foundation.schema.Commentatable
getComment, setComment
 
Methods inherited from interface de.uka.ipd.consensus.foundation.schema.Rateable
addRating, getAverageRatingValue, getRating, getRatings, getRatingsCount
 
Methods inherited from interface de.uka.ipd.consensus.foundation.schema.Createable
getCreator
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface de.uka.ipd.consensus.foundation.schema.Attributeable
addAttribute, getAttribute, getAttributes, getAttributes, removeAttribute
 

Method Detail

getAssociations

public Collection getAssociations(User user)
Returns a collection of Association objects in which this topic plays a role.

Parameters:
user - the user who wants to see the associations
Returns:
a possibly empty collection, never null
See Also:
Association, DynamicRightsManager.mayViewAssociation(User, Association), QueryEngine.getAssociations(User, Topic)

getType

public TypeInstance getType(User user,
                            String id)
Queries a type with the given id of this instance topic.

Parameters:
user - the user who wants to see the type
id - the queried id
Returns:
a TypeInstance object containing the type or null if there's no type with the given id
See Also:
DynamicRightsManager.mayViewTopic(User, Topic), getSuperclass(User, String)

getTypes

public Collection getTypes(User user)
Returns a collection of TypeInstance objects containing the types of this instance topic.

Parameters:
user - the user who wants to see the types
Returns:
a possibly empty collection, never null
See Also:
TypeInstance, DynamicRightsManager.mayViewTopic(User, Topic), QueryEngine.getTypes(User, Topic), getSuperclasses(User)

getInstances

public Collection getInstances(User user)
Returns a collection of TypeInstance objects containing the instances of this type (class) topic.

Parameters:
user - the user who wants to see the instances
Returns:
a possibly empty collection, never null
See Also:
TypeInstance, DynamicRightsManager.mayViewTopic(User, Topic), QueryEngine.getInstances(User, Topic), isClassTopic(), getSubclasses(User)

addType

public TypeInstance addType(User adder,
                            Topic type)
                     throws OntologyManagerException,
                            DynamicRightsManagerException
Adds a type to this topic. If the implementation supports classes, the type must be a class topic.

Parameters:
adder - the user who wants to add the type
type - the type topic to be added (must not be null)
Returns:
a TypeInstance object containing the type topic
Throws:
OntologyManagerException - if the type could not be added
DynamicRightsManagerException - if the user is not allowed to add a type
See Also:
isClassTopic(), DynamicRightsManager.mayAddType(User, Topic), addSuperclass(User, Topic)

removeType

public void removeType(User remover,
                       Topic type)
                throws OntologyManagerException,
                       DynamicRightsManagerException
Removes a type from this topic. If the given type is no type of this topic, this call has no effect.

Parameters:
remover - the user who wants to remove the type
type - the type to be removed
Throws:
OntologyManagerException - if the type could not be removed
DynamicRightsManagerException - if the user is not allowed to remove the type
See Also:
TypeInstance, DynamicRightsManager.mayRemoveType(User, TypeInstance), removeSuperclass(User, Topic)

addOccurrence

public Occurrence addOccurrence(User adder,
                                String data,
                                Topic type)
                         throws OntologyManagerException,
                                DynamicRightsManagerException
Creates an occurrence for this topic with the given type and value (data). If the implementation supports classes, the type must be a class topic.

Parameters:
adder - the user who wants to create the occurrence
data - the value of the occurrence (null is treated as the empty string)
type - the type of the occurrence, including null for a typeless occurrence
Returns:
the newly created Occurrence object
Throws:
OntologyManagerException - if a new occurrence could not be created
DynamicRightsManagerException - if the user is not allowed to create occurrences
See Also:
isClassTopic(), DynamicRightsManager.mayChangeOccurrence(User)

removeOccurrence

public void removeOccurrence(User remover,
                             Occurrence occ)
                      throws OntologyManagerException,
                             DynamicRightsManagerException
Removes an occurrence from this topic.

Parameters:
remover - the user who wants to remove the occurrence.
occ - the occurrence to be removed
Throws:
OntologyManagerException - if the occurrence could not be removed
DynamicRightsManagerException - if the user is not allowed to remove occurrences
See Also:
DynamicRightsManager.mayChangeOccurrence(User)

getOccurrences

public Collection getOccurrences(User user)
Returns a collection of all Occurrence objects for this topic. The collection contains only occurrences whose type the user is allowed to see.

Parameters:
user - the user who wants to see the occurrences.
Returns:
a possibly empty collection, never null
See Also:
Occurrence, DynamicRightsManager.mayViewTopic(User, Topic)

getOccurrences

public Collection getOccurrences(Topic type)
Returns a collection of all Occurrence objects of a certain type for this topic.

Parameters:
type - the type of the occurrences
Returns:
a possibly empty collection, never null
See Also:
Occurrence

getOccurrence

public Occurrence getOccurrence(User user,
                                String id)
Queries an occurrence of this topic with the given id.

Parameters:
user - the user who wants to see the occurrence
id - the queried id
Returns:
the occurrence or null if there's no occurrence with the given id for this topic
See Also:
Occurrence.getId(), DynamicRightsManager.mayViewTopic(User, Topic)

addSynonym

public Synonym addSynonym(User adder,
                          Topic synonym)
                   throws OntologyManagerException,
                          DynamicRightsManagerException
Adds another topic as a synonym to this topic (and vice versa).

Parameters:
adder - the user who wants to add the synonym
synonym - the synonymous topic to be added (not null, not this topic itself)
Returns:
a Synonym object containing the two synonymous topics
Throws:
OntologyManagerException - if the synonymous topic could not be added
DynamicRightsManagerException - if the user is not allowed to add synonyms
See Also:
DynamicRightsManager.mayAddSynonym(User, Topic)

removeSynonym

public void removeSynonym(User remover,
                          Topic synonym)
                   throws OntologyManagerException,
                          DynamicRightsManagerException
Removes a synonymous topic from this topic (and vice versa).

Parameters:
remover - the user who wants to remove the synonymous topic
synonym - the synonymous topic to be removed
Throws:
OntologyManagerException - if the synonymous topic could not be removed
DynamicRightsManagerException - if the user is not allowed to remove the synonymous topic
See Also:
Synonym, DynamicRightsManager.mayRemoveSynonym(User, Synonym)

getSynonyms

public Collection getSynonyms(User user)
Returns a collection of all Synonym objects for this topic. The collection contains only synonymous topics the user is allowed to see.

Parameters:
user - the user who wants to see the synonyms
Returns:
a possibly empty collection, never null
See Also:
Synonym, DynamicRightsManager.mayViewTopic(User, Topic)

getSynonym

public Synonym getSynonym(User user,
                          String id)
Queries a synonym of this topic with the given id.

Parameters:
user - the user who wants to see the synonym
id - the queried id
Returns:
a Synonym object containing the two synonymous topics or null if there's no synonym with the given id
See Also:
DynamicRightsManager.mayViewTopic(User, Topic)

isSynonymous

public boolean isSynonymous(Topic topic)
Checks if the given topic is synonymous with this topic.

Parameters:
topic - the topic in question
Returns:
true if the two topics are synonymous, false otherwise

getSuperclass

public SuperSubclass getSuperclass(User user,
                                   String id)
Queries a superclass of this topic with the given id. If this topic is not a class or if the implementation does not support classes at all, null is returned.

Parameters:
user - the user who wants to see the superclass
id - the queried id
Returns:
a SuperSubclass object containing the superclass topic or null if there's no superclass with the given id
See Also:
DynamicRightsManager.mayViewTopic(User, Topic), isClassTopic(), getType(User, String)

getSuperclasses

public Collection getSuperclasses(User user)
Returns a collection of SuperSubclass objects containing the superclasses of this class topic. If this topic is not a class or if the implementation does not support classes at all, an empty collection is returned.

Parameters:
user - the user who wants to see the superclasses
Returns:
a possibly empty collection, never null
See Also:
SuperSubclass, DynamicRightsManager.mayViewTopic(User, Topic), QueryEngine.getSuperclasses(User, Topic), getTypes(User)

getSubclasses

public Collection getSubclasses(User user)
Returns a collection of SuperSubclass objects containing the subclasses of this class topic. If this topic is not a class or if the implementation does not support classes at all, an empty collection is returned.

Parameters:
user - the user who wants to see the subclasses
Returns:
a possibly empty collection, never null
See Also:
SuperSubclass, DynamicRightsManager.mayViewTopic(User, Topic), QueryEngine.getSubclasses(User, Topic), getInstances(User)

addSuperclass

public SuperSubclass addSuperclass(User adder,
                                   Topic cls)
                            throws OntologyManagerException,
                                   DynamicRightsManagerException
Adds a superclass to this topic. Both topics must be class topics.

Parameters:
adder - the user who wants to add the superclass
cls - the superclass topic to be added (must not be null)
Returns:
a SuperSubclass object containing the superclass topic
Throws:
OntologyManagerException - if the superclass could not be added
DynamicRightsManagerException - if the user is not allowed to add a superclass
UnsupportedOperationException - if the implementation does not support classes
See Also:
isClassTopic(), DynamicRightsManager.mayAddClass(User, Topic), addType(User, Topic)

removeSuperclass

public void removeSuperclass(User remover,
                             Topic cls)
                      throws OntologyManagerException,
                             DynamicRightsManagerException
Removes a superclass from this class topic.

Parameters:
remover - the user who wants to remove the superclass
cls - the superclass topic to be removed
Throws:
OntologyManagerException - if the superclass could not be removed
DynamicRightsManagerException - if the user is not allowed to remove the superclass
UnsupportedOperationException - if the implementation does not support classes
See Also:
isClassTopic(), DynamicRightsManager.mayRemoveClass(User, SuperSubclass), removeType(User, Topic)

setClassTopic

public void setClassTopic(boolean isclass)
                   throws OntologyManagerException

Controls the class flag, i.e. if the topic is a class or an instance topic.

You can use this method explicitely if the implementation is not configured to use classes, but usually you'll let the implementation decide which topics are classes by how the topics are created.

Parameters:
isclass - true if the topic shall be a class topic, false if it shall be an instance topic
Throws:
OntologyManagerException - if the class flag could not be changed
See Also:
OntologyManager.createClassTopic(User, String, String, Topic), isClassTopic()

isClassTopic

public boolean isClassTopic()
Checks if this topic is a class topic.

Returns:
true if this topic is a class topic, false otherwise
See Also:
setClassTopic(boolean)