gpt4 book ai didi

net.ontopia.topicmaps.xml.XTMTopicMapReader.read()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 20:23:40 27 4
gpt4 key购买 nike

本文整理了Java中net.ontopia.topicmaps.xml.XTMTopicMapReader.read()方法的一些代码示例,展示了XTMTopicMapReader.read()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XTMTopicMapReader.read()方法的具体详情如下:
包路径:net.ontopia.topicmaps.xml.XTMTopicMapReader
类名称:XTMTopicMapReader
方法名:read

XTMTopicMapReader.read介绍

暂无

代码示例

代码示例来源:origin: ontopia/ontopia

protected Collection readAll(TopicMapStoreFactoryIF store_factory) throws IOException {
 Collection result = new ArrayList();
 TopicMapIF tm = read(store_factory);
 while (tm != null) {
  result.add(tm);
  tm = read(store_factory);
 }
 return result;      
}

代码示例来源:origin: ontopia/ontopia

@Override
public TopicMapIF read() throws IOException {
 return read(getStoreFactory());
}

代码示例来源:origin: ontopia/ontopia

protected TopicMapIF readTopicMap(String filename) throws IOException {
 filename = TestFileUtils.getTestInputFile(testdataDirectory, "in", filename);
 XTMTopicMapReader reader = new XTMTopicMapReader(TestFileUtils.getTestInputURL(filename));
 reader.setValidation(false);
 TopicMapIF tm = reader.read();
 Assert.assertTrue(
   "attempting to read second (non-existent) topic map did not give null",
   reader.read() == null);
 return tm;
}

代码示例来源:origin: ontopia/ontopia

protected TopicMapIF readTopicMap(String dir, String filename)
  throws IOException {
 filename = TestFileUtils.getTestInputFile(dir, filename);
 return new XTMTopicMapReader(TestFileUtils.getTestInputURL(filename)).read();
}

代码示例来源:origin: ontopia/ontopia

private void reload(boolean validate) throws IOException {
 export();
 XTMTopicMapReader reader = new XTMTopicMapReader(tmfile);
 reader.setValidation(validate);
 topicmap = reader.read();
}

代码示例来源:origin: ontopia/ontopia

protected TopicMapIF readTopicMap(String dir, String subdir, String filename)
  throws IOException {
 filename = TestFileUtils.getTestInputFile(dir, subdir, filename);
 return new XTMTopicMapReader(TestFileUtils.getTestInputURL(filename)).read();
}

代码示例来源:origin: ontopia/ontopia

@Override
protected void setUp() {
 XTMTopicMapReader reader  = null;
 try {
  reader = new XTMTopicMapReader(TestFileUtils.getTestInputURL("various", "stats.xtm"));
  tm = reader.read();
 } catch (IOException e) {
  fail("Error reading file\n" + e);
 }
}

代码示例来源:origin: ontopia/ontopia

@Test
public void testReadFromInputSource() throws IOException {
 TestFileUtils.transferTestInputDirectory("various");
 File file = TestFileUtils.getTransferredTestInputFile("various", "jill.xtm");
 TopicMapIF tm = new XTMTopicMapReader(new InputSource(new FileReader(file)), new URILocator(file)).read();
 Assert.assertNotNull(tm);
 Assert.assertEquals(39, tm.getTopics().size());
}

代码示例来源:origin: ontopia/ontopia

private TopicMapIF load(String dir, String file) throws IOException {
  return new XTMTopicMapReader(TestFileUtils.getTestInputURL(TestFileUtils.getTestInputFile(dir, file))).read();
 }
}

代码示例来源:origin: ontopia/ontopia

public void testFile() throws IOException {
  XTMTopicMapReader reader = new XTMTopicMapReader(inputFile);

  try {
   reader.read();
   Assert.fail("succeeded in importing bad file " + filename);
  } catch (IOException e) {
   // ok
   return;
  } catch (ConstraintViolationException e) {
   // ok
  } catch (OntopiaRuntimeException e) {
   if (!(e.getCause() instanceof org.xml.sax.SAXParseException)) {
    throw e;
   }
  }
 }
}

代码示例来源:origin: ontopia/ontopia

@Test
public void testReadFromReader() throws IOException {
 TestFileUtils.transferTestInputDirectory("various");
 File file = TestFileUtils.getTransferredTestInputFile("various", "jill.xtm");
 TopicMapIF tm = new XTMTopicMapReader(new FileReader(file), new URILocator(file)).read();
 Assert.assertNotNull(tm);
 Assert.assertEquals(39, tm.getTopics().size());
}

代码示例来源:origin: ontopia/ontopia

@Test
public void testReadFromInputStream() throws IOException {
 TestFileUtils.transferTestInputDirectory("various");
 File file = TestFileUtils.getTransferredTestInputFile("various", "jill.xtm");
 TopicMapIF tm = new XTMTopicMapReader(new FileInputStream(file), new URILocator(file)).read();
 Assert.assertNotNull(tm);
 Assert.assertEquals(39, tm.getTopics().size());
}

代码示例来源:origin: ontopia/ontopia

@Test
public void testReadFromURL() throws IOException {
 TopicMapIF tm = new XTMTopicMapReader(TestFileUtils.getTestInputURL("various", "jill.xtm")).read();
 Assert.assertNotNull(tm);
 Assert.assertEquals(39, tm.getTopics().size());
 
}

代码示例来源:origin: ontopia/ontopia

public void testFile() throws IOException {
   XTMTopicMapReader reader = new XTMTopicMapReader(inputFile);
   reader.setValidation(true);
   // FIXME: should we do a setXTM2Required(true) or something?

   try {
    reader.read();
    Assert.fail("Reader accepted invalid topic map: " + filename);
   } catch (InvalidTopicMapException e) {
    // goodie
   } catch (IOException e) {
    // ok
   } catch (OntopiaRuntimeException e) {
    if (!(e.getCause() instanceof org.xml.sax.SAXParseException))
     throw e;
   }
  }
}

代码示例来源:origin: ontopia/ontopia

@Test
public void testReadFromFile() throws IOException {
 TestFileUtils.transferTestInputDirectory("various");
 TopicMapIF tm = new XTMTopicMapReader(TestFileUtils.getTransferredTestInputFile("various", "jill.xtm")).read();
 Assert.assertNotNull(tm);
 Assert.assertEquals(39, tm.getTopics().size());
}

代码示例来源:origin: ontopia/ontopia

protected CountingRefHandler readTestFile(String fileName) {
 CountingRefHandler extRefHandler = new CountingRefHandler();
 try {
  String testfile = TestFileUtils.getTestInputFile(testdataDirectory, fileName);
  XTMTopicMapReader reader = new XTMTopicMapReader(TestFileUtils.getTestInputURL(testfile));
  reader.setExternalReferenceHandler(extRefHandler);
  reader.read();
 } catch (MalformedURLException ex) {
  Assert.fail("MalformedURLException initialising base address of test file.");
 } catch (IOException ex) {
  Assert.fail("IOException parsing test file." + ex.toString());
 }
 return extRefHandler;
}

代码示例来源:origin: ontopia/ontopia

@Override
  public void testFile() throws IOException {
   XTMTopicMapReader reader = new XTMTopicMapReader(inputFile);
   reader.setValidation(true);
   // FIXME: should we do a setXTM2Required(true) or something?

   try {
    reader.read();
    Assert.fail("Reader accepted invalid topic map: " + filename);
   } catch (InvalidTopicMapException e) {
    // goodie
   } catch (IOException e) {
    // ok
   } catch (OntopiaRuntimeException e) {
    if (e.getCause() instanceof ConstraintViolationException) return;
    if (!(e.getCause() instanceof org.xml.sax.SAXParseException))
     throw e;
   }
  }
}

代码示例来源:origin: ontopia/ontopia

@Override
protected void canonicalize(URL infile, File outfile)
 throws IOException {
 TopicMapStoreFactoryIF sfactory = getStoreFactory();
 XTMTopicMapReader reader = new XTMTopicMapReader(infile);
 reader.setValidation(false);
 // FIXME: should we do a setXTM2Required(true) or something?
 reader.setStoreFactory(sfactory);
 TopicMapIF source = reader.read();
 CanonicalXTMWriter cwriter = new CanonicalXTMWriter(outfile);
 cwriter.write(source);
 source.getStore().close();
}

代码示例来源:origin: ontopia/ontopia

@Override
protected void canonicalize(URL infile, File outfile)
 throws IOException {
 TopicMapStoreFactoryIF sfactory = getStoreFactory();
 XTMTopicMapReader reader = new XTMTopicMapReader(infile);
 reader.setValidation(false);
 // FIXME: should we do a setXTM2Required(true) or something?
 reader.setStoreFactory(sfactory);
 TopicMapIF source = reader.read();
 CanonicalXTMWriter cwriter = new CanonicalXTMWriter(outfile);
 cwriter.write(source);
 source.getStore().close();
}

代码示例来源:origin: ontopia/ontopia

@Override
protected void canonicalize(URL infile, File outfile) throws IOException {
 TopicMapStoreFactoryIF sfactory = getStoreFactory();
 XTMTopicMapReader reader = new XTMTopicMapReader(infile);
 reader.setValidation(false);
 reader.setStoreFactory(sfactory);
 TopicMapIF source = reader.read();
 CanonicalTopicMapWriter cwriter = new CanonicalTopicMapWriter(outfile);
 cwriter.setBaseLocator(new URILocator(infile));
 cwriter.write(source);
 source.getStore().close();
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com