一路拾遺
          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) 評(píng)論(0)  編輯  收藏

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 阿瓦提县| 迁西县| 孟州市| 平南县| 大方县| 伊金霍洛旗| 葵青区| 河东区| 乌海市| 尼勒克县| 惠来县| 宁海县| 方山县| 邻水| 泰和县| 藁城市| 资源县| 景谷| 常宁市| 鄂托克旗| 广安市| 辽宁省| 资源县| 杂多县| 丰镇市| 胶南市| 中山市| 拉萨市| 金川县| 察哈| 玉树县| 武功县| 香河县| 壶关县| 广灵县| 江川县| 六枝特区| 天全县| 齐齐哈尔市| 九江县| 城步|