On Aug 10, 12:46 pm, Catrina <[email protected]>
wrote:
> We are creating SPIN functions for SPARQLMotion scripts that will be
> kicked off from Ensemble.
>
> 1)  Is it possible to nest the SPIN functions?
>
> For example, we want a main function that will be displayed in
> Ensemble.  Then, based on the hierarchy (we have various different
> hierarchies), we want to define some sort of like sub-functions of the
> main spin function and call them in order to prompt the user for
> further information.

Yes, once a SPIN function is created, it is available in any SPARQL
query.  E.g. :getCurrentYear is a spin function in kennedysSPIN.owl
(available in Examples folder of a Composer installation).  You could
write a new function, say :myNewFunct that specifies :getCurrentYear
in the body - e.g. LET (?age := :getCurrentYear() - ?birthYear)

>
> 2)  Is it possible to prompt the user for various inputs, where the
> various inputs that are needed aren't determined until run time?

Yes, there are a couple of modules that will do this.  One is
sml:EnterLiteral.  Another is to define an argument specifying an xsd
literal as the value type.  The property name will be the label
displayed in the text box.  The DBPediaCallingCodes example script at
http://www.topquadrant.com/products/SPARQLMotion.html has an example.

Either of these modules can be placed anywhere in a script.

>
> 3)  When a SPIN function is created in order to set a SPARQLMotion
> script available for use by Ensemble, is it possible to have a
> spin:body value on this SPIN function?
>
> For example, a subclass of spin:Functions is generated that contains
> one or more spin:constraints.  

spin:constraint's on a SPIN function are the parameters passed to the
function.  By "generated" do you mean "defined"?

> The sm:returnModule is set to an
> instance of the  sml:ReturnText module.  

Things are getting a little mixed here.  SPIN functions live outside
of the scope of SM scripts.  I.e. if you define a SPIN function, then
the function is available in any sparql context, as long as the
function definition is available (model opened or imported).

To have a way in which an entity can call a script, Composer/Live uses
SPIN functions to link a function to the script.

> Can I also set a spin:body
> value on my subclass of spin:Functions and have it execute when the
> script is run from Ensemble?  

Yes, any defined SPIN function (which is what I believe you mean by
"subclass of spin:Functions") can define a spin:body, which is a
SPARQL query that returns a bound value.

>If so, how do I capture the value from a
> select query in that spin:body?

The variable in the SELECT statement of a SPIN function's body is the
return value from the function.  Since it defines a function, only one
value is passed.

As an example, look at the :getFather function in kennedysSPIN.  This
function specifies that a member of kennedys:Person is passed to the
function and bound as the argument ?arg1.  The query in spin:body is
executed and the binding for ?father is returned.  Hence:
    LET (?dad := :getFather (kennedys:CarolineKennedy))
will return kennedys:JohnKennedy

>
> 4)  Is is possible to have a SPARQLMotion file publish as both .sms
> and .spin?
>
> For example, if I have a SPARQLMotion script that contains a script
> that is to be executed from Ensemble and the script itself needs to
> call a SPIN function local to the current SPARQLMotion script file,
> how can I have both the sms and spin published and available from
> Ensemble?

Yes.  In the scenario you give, this is already done.  When you create
a SPARQLMotion file, SPIN is already imported.  This means you can
create the SPIN functions, attach them to SM scripts via
sm:returnModule, and the scripts are registered.  If the SPIN
functions need to be registered separately for some reason, then
import the .spin files.

>
> Thanks,
> Catrina
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TopBraid Composer Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/topbraid-composer-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to