// The MIT License
//
// Copyright (c) 2004 Evren Sirin
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
/*
* Created on Mar 19, 2004
*/
package examples;
/**
*
* Examples to show how services can be executed. Some examples of simple execution monitoring is
* included.
*
* @author Evren Sirin
*/
public class RunService {
WSDLService s;
public RunService() {
// create an execution engine
// Attach a listener to the execution engine
}
// read the service description
// get the parameter using the local name
// Service service1 = kb.readService("http://www.mindswap.org/2004/owl-s/1.1/FrenchDictionary.owl");
// Service service2 = kb.readService("http://www.mindswap.org/2004/owl-s/1.1/FindCheaperBook.owl");
// Service service3 = kb.readService("http://www.mindswap.org/2004/owl-s/1.1/Dictionary.owl");
// Service service4 = kb.readService("http://www.mindswap.org/2004/owl-s/1.1/BabelFishTranslator.owl");
// Process process1 = service1.getProcess();
// Process process2 = service2.getProcess();
// Process process3 = service3.getProcess();
// Process process4 = service4.getProcess();
// initialize the input values to be empty
// ValueMap values1 = new ValueMap();
// ValueMap values2 = new ValueMap();
// ValueMap values3 = new ValueMap();
// ValueMap values4 = new ValueMap();
// set inputs
// values1.setDataValue(process1.getInput("InputString"), "mere");
// values2.setDataValue(process2.getInput("BookName"), "City of Glass");
//
// inValue = "hello";
// values3.setDataValue(process3.getInput("InputString"), inValue);
//
// String langOnt = "http://www.daml.org/2003/09/factbook/languages#";
// OWLIndividual English = kb.getIndividual(URI.create(langOnt + "English"));
// OWLIndividual French = kb.getIndividual(URI.create(langOnt + "French"));
// values4.setDataValue(process4.getInput("InputString"), "Hello world!");
// values4.setValue(process4.getInput("InputLanguage"), English);
// values4.setValue(process4.getInput("OutputLanguage"), French);
// threadedExec.executeInThread(process1, values1);
// threadedExec.executeInThread(process2, values2);
// threadedExec.executeInThread(process3, values3);
// threadedExec.executeInThread(process4, values4);
}
// initialize the input values to be empty
// get the result
// do something with output
}
// read the service description
// get the parameter using the local name
// do something with output
}
// read the service description
// initialize the input values to be empty
// use any book name
inValue = "City of Glass";
// get the parameter using the local name
// get the output param using the index
// do something with output
}
// read the service description
// initialize the input values to be empty
// use an arbitrary book name
inValue = "City of Glass";
// get the parameter using the local name
// get the output param using the index
// do something with output
}
// we need to check preconditions so that local variables will be assigned values
exec.setPreconditionCheck( true );
// read the service description
// initialize the input values to be empty
// use an arbitrary book name
// get the output values
// do something with output
}
// read the service description
// initialize the input values to be empty
// get the parameter using the local name
// get the output param using the index
// do something with output
}
// we need a reasoner that can evaluate the precondition of the translator
// initialize the input values to be empty
inValue = "mere";
// get the output using local name
// do something with output
}
// language ontology
// we at least need RDFS reasoning to evaluate preconditions (to understand
// that process:Parameter is subclass of swrl:Variable)
// get the references for these values
// initialize the input values to be empty
// get the output using local name
// do something with output
}
// initialize the input values to be empty
inValue = "hello";
// get the output
// do something with output
}
// try {
// runCurrencyConverter();
// } catch(Exception e) {
// }
try {
runZipCode();
} catch(Exception e) {
}
//
// try {
// runTranslator();
// } catch(Exception e) {
// }
//
// try {
// runJGroundingTest();
// } catch(Exception e) {
// }
//
// try {
// runDictionary();
// } catch(Exception e) {
// }
//
// try {
// runBookFinder();
// } catch(Exception e) {
// }
//
// try {
// runFrenchDictionary();
// } catch(Exception e) {
// }
//
// try {
// runBookPrice();
// } catch(Exception e) {
// }
//
// try {
// runFindCheaperBook();
// } catch(Exception e) {
// }
}
}
}