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; publicclass CallService { publicstaticvoid 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); } }