net.ontopia.topicmaps.xml
Class XTMFragmentExporter

java.lang.Object
  extended by net.ontopia.topicmaps.xml.AbstractTopicMapExporter
      extended by net.ontopia.topicmaps.xml.XTMTopicMapExporter
          extended by net.ontopia.topicmaps.xml.XTMFragmentExporter

public class XTMFragmentExporter
extends XTMTopicMapExporter

PUBLIC: Exports partial topic maps using an approach inspired by the XTM Fragment Interchange 0.1 specification, but different.

Note that the TopicMapFragmentWriterIF implementation is not this class, but XTMTopicMapFragmentWriter.

WARNING: This class is not thread-safe.

See Also:
XTMTopicMapFragmentWriter

Nested Class Summary
static interface XTMFragmentExporter.LocatorHandlerIF
          EXPERIMENTAL: Handler class used for processing locators.
 
Field Summary
protected  java.util.Set alreadyExported
           
protected  XTMFragmentExporter.LocatorHandlerIF locator_handler
           
protected  java.util.Collection reifiers
           
protected  boolean use_local_ids
           
static java.lang.String VIRTUAL_URN
           
 
Fields inherited from class net.ontopia.topicmaps.xml.XTMTopicMapExporter
atts, EMPTY_ATTR_LIST, export_srclocs
 
Fields inherited from class net.ontopia.topicmaps.xml.AbstractTopicMapExporter
add_ids, filter
 
Constructor Summary
XTMFragmentExporter()
          PUBLIC: Initializes the exporter.
XTMFragmentExporter(java.lang.String tmid)
           
 
Method Summary
 void endTopicMap(org.xml.sax.DocumentHandler dh)
          PUBLIC: Outputs the end tag.
 void exportAll(java.util.Iterator it, org.xml.sax.DocumentHandler dh)
          PUBLIC: Exports an XTM Fragment (complete with root element) to the given DocumentHandler, containing all the topics retrieved from the Iterator.
 void exportTopicNames(java.util.Iterator it, org.xml.sax.DocumentHandler dh)
          PUBLIC: Exports a set of topic names without any wrapping element.
 void exportTopics(java.util.Iterator it, org.xml.sax.DocumentHandler dh)
          PUBLIC: Exports a set of topics without any wrapping element.
 boolean getUseLocalIds()
          PUBLIC: Whether or not internal references of the form '#id' will be exported.
static boolean isVirtualReference(java.lang.String address)
           
protected  java.lang.String makeVirtualReference(TopicIF topic)
           
static java.lang.String makeVirtualReference(TopicIF topic, java.lang.String topicmap_id)
           
static java.lang.String resolveVirtualReference(java.lang.String address, java.lang.String tmid)
           
 void setLocatorHandler(XTMFragmentExporter.LocatorHandlerIF locator_handler)
          EXPERIMENTAL: Sets the locator handler.
 void setUseLocalIds(boolean use_local_ids)
          PUBLIC: Controls whether or not internal references of the form '#id' will be used.
static java.lang.String sourceTopicMapFromVirtualReference(java.lang.String address)
           
 void startTopicMap(org.xml.sax.DocumentHandler dh)
          PUBLIC: Outputs the start tag.
protected  void writeAssociation(AssociationIF assoc, org.xml.sax.DocumentHandler dh)
           
protected  void writeMembers(AssociationIF assoc, org.xml.sax.DocumentHandler dh)
           
protected  void writeOccurrences(java.util.Collection occurrences, org.xml.sax.DocumentHandler dh)
           
protected  void writeSubjectIdentity(TopicIF topic, org.xml.sax.DocumentHandler dh)
           
protected  void writeTopic(TopicIF topic, org.xml.sax.DocumentHandler dh)
           
protected  void writeTopicNames(java.util.Collection names, org.xml.sax.DocumentHandler dh)
           
protected  void writeTopicNames(TopicIF topic, org.xml.sax.DocumentHandler dh)
           
protected  void writeTopicRef(TopicIF topic, org.xml.sax.DocumentHandler dh)
           
protected  void writeVariants(java.util.Collection variants, org.xml.sax.DocumentHandler dh)
           
 
Methods inherited from class net.ontopia.topicmaps.xml.XTMTopicMapExporter
export, export, getAddIds, getExportSourceLocators, getSubjectIndicatorRef, reportInvalidLocator, setAddIds, setExportSourceLocators, writeInstanceOf, writeInstanceOf, writeMembers, writeParameters, writeRoleSpec, writeScope, writeVariantName
 
Methods inherited from class net.ontopia.topicmaps.xml.AbstractTopicMapExporter
addId, filterCollection, filterOk, getElementId, isValidXMLId, mayCollide, setFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIRTUAL_URN

public static final java.lang.String VIRTUAL_URN
See Also:
Constant Field Values

locator_handler

protected XTMFragmentExporter.LocatorHandlerIF locator_handler

reifiers

protected java.util.Collection reifiers

alreadyExported

protected java.util.Set alreadyExported

use_local_ids

protected boolean use_local_ids
Constructor Detail

XTMFragmentExporter

public XTMFragmentExporter()
PUBLIC: Initializes the exporter.


XTMFragmentExporter

public XTMFragmentExporter(java.lang.String tmid)
Method Detail

setLocatorHandler

public void setLocatorHandler(XTMFragmentExporter.LocatorHandlerIF locator_handler)
EXPERIMENTAL: Sets the locator handler. Currently only used for occurrences.


setUseLocalIds

public void setUseLocalIds(boolean use_local_ids)
PUBLIC: Controls whether or not internal references of the form '#id' will be used. TMRAP cannot use this, whereas when self-contained XTM fragment files are produced this should be used.


getUseLocalIds

public boolean getUseLocalIds()
PUBLIC: Whether or not internal references of the form '#id' will be exported.


exportAll

public void exportAll(java.util.Iterator it,
                      org.xml.sax.DocumentHandler dh)
               throws org.xml.sax.SAXException
PUBLIC: Exports an XTM Fragment (complete with root element) to the given DocumentHandler, containing all the topics retrieved from the Iterator. Duplicates do not cause problems.

Throws:
org.xml.sax.SAXException

exportTopics

public void exportTopics(java.util.Iterator it,
                         org.xml.sax.DocumentHandler dh)
                  throws org.xml.sax.SAXException
PUBLIC: Exports a set of topics without any wrapping element.

Throws:
org.xml.sax.SAXException

exportTopicNames

public void exportTopicNames(java.util.Iterator it,
                             org.xml.sax.DocumentHandler dh)
                      throws org.xml.sax.SAXException
PUBLIC: Exports a set of topic names without any wrapping element.

Throws:
org.xml.sax.SAXException

startTopicMap

public void startTopicMap(org.xml.sax.DocumentHandler dh)
                   throws org.xml.sax.SAXException
PUBLIC: Outputs the start tag.

Throws:
org.xml.sax.SAXException

endTopicMap

public void endTopicMap(org.xml.sax.DocumentHandler dh)
                 throws org.xml.sax.SAXException
PUBLIC: Outputs the end tag.

Throws:
org.xml.sax.SAXException

writeTopic

protected void writeTopic(TopicIF topic,
                          org.xml.sax.DocumentHandler dh)
                   throws org.xml.sax.SAXException
Overrides:
writeTopic in class XTMTopicMapExporter
Throws:
org.xml.sax.SAXException

writeTopicNames

protected void writeTopicNames(TopicIF topic,
                               org.xml.sax.DocumentHandler dh)
                        throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

writeTopicNames

protected void writeTopicNames(java.util.Collection names,
                               org.xml.sax.DocumentHandler dh)
                        throws org.xml.sax.SAXException
Overrides:
writeTopicNames in class XTMTopicMapExporter
Throws:
org.xml.sax.SAXException

writeTopicRef

protected void writeTopicRef(TopicIF topic,
                             org.xml.sax.DocumentHandler dh)
                      throws org.xml.sax.SAXException
Overrides:
writeTopicRef in class XTMTopicMapExporter
Throws:
org.xml.sax.SAXException

writeSubjectIdentity

protected void writeSubjectIdentity(TopicIF topic,
                                    org.xml.sax.DocumentHandler dh)
                             throws org.xml.sax.SAXException
Overrides:
writeSubjectIdentity in class XTMTopicMapExporter
Throws:
org.xml.sax.SAXException

writeVariants

protected void writeVariants(java.util.Collection variants,
                             org.xml.sax.DocumentHandler dh)
                      throws org.xml.sax.SAXException
Overrides:
writeVariants in class XTMTopicMapExporter
Throws:
org.xml.sax.SAXException

writeOccurrences

protected void writeOccurrences(java.util.Collection occurrences,
                                org.xml.sax.DocumentHandler dh)
                         throws org.xml.sax.SAXException
Overrides:
writeOccurrences in class XTMTopicMapExporter
Throws:
org.xml.sax.SAXException

writeAssociation

protected void writeAssociation(AssociationIF assoc,
                                org.xml.sax.DocumentHandler dh)
                         throws org.xml.sax.SAXException
Overrides:
writeAssociation in class XTMTopicMapExporter
Throws:
org.xml.sax.SAXException

writeMembers

protected void writeMembers(AssociationIF assoc,
                            org.xml.sax.DocumentHandler dh)
                     throws org.xml.sax.SAXException
Throws:
org.xml.sax.SAXException

isVirtualReference

public static boolean isVirtualReference(java.lang.String address)

resolveVirtualReference

public static java.lang.String resolveVirtualReference(java.lang.String address,
                                                       java.lang.String tmid)

sourceTopicMapFromVirtualReference

public static java.lang.String sourceTopicMapFromVirtualReference(java.lang.String address)

makeVirtualReference

protected java.lang.String makeVirtualReference(TopicIF topic)

makeVirtualReference

public static java.lang.String makeVirtualReference(TopicIF topic,
                                                    java.lang.String topicmap_id)


Copyright © 2000-2012 Ontopia.