What Scott says is true, and makes sense in the example he gives.  It 
might make sense for you, too.

But I have often found that when I have scripts with multiple endpoints, 
that there is a better way to accomplish reuse, and that is to use 
SPARQLMotion to create new SPARQLMotion modules.  I don't know where 
this is documented, but you do it basically the same way you do web 
services; create a subclass of spin:Function, and give it a returnModule 
of type returnRDF (or any returnXXX, but returnRDF is probably what you 
want).  Then you can use it as a module in another script.  So you could 
have a DeleteChildren module, and make your DeleteAll script start by 
calling a (n instance of) DeleteChildren.

I don't know if this is the right solution for you, but it is an 
alternative you might want to consider.


Dean


Scott Henninger wrote:
> Barb;  Yes, a script is allowed to have multiple endpoints.  Each end
> module can be called independently.  The SPARQLMotion engine will
> determine which modules to run from an end module by backtracing the
> "prerequisites" (all sm:next properties) for each module.
>
> In this way, the kind of reuse you are asking for is supported without
> needing a branch statement.  Take one of your scripts and extend it
> with the desired next transitions of the second script.  (Basically
> the union of the two scripts.)
>
> As a simple example, assume you had a script that wanted to export as
> a text file or rdf file.  The script can look like this:
>   ImportFromZZZ sm:next ApplyZZZ
>   ApplyZZZ sm:next ExportToRDFFile
>   ApplyZZZ sm:next ExportToTextFile
>
> Choosing either 'ExportToTextFile' or 'ExportToRDFFile' will execute
> 'ImportFromZZZ', then 'ApplyZZZ', followed by the selected end module.
>
> I assume you are using BranchByAsk?  Note that the result of this
> module is passed to the next module through sm:next. I.e. sm:if and
> sm:else process the input and pass results to sm:next.
>
> -- Scott
>
> On Sep 2, 3:11 pm, Barb <[email protected]> wrote:
>   
>> I have an *sms.n3 script which deletes selected node(s) from the
>> hierarchy tree. Originally I had 2 scripts ... one that deleted the
>> selected node and its children while the other kept the selected node
>> and deleted only the children. Because of the commonality, I decided
>> to combine them into one.
>>
>> The current script contains the common code and a branch to determine
>> which set of updates to perform.
>> It also contains 2 SPIN functions ... one is the endpoint of the "if"
>> and the other is the endpoint of the "else".
>> Both functions have an sml:selectedResource.
>>
>> The scripts work fine separately, however not combined as described
>> above.
>> I don't see any errors messages, but unfortunately, nodes are not
>> being deleted.
>>
>> Is a script allowed to have multiple endpoints?
>>
>> Barb
>>     
> >
>   


--~--~---------~--~----~------------~-------~--~----~
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