以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 Semantic Web(语义Web)/描述逻辑/本体 』  (http://bbs.xml.org.cn/list.asp?boardid=2)
----  [求助]关于Protégé-OWL API 的问题????  (http://bbs.xml.org.cn/dispbbs.asp?boardid=2&rootid=&id=37108)


--  作者:lqm
--  发布时间:8/22/2006 11:11:00 PM

--  [求助]关于Protégé-OWL API 的问题????
请各位大侠帮我!!!!!
    就是这份资料中给的第一个简单程序,我想尽一切办法就是调试通不过。
资料出处:http://protege.stanford.edu/plugins/owl/api/guide.html
程序代码:
package com.demo.application;

import edu.stanford.smi.protegex.owl.model.OWLModel;
import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
import edu.stanford.smi.protegex.owl.ProtegeOWL;

public class OWLAPIDemoApplication {

    public static void main(String[] args) {
        OWLModel owlModel = ProtegeOWL.createJenaOWLModel();
        owlModel.getNamespaceManager().setDefaultNamespace("http://hello.com#");
        OWLNamedClass worldClass = owlModel.createOWLNamedClass("World");
        System.out.println("Class URI: " + worldClass.getURI());
    }
}
论坛里有人已经把这个程序调试通过了,可是我按照他们的指示还是不能运行
我不知重装了好多次Jbuilder和Jcreator 分别在不同的环境中运行,很郁闷,仍然不行!!!
在Jcreator中报错:
cannot access edu.stanford.smi.protegex.owl.model.OWLModel
在Jbuilder 2005中,编译能通过,但是运行时虽然出了结果,,但是报一串警告
不知是何故???
D:\JBuilder2005\jdk1.4\bin\javaw -classpath "G:\testapp\JBProject;D:\JBuilder2005\jdk1.4\jre\javaws\javaws.jar;D:\JBuilder2005\jdk1.4\jre\lib\charsets.jar;D:\JBuilder2005\jdk1.4\jre\lib\ext\dnsns.jar;D:\JBuilder2005\jdk1.4\jre\lib\ext\ldapsec.jar;D:\JBuilder2005\jdk1.4\jre\lib\ext\localedata.jar;D:\JBuilder2005\jdk1.4\jre\lib\ext\sunjce_provider.jar;D:\JBuilder2005\jdk1.4\jre\lib\im\indicim.jar;D:\JBuilder2005\jdk1.4\jre\lib\im\thaiim.jar;D:\JBuilder2005\jdk1.4\jre\lib\jce.jar;D:\JBuilder2005\jdk1.4\jre\lib\jsse.jar;D:\JBuilder2005\jdk1.4\jre\lib\plugin.jar;D:\JBuilder2005\jdk1.4\jre\lib\rt.jar;D:\JBuilder2005\jdk1.4\jre\lib\sunrsasign.jar;D:\JBuilder2005\jdk1.4\lib\dt.jar;D:\JBuilder2005\jdk1.4\lib\htmlconverter.jar;D:\JBuilder2005\jdk1.4\lib\tools.jar;D:\Protege_3.1\protege.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\antlr.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\commons-logging.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\concurrent.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\ekitspell.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\icu4j.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\jakarta-oro-2.0.5.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\jcalendar.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\jena.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\junit.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\kazuki.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\log4j.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\protege-owl.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\rdf-api-2001-01-19.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\xercesImpl.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\xml-apis.jar;D:\Protege_3.1\plugins\edu.stanford.smi.protegex.owl\xmlParserAPIs.jar"  testapp.OWLAPIDemoApplication
CONFIG: Protege 3.1.1 Build 216, JVM 1.4.2_04-b05, memory=66M, Windows XP, encoding=UTF-8, language=zh, country=CN
WARNING: Look and feel not found: com.jgoodies.plaf.plastic.PlasticLookAndFeel -- SystemUtilities.setLookAndFeel()
WARNING: Plugins directory not found: G:\testapp\plugins -- PluginUtilities.findPluginsDirectory()


Class URI: http://hello.com#World(程序的结果)
但前面的警告什么意思???
求大侠能帮我????



--  作者:lqm
--  发布时间:8/22/2006 11:17:00 PM

--  
主要是不明白:
CONFIG: Protege 3.1.1 Build 216, JVM 1.4.2_04-b05, memory=66M, Windows XP, encoding=UTF-8, language=zh, country=CN
WARNING: Look and feel not found: com.jgoodies.plaf.plastic.PlasticLookAndFeel -- SystemUtilities.setLookAndFeel()
WARNING: Plugins directory not found: G:\testapp\plugins -- PluginUtilities.findPluginsDirectory()
这是什么意思?
该怎么办?
为什么同样的*.jar配置,在Jcreator中就报错:

cannot access edu.stanford.smi.protegex.owl.model.OWLModel
根本不能执行呢?



--  作者:jpz6311whu
--  发布时间:8/22/2006 11:44:00 PM

--  
Jbuilder 2005已经成功了,并没有报错啊
那些WARNING并不是报错,并不影响程序运行
--  作者:lqm
--  发布时间:8/23/2006 9:36:00 AM

--  
谢谢提醒!
   我还是想弄清楚,那串Warning是什么意思???
--  作者:lqm
--  发布时间:8/25/2006 3:21:00 PM

--  
在Jcreator中编译报错终于解决了!!!!!
“cannot access edu.stanford.smi.protegex.owl.model.OWLModel
”原来程序运行的时候要到你的工程目录上去找这些“ edu.stanford.smi.protegex.owl.model.×”文件,只用import 语句包含文件包还不行!!!
解决的办法是把Proege安装目录下如:D:\protege\plugins\*.jar 复制到工程目录下如:G:\testOWL(工程文件夹)\plugins\*.jar   
这样同样可以在Jcreator环境中编译运行了!!
就这么一个小问题,还是偶然之间发现的哈哈!!!
--  作者:lqm
--  发布时间:8/27/2006 3:38:00 PM

--  
偶然间又解决了这个问题:??
WARNING: Look and feel not found: com.jgoodies.plaf.plastic.PlasticLookAndFeel -- SystemUtilities.setLookAndFeel()
需要把plugins的源代码按照原来的目录结构不变,放到工程目录下面
总结:
要用JCreator编译Proteg OWL API 提供的测试程序需要:
1.在工程目录下复制plugins\*.jar
2. 在工程目录下复制plugins的源代码
3.当然别忘了把Pretege安装目录下面的×。
--  作者:flyinqq
--  发布时间:7/10/2008 6:29:00 PM

--  
求助~~
我的protege的安装目录下的plugins里面
有edu.stanford.smi.protegex.owl
但怎么也没有edu.stanford.smi.protegex.owl.model啊
所以编译时import edu.stanford.smi.protegex.owl.model.OWLModel就有问题了。
虽然我已经将plugins里的所有文件夹都拷到我的project目录的plugins里面了。
各位edu.stanford.smi.protegex.owl.model这个有吗?在哪??
我用的protege 3.4 beta
--  作者:lafille
--  发布时间:7/10/2008 6:44:00 PM

--  
edu.stanford.smi.protegex.owl.model.OWLModel在protege-owl这个包里面,把plugins\edu.stanford.smi.protegex.owl里面所有的包都拷进你的project应该就可以
--  作者:flyinqq
--  发布时间:7/10/2008 6:49:00 PM

--  
我用的JCreator
我已经把plugins\edu.stanford.smi.protegex.owl里面的所有jar文件都添加到classpath里去了啊

我的程序就是protege owl api guide里的一个示例

import edu.stanford.smi.protegex.owl.model.OWLModel;
import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
import edu.stanford.smi.protegex.owl.ProtegeOWL;

public class OWLAPIDemoApplication {
    
    public static void main(String[] args) {
     
     OWLModel owlModel = ProtegeOWL.createJenaOWLModel();
        owlModel.getNamespaceManager().setDefaultNamespace("http://hello.com#");
        OWLNamedClass worldClass = owlModel.createOWLNamedClass("World");
        System.out.println("Class URI: " + worldClass.getURI());

    }
}

错误信息是这样的
--------------------Configuration: OWLAPIDemoApplication - JDK version 1.6.0_07 <Default> - <Default>--------------------
D:\Program Files\Protege_3.4_beta\OWLAPIDemoApplication\src\OWLAPIDemoApplication.java:18: 无法访问 edu.stanford.smi.protege.model.DefaultKnowledgeBase
未找到 edu.stanford.smi.protege.model.DefaultKnowledgeBase 的类文件
        OWLModel owlModel = ProtegeOWL.createJenaOWLModel();
                                                         ^
D:\Program Files\Protege_3.4_beta\OWLAPIDemoApplication\src\OWLAPIDemoApplication.java:19: 无法访问 edu.stanford.smi.protege.model.KnowledgeBase
未找到 edu.stanford.smi.protege.model.KnowledgeBase 的类文件
        owlModel.getNamespaceManager().setDefaultNamespace("http://hello.com#");
                ^
D:\Program Files\Protege_3.4_beta\OWLAPIDemoApplication\src\OWLAPIDemoApplication.java:21: 无法访问 edu.stanford.smi.protege.model.Instance
未找到 edu.stanford.smi.protege.model.Instance 的类文件
        System.out.println("Class URI: " + worldClass.getURI());
                                                     ^
3 错误

Process completed.


--  作者:flyinqq
--  发布时间:7/10/2008 6:52:00 PM

--  
还有我查了一下
http://protege.stanford.edu/download/prerelease_javadoc_owl/index.html

的确是有Package edu.stanford.smi.protegex.owl.model 这个包的
可能我protege安装目录下plugins里面没有。。。


--  作者:lafille
--  发布时间:7/10/2008 7:05:00 PM

--  
报错的是缺少edu.stanford.smi.protege.model.*这个包,刚才你说的是edu.stanford.smi.protegex.owl.model,两个包不同的,edu.stanford.smi.protege.model.*这个包在protege安装目录下面,你把protege按照目录下的几个jar包也要考进去
--  作者:flyinqq
--  发布时间:7/10/2008 7:23:00 PM

--  
哦,好的,谢谢ls的,我再去试试看~~太大意了。。
另外,我想问一下,guide里说要把这个demo建在protege安装程序下,如果我把project home放在其它目录里,将protege plugins里面的所有文件夹都拷到project目录下,再将所有jar放到classpath里去,是不是应该也可以?
--  作者:flyinqq
--  发布时间:7/10/2008 7:34:00 PM

--  
oh yeah!!!编译通过了,可以run了!!
谢谢ls的~~
但还有个warning...请教一下怎么回事?

--------------------Configuration: OWLAPIDemoApplication - JDK version 1.6.0_07 <Default> - <Default>--------------------
WARNING: [Local Folder Repository] The specified file must be a directory. (D:\Program Files\Protege_3.4_beta\OWLAPIDemoApplication\classes\plugins\edu.stanford.smi.protegex.owl) -- LocalFolderRepository.update()
Class URI: http://hello.com#World

Process completed.


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