It may be the case that you only need to run inferences some of the
time.  For example, you may want to leave it to the user to choose
when inferences and scripts are executed, as it is done in Composer.
We can do that with a couple of changes to the previous examples.

In this case, we'll leave the relay out and have the user choose to
execute inferences on items displayed in the grid.  Do the following:

1) Remove the relay or re-start with the Default Application.  Close
the example files without saving any changes,

2) In Composer, open the CreateKennedys SPIN function (spin:Modules/
spin:Functions/CreateKennedys) in CreateKennedysLabels.sms.ttl.

3) In the spin:constraint property, use the context button to choose
"Create From SPIN Template"

4) Choose sml:SelectedResourceArgument in the upper-left.

5) We want this function to be available when an instance of
kennedys:Person is chosen.  This is controlled by the valueType
property.  Add kennedys:Person to this - since the script does not
import the data file, use the full URL: <http://topbraid.org/examples/
kennedysEnsembleExample#Person>

6) Perform a Scripts > Refresh/Display SPARQLMotion functions… to
register the SPIN function changes

7) Open the kennedysEnsembleExample with the default app in Ensemble.
Choose an instance of Person in the Grid.

8) Click on the SPARQLMotion icon ("cog" icon) and choose "Create
Kennedys labels".  The script described in the previous post will be
executed and the labels will appear in the Grid.

This kind of behavior can be done in a number of contexts and give you
full control over when inferences are executed.  Since it is done
through scripts, there is much more flexibility, as you can control
which triples inferences are executed against, which inference pieces
are displayed in Ensemble, combinations of inference engines can be
executed, etc.

Hopefully this is enough to get some people started.  If there are
questions or this isn't quite meeting your needs, please let us know.

-- Scott

On Apr 27, 2:05 pm, Scott Henninger <[email protected]>
wrote:
> I am hijacking this thread, as its contents are not relevant to magic 
> properties.
> This is the first of a couple of examples on how inferences (and scripts) can 
> be integrated into Ensemble   This example will tie execution of a script to 
> a user action via a relay.  Copy the three files into your workspace.  Then 
> open Ensemble, Default Application, and choose the file 
> kennedysEnsembleExample.  Click on Person.  Note that the label is empty.
> Now create a new SPARQLMotion Relay (Add component > Add Event Rules > 
> SPARQLMotion Relay) and do the following:
> 1) In the tree component (named "Select Class to Begin" in 3.3.1), note that 
> the single-click selection event is "Tree Click"
> 2) In the SPARQLMotion Relay, add that event, "Tree Click" to the Input 
> (Listen > Input)
> 3) In Post > Relayed Event, create a new event, let's call it "Relayed Tree 
> Click"
> 4) Modify the Listen > Refresh Grid Object event in the grid so it listens to 
> "Relayed Tree Click" instead of "Tree Click"
> At this point, note that the event works as before.  Clicking on the Person 
> class displays instances in the grid, with missing labels.  But this is 
> passed through the relay, which can call a SPARQLMotion script before 
> relaying the event.  That's the next step.
> 5) Configure the SPARQLMotion Relay to call CreateKennedyLabels (Attributes > 
> SM Script ID, enter CreateKennedyLabels), a SPIN function defined in 
> CreateKennedysLabels.sms.n3.
> Now click on the class Person and the labels will appear.  This is because 
> the script entered in step 5 run inferences to assert values for rdfs:label.
> You can look at the script in CreateKennedysLabels.sms.n3 to see how this 
> works.  The script simply imports the current RDF, runs TopSPIN, inserts the 
> inferred triples into thehttp://tb-sessiongraph, and uses ReturnText to 
> terminate the script.  OWLIM inferences could replace the TopSPIN module, and 
> in fact any script modules could be used.  The key is that for the triples to 
> appear in Ensemble, they need to be inserted intohttp://tb-session.
> There are tradeoffs to this approach, of course. You may not want to run the 
> script every time a class instance is entered.  That will be the next post…
> -- Scott

-- 
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
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-users?hl=en

Reply via email to