[owl-s] Creating an "identity" process

Thorsten Möller Thorsten.Moeller at unibas.ch
Wed Jun 9 11:24:23 EDT 2010


On Wednesday, June 09, 2010 4:48 PM [GMT+1=CET],
Dimitris Andreou <jim.andreou at gmail.com> wrote (with possible 
deletions):

> Hi again,
>
> I have another rather similar problem, so I post in this thread.
>
> By the way, here is my code that creates an identity process:
>
>     static Process identityProcess(URI inputType, URI outputType,
> OWLOntology ont) {
>         CompositeProcess identity = ont.createCompositeProcess(null);
>
>         Input input = identity.createInput(null,
> ont.createClass(inputType));
>         Output output = identity.createOutput(null,
> ont.createClass(outputType));
>
>         Produce produce = ont.createProduce(null);
>         ValueOf valueOfInput = ont.createValueOf(null);
>         valueOfInput.setSource(input, OWLS.Process.ThisPerform);
>         produce.addBinding(output, valueOfInput);
>
>         identity.setComposedOf(produce);
>
>         return identity;
>     }
>
> Now I'm trying to create something similar: a process that produces
> the
> value of a particular (functional) property of the input. E.g., if
> the input
> is X, the property I'm interested into is P, and there is a [X P Y]
> triple,
> I'd like a process that given X yields Y.
Yepp, thanks to a new feature of using SPARQL statements in order to 
assign process variables :-)

It could be done as follows (there would be another possibility whether 
P is not a input but fixed (a constant)): Create a composite CP process 
that takes X and P as inputs, and has an Output O. Also, create a Loc 
variable L. Then, let CP be composed of a sequence, where the first 
control construct is a Set S and the second a Produce P. Assign L in S 
using a ValueFunction that uses a SPARQL query SELECT ?y WHERE { ?X ?P 
?y . }. Finally "produce" the value of L to the output O.

Speaking in terms of pseudocde this process realizes the following 
method:

foo(X, P):O // X, P, O shall be a names, not a types
{
    L = SELECT ?L WHERE { X, P, ?L . }; // the Set
    return L; // the Produce
}

There is a example/test process in the Repository doing similar things. 
It shows you how to use a SPARQL value function to assign a local 
variable.

http://on.cs.unibas.ch/sventon/repos/on/show/trunk/owls-api/src/test/resources/owls/1.2/RepeatUntil.owl?revision=HEAD

If you have further questions feel free to ask.

Cheers,
Thorsten

PS: Actually it should be also possible to assign L using a SWRL or 
SPARQL preconditon. 




More information about the OWL-S mailing list