示例#1
0
 /**
  * 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();
 }
示例#2
0
 static boolean isOntopia(TopicMap topicMap) {
   return topicMap.getClass().getName().startsWith(_ONTOPIA);
 }
示例#3
0
 static boolean isTinyTim(TopicMap topicMap) {
   return topicMap.getClass().getName().startsWith(_TINYTIM);
 }
示例#4
0
 /* (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);
 }