Ernest Friedman-Hill
Tue, 03 Nov 2009 08:14:10 -0800
Note if you use getShadowClassName() as suggested below, then you'll get the name of the class used to define the template, which might be an interface (in which case you can't instantiate it, of course.) If you use the OBJECT slot, as I suggest, then you'll get the actual class of the object behind the fact, and that may or may not be what you actually want.
On Nov 3, 2009, at 7:26 AM, Marco Zappatore wrote:
I think that a possible solution could be the following val.factValue(context).getDeftemplate().getShadowClassName()and then instantiate a new instance starting from the string that the abovemethod returns... In any case, I'd like to know your opinion... Marco Zappatore wrote:Dear Jess users,I have a rule "myrule" that fires whenever two facts with specific slotcontents are found within the working memory. These facts are shadow facts.Then I have a java user function "myUserFunction" that passes those two facts (using their pointers, let's say ?f1 and ?f2) to a Java program. My question is: is it possible to get those facts and instantiate themagain in Java? In other words the procedure is: 1) define a java bean2) assert shadow facts from that java bean with different slot contentseach time 3) find a given fact with a given content using a proper rule 4) pass the fact to a java program5) create a new instance of the java bean with the content just retrievedthe problem resides at point n°5 because actually I'm using Value val = vv.get(1).resolveValue(context);Using val.factValue(context)) I can verify that the content is correct buthow can I use val to instantiate a new Java Bean? Any help is appreciated, thanks in advance. Marco Zappatore-- View this message in context: http://old.nabble.com/Retrieve-facts-from-Jess-and-re-instantiate-them-in-Java-tp26160053p26160091.html Sent from the Jess mailing list archive at Nabble.com. --------------------------------------------------------------------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 .--------------------------------------------------------------------
--------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- 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. --------------------------------------------------------------------