RE: [rules-users] RE: questions on guvnor and drools 5.0
We have lists of objects and I was talking about how you do it with the test scenario in Guvnor. The fact is in working memory but I need to be able to create the object so it has a list of objects. Because the rule matches if it is in working memory and party of another object's list. So if I have a School and Children for example Then I write a rule that says if School and Child where child is a member of the School [when] $child : Child(readyForRegistration == true) $school : School($child memberof children) [then] $school.registerChild($child); [end] So in Guvnor I need to create a test scenario where School has a list of Children objects. But Guvnor only shows me a textfield so I assume it wants a value like "Bob" or 1. I don't see the option or an example how to create a Child fact with a name of Bob and readyForRegistration = true. Then another child with name of Nancy which readyForRegistration = false. Then I want to put them in both into a collection and create a new School object using the collection of Bob and Nancy. I can do this type of thing easily with a JUnit test creating and inserting facts into working memory. It would be nice if business users could write test scenarios just as easy with Guvnor. If you haven't checked out that part of Guvnor it might help if you take a peek. SG -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Thursday, June 04, 2009 11:59 AM To: Rules Users List Subject: Re: [rules-users] RE: questions on guvnor and drools 5.0 On 6/4/09, Garner, Shawn wrote: > 2) How do you use the test scenarios with complex object structures? >-eg Create a fact in working memory that has another Object in it > which in turn has a list of Objects in it. >-Seems like any Fact in working memory is assumed to only have only > primitive values like Strings or numbers. >-We would like a more depth of objects where objects have a deep > relationship to other objects at least 2-4 levels deep. Any object that is inserted as a fact may contain references to other objects, which, in turn, may contain references, and so on. The main thing to consider with complex object structures is, which of the objects should be inserted as facts. The distinction should be made according to whether an object's properties participate in rule patterns and whether this object will change during the (stateful) session. If so, make it a fact. Referring to object properties via one or more levels of dereferencing when using them in patterns won't be possible except in inline evals or eval patterns. Notice that LHS patterns may be written so that additional levels of objects are included in the reasoning, letting you access their non-reference fields in field constraints, e.g.: rule x when $p : Person( $name : name, $f : father ) Person( this == $f, name == "Joe" ) then // $name is a child of Joe end -W ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -Message Disclaimer- This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email to conn...@principal.com and delete or destroy all copies of the original message and attachments thereto. Email sent to or from the Principal Financial Group or any of its member companies may be retained as required by law or regulation. Nothing in this message is intended to constitute an Electronic signature for purposes of the Uniform Electronic Transactions Act (UETA) or the Electronic Signatures in Global and National Commerce Act ("E-Sign") unless a specific statement to the contrary is included in this message. While this communication may be used to promote or market a transaction or an idea that is discussed in the publication, it is intended to provide general information about the subject matter covered and is provided with the understanding that The Principal is not rendering legal, accounting, or tax advice. It is not a marketed opinion and may not be used to avoid penalties under the Internal Revenue Code. You should consult with appropriate counsel or other advisors on all matters pertaining to legal, tax, or accounting obligations and requirements. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] RE: questions on guvnor and drools 5.0
On 6/4/09, Garner, Shawn wrote: > 2) How do you use the test scenarios with complex object structures? >-eg Create a fact in working memory that has another Object in it > which in turn has a list of Objects in it. >-Seems like any Fact in working memory is assumed to only have only > primitive values like Strings or numbers. >-We would like a more depth of objects where objects have a deep > relationship to other objects at least 2-4 levels deep. Any object that is inserted as a fact may contain references to other objects, which, in turn, may contain references, and so on. The main thing to consider with complex object structures is, which of the objects should be inserted as facts. The distinction should be made according to whether an object's properties participate in rule patterns and whether this object will change during the (stateful) session. If so, make it a fact. Referring to object properties via one or more levels of dereferencing when using them in patterns won't be possible except in inline evals or eval patterns. Notice that LHS patterns may be written so that additional levels of objects are included in the reasoning, letting you access their non-reference fields in field constraints, e.g.: rule x when $p : Person( $name : name, $f : father ) Person( this == $f, name == "Joe" ) then // $name is a child of Joe end -W ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] RE: questions on guvnor and drools 5.0
Hi Shawn, I'm also currently evaluating Guvnor. I certainly don't have all the answers but maybe I can share what I have learned so far. I've put my comments below. Steve Ronderos rules-users-boun...@lists.jboss.org wrote on 06/04/2009 08:14:30 AM: > [image removed] > > [rules-users] RE: questions on guvnor and drools 5.0 > > Garner, Shawn > > to: > > rules-users@lists.jboss.org > > 06/04/2009 08:19 AM > > Sent by: > > rules-users-boun...@lists.jboss.org > > Please respond to Rules Users List > > Sorry it's been a few days and I haven't gotten any response on any > questions/statements below. > > I've used drools in the past but am pretty new to some features of > drools still and new to Guvnor. I wrote a proof of concept drools/ > Guvnor app and these are the things I don't like or have questions around. > > I was wondering if other people have the same problems or am I going > about things wrong? Are there work arounds or is there plans to > expand/change functionality? Maybe I should ask the dev list? > > SG > > -Original Message- > From: G, S > Sent: Monday, June 01, 2009 3:28 PM > To: 'rules-users@lists.jboss.org' > Subject: questions on guvnor and drools 5.0 > > I was wondering if somebody can help me with some questions: > > 1) Is there any more detail on how to setup Guvnor with a database? Guvnor uses Apache Jackrabbit for persistence. You can find a pretty good walk through on the Drools blog http://blog.athico.com/2008/08/tuning-guvnor.html. Additional information about configuring the repository can be found on the Apache Jackrabbit site. http://jackrabbit.apache.org/jackrabbit-configuration.html > 2) How do you use the test scenarios with complex object structures? >-eg Create a fact in working memory that has another Object in it > which in turn has a list of Objects in it. >-Seems like any Fact in working memory is assumed to only have > only primitive values like Strings or numbers. >-We would like a more depth of objects where objects have a deep > relationship to other objects at least 2-4 levels deep. I'm not sure, haven't used that feature of Guvnor much yet. > 3) Why add ruleflow-group to the rule definition instead of adding > the rule to a ruleflow-group? If the ruleflow-group is part of the > rule then you can't use the same rule in multiple ruleflow-groups > and leads to copy and maintaining the rule in two different spots. Should probably ask the dev group this one. > 4) DSL seems to be very inconvenient to edit in a text box > especially when it wraps. Why not a table where you can add rows > and each row is a translation. Also there are no examples how to do > translation into Drools syntax that is multiple lines long and not > just a single line. I haven't used DSLs much either yet. Maybe ask the dev group this one also. > 5) Is Java 5 Type Enumerations supported? I was assuming I'd get a > list of values if a field was an Enumeration. Not sure > 6) There seems to be a vast functionality difference between the > Guvnor decision tables and examples that use spreadsheets. I believe that Guvnor decision tables are not as full featured as the spreadsheet based version, but you can still upload spreadsheets to Guvnor as decision tables. > 7) Guvnor lost the ability to select variables for use in other > statements. Functionality was in BRMS of drools 4.0.7 I don't understand the question. Are you talking about assigning a pattern or an attribute in a pattern to a variable for use in another statement in the LHS or RHS? If so clicking on the fact type or field restriction that gives you that option. > 8) I was not able to insert a fact using a constructor that needed > parameter values. Seems like it assumes everything is a bean but I > couldn't find this requirement stated in the documentation anywhere. > Examples in documentation show inserting facts with constructor parameters. Are you talking about in the Guided Rules Editor? I haven't tried this, but it sounds like a bug. Maybe ask the dev team. > 9) It would be nice when you upload a domain model jar that you > could explore the objects and fields somehow. I agree, being able to traverse the model that you include would be nice. Maybe ask the dev team if there are plans for such a feature or create a request in the Guvnor JIRA. https://jira.jboss.org/jira/browse/JBRULES > 10) When you write a rule using one particular editor it would be > nice if you could switch to another editor. Switch between Guided, > DSL, Technical, etc. Agreed. Some other posters on the email group have discussed this before. As it stands the different editors aren't equally as powerful. Some rules can not be represented in the Guided editor since it does not have anything capable of "from" (I think). Maybe ask the dev team about this and possibly create a feature request. > 11) It seems hard to reorder the statements in a when o