/** * Main entry point for writing TM/XML. * * <p>This method generates the prefixes and writes TM/XML. * * @param topics The topics to write. * @param topicMap The topic map to which all topics belong to or <tt>null</tt>. * @throws IOException In case of an error. */ private void _write(final Iterable<Topic> topics, final TopicMap topicMap) throws IOException { _registerPrefixes(topics); _startTopicMap(topicMap); final Iterator<Topic> iter = topics.iterator(); if (iter.hasNext()) { final Topic topic = iter.next(); final TopicMap tm = topic.getTopicMap(); // Assuming that the locator can be used for all topics even if // they originate from different topic maps. _defaultNameTypeLocator = tm.createLocator(TMDM.TOPIC_NAME); _writeTopic(topic); while (iter.hasNext()) { _writeTopic(iter.next()); } } _endTopicMap(); _prefix2IRI.clear(); _iri2Prefix.clear(); _topic2Reference.clear(); _exportedAssocIds.clear(); }
static boolean isOntopia(TopicMap topicMap) { return topicMap.getClass().getName().startsWith(_ONTOPIA); }
static boolean isTinyTim(TopicMap topicMap) { return topicMap.getClass().getName().startsWith(_TINYTIM); }
/* (non-Javadoc) * @see org.tmapix.io.TopicMapWriter#write(org.tmapi.core.TopicMap) */ @Override public void write(final TopicMap topicMap) throws IOException { super.init(topicMap); _write(topicMap.getTopics(), topicMap); }