新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   >>中国XML论坛<<     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论Semantic Web(语义Web,语义网或语义万维网, Web 3.0)及相关理论,如:Ontology(本体,本体论), OWL(Web Ontology Langauge,Web本体语言), Description Logic(DL, 描述逻辑),RDFa,Ontology Engineering等。
    [返回] 中文XML论坛 - 专业的XML技术讨论区W3CHINA.ORG讨论区 - Web新技术讨论『 Semantic Web(语义Web)/描述逻辑/本体 』 → jena 存储 owl 本体 为什么数据库中无数据 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 2823 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: jena 存储 owl 本体 为什么数据库中无数据 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     fourstone00 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:4
      积分:73
      门派:XML.ORG.CN
      注册:2007/3/29

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给fourstone00发送一个短消息 把fourstone00加入好友 查看fourstone00的个人资料 搜索fourstone00在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看fourstone00的博客楼主
    发贴心情 jena 存储 owl 本体 为什么数据库中无数据

    在下面的代码中实现本体的数据库存储为什么我的数据库中建立了看不到我的test。owl本体的数据那??????????
    请高手指点指点

    public class ontology {
     public static final String ONT1 = "http://www.owl-ontologies.com/Ontology1178677723.owl";
     //public static final String ONT2 = "urn:x-hp-jena:test2";

     public static final String DB_URL = "jdbc:mysql://localhost/a";
     public static final String DB_USER = "root";
     public static final String DB_PASSWD = "";
     public static final String DB = "Mysql";
     public static final String DB_DRIVER = "com.mysql.jdbc.Driver";


     private static String s_dbURL = DB_URL;
        private static String s_dbUser = DB_USER;
     private static String s_dbPw = DB_PASSWD;
     private static String s_dbType = DB;
     private static String s_dbDriver = DB_DRIVER;


     private static boolean s_reload = false;

     // source URL to load data from; if null, use default
     private static String s_source;


     public static void main( String[] args ) {
      System.out.println(args.length);
         processArgs( args );

     // check for default sources
     if ( s_source == null) {
      s_source = getDefaultSource();
         //  System.out.println(s_source);
        }

     // create the helper class we use to handle the persistent ontologies
     PersistentOntology po = new PersistentOntology();

     // ensure the JDBC driver class is loaded
     try {
         Class.forName( s_dbDriver );
        }
     catch (Exception e) {
            System.err.println( "Failed to load the driver for the database: " + e.getMessage() );
            System.err.println( "Have you got the CLASSPATH set correctly?" );
     }

     // are we re-loading the data this time?
     if (s_reload) {

     // we pass cleanDB=true to clear out existing models
     // NOTE: this will remove ALL Jena models from the named persistent store, so
     // use with care if you have existing data stored
     ModelMaker maker = po.getRDBMaker( s_dbURL, s_dbUser, s_dbPw, s_dbType, true );

     // now load the source data into the newly cleaned db
     po.loadDB( maker, s_source );
     //System.out.println("in s_reload");
     }

     // now we list the classes in the database, to show that the persistence worked
     ModelMaker maker = po.getRDBMaker( s_dbURL, s_dbUser, s_dbPw, s_dbType, false );
     po.listClasses( maker, s_source );
     }


     // Internal implementation methods
    //////////////////////////////////

     /**
        * Process any command line arguments
        */
     private static void processArgs( String[] args ) {
     int i = 0;
     while (i < args.length) {
     String arg = args[i++];

     if(arg.equals( "--dbUser" )){s_dbURL = args[i++];}
     else if (arg.equals( "--dbURL" )){s_dbURL = args[i++];}
     else if (arg.equals( "--dbPasswd" )) {s_dbPw = args[i++];}
     else if (arg.equals( "--dbType" )){s_dbType = args[i++];}
     else if (arg.equals( "--reload" )){s_reload = true;}
     else if (arg.equals( "--dbDriver" )) {s_dbDriver = args[i++];}
     else {
          // assume this is a URL to load data from
          s_source = arg;
             }
          }
        }

     /**
        * Answer the default source document, and set up the document manager
        * so that we can find it on the file system
        *
        * @return The URI of the default source document
        */
     private static String getDefaultSource() {
     // use the ont doc mgr to map from a generic URN to a local source file
     OntDocumentManager.getInstance().addAltEntry( "http://www.w3.org/2001/sw/WebOnt/guide-src/wine","E:test1.owl" );
     return ONT1;
        }
    }


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/2/28 15:34:00
     
     iseleanor 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:3
      积分:76
      门派:XML.ORG.CN
      注册:2007/12/7

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给iseleanor发送一个短消息 把iseleanor加入好友 查看iseleanor的个人资料 搜索iseleanor在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看iseleanor的博客2
    发贴心情 
    我也遇到了同样的问题。。。
    谁能帮我一下。
    我的msn : iseleanor@live.cn
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/3/3 21:05:00
     
     weihuili5 美女呀,离线,快来找我吧!
      
      
      等级:大一新生
      文章:2
      积分:60
      门派:XML.ORG.CN
      注册:2008/3/7

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给weihuili5发送一个短消息 把weihuili5加入好友 查看weihuili5的个人资料 搜索weihuili5在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看weihuili5的博客3
    发贴心情 
    我也遇到这样的问题了,请高手帮忙!
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/3/7 10:04:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/3/9 6:03:32

    本主题贴数3,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    6,324.219ms