org.tm4j.topicmap
Interface TopicMapUtils


public interface TopicMapUtils

This interface defines the basic set of utility functions expected from a topic map engine. Different concrete instances of the TopicMap interface may define their own concrete instance of this interface.

See Also:
TopicMap

Method Summary
 java.lang.String generateId()
           
 java.lang.String generateId(java.net.URL baseURL)
           
 java.util.Collection getAssociations(Topic topic)
          Returns a collection of all associations in which the specified topic plays a role.
 java.util.Collection getAssociationsInScope(Topic[] scope, java.util.Collection associations)
          Returns an unmodifiable collection of associations in a given scope.
 java.util.Collection getAssociationsInScope(Topic scope, java.util.Collection associations)
          Returns a collection of the associations in a given scope.
 java.util.Iterator getAssociationsIterator()
          Returns an iterator over all of the Associations in the topic map.
 java.util.Collection getAssociationsOfType(Topic type, java.util.Collection associations)
          Returns an unmodifiable collection of associations which are of the specified type.
 java.util.Collection getAssociationTypes(java.util.Collection associations)
          Retrieves the type of all specified associations
 java.lang.String getDisplayName(Topic topic, Topic[] inScope)
          Returns a string which may be used as a display name in the specified scope.
 java.util.Collection getMembersOfType(Association assoc, Locator subjectOrIndicator)
          Returns the set of Members of the specified Association for which the subject or subject indicator of the roleSpec matches the specified locator
 java.util.Collection getMembersOfType(Topic topic, Locator subjectOrIndicator)
          Returns the set of Members of the specified Topic for which the subject or subject indicator of the roleSpec matches the specified locator.
 java.util.Iterator getNamesIterator()
          Returns an iterator over all of the base names of topics in the topic map.
 java.util.Collection getObjectScopes(java.util.Collection objects)
          Get the scopes of all specified topic map objects.
 java.util.Collection getObjectsInScope(java.util.Collection scope, java.util.Collection objects)
          Gets the all topic map objects in the specified scope
 java.util.Collection getObjectsOfType(Topic type, java.util.Collection objects)
          Returns only those objects in the specified collection which are of the specifed type.
 java.util.Collection getObjectTypes(java.util.Collection objects)
          Gets the types of the specified objects
 java.util.Iterator getOccurrencesIterator()
          Returns an iterator over all of the occurrences of topics in the topic map
 java.util.Collection getPlayersOfRole(Association assoc, Topic roleSpec)
          Returns the set of topics which are players in Members of the specified association where the Member plays role defined by roleSpec.
 java.lang.String getSortName(Topic topic, Topic[] inScope)
          Returns a string which may be used as a sort name in the specified scope.
 java.util.Collection getSubClasses(Topic cls)
          Retrieves the subclasses of the class defined by the Topic cls.
 java.util.Collection getSuperClasses(Topic cls)
          Retrieves the superclasses of the class defined by the Topic cls.
 java.util.Collection getThemes()
          Deprecated. from 0.9.0 use the ThemesIndex
 java.util.Collection getTopicsByIdentity(java.lang.String identity)
          getTopicsByIdentity Gets the Topic objects which have the specified identity.
 java.util.Iterator getTopicsIterator()
          Returns an iterator over all of the topics in the topic map.
 java.util.Collection getTopicTypes(java.util.Collection topics)
          getTopicTypes Returns all of the Topics which describe the type of another topic.
 

Method Detail

getAssociationTypes

public java.util.Collection getAssociationTypes(java.util.Collection associations)
Retrieves the type of all specified associations

Parameters:
associations - The associations to be searched. If this parameter is null, all associations in the topic map are searched.
Returns:
An unmodifiable collection of Topics defining the type of the searched associations.

getAssociationsInScope

public java.util.Collection getAssociationsInScope(Topic scope,
                                                   java.util.Collection associations)
Returns a collection of the associations in a given scope.

Parameters:
scope - The single-theme scope to be searched.
associations - The associations to be searched. If this is null then all associations in the topic map are searched.
Returns:
An unmodifiable collection of all the associations found.

getAssociationsInScope

public java.util.Collection getAssociationsInScope(Topic[] scope,
                                                   java.util.Collection associations)
Returns an unmodifiable collection of associations in a given scope.

Parameters:
scope - The set of themes to be searched.
associations - The associations to be searched. If this is null then all associations in the topic map are searched.
Returns:
An unmodifiable collection of all the associations found.

getAssociationsOfType

public java.util.Collection getAssociationsOfType(Topic type,
                                                  java.util.Collection associations)
Returns an unmodifiable collection of associations which are of the specified type.

Parameters:
type - The topic defining the type to be searched.
associations - The associations to be searched. If this is null, then all associations in the topic map are searched.

getAssociationsIterator

public java.util.Iterator getAssociationsIterator()
Returns an iterator over all of the Associations in the topic map.

Returns:
an Iterator object which will iterate over the topic map's associations

getTopicTypes

public java.util.Collection getTopicTypes(java.util.Collection topics)
getTopicTypes Returns all of the Topics which describe the type of another topic.

Parameters:
topics - A Collection of the topics to return the types of. If this is null, then the types of all topics in the map will be returned.

getTopicsIterator

public java.util.Iterator getTopicsIterator()
Returns an iterator over all of the topics in the topic map.


getNamesIterator

public java.util.Iterator getNamesIterator()
Returns an iterator over all of the base names of topics in the topic map.

Returns:
an Iterator over BaseName objects

getOccurrencesIterator

public java.util.Iterator getOccurrencesIterator()
Returns an iterator over all of the occurrences of topics in the topic map

Returns:
an Iterator over Occurrence objects

getObjectsOfType

public java.util.Collection getObjectsOfType(Topic type,
                                             java.util.Collection objects)
Returns only those objects in the specified collection which are of the specifed type.

Parameters:
type - The topic defining the type to filter on
objects - The objects to be filtered

getObjectsInScope

public java.util.Collection getObjectsInScope(java.util.Collection scope,
                                              java.util.Collection objects)
Gets the all topic map objects in the specified scope

Parameters:
scope - The scope to be searched.
objects - The objects to be processed. If null, all objects in the topic map are processed.
Returns:
The set of all objects in the given scope.

getObjectScopes

public java.util.Collection getObjectScopes(java.util.Collection objects)
Get the scopes of all specified topic map objects.

Parameters:
objects - A List of the objects to be processed. If this is null then all objects in the topic map are processed.
Returns:
The collection of all themes defined by the collection of objects

getObjectTypes

public java.util.Collection getObjectTypes(java.util.Collection objects)
Gets the types of the specified objects

Parameters:
objects - List of the objects to be processed
Returns:
Collection of all types found.

getTopicsByIdentity

public java.util.Collection getTopicsByIdentity(java.lang.String identity)
getTopicsByIdentity Gets the Topic objects which have the specified identity. Note that a Topic Map implementation may return only one Topic or a number of Topics, depending on whether Topics are early-merged or late-merged.

Parameters:
identity - The topic identity to be searched for
Returns:
The collection of all Topics which have the specified identity.

getThemes

public java.util.Collection getThemes()
Deprecated. from 0.9.0 use the ThemesIndex

Returns the set of Topics in this topic map which are used as a theme in the scope of one or more other topic map objects.


getMembersOfType

public java.util.Collection getMembersOfType(Topic topic,
                                             Locator subjectOrIndicator)
Returns the set of Members of the specified Topic for which the subject or subject indicator of the roleSpec matches the specified locator.


getMembersOfType

public java.util.Collection getMembersOfType(Association assoc,
                                             Locator subjectOrIndicator)
Returns the set of Members of the specified Association for which the subject or subject indicator of the roleSpec matches the specified locator


getPlayersOfRole

public java.util.Collection getPlayersOfRole(Association assoc,
                                             Topic roleSpec)
Returns the set of topics which are players in Members of the specified association where the Member plays role defined by roleSpec.


getDisplayName

public java.lang.String getDisplayName(Topic topic,
                                       Topic[] inScope)
Returns a string which may be used as a display name in the specified scope. If a variant name with a parameter of 'display' exists in the specified scope, then that variant's name string is returned. Otherwise a base name in the specified scope is sought and if found, then the base name string is returned. Finally a base name in the unconstrained scope is sought and that name string returned. If all of these searches fail, null is returned.


getSortName

public java.lang.String getSortName(Topic topic,
                                    Topic[] inScope)
Returns a string which may be used as a sort name in the specified scope. If a variant name with a parameter of 'sort' exists in the specified scope, then that variant's name string is returned. Otherwise a base name in the specified scope is sought and if found, then the base name string is returned. Finally a base name in the unconstrained scope is sought and that name string returned. If all of these searches fail, null is returned.


getAssociations

public java.util.Collection getAssociations(Topic topic)
Returns a collection of all associations in which the specified topic plays a role.


generateId

public java.lang.String generateId()

generateId

public java.lang.String generateId(java.net.URL baseURL)

getSuperClasses

public java.util.Collection getSuperClasses(Topic cls)
Retrieves the superclasses of the class defined by the Topic cls. This method makes use of the XTM-defined subclass/superclass association and role types

Parameters:
cls - The topic defining the class to retrieve the superclasses for.
Returns:
An unmodifiable Collection of the Topic objects which define the superclasses of cls
Since:
0.7.0

getSubClasses

public java.util.Collection getSubClasses(Topic cls)
Retrieves the subclasses of the class defined by the Topic cls. This method makes use of the XTM-defined subclass/superclass association and role types.

Parameters:
cls - The topic defining the class to retrieve the subclasses for.
Returns:
An unmodifiable Collection of the Topic objects which define the subclasses of cls
Since:
0.7.0