protected static void export(TopicMapIF tm, String outfile, String encoding, char format) throws java.io.IOException { if (encoding == null) encoding = "utf-8"; if (format == 'e') new XTMTopicMapWriter(new File(outfile), encoding).write(tm); else ImportExportUtils.getWriter(new File(outfile), encoding).write(tm); }
protected static void export(TopicMapIF tm, String outfile, boolean xtm) throws java.io.IOException { if (xtm) { if (encoding != null) new XTMTopicMapWriter(new File(outfile), encoding).write(tm); else new XTMTopicMapWriter(new File(outfile)).write(tm); } else ImportExportUtils.getWriter(new File(outfile), encoding).write(tm); }
/** * INTERNAL: Saves the topic map as an XTM document in the location managed by * the reference's source. */ public synchronized void save() throws IOException { if (store != null && source instanceof XTMPathTopicMapSource) { XTMPathTopicMapSource src = (XTMPathTopicMapSource) source; String path = src.getPath(); if (path != null) { File file = new File(path + File.separator + this.getId()); TopicMapWriterIF writer = new XTMTopicMapWriter(file); writer.write(store.getTopicMap()); } } }
/** * INTERNAL: Saves the topic map as an XTM document in the location * managed by the reference's source. */ public synchronized void save() throws IOException { if (store != null && source instanceof TMXMLPathTopicMapSource) { TMXMLPathTopicMapSource src = (TMXMLPathTopicMapSource) source; String path = src.getPath(); if (path != null) { File file = new File(path + File.separator + this.getId()); TopicMapWriterIF writer = new TMXMLWriter(file); writer.write(store.getTopicMap()); } } }
private static void convert(String infile, String outfile, OptionsListener options) throws java.io.IOException, java.net.MalformedURLException { TopicMapReaderIF reader = ImportExportUtils.getReader(infile); if (options.rdfmap != null) { Map<String, Object> config = new HashMap<String, Object>(); config.put("mappingFile", new File(options.rdfmap)); config.put("mappingSyntax", getSyntax(options.rdfmap)); reader.setAdditionalProperties(config); } if (reader instanceof XTMTopicMapReader) ((XTMTopicMapReader) reader).setValidation(options.validate); TopicMapIF tm = reader.read(); DuplicateSuppressionUtils.removeDuplicates(tm); if (options.xtm) { if (options.encoding != null) new XTMTopicMapWriter(new File(outfile), options.encoding).write(tm); else new XTMTopicMapWriter(new File(outfile)).write(tm); } else ImportExportUtils.getWriter(new File(outfile), options.encoding).write(tm); }
public static void main(String[] args) throws Exception { String tmuri = args[0]; TopicMapIF tm = ImportExportUtils.getReader(tmuri).read(); TopicMapStoreIF store = tm.getStore(); try { RandomTopicMapGenerator rg = new RandomTopicMapGenerator(tm); rg.topics = Integer.parseInt(args[1]); rg.populateTopicMap(); if (args.length > 2) ImportExportUtils.getWriter(new File(args[2])).write(tm); store.commit(); } finally { store.close(); } }
writer.write(tm); long end = System.currentTimeMillis();
log.debug("Exporting topic map to {}", outfile); TopicMapWriterIF writer = ImportExportUtils.getWriter(new File(outfile)); writer.write(topicmap);
writer.write(store.getTopicMap()); } catch (IOException e) { throw new OntopiaRuntimeException(e);
log.debug("Exporting topic map to " + outfile); TopicMapWriterIF writer = ImportExportUtils.getWriter(outfile); writer.write(topicmap);
log.debug("Exporting topic map to " + outfile); TopicMapWriterIF writer = ImportExportUtils.getWriter(new File(outfile)); writer.write(store.getTopicMap());
throw new OntopiaRuntimeException("Unsupported/unknown export format: " + format); writer.write(tm);
throw new OntopiaRuntimeException("Unsupported/unknown export format: " + format); writer.write(tm);
writer.write(sourceMap);