Hi Scott, That is fine. Maybe I did not explain the situation in enough detail or hit the point directly.
I understand that we can call a javaScript function in sparql or in another javascript function. I mean that when I say to call a function directly. But I bet a mechanism is required to call a function in a library because it is not in the file created in the workspace. For simple functions, such as abs(x), it is easy to re-create the code; but for complicated ones, re-creation is a waste of time. I would still search for ways to import them to the project. Mingzhen On Apr 16, 11:19 pm, Scott Henninger <[email protected]> wrote: > Oh, my apologies. This is a different story altogether. It seems > that Composer's version of of JavaScript (Mozilla Rhino) is not > providing access to the built-in objects (Math, Boolean, Array, > etc.). We are working to fix this. > > In the meantime there are a couple of steps to take to try to work > around this. The first is to find the definitions for js these > objects, and the second is to import/embed them into the Javascript > files you are using. I'd love to have immediate solutions, but will > instead settle on telling you we will work on this. Any hints from > Javascripters on the forum? > > When you say "I can use Math.sin(x) directly from the library.", do > you mean in a browser? I'm just fishing for hints to try to figure > out some workarounds. > > Sorry it too so long to arrive at this conclusion. > -- Scott > > On Apr 16, 3:54 pm, mwz <[email protected]> wrote: > > > > > Scott, > > > I guess I did not make myself clear. What I try to do is to include a > > JavaScript library so I do not need to code functions defined in the > > library again. For example, I can use Math.sin(x) directly from the > > library. > > > Mingzhen > > > On Apr 16, 3:35 pm, Scott Henninger <[email protected]> > > wrote: > > > > Mingzhen; There is no need to try to include the Javascript file in > > > Composer or Eclipse or a Workspace. > > > > It works the other way around. Given a SPIN function that names a > > > JavaScript function, all you need is a valid pointer (pathname/URL) to > > > the file in spinx:javaScriptFile. > > > > So all you need is a valid way to address the file. For example, it > > > can be a URL to a file on a remote server. > > > > -- Scott > > > > On Apr 16, 2:55 pm, mwz <[email protected]> wrote: > > > > > Hi Scott, > > > > > I got the function part work for me. My question is: how I can add a > > > > javaScript library so I can use functions defined in the library. > > > > > I tried to follow the help file from TopBraid, which led me to check > > > > the properties of the project (which makes great sense to me because I > > > > had same experience when I used Eclipse development environment), > > > > items in my project properties are different from those described in > > > > the help file. There is no item for 'JavaScript' and 'JavaScript > > > > Libraries' so you can add or delete runtime library. There are only > > > > 'resource', 'builders', 'project references', 'refactoring history', > > > > 'run/debug setting', 'task tags' and 'valiation'. > > > > > I want to know what I should do to solve the problem. > > > > > I hope I described the issue clearly to you. Thank you for help. > > > > > Mingzhen > > > > > On Apr 16, 1:31 pm, Scott Henninger <[email protected]> > > > > wrote: > > > > > > Mingzhen; What exactly do you mean by "'JavaScript' bar" and "as > > > > > shown in the help section of advanced javascript topic"? > > > > > > In terms of adding a JavaScript file, the way it works in Composer is > > > > > that you provide a URL for a JavaScript file in the > > > > > spinx:javaScriptFile. I.e. just like a Web page would address a js > > > > > page. > > > > > > Working from a defined JS file, the way to create a SPIN function for > > > > > a function myJSfunc() from the > > > > > filehttp://myserver.org/myJSfunctions.js > > > > > would be as follows: > > > > > 1. Create a subclass of spin:Functions named myJSfunc > > > > > 2. Insert "http://myserver.org/myJSfunctions.js" in a value for > > > > > spinx:javaScriptFile > > > > > > The details are if arguments are passed and defining the return type. > > > > > > -- Scott > > > > > > On Apr 16, 10:54 am, mwz <[email protected]> wrote: > > > > > > > Hi, > > > > > > > I am having problem to import a JavaScript library so I can use > > > > > > functions defined in them. I looked at the project properties (by > > > > > > right clicking on the project), there is no 'JavaScript' bar to > > > > > > expand > > > > > > as shown in the help section of advanced javascript topic. > > > > > > > What could I do for the system to get the featuer I need? Thank you > > > > > > veyr much. > > > > > > > Mingzhen- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TopBraid Composer Users" group. 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-composer-users?hl=en -~----------~----~----~----~------~----~------~--~---
