I don't think SPINX would be helping you, even with a stand-alone file -
each invocation of such a SPIN function would get its own JavaScript
engine, and all intermediate values will be lost.
Your computation below looks like easily done in SPARQL. All you need to
do is remember the intermediate values in a graph such as ui:tempGraph.
Holger
On 3/13/15 8:24 AM, Jack Hodges wrote:
This seems like a good idea but it isn't working out so nicely. If I
use the spix.javaScriptCode proerty on the following javascript fragment:
var prev = 6; var curr = 0; if(arg1 == 0) curr = 5; else curr = prev -
0.4 * arg2; prev = curr; return curr;
the code executes (in a SPARQL window) but doesn't persist the value
of 'prev', which was the original need.
If I use the spinx:javaScriptFile on the following (named
'position.js' in the folder where the SPIN file is located):
function yBoxStart(index, count) {
var prev = 6;
var curr = 0;
if (index == 0) {
curr = 5;
} else {
curr = prev - 0.4 * count;
}
prev = curr;
return curr;
}
Then it doesn't produce any results in the SPARQL window at all. I
suspect that the 'position.js' file cannot be found. I have put it in
different folders and tried a full URL to it with the same [lack of]
results. The documentation goes part way through a full example but
leaves out just enough for me to fail to get it working. Clearly this
is the rudimentary of functions so there must be something very simple
that is wrong. I didn't see anything about the name of the javascript
function in the documentation. Is that maybe related to this problem?
Comments?
Jack
On Tuesday, March 10, 2015 at 3:22:50 PM UTC-7, Holger Knublauch wrote:
ui:functionCall is only producing JavaScript source code that
would be executed client-side. If you want server-side execution
of JavaScript logic, you could use SPINx
http://spinrdf.org/spinx.html
HTH
Holger
On 3/11/15 7:11 AM, Jack Hodges wrote:
and performs some calculation? I am trying to calculate a display
position for part of a graphic inside a ui:foreach. The position
is based on the position of the previous item in the iteration.
It is easy enough to write a js function that will maintain the
variables and their values, and calculate the new position, but
is using ui:functionCall and appropriate way to talk with the
function? Thanks,
Jack
--
You received this message because you are subscribed to the
Google Group "TopBraid Suite Users", the topics of which include
Enterprise Vocabulary Network (EVN), Reference Data Manager
(RDM), TopBraid Composer, TopBraid Live, TopBraid Insight,
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to topbrai...@googlegroups.com
<javascript:>
---
You received this message because you are subscribed to the
Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to topbraid-user...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise
Vocabulary Network (EVN), Reference Data Manager (RDM), TopBraid
Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web
Pages and SPIN.
To post to this group, send email to topbraid-users@googlegroups.com
---
You received this message because you are subscribed to the Google
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to topbraid-users+unsubscr...@googlegroups.com
<mailto:topbraid-users+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Group "TopBraid
Suite Users", the topics of which include Enterprise Vocabulary Network (EVN),
Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, TopBraid Insight,
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to topbraid-users@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.