Scott thanks for reply.
The JS file is in the same dir of the spin rule file in the TB workspace 
(C:\Users\Pierluigi\TBCFreeWorkspace\MIVIA Tracking).
I'm testing the function with a simple query like this:

SELECT ?x
WHERE {
    LET (?x := tracking:isSmallDiff (2,2,3)) .
}

I'm using Top Braid Composer Free Edition 4.5.0 on Windows 8.1.


Il giorno mercoledì 14 gennaio 2015 19:13:25 UTC+1, Pierluigi Ritrovato ha 
scritto:
>
> 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? 
>
>

-- 
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 [email protected]
--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to