以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Semantic Web(语义Web)/描述逻辑/本体 』  (http://bbs.xml.org.cn/list.asp?boardid=2)
----  能看下到底是什么出问题么?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=89855)


--  作者:ehuangjiazi
--  发布时间:3/21/2011 3:50:00 PM

--  能看下到底是什么出问题么?
前段时间按照论坛上的保存本体的办法保存了一下,并且把信息改成我的,但是运行不成功,能帮忙看一下嘛?代码如下

import java.io.*;
import java.sql.SQLException;
import com.hp.hpl.jena.db.*;
import com.hp.hpl.jena.rdf.model.*;

public class Persistent {
 public static final String strDriver = "com.mysql.jdbc.Driver";
 public static final String strURL = "jdbc:mysql://localhost:3306/jena";
 // localhost的后面要直接写冒号,再写3306;
 public static final String strUser = "root";
 public static final String strPassword = "123";
 public static final String strDB = "MySQL";

 public static void main(String[] args) {
  try {
   DBConnection connection = new DBConnection(strURL, strUser,
     strPassword, strDB);
   // 创建连接时,第四个参数需要指定所用的数据库类型;也就是说strDB的值应该是“MySQL”
   try {
    Class.forName("com.mysql.jdbc.Driver");
    System.out.println("驱动程序已经安装。");
   } catch (ClassNotFoundException e) {
    System.out
      .println("ClassNotFoundException, Driver is not available");
   }
   System.out.println("数据库连接成功。");

   // 从此处开始读入一个OWL文件并且存储到数据库中;

   ModelMaker maker = ModelFactory.createModelRDBMaker(connection);
   // 使用数据库连接参数创建一个模型制造器
   Model defModel = maker.createModel("Animal");
   // 创建一个默认模型,命名为Costume,因为我要存入的OWL文件名是Costume

   FileInputStream read = null;
   try {
    File file = new File("E:/Program Files/Protege_3.4.4/Animal.owl");
    read = new FileInputStream(file);
   } catch (FileNotFoundException e) {
    e.printStackTrace();
    System.out.println("未找到要存储的本体文件,请检查文件地址及名称");
   }
   System.out.println("已将本体文件转换为字节流文件。");

   InputStreamReader in = null;
   try {
    in = new InputStreamReader((FileInputStream) read, "UTF-8");
   } catch (UnsupportedEncodingException e) {
    e.printStackTrace();
    System.out.println("不支持上述字符集。");
   }
   System.out.println("已将字节流文件转换为UTF-8编码。");

   defModel.read(in, null);
   try {
    in.close();
   } catch (IOException e) {
    e.printStackTrace();
    System.out.println("无法关闭字节流文件。");
   }
   System.out.println("已将字节流文件关闭。");

   defModel.commit();
   System.out.println("数据转换执行完毕,已将本体文件存入数据库。");
   try {
    connection.close();
   } catch (SQLException e) {
    e.printStackTrace();
    System.out.println("文件无法关闭。");
   }
  } catch (RDFRDBException e) {
   System.out.println("出现异常");
  }
  System.out.println("已将本体文件持久化到数据库中");
 }
}


运行的时候出现的错误是
驱动程序已经安装。
数据库连接成功。
已将本体文件转换为字节流文件。
已将字节流文件转换为UTF-8编码。
Exception in thread "main" java.lang.NoSuchMethodError: com.ibm.icu.text.Normalizer.isNormalized(Ljava/lang/String;Lcom/ibm/icu/text/Normalizer$Mode;I)Z
 at com.hp.hpl.jena.rdf.arp.impl.CharacterModel.isNormalFormC(CharacterModel.java:26)
 at com.hp.hpl.jena.rdf.arp.impl.ParserSupport.checkString(ParserSupport.java:117)
 at com.hp.hpl.jena.rdf.arp.impl.ARPDatatypeLiteral.<init>(ARPDatatypeLiteral.java:24)
 at com.hp.hpl.jena.rdf.arp.states.WantTypedLiteral.endElement(WantTypedLiteral.java:31)
 at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.endElement(XMLHandler.java:140)
 at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
 at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(Unknown Source)
 at org.apache.xerces.impl.XMLNamespaceBinder.endElement(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
 at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
 at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
 at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.parse(RDFXMLParser.java:106)
 at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:197)
 at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:184)
 at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:222)
 at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:187)
 at Persistent.main(Persistent.java:54)


--  作者:ehuangjiazi
--  发布时间:3/21/2011 5:01:00 PM

--  
我想知道导入jar包除了build path之外,还有什么方法啊?
--  作者:ccc689
--  发布时间:8/19/2011 5:37:00 PM

--  
★★★中国医学论文下载中心http://www.yixue68.com/index.php  
医学论文发表:http://www.jiaoyu68.com/sitemap.xml
医学期刊检索:http://www.yixue68.com/xyfm/class/
医药卫生杂志 医药管理杂志 医学教育杂志 预防医学杂志 基础医学杂志 临床医学杂志 中西医结合杂志  呼吸系统杂志 消化系统杂志 中医学杂志 中药学杂志 内分泌腺杂志 泌尿科杂志 传染病与皮肤病杂志 妇产杂志 心脑血管杂志 儿科杂志 外科杂志 眼科与耳鼻喉杂志 口腔杂志 肿瘤杂志 护理杂志 神经病杂志 生物医学杂志  影像学杂志 药学杂志 畜牧兽医杂志
儿科学论文:http://www.yixue68.com/erke/class/?108.html  
护理学论文:http://www.yixue68.com/huli/class/?124.html  
妇科学论文:http://www.yixue68.com/fuchanke/class/?107.html  
产科学论文:http://www.yixue68.com/fuchanke/class/?132.html  
孕育学论文:http://www.yixue68.com/fuchanke/class/?133.html   
乳腺学论文:http://www.yixue68.com/fuchanke/class/?182.html  
肺学论文:http://www.yixue68.com/huxi/class/?103.html  
呼吸道学论文:http://www.yixue68.com/huxi/class/?162.html   
胆囊学论文:http://www.yixue68.com/zhongyao/class/?175.html  
胰腺学论文:http://www.yixue68.com/zhongyao/class/?176.html  
心脏学论文:http://www.yixue68.com/xinxueguan/class/?129.html  
血液学论文:http://www.yixue68.com/xinxueguan/class/?128.html  
血管学论文:http://www.yixue68.com/xinxueguan/class/?121.html  
肝脏学论文:http://www.yixue68.com/zhongyao/class/?119.html  
胃学论文:http://www.yixue68.com/xiaohua/class/?117.html  
消化腺学论文:http://www.yixue68.com/xiaohua/class/?151.html  
肛肠学论文:http://www.yixue68.com/xiaohua/class/?171.html  
肾脏学论文:http://www.yixue68.com/miniao/class/?178.html  
糖尿病学论文:http://www.yixue68.com/miniao/class/?118.html  
男科学论文:http://www.yixue68.com/miniao/class/?186.html  
肾上腺学论文:http://www.yixue68.com/miniao/class/?183.html  
耳鼻喉学论文:http://www.yixue68.com/wuguan/class/?109.html  
口腔学论文:http://www.yixue68.com/kouqiang/class/?123.html  
眼科学论文:http://www.yixue68.com/wuguan/class/?131.html  
牙科学论文:http://www.yixue68.com/kouqiang/class/?152.html  
皮肤病学论文:http://www.yixue68.com/pifu/class/?120.html  
美容学论文:http://www.yixue68.com/pifu/class/?136.html  
整形学论文:http://www.yixue68.com/pifu/class/?135.html   
性病学论文:http://www.yixue68.com/pifu/class/?148.html  
临床医学论文:http://www.yixue68.com/linchuang/class/?102.html  
中医内科学论文:http://www.yixue68.com/zhongyi/class/?104.html  
中医外科学论文:http://www.yixue68.com/zhongyi/class/?138.html  
中西医学论文:http://www.yixue68.com/zhongxi/class/?116.html   
针灸学论文:http://www.yixue68.com/zhongyi/class/?174.html   
西药学论文:http://www.yixue68.com/yao/class/?113.html   
中药学论文:http://www.yixue68.com/yao/class/?146.html  
医药管理学论文:http://www.yixue68.com/news/class/?2.html  
生物医学论文:http://www.yixue68.com/shengwu/class/?112.html  
医药文献论文:http://www.yixue68.com/news/class/?161.html  
医学教育学论文:http://www.yixue68.com/jiaoyu/class/?114.html  
医学心理学论文:http://www.yixue68.com/jiaoyu/class/?147.html  
病理学论文:http://www.yixue68.com/jichu/class/?115.html  
老年保健论文:http://www.yixue68.com/yufang/class/?101.html  
免疫学论文:http://www.yixue68.com/yufang/class/?137.html  
甲状腺学论文:http://www.yixue68.com/yufang/class/?184.html  
传染病学论文:http://www.yixue68.com/yufang/class/?188.html  
肿瘤学论文:http://www.yixue68.com/zhongliu/class/?110.html  
理疗学论文:http://www.yixue68.com/tezhong/class/?166.html  
放疗学论文:http://www.yixue68.com/zhongliu/class/?169.html  
医学信息学论文:http://www.yixue68.com/jiaoan/class/?187.html  
医疗器械学论文:http://www.yixue68.com/jiaoan/class/?4.html  
检验学论文:http://www.yixue68.com/tezhong/class/?126.html  
心电学论文:http://www.yixue68.com/xinxueguan/class/?170.html  
CT 学论文:http://www.yixue68.com/tezhong/class/?164.html  
核医学论文:http://www.yixue68.com/tezhong/class/?165.html   
超声学论文:http://www.yixue68.com/tezhong/class/?168.html  
骨科学论文:http://www.yixue68.com/waike/class/?150.html  
创伤学论文:http://www.yixue68.com/waike/class/?122.html  
器官移植学论文:http://www.yixue68.com/zhongyao/class/?153.html  
药理学论文:http://www.yixue68.com/jichu/class/?160.html  
麻醉学论文:http://www.yixue68.com/waike/class/?177.html  
手术解剖学论文:http://www.yixue68.com/waike/class/?172.html   
脑外科学论文:http://www.yixue68.com/xinxueguan/class/?130.html  
脊神经学论文:http://www.yixue68.com/shengjing/class/?180.html  
脑神经学论文:http://www.yixue68.com/shengjing/class/?111.html  
植物神经学论文:http://www.yixue68.com/shengjing/class/?181.html  
垂体学论文:http://www.yixue68.com/shengjing/class/?185.html  
精神病学论文:http://www.yixue68.com/shengjing/class/?179.html  
兽医学论文:http://www.yixue68.com/xumushouyi/class/?191.html  
禽医学论文:http://www.yixue68.com/xumushouyi/class/?192.html  

W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
7,889.648ms