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

    >> Web服务(Web Services,WS), 语义Web服务(Semantic Web Services, SWS)讨论区: WSDL, SOAP, UDDI, DAML-S, OWL-S, SWSF, SWSL, WSMO, WSML,BPEL, BPEL4WS, WSFL, WS-*,REST, PSL, Pi-calculus(Pi演算), Petri-net,WSRF,
    [返回] W3CHINA.ORG讨论区 - 语义网·描述逻辑·本体·RDF·OWLW3CHINA.ORG讨论区 - Web新技术讨论『 Web Services & Semantic Web Services 』 → Eclipse下解析owl-s文件 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 7823 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: Eclipse下解析owl-s文件 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     yuwengong_720 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:6
      积分:71
      门派:XML.ORG.CN
      注册:2008/8/30

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给yuwengong_720发送一个短消息 把yuwengong_720加入好友 查看yuwengong_720的个人资料 搜索yuwengong_720在『 Web Services & Semantic Web Services 』的所有贴子 引用回复这个贴子 回复这个贴子 查看yuwengong_720的博客楼主
    发贴心情 Eclipse下解析owl-s文件

    学习一个例子。我导入了owl-s包还不够吗?是不是还需要什么?请大家指教!
    代码如下:
    import org.mindswap.owl.OWLFactory;
    import org.mindswap.owl.OWLIndividual;
    import org.mindswap.owl.OWLKnowledgeBase;
    import org.mindswap.owls.OWLSFactory;
    import org.mindswap.owls.process.AtomicProcess;
    import org.mindswap.owls.process.Process;
    import org.mindswap.owls.process.execution.ProcessExecutionEngine;
    import org.mindswap.owls.process.execution.ProcessExecutionListener;
    import org.mindswap.owls.profile.Profile;
    import org.mindswap.owls.service.Service;
    import org.mindswap.query.ValueMap;
    import org.mindswap.utils.Utils;
    import org.mindswap.wsdl.WSDLOperation;
    import org.mindswap.wsdl.WSDLService;

    public class RunService {

     /**
      * @param args
      */
     Service service;
      Profile profile;
      Process process;
      WSDLService s;
      WSDLOperation op;
      String inValue;
      String outValue;
      ValueMap values;
      ProcessExecutionEngine exec;
     
      public RunService() {
       // create an execution engine
       exec = OWLSFactory.createExecutionEngine();
       
       // Attach a listener to the execution engine
       exec.addExecutionListener(new ProcessExecutionListener() {

        public void setCurrentExecuteService(Process p) {
         System.out.println("Start executing process " + p);
        }
        
        public void printMessage(String message) {
        }

        public void finishExecution(int retCode) {
         System.out.println("Finished execution " +
             ((retCode == ProcessExecutionListener.EXEC_ERROR)
             ? "with errors" : "successfully"));  
        }   
       });
      }
     
      public void runZipCode() throws Exception {
          OWLKnowledgeBase kb = OWLFactory.createKB();

          service = kb.readService("file:G:/Downloads/ZipCodeFinder.owl");
       process = service.getProcess();  

       // initialize the input values to be empty
       values = new ValueMap();
       
       values.setDataValue(process.getInput("City"), "College Park");  
       values.setDataValue(process.getInput("State"), "MD");  

       values = exec.execute(process, values);
     
       // get the result
       OWLIndividual out = values.getIndividualValue(process.getOutput());
         
       // display the results
       System.out.println("Executed service '" + service + "'");
       System.out.println("Grounding WSDL: " +
           ((AtomicProcess) process).getGrounding().getDescriptionURL());
       System.out.println("City   = " + "College Park");
       System.out.println("State  = " + "MD");
       System.out.println("Output = ");
       System.out.println(Utils.formatRDF(out.toRDF()));
       System.out.println();
      }
     

     
      public static void main(String[] args) throws Exception {  
       RunService test = new RunService();
       
     
       try {
        test.runZipCode();
             } catch(Exception e) {
                 e.printStackTrace();
             }

     }
    }
    出现下面的问题:
    java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
     at com.hp.hpl.jena.rdf.model.impl.PropertyImpl.<clinit>(PropertyImpl.java:58)
     at com.hp.hpl.jena.rdf.model.ResourceFactory$Impl.createProperty(ResourceFactory.java:188)
     at com.hp.hpl.jena.rdf.model.ResourceFactory.createProperty(ResourceFactory.java:96)
     at com.hp.hpl.jena.vocabulary.RDF.property(RDF.java:32)
     at com.hp.hpl.jena.vocabulary.RDF.<clinit>(RDF.java:45)
     at com.hp.hpl.jena.reasoner.rulesys.impl.RDFSCMPPreprocessHook.<clinit>(RDFSCMPPreprocessHook.java:29)
     at com.hp.hpl.jena.reasoner.rulesys.RDFSRuleReasoner.<clinit>(RDFSRuleReasoner.java:56)
     at com.hp.hpl.jena.reasoner.rulesys.RDFSRuleReasonerFactory.create(RDFSRuleReasonerFactory.java:46)
     at com.hp.hpl.jena.reasoner.ReasonerRegistry.getRDFSReasoner(ReasonerRegistry.java:181)
     at impl.jena.JenaOWLFactory.<init>(JenaOWLFactory.java:42)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
     at java.lang.Class.newInstance0(Class.java:308)
     at java.lang.Class.newInstance(Class.java:261)
     at org.mindswap.owl.OWLFactory.createFactory(OWLFactory.java:72)
     at org.mindswap.owl.OWLFactory.<clinit>(OWLFactory.java:66)
     at RunService.runZipCode(RunService.java:64)
     at RunService.main(RunService.java:98)
    Exception in thread "main"


       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2008/8/30 11:36:00
     
     xufeng5264 帅哥哟,离线,有人找我吗?
      
      
      等级:大一(高数修炼中)
      文章:21
      积分:135
      门派:XML.ORG.CN
      注册:2011/10/17

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给xufeng5264发送一个短消息 把xufeng5264加入好友 查看xufeng5264的个人资料 搜索xufeng5264在『 Web Services & Semantic Web Services 』的所有贴子 引用回复这个贴子 回复这个贴子 查看xufeng5264的博客2
    发贴心情 
    我跟你遇到同样的问题了
    service = kb.readService("file:G:/Downloads/ZipCodeFinder.owl");获取的service为空,以至于process = service.getProcess();出错
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2011/11/2 10:17:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Web Services & Semantic Web Services 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/4/18 17:23:39

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

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