一路拾遺
          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 胖胖泡泡 閱讀(465) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 孙吴县| 嘉禾县| 牟定县| 海口市| 深水埗区| 土默特右旗| 罗江县| 阳新县| 科尔| 大余县| 堆龙德庆县| 中西区| 荥阳市| 昌宁县| 石泉县| 临泽县| 阿尔山市| 郸城县| 洪泽县| 仙游县| 灌南县| 烟台市| 崇仁县| 霍山县| 鲜城| 蕉岭县| 上虞市| 和顺县| 迁安市| 增城市| 安平县| 岗巴县| 汝南县| 翼城县| 浮山县| 华容县| 祁连县| 西华县| 开江县| 肇东市| 株洲市|