- From: Robert Langner <robert.langner@freenet.de>
- Date: Fri, 9 May 2008 11:49:02 +0200
- To: <semantic-web@w3.org>
- Message-ID: <002101c8b1b9$ea497d50$bedc77f0$@langner@freenet.de>
Hello, i have a problem when executing the "PreconditionCheck" Example from the OWL-S API. When I want to run it, this error occurs: Precondition check disabled --------------------------- Trying unsupported language pair... Exception in thread "main" java.lang.NullPointerException at impl.jena.OWLModelImpl.isTrue(OWLModelImpl.java:946) atimpl.owls.generic.expression.SWRLExpressionImpl.isTrue(SWRLExpressionImpl. java:66) at reasoning.PreconditionCheck.run(PreconditionCheck.java:54) at reasoning.PreconditionCheck.main(PreconditionCheck.java:110) Can someone help me? Code of PreconditionCheck: import java.net.URI; import org.mindswap.exceptions.ExecutionException; import org.mindswap.exceptions.PreconditionException; import org.mindswap.owl.OWLFactory; import org.mindswap.owl.OWLIndividual; import org.mindswap.owl.OWLKnowledgeBase; 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; /** * * Examples to show how services can be executed. Some examples of simple execution monitoring is * included. * * @author Evren Sirin */ public class PreconditionCheck { public void run() throws Exception { OWLKnowledgeBase kb = OWLFactory.createKB(); ProcessExecutionEngine exec = OWLSFactory.createExecutionEngine(); kb.setReasoner("Pellet"); // language ontology String langOnt =" <http://www.daml.org/2003/09/factbook/languages> http://www.daml.org/2003/09/factbook/languages#"; Service service =kb.readService("http://www.mindswap.org/2004/owls/1.1/BabelFishTranslator.o wl"); Process process = service.getProcess(); OWLIndividual English = kb.getIndividual(URI.create(langOnt +"English")); OWLIndividual German = kb.getIndividual(URI.create(langOnt +"German")); OWLIndividual Italian = kb.getIndividual(URI.create(langOnt +"Italian")); ValueMap values = new ValueMap(); exec.setPreconditionCheck( false ); System.out.println( "Precondition check disabled" ); System.out.println( "---------------------------" ); try { values.setDataValue(process.getInput("InputString"), "ciaomondo!"); values.setValue(process.getInput("InputLanguage"),Italian); values.setValue(process.getInput("OutputLanguage"),German); System.out.println( "Trying unsupported language pair..."); System.out.println( "Precondition satisfied: " +process.getCondition().isTrue( values ) ); exec.execute(process, values); System.out.println("Execution successecful!"); } catch(PreconditionException e) { System.out.println("Precondition evaluation failed!"); System.out.println(e); } catch(ExecutionException e) { System.out.println("Execution failed!"); System.out.println(e); } System.out.println(); exec.setPreconditionCheck( true ); System.out.println( "Precondition check enabled" ); System.out.println( "---------------------------" ); try { values.setDataValue(process.getInput("InputString"), "ciaomondo!"); values.setValue(process.getInput("InputLanguage"),Italian); values.setValue(process.getInput("OutputLanguage"),German); System.out.println( "Trying unsupported language pair..."); System.out.println( "Precondition satisfied: " +process.getCondition().isTrue( values ) ); exec.execute(process, values); System.out.println("Execution successecful!"); } catch(PreconditionException e) { System.out.println("Precondition evaluation failed!"); System.out.println(e); } catch(ExecutionException e) { System.out.println("Execution failed!"); System.out.println(e); } System.out.println(); try { values.setDataValue(process.getInput("InputString"), "ciaomondo!"); values.setValue(process.getInput("InputLanguage"),Italian); values.setValue(process.getInput("OutputLanguage"),English); System.out.println( "Trying supported language pair..." ); System.out.println( "Precondition satisfied: " +process.getCondition().isTrue( values ) ); exec.execute(process, values); System.out.println("Execution successecful!"); } catch(PreconditionException e) { System.out.println("Precondition evaluation failed!"); System.out.println(e); } catch(ExecutionException e) { System.out.println("Execution failed!"); System.out.println(e); } } public static void main(String[] args) throws Exception { PreconditionCheck test = new PreconditionCheck(); test.run(); } }
Received on Friday, 9 May 2008 10:57:26 UTC