public class TopicTools
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
dchars |
static int |
locatorCounter |
static java.lang.String |
nameOfInstanceType |
static java.lang.String |
nameOfTypeType |
static java.lang.String |
schars |
Constructor and Description |
---|
TopicTools()
Creates a new instance of TopicTools
|
Modifier and Type | Method and Description |
---|---|
static Locator |
cleanDirtyLocator(Locator l) |
static java.lang.String |
cleanDirtyLocator(java.lang.String s)
Removes or replaces all "dirty" characters in the string.
|
static Locator |
createDefaultLocator()
Returns a default locator that can be given to a topic and it
is very likely (but not sure) that the subject identifier doesn't
cause accidental merge.
|
static java.lang.String[] |
getAssociationsAsTriplets(Topic t)
Returns a flat string array that contains associations (including
classes and instances) of a given topic.
|
static java.lang.String[] |
getAssociationsAsTypePlayerTuples(Topic t)
Returns a flat string array that contains associations (including classes
and instances) of a given topic.
|
static java.lang.String[] |
getAsTriplet(Association a)
Returns given association as a string array where first element
is association type and next elements association player topics.
|
private static void |
getCyclePaths(java.util.List<java.util.List<Topic>> cycles,
java.util.List<Topic> path,
Topic base,
Topic associationType,
Topic baseRole,
Topic outRole) |
static java.util.List<java.util.List<Topic>> |
getCyclePaths(Topic base,
Topic associationType,
Topic baseRole,
Topic outRole)
Returns possible paths where one can traverse given associations
back to the starting topic.
|
static Topic |
getEdgeTopic(Topic base,
Topic associationType,
Topic baseRole,
Topic outRole)
Return one edge topic.
|
static java.util.Collection<Topic> |
getEdgeTopics(java.util.Collection<Topic> source,
Topic associationType,
Topic baseRole,
Topic outRole)
Return a collection of topics.
|
static Topic |
getFirstPlayer(Topic topic,
java.lang.String associationTypeSI,
java.lang.String roleSI)
Get one player in the associations of given type in the topic that is of given role.
|
static Topic |
getFirstPlayerWithRole(Topic topic,
java.lang.String roleSI)
Returns one player of given role in the associations of the topic.
|
static java.util.List<Layer> |
getLayers(ContainerTopicMap tm)
Returns a list of topic map layers of given container topic map.
|
static java.util.List<Topic> |
getPlayers(java.util.Collection topics,
java.lang.String associationTypeSI,
java.lang.String roleSI)
Get all players of associations of a given topics.
|
static java.util.List<Topic> |
getPlayers(java.util.Collection topics,
java.lang.String associationTypeSI,
java.lang.String roleSI,
java.lang.String hasRole,
java.lang.String hasPlayer)
Get all players of topics if next conditions apply:
Association type must be same as argument associationTypeSI.
|
static java.util.List<Topic> |
getPlayers(Topic topic,
java.lang.String associationTypeSI)
Get all players of all associations of a given type in the topic.
|
static java.util.List<Topic> |
getPlayers(Topic topic,
java.lang.String associationTypeSI,
java.lang.String roleSI)
Get all player topics within associations of a given topic.
|
static java.util.List<Topic> |
getPlayers(Topic topic,
java.lang.String associationTypeSI,
java.lang.String roleSI,
java.lang.String hasRole,
java.lang.String hasPlayer)
Get all players of a topic if next conditions apply:
Association type must be same as argument associationTypeSI.
|
static java.util.List<Topic> |
getPlayers(Topic topic,
Topic associationType,
Topic role)
Return a list of topics.
|
static java.util.List<Topic> |
getPlayers(Topic topic,
Topic type,
Topic role,
Topic hasRole,
Topic hasPlayer)
Get all players of a topic if next conditions apply:
Association type must be same as argument type.
|
static java.util.List<Topic> |
getPlayersWithRole(java.util.Collection topics,
java.lang.String roleSI)
Get all players of given role in the associations of a collection of topics.
|
static java.util.List<Topic> |
getPlayersWithRole(Topic topic,
java.lang.String roleSI)
Get all players of given role in the associations of the topic.
|
static java.util.List<Topic> |
getPlayersWithRoles(java.util.Collection topics,
java.util.Collection roleSIs)
Get all players with one of specified roles in the associations of topics
in the collection.
|
static java.util.List<Topic> |
getPlayersWithRoles(java.util.Collection topics,
java.lang.String[] roleSIs)
Get all players with one of specified roles in the associations of topics
in the collection.
|
static java.util.List<Topic> |
getPlayersWithRoles(Topic topic,
java.util.Collection roleSIs)
Get all players with one of specified roles in the associations of the topic.
|
static java.util.List<Topic> |
getPlayersWithRoles(Topic topic,
java.lang.String[] roleSIs)
Get all players with one of specified roles in the associations of the topic.
|
static java.util.List<Topic> |
getSinglePath(Topic base,
Topic associationType,
Topic baseRole,
Topic outRole)
Returns one path (a list of topics) that is created traversing associations
from a given start point to the end point.
|
static java.util.List<java.lang.String> |
getSLsOfPlayers(Topic topic,
java.lang.String associationTypeSI,
java.lang.String roleSI) |
static java.util.List<java.lang.String> |
getSLsOfTopics(java.util.Collection topics)
Returns a list subject locators of given topics.
|
static java.util.List<Topic> |
getSortedPlayers(Topic topic,
java.util.Collection associationTypesSI,
java.util.Collection rolesSI,
java.lang.String sortRole,
java.lang.String lang)
Gets a sorted list of player topics of a given topic and association types
and roles.
|
static java.util.List<Topic> |
getSortedPlayers(Topic topic,
java.lang.String associationTypeSI,
java.lang.String roleSI,
java.lang.String sortRole,
java.lang.String lang)
Gets a sorted list of player topics of a given topic and association type
and role.
|
static java.util.List<java.lang.String> |
getSubjectLocatorsOfPlayers(Topic topic,
java.lang.String associationTypeSI,
java.lang.String roleSI) |
static java.util.List<java.lang.String> |
getSubjectLocatorsOfTopics(java.util.Collection topics)
Returns a list subject locators of given topics.
|
static java.lang.String |
getTopicName(Topic t)
Returns topic's base name if base name exists.
|
static java.util.List<Topic> |
getTypesOfRequiredType(Topic topic,
java.lang.String requiredTypeSI)
Returns a list of type topics of a given topic.
|
static boolean |
isDirtyLocator(Locator l)
Checks if given locator contains unwanted characters that make
the locator "dirty".
|
static boolean |
isDirtyLocatorCharacter(char c)
Method isDirtyLocator uses this method to decide whether or not
a character is "dirty".
|
static boolean |
isTopicMapContainer(TopicMap tm)
Checks if a given topic map is a container topic map.
|
static char |
repacementLocatorCharacterFor(char c)
Finds a suitable replacement character for some "dirty" characters.
|
public static java.lang.String schars
public static java.lang.String dchars
public static int locatorCounter
public static final java.lang.String nameOfInstanceType
public static final java.lang.String nameOfTypeType
public static Topic getFirstPlayerWithRole(Topic topic, java.lang.String roleSI)
topic
- roleSI
- public static java.util.List<Topic> getPlayersWithRole(Topic topic, java.lang.String roleSI) throws TopicMapException
topic
- roleSI
- TopicMapException
public static java.util.List<Topic> getPlayersWithRole(java.util.Collection topics, java.lang.String roleSI)
topics
- roleSI
- public static java.util.List<Topic> getPlayersWithRoles(Topic topic, java.lang.String[] roleSIs)
topic
- roleSIs
- public static java.util.List<Topic> getPlayersWithRoles(Topic topic, java.util.Collection roleSIs)
topic
- roleSIs
- public static java.util.List<Topic> getPlayersWithRoles(java.util.Collection topics, java.util.Collection roleSIs)
topics
- roleSIs
- public static java.util.List<Topic> getPlayersWithRoles(java.util.Collection topics, java.lang.String[] roleSIs)
topics
- roleSIs
- public static java.util.List<Topic> getPlayers(Topic topic, java.lang.String associationTypeSI) throws TopicMapException
topic
- associationTypeSI
- TopicMapException
public static Topic getFirstPlayer(Topic topic, java.lang.String associationTypeSI, java.lang.String roleSI)
topic
- associationTypeSI
- roleSI
- public static java.util.List<Topic> getPlayers(Topic topic, java.lang.String associationTypeSI, java.lang.String roleSI) throws TopicMapException
topic
- associationTypeSI
- roleSI
- TopicMapException
public static java.util.List<Topic> getPlayers(Topic topic, Topic associationType, Topic role) throws TopicMapException
topic
- associationType
- role
- TopicMapException
public static java.util.List<Topic> getPlayers(java.util.Collection topics, java.lang.String associationTypeSI, java.lang.String roleSI)
topics
- associationTypeSI
- roleSI
- public static java.util.List<Topic> getPlayers(Topic topic, java.lang.String associationTypeSI, java.lang.String roleSI, java.lang.String hasRole, java.lang.String hasPlayer) throws TopicMapException
topic
- associationTypeSI
- roleSI
- hasRole
- hasPlayer
- TopicMapException
public static java.util.List<Topic> getPlayers(Topic topic, Topic type, Topic role, Topic hasRole, Topic hasPlayer) throws TopicMapException
topic
- type
- role
- hasRole
- hasPlayer
- TopicMapException
public static java.util.List<Topic> getPlayers(java.util.Collection topics, java.lang.String associationTypeSI, java.lang.String roleSI, java.lang.String hasRole, java.lang.String hasPlayer) throws TopicMapException
topics
- associationTypeSI
- roleSI
- hasRole
- hasPlayer
- TopicMapException
public static java.util.List<Topic> getSortedPlayers(Topic topic, java.lang.String associationTypeSI, java.lang.String roleSI, java.lang.String sortRole, java.lang.String lang) throws TopicMapException
topic
- associationTypeSI
- roleSI
- sortRole
- lang
- TopicMapException
public static java.util.List<Topic> getSortedPlayers(Topic topic, java.util.Collection associationTypesSI, java.util.Collection rolesSI, java.lang.String sortRole, java.lang.String lang) throws TopicMapException
topic
- associationTypesSI
- rolesSI
- sortRole
- lang
- TopicMapException
public static java.util.List<Topic> getTypesOfRequiredType(Topic topic, java.lang.String requiredTypeSI)
topic
- requiredTypeSI
- public static java.util.List<java.lang.String> getSLsOfPlayers(Topic topic, java.lang.String associationTypeSI, java.lang.String roleSI) throws TopicMapException
TopicMapException
public static java.util.List<java.lang.String> getSubjectLocatorsOfPlayers(Topic topic, java.lang.String associationTypeSI, java.lang.String roleSI) throws TopicMapException
TopicMapException
public static java.util.List<java.lang.String> getSLsOfTopics(java.util.Collection topics)
topics
- public static java.util.List<java.lang.String> getSubjectLocatorsOfTopics(java.util.Collection topics)
topics
- public static java.util.Collection<Topic> getEdgeTopics(java.util.Collection<Topic> source, Topic associationType, Topic baseRole, Topic outRole)
source
- associationType
- baseRole
- outRole
- public static Topic getEdgeTopic(Topic base, Topic associationType, Topic baseRole, Topic outRole)
base
- associationType
- baseRole
- outRole
- public static java.util.List<Topic> getSinglePath(Topic base, Topic associationType, Topic baseRole, Topic outRole)
base
- associationType
- baseRole
- outRole
- public static java.util.List<java.util.List<Topic>> getCyclePaths(Topic base, Topic associationType, Topic baseRole, Topic outRole)
base
- associationType
- baseRole
- outRole
- private static void getCyclePaths(java.util.List<java.util.List<Topic>> cycles, java.util.List<Topic> path, Topic base, Topic associationType, Topic baseRole, Topic outRole)
public static boolean isDirtyLocator(Locator l)
l
- public static boolean isDirtyLocatorCharacter(char c)
c
- public static char repacementLocatorCharacterFor(char c)
c
- public static java.lang.String cleanDirtyLocator(java.lang.String s)
s
- public static Locator createDefaultLocator()
public static java.lang.String getTopicName(Topic t)
t
- public static java.lang.String[] getAssociationsAsTriplets(Topic t)
t
- public static java.lang.String[] getAssociationsAsTypePlayerTuples(Topic t)
t
- public static java.lang.String[] getAsTriplet(Association a)
a
- public static java.util.List<Layer> getLayers(ContainerTopicMap tm)
tm
- public static boolean isTopicMapContainer(TopicMap tm)
tm
- Copyright 2004-2015 Wandora Team