I have defined a spin function that make some simple computation through a javascript snippet and works well.
Now I moved the snipped code in a js file and it doesn't work!
this is the spin function
tracking:isSmallDiff a spin:Function ;
rdfs:label "computes if difference is small"^^xsd:string ;
rdfs:subClassOf spin:Functions ;
spin:constraint [ a spl:Argument ;
spl:predicate sp:arg3 ;
spl:valueType xsd:integer
] ;
spin:constraint [ a spl:Argument ;
spl:predicate sp:arg2 ;
spl:valueType xsd:integer
] ;
spin:constraint [ a spl:Argument ;
spl:predicate sp:arg1 ;
spl:valueType xsd:integer
] ;
spin:returnType xsd:integer ;
spinx:javaScriptFile "isSmallDiff.js"^^xsd:string .
the js code is:
function isSmallDiff(arg1, arg2, arg3) {
if (Math.abs(arg1-arg2) < arg3)
return 1;
else
return 0;
}
I copied the JS file any pace in my file system!
thank you very much in advance for any help.
Pierluigi
PS curiosity: the javascript code works only if I use arg1, arg2, .... arg5 as argument variables?