Barb; I take it the issue here is to have two scripts that share some
modules, perhaps a series of modules?  The way to do this would be to
use Dean's method above.  You define the shared part as a separate
script.  Then create a SPIN function that returns RDF, with the
sml:returnModule referring to the (sub) script.  This defines the
script as a function that you can choose from the graph palette and
use in any script.

In your case, you'd create two separate scripts, one for each selected
resource type you want. The script function you've defined would be
used in these scripts.

-- Scott

On Sep 8, 12:11 pm, Barb <[email protected]> wrote:
> I see how a script can have multiple endpoints but can it also have
> multiple sml:selectedResource modules?
>
> Currently I have one script that has 2 selectedResouce modules each of
> which creates a different menu option.
> No matter which option is selected from the "Resource" dropdown, it
> seems to "execute" that associated module as well as the other.
>
> Is the above allowed ??
>
> Barb
>
> On Sep 2, 6:28 pm, Dean Allemang <[email protected]> wrote:
>
> > 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 ansml: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- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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