public abstract class AbstractTopicMapExporter extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
add_ids
INTERNAL: Whether or not IDs should be added to all elements.
|
protected static String |
EMPTY_LOCALNAME |
protected static String |
EMPTY_NAMESPACE |
protected Predicate |
filter |
Constructor and Description |
---|
AbstractTopicMapExporter() |
Modifier and Type | Method and Description |
---|---|
protected void |
addId(AttributesImpl atts,
TMObjectIF tmobject) |
protected Collection |
filterCollection(Collection unfiltered)
Filter a whole collection of objects.
|
protected boolean |
filterOk(Object unfiltered)
INTERNAL: Filter a single object.
|
String |
getElementId(TMObjectIF tmobject)
INTERNAL: Method used to extract the XTM element id from a topic
map object when a source locator relative to the topic map base
address exists.
|
protected boolean |
isValidXMLId(String id)
INTERNAL: Used to test whether the ID is a syntactically valid
XML ID.
|
static boolean |
mayCollide(String id)
INTERNAL: Used to find out whether this ID may collide with IDs
produced from object IDs.
|
void |
setFilter(Predicate filter)
PUBLIC: Sets the filter that decides which topic map constructs
are accepted in the exported TM/XML.
|
protected static final String EMPTY_NAMESPACE
protected static final String EMPTY_LOCALNAME
protected Predicate filter
protected boolean add_ids
public void setFilter(Predicate filter)
filter
- Places constraints on individual topicmap constructs.protected Collection filterCollection(Collection unfiltered)
unfiltered
- The objects to filter.protected boolean filterOk(Object unfiltered)
unfiltered
- The object to filter.protected void addId(AttributesImpl atts, TMObjectIF tmobject)
public String getElementId(TMObjectIF tmobject)
This method is critical because we want to preserve the connection between subject indicators used to reify local objects, and at the same time we wish to keep the symbolic IDs often used in XTM and LTM files.
When setting the IDs of elements we set the ID to "fragment" if the object has a source locator of the form "base#fragment", where base is the base address of the topic map store. If no such source locator is found, the ID becomes "id" + object ID.
See the getSubjectIndicatorRef method in XTMTopicMapExporter to see how subject indicators are exported. Synchronization of these two methods is vital.
public static boolean mayCollide(String id)
protected boolean isValidXMLId(String id)