// 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.
package examples;
/**
* An example to show how service descriptions can be created on the fly, saved and executed.
*
* @author Evren Sirin
*/
public class CreateSequence {
public CreateSequence() {
}
/**
*
* Create a new Sequence from the processes of the given services and put them in a new
* Service object with a automatically generated Profile. This function assumes that
* each service in the list has exactly one input and one output (except the first and
* last one) such that in the resulting Service the output of each service will be fed
* as input to the next one. The first service does not have to have an input and the
* last one does not need to have an output. The resulting service will have an input
* (or an output) depending on this.
*
* @param services List of Service objects
* @param baseURI The base URI for the generated service
* @return The Service which is a Sequence of the given services
*/
if(pc instanceof AtomicProcess) {
}
}
return service;
}
/**
*
* Create a label for the composite service based on the labels of services. Basically
* return the string [Service1 + Service2 + ... + ServiceN] as the label
*
* @param services List of Servie objects
* @return
*/
}
label += "]";
return label;
}
/**
*
* Create a Profile for the composite service. We only set the input and output of the profile
* based on the process.
*
* @param profile
* @param process
* @return
*/
}
}
return profile;
}
/**
*
* Create a Sequence process for the processes of given services. Creates the DataFlow asssuming each
* service has one output and one intput (except first and last one).
*
* @param compositeProcess
* @param grounding
* @param services
* @return
*/
Process p = s.getProcess();
performs[i].setProcess(p);
if(i > 0) {
// the value of 'input' is the value of 'output' from 'prevPerform'
}
}
if(createInput) {
// input of the first perform is directly read from the input of the
// composite process
}
if(createOutput) {
// the output of the composite process is the output pf last process
}
return compositeProcess;
}
// create an OWL-S knowledge base
// create an empty ontology in this KB
// create an execution engine
// load two services
// put the services in a list
// create a new service as a sequence of the list
// print the description of new service to standard output
// get the process of the new service
// initialize the input values to be empty
// get the parameter using the local name
// execute the service
// get the output param using the index
// display the result
}
}
}