ProcessImpl.java revision 24
cfba646ddfa9d543f0c40e4c7788c65b4a24b34dPhill Cunnington// The MIT License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// Copyright (c) 2004 Evren Sirin
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// Permission is hereby granted, free of charge, to any person obtaining a copy
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// of this software and associated documentation files (the "Software"), to
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// deal in the Software without restriction, including without limitation the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// sell copies of the Software, and to permit persons to whom the Software is
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// furnished to do so, subject to the following conditions:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// The above copyright notice and this permission notice shall be included in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// all copies or substantial portions of the Software.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster// IN THE SOFTWARE.
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp * Created on Dec 27, 2003
ef88f1a01f0248a7321f6abcf304acfeeafab9ceNeil Maddenimport org.mindswap.owls.vocabulary.OWLS_Extensions;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @author Evren Sirin
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic abstract class ProcessImpl extends WrappedIndividual implements Process {
ef88f1a01f0248a7321f6abcf304acfeeafab9ceNeil Madden /* (non-Javadoc)
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp * @see org.mindswap.owls.process.Process#getService()
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (Service) getPropertyAs(OWLS.Service.describes, Service.class);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if(hasProperty(OWLS.Service.describes, service))
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void removeService() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if(hasProperty(OWLS.Service.describes, getService()))
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster removeProperty(OWLS.Service.describes, getService());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public Input createInput(URI uri, OWLType paramType) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public Output createOutput(URI uri, OWLType paramType) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Output out = getOntology().createOutput( uri );
ef88f1a01f0248a7321f6abcf304acfeeafab9ceNeil Madden public Local createLocal(URI uri, OWLType paramType) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Result result = getOntology().createResult( uri );
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp if (hasProperty(OWLS.Process.hasResult, result))
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp public void removeResults() {
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp return OWLSFactory.createInputList(getProperties(OWLS.Process.hasInput));
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp return inputs.isEmpty() ? null : inputs.inputAt(0);
c11e5b267744dd8487fef1dd1ccc89be08fbd16bPeter Major return OWLSFactory.createOutputList(getProperties(OWLS.Process.hasOutput));
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp return outputs.isEmpty() ? null : outputs.outputAt(0);
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp return (Output) outputs.getParameter(localName);
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp return OWLSFactory.createParameterList(getProperties(OWLS.Process.hasLocal));
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp ParameterList parameters = OWLSFactory.createParameterList(getInputs());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /* (non-Javadoc)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @see org.mindswap.owls.process.Process#getParameter(java.net.URI)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public Parameter getParameter(URI parameterURI) {
4617bf16e6b67d2c607d3c4bccb1b7b250e54008Travis Papp return getParameters().getParameter(parameterURI);
4617bf16e6b67d2c607d3c4bccb1b7b250e54008Travis Papp /* (non-Javadoc)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @see org.mindswap.owls.process.Conditional#getCondition()
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return (Condition) getPropertyAs(OWLS.Process.hasPrecondition, Condition.class);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return OWLSFactory.createConditionList(getProperties(OWLS.Process.hasPrecondition));
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setCondition(Condition condition) {
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp setProperty(OWLS.Process.hasPrecondition, condition);
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp addProperty(OWLS.Process.hasPrecondition, condition);
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp return OWLSFactory.createResultList(getProperties(OWLS.Process.hasResult));
ef88f1a01f0248a7321f6abcf304acfeeafab9ceNeil Madden return (Result) getPropertyAs(OWLS.Process.hasResult, Result.class);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return getPropertyAsString(OWLS.Process.name, lang);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String str = getLabel() + " " + getURI() + "\n";
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp str += outputs.outputAt(i).debugString() + "\n";
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp return (Perform) getPropertyAs(OWLS_Extensions.Process.hasPerform, Perform.class);
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp if(hasProperty(OWLS_Extensions.Process.hasPerform, perform))
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp setProperty(OWLS_Extensions.Process.hasPerform, perform);
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp public void removeInputs() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void removeLocals() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (hasProperty(OWLS.Process.hasOutput, output))
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster removeProperty(OWLS.Process.hasOutput, output);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void removeOutputs() {
ef88f1a01f0248a7321f6abcf304acfeeafab9ceNeil Madden public void deleteInputs() {
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp for (int index = 0; index < inputs.size(); index++)
ef88f1a01f0248a7321f6abcf304acfeeafab9ceNeil Madden public void deleteLocals() {
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp for (int index = 0; index < locals.size(); index++)
ef88f1a01f0248a7321f6abcf304acfeeafab9ceNeil Madden public void deleteOutputs() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster for (int index = 0; index < outputs.size(); index++)
5fa3e419a5008528550756b7eb0ed31ab5d06b8cTravis Papp public void deleteResults() {
ef88f1a01f0248a7321f6abcf304acfeeafab9ceNeil Madden for (int index = 0; index < results.size(); index++)
ef88f1a01f0248a7321f6abcf304acfeeafab9ceNeil Madden public void delete() {