On Feb 15, 2012, at 9:33 PM, Guilherme Scomparim wrote:
> Hi Holger, Scott and Bob,
>
> Thank you for the quick reply.
>
> First of all, I managed to go around the limitation by using some java
> script called by the page load where I have the example of the code
> below.
>
> <html>
> <body onload="createSession()">
> <ui:createLink arg:applicationName="{=
> PortalPlatform_spin:applicationName() }"
> arg:id="PortalPlatform.sms:CreateSessionUser" arg:userName="{= ?
> UserName }" ui:servlet="sparqlmotion">
> <script>function createSession() {
> window.location.href = '{=
> ?link }';
> };</script>
> </ui:createLink>
> </body>
> </html>
Looks good. If you want to insert the result of a SWP call from a SM script, I
think the following could also work, assuming that the SM script is wrapped
into a SPIN function/web service ex:fun:
<ui:group let:text="{= ex:fun() }">
<ui:parse ui:str="{= ?text }" />
</ui:group>
ui:parse takes an HTML snippet as input and inserts it. Your SM script could
(theoretically) produce such HTML using sml:CreateUISPINDocument followed by
sml:ReturnText. Anyway, <ui:call sm:script="ex:fun" arg:... /> sounds cleaner
once I get to it.
> My current use cases fits to your first example, where my SM end up
> calling pages that are going to be built dynamically based on returned
> parameters and/or Triples. I do not really know how to use the
> snippets yet, but I am still in process of building the components
> pages and I am sure I am going to need.
So it sounds like the control is done by the SM scripts, and they call
corresponding SWP code. This is one option.
> I also can't see the impact or the benefits of making the SM modules
> ui:Elements as well. Can you elaborate on this? It may help me in
> something else.
The approach that I am trying to get to is to increase the flexibility so that
SWP itself can be the control structure, e.g. using ui:if to branch into
"behavior". For this reason I believe something like the following should work:
<ui:if ui:condition="{= bound(?fileName) }">
<sml:ImportTextFile sm:outputVariable="text" sml:sourceFileName="{=
?fileName }">
<div>Here is your file: <textarea>{= ?text }</textarea></div>
</sml:ImportTextFile>
</ui:if>
If the SML modules were instances of ui:Element then they could be used just
like that, because they follow the same syntax. I would need to implement a
wrapper that can invoke the corresponding SM code when such an element is used.
The children of such sml: nodes would see all the new variable bindings as
would have the output RDF graph as SWP context graph.
> I am going to explain a bit of what I am trying to do, and you can
> even point me to another direction if what I am doing is not correct.
>
> Now, I am designing a portal application that is all based in SWP,
> using HTML5 and Javascript. Really looking forward to use SVG when
> inline becomes available.
>
> The reason I am using SWP is because my entire logic is dynamically
> captured in my executable models and I really need to have access to
> resources like SPIN Functions, Templates, Magic Variables and SM to
> run inferences
Would be
<ui:setContext ui:queryGraph="...">
<sml:ApplyTopSPIN>
<div>Now the inferences are visible, we are in queryGraph +
inferences</div>
</sml:ApplyTopSPIN>
</ui:setContext>
> because the entire sequence of pages, the content of
> pages and events are going to be dynamically created using SPARQL
> Queries { } based in state changes. I am also not an experienced Java
> programmer to build an application using APIs, so I am keen t wait for
> its full development.
>
> This application has some similarities of what TQ have developed in
> Flex for ensemble, where I defined HTML components like Forms,
> Fields, Buttons, Menus, Events, Session, LoginForm etc . The meta-data
> views instances are then stored in each separated executable models by
> domain that import the components in the .ui model.
Very cool, I am probably working on something similar. Open TBC-ME 3.6 beta and
go to
http://localhost:8083/tbl/swp?_viewClass=swadoc:Index
for the evolving component library with forms, trees, grids etc. All
model-driven and very flexible using SWP.
> Here is my first scenario
>
> I have a SWP page that is called pt:InboundEvent, that has a parameter
> called pt:sessionGraphID.
> A particular instance view of the page pt:InboundEvent is the
> pt:login request with ui:name=login.
> This login request does not have a pt:sessionGraphId as parameter,
> because a session still needs to be created.
> In this case, when the pt:sessionGraphId is not bound, my page
> ui:prototype will call the script that creates a sessiongraph using
> the user and timestamp information that imports the portal.ui and the
> portalInstance.ui .
> My script then call back the page, not the view, but in this case
> passing the sessionGraphId as parameter and the sequence flows...
>
> Second Scenario
>
> A particular pt:InboundEvent is trying to perform updates,
Are you using sml:PerformUpdate or swp:update?
> so I need
> to validate if there is no constraints triggered with such update.
> In this case the pt:inboundEvent call a page pt:makesUpdate that
> performs the updates in the session Graph.
> This page then call a script that will perform the update in a
> dynamically defined model by passing the sessionGraphID as parameter.
> This script is going to import the sessionGraph to find out the
> relevant models are required for such update based on parameters
> importing these required models dynamically to infer constraints.
> In case there is no constraints the script will update the relevant
> model and call a pt:OutboundEvent page that will just communicate a
> successful update passing the new State moving dynamically to the next
> page or will show the constraints stopping the update.
>
> I already see a great benefits by having the ability to build pages
> and also the sequence of events dynamically by using SM call that can
> import and infer only the required models and triples, instead of
> running inference in the entire application graph, what I already
> verified would have performance issues.
>
> I hope this helps, I am still in process of finding other cases that I
> am going to share with you as soon as I have it. I am happy to talk
> about my plans with SWP because I am keen in improving it.
Yes thank you, let's continue brainstorming (either here or off-list).
Holger
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary
Network (EVN), 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