一路拾遗
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 胖胖泡泡 阅读(457) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: