Hi Samson,
As you probably know, Jess learns about Userfunctions via method calls. As
you may not realize, when the JessDE is running, there's a copy of the
Jess engine in there that's used to parse and interpret Jess code. If the
code you're editing makes that copy of Jess aware of the Userfunctions you
want to refer to, then they'll be available.
So, a very simple example: let's say there's is a Userfunction named "foo"
implemented in a class named com.foo.FooFunction that's in a jar named
foo.jar . You want to edit Jess code that calls this function. One way to
accomplish this would be to add foo.jar to the project's Java build path,
then simply have this Jess function call in your file of Jess code:
(load-function com.foo.FooFunction)
If there's a com.foo.FooPackage that adds a whole bunch of functions, you
could add the jar and call
(load-function com.foo.FooPackage)
Now, the problem is that this will actually load the classes in foo.jar
into Eclipse. Sometimes this is innocuous, but sometimes -- and Protégé is
probably one of those times -- that would bring too much baggage with it.
So instead, you can fake the editor out. For example, just adding a line
like
(deffunction foo () )
To your source file will define a function "foo"; you could have a whole
bunch of these lines to define all the functions in a package.
But of course, that litters your source file, and nobody wants that. So
you move all those functions info another Jess file called, say,
"development.clp", and load it like this:
(require development)
And development.clp can include "(provide development)" and this will work
great. But what about when you deploy, won't this file cause problems? Not
if instead you use "require*", which silently deals with missing files. At
deployment time, you simply don't include development.clp in your deployed
package, Jess will ignore the require*, and everything will work normally.
So, long story short, the best way to edit protégé code would be to create
a "protégé-development.clp" containing all the needed function
declarations, and use it as described.
On 4/3/13 7:03 PM, "Samson Tu" wrote:
>
>Hi,
>
>Perhaps I can clarify that my question is more general than JessTab. It
>is really about how to make Eclipse JessDE recognize Jess user functions
>and templates. The value of Eclipse JessDE is much diminished if it
>cannot recognize user functions.
>
>Thank you.
>
>With best regards,
>Samson
>
>
>On 3/29/2013 5:06 PM, Samson Tu wrote:
>> Hi,
>>
>> I am writing Jess rules for use in Protege's JessTab. I would like to
>> use the Eclipse JessDE, but it doesn't recognize any of the JessTab
>> functions, which were implemented as Jess user functions (accessible
>> in jesstab.jar). What do I need to do to make JessDE recognize JessTab
>> functions?
>>
>> Thanks.
>>
>> With best regards,
>> Samson
>>
>
>--
>Samson Tu email: s...@stanford.edu
>Senior Research Scientist web: www.stanford.edu/~swt/
>Center for Biomedical Informatics Research phone: 1-650-725-3391
>Stanford University fax: 1-650-725-7944
>
>
>To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
>in the BODY of a message to majord...@sandia.gov, NOT to the list
>(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
>
To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.