2ronwalf * A JavaAtomicGrounding grounds an OWL-S Service to a Java method invocation. The method call
2ronwalf * <li>a map of all input parameters (at the time only primitive datatypes and their adapter classes)</li>
2ronwalf * @see <a href="http://www.ifi.unizh.ch/ddis/ont/owl_s/MoreGroundings.owl">Grounding Ontology</a>
30daenzeroramapublic class JavaAtomicGroundingImpl extends AtomicGroundingImpl implements JavaAtomicGrounding {
2ronwalf * @see org.mindswap.owls.grounding.JavaAtomicGrounding#setClaz(java.lang.String)
2ronwalf * @see org.mindswap.owls.grounding.JavaAtomicGrounding#getClaz()
2ronwalf * @see org.mindswap.owls.grounding.JavaAtomicGrounding#setMethod(java.lang.String)
2ronwalf * @see org.mindswap.owls.grounding.JavaAtomicGrounding#getMethod()
2ronwalf * @see org.mindswap.owls.grounding.AtomicGrounding#addMessageMap(org.mindswap.owls.process.Parameter, java.lang.String, java.lang.String)
2ronwalf * @see org.mindswap.owls.grounding.AtomicGrounding#invoke(org.mindswap.query.ValueMap, org.mindswap.owl.OWLKnowledgeBase)
2ronwalf } catch (ClassNotFoundException e){
2ronwalf throw new ExecutionException("JavaAtomicGrounding: Class " + strClaz + " defined in Grounding not found." );
2ronwalf } catch (NoSuchMethodException e) {
2ronwalf throw new ExecutionException("JavaAtomicGrounding: Method " + strMethod + " defined in Grounding not found." );
2ronwalf throw new ExecutionException("JavaAtomicGrounding: " + e.getClass().toString() + " ocurred: " + e.getMessage());
28daenzerorama paramValues[i] = ReflectionUtils.getCastedObjectFromStringValue(((OWLDataValue) owlValue).getLexicalValue(), params[i]);
3daenzerorama //System.out.println( "Parameter " + i + " " + paramValues[i] );
2ronwalf } catch (InvocationTargetException e) {
2ronwalf throw new ExecutionException("JavaAtomicGrounding: Error in executed method\n" + e.getTargetException().toString() + " ocurred: ");
2ronwalf throw new ExecutionException("JavaAtomicGrounding: Error while executing method\n" + e.getClass().toString() + " ocurred: ");
3daenzerorama throw new ExecutionException("JavaAtomicGrounding: Output in Grounding not specified although method provides a return value.");
30daenzerorama return null;
30daenzerorama try {
31daenzerorama Constructor constructor = transformerClass.getConstructor(new Class[] {OWLKnowledgeBase.class});
31daenzerorama JavaClassTransformator transformer = (JavaClassTransformator) constructor.newInstance(new Object[] {getKB()});
30daenzerorama } catch (ClassNotFoundException e) {
30daenzerorama } catch (InstantiationException e) {
30daenzerorama } catch (IllegalAccessException e) {
31daenzerorama } catch (IllegalArgumentException e) {
31daenzerorama } catch (InvocationTargetException e) {
31daenzerorama } catch (SecurityException e) {
31daenzerorama } catch (NoSuchMethodException e) {
30daenzerorama return null;
30daenzerorama // returns the OWL-S Output Parameter
2ronwalf OWLObject owlsParam = getProperty(MoreGroundings.javaOutput).getProperty(MoreGroundings.owlsParameter);
30daenzerorama return null;
2ronwalf // returns the n-th Parameter of the Java Method specified in the OWL-S JavaAtomicProcessGrounding
30daenzerorama return null;
30daenzerorama try {
31daenzerorama Constructor constructor = transformerClass.getConstructor(new Class[] {OWLKnowledgeBase.class});
31daenzerorama JavaClassTransformator transformer = (JavaClassTransformator) constructor.newInstance(new Object[] {getKB()});
30daenzerorama } catch (ClassNotFoundException e) {
30daenzerorama } catch (InstantiationException e) {
30daenzerorama } catch (IllegalAccessException e) {
31daenzerorama } catch (SecurityException e) {
31daenzerorama } catch (NoSuchMethodException e) {
31daenzerorama } catch (IllegalArgumentException e) {
31daenzerorama } catch (InvocationTargetException e) {
30daenzerorama return null;
30daenzerorama } else {
30daenzerorama // returns the n-th Parameter of the Java Method specified in the OWL-S JavaAtomicProcessGrounding
30daenzerorama return null;
30daenzerorama try {
31daenzerorama Constructor constructor = transformerClass.getConstructor(new Class[] {OWLKnowledgeBase.class});
31daenzerorama JavaClassTransformator transformer = (JavaClassTransformator) constructor.newInstance(new Object[] {getKB()});
30daenzerorama } catch (ClassNotFoundException e) {
30daenzerorama } catch (InstantiationException e) {
30daenzerorama } catch (IllegalAccessException e) {
31daenzerorama } catch (SecurityException e) {
31daenzerorama } catch (NoSuchMethodException e) {
31daenzerorama } catch (IllegalArgumentException e) {
31daenzerorama } catch (InvocationTargetException e) {
30daenzerorama return null;
30daenzerorama } else {
2ronwalf * @see org.mindswap.owls.grounding.JavaAtomicGrounding#setOutputVar(java.lang.String, java.lang.String, org.mindswap.owls.process.Output)
2ronwalf OWLIndividual ind = getOntology().createInstance(MoreGroundings.JavaVariable, URI.create(name));
2ronwalf * @see org.mindswap.owls.grounding.JavaAtomicGrounding#setInputVar(java.lang.String, java.lang.String, int, org.mindswap.owls.process.Input)
24daenzerorama public void setInputParameter(String name, String type, int index, Input owlsParameter) {
27daenzerorama OWLIndividual ind = getOntology().createInstance(MoreGroundings.JavaParameter, URIUtils.createURI(name));
24daenzerorama // TODO an rdf:type property of the related input stays persistent. why????
24daenzerorama super.delete();
24daenzerorama OWLIndividualList list = getPropertiesAs(MoreGroundings.hasJavaParameter, JavaParameter.class);
24daenzerorama return null;
30daenzerorama OWLIndividualList list = getPropertiesAs(MoreGroundings.hasJavaParameter, JavaParameter.class);
30daenzerorama String curIndex = list.individualAt(i).getProperty(MoreGroundings.paramIndex).getLexicalValue();
30daenzerorama return null;
26daenzerorama OWLIndividualList list = getPropertiesAs(MoreGroundings.hasJavaParameter, JavaParameter.class);
26daenzerorama // loop through every element
26daenzerorama int pos = i;
26daenzerorama // find the minimal element in the rest
26daenzerorama pos = j;
26daenzerorama // swap it to the front
26daenzerorama return list;