Firstly, I needed 2 different resource menu options, so I created 2
different spin:Functions each with an sml:selectedResource.
Then, being I needed to know which menu option was selected, I added
an spl:attribute to each (initialized with a default value)
By checking the value of the attribute, I thought I could determine
which menu option had been selected and then navigate to the
appropriate path in my branch.

In the above scenario, I have only one module of common code
(minimal). I was looking down the road and trying to think of
different ways to deal with commonality.

Barb

On Sep 8, 2:31 pm, Holger Knublauch <[email protected]> wrote:
> No, having two selectedResource modules is not supported. I have not  
> thought about a use case for it. Why can't you just share the same  
> selectedResource module in multiple script paths?
>
> Holger
>
> On Sep 8, 2009, at 10:11 AM, Barb 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 -- 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