一路拾遺
          Collect By Finding All The Way ......
          posts - 81,comments - 41,trackbacks - 0
          import java.net.URI;

          import org.mindswap.owl.OWLFactory;
          import org.mindswap.owl.OWLKnowledgeBase;
          import org.mindswap.owl.OWLOntology;
          import org.mindswap.owls.OWLSFactory;
          import org.mindswap.owls.process.Process;
          import org.mindswap.owls.process.execution.ProcessExecutionEngine;
          import org.mindswap.owls.service.Service;
          import org.mindswap.query.ValueMap;

          public class CallService {

              
          public static void main(String[] args) throws Exception {
                  
                   
          // create a URI for the service (note that this is a 0.9 version file)   
                  URI uri = new URI("http://www.mindswap.org/2004/owl-s/1.1/Dictionary.owl");

                  
          // create a KB  
                  OWLKnowledgeBase kb = OWLFactory.createKB();
                  
                  
          // set the Reasoner
                  kb.setReasoner("Pellet");

                  
          // create a generic reader and a 1.0 writer
                  OWLOntology ont = kb.read(uri);
              
                  
          // get the service
                  Service service = ont.getService();
                  
                  
          // get the process of the service
                  Process process = service.getProcess();

                  
          // create an execution engine 
                  ProcessExecutionEngine exec = OWLSFactory.createExecutionEngine(); 

                  
          // create an empty value map
                  ValueMap values = new ValueMap();
                  
                  
          // set the value of input parameter
                  values.setDataValue(process.getInput("InputString"), "man");    
                  
          // execute the process with the given input bindings
               
                  values 
          = exec.execute(process, values);
              
                  
          // get the output value as a string
                  String outValue = values.getStringValue(process.getOutput());
                  
                  
          // display the result
                  System.out.println("Output = " + outValue);
              }

          }

          posted on 2008-08-02 19:57 胖胖泡泡 閱讀(464) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 永修县| 内乡县| 民县| 南宫市| 萨嘎县| 图木舒克市| 保亭| 芮城县| 巴塘县| 高平市| 锡林浩特市| 呼和浩特市| 灵璧县| 宜兰县| 江油市| 克东县| 视频| 临沭县| 托克逊县| 咸丰县| 哈巴河县| 萨嘎县| 阜城县| 汶上县| 弥勒县| 兴隆县| 南陵县| 定陶县| 始兴县| 晴隆县| 台东市| 丰镇市| 军事| 博野县| 方正县| 大名县| 咸阳市| 乌苏市| 五家渠市| 墨竹工卡县| 昌乐县|