Rules associate types (classes) with constraints on properties. So, in fact, some rule will tell you: class Person, property int age, lower bound 18, upper bound 60. To generate data, you'll have to create 1000 persons, each with some random age. (I'm assuming that you may want to set other Person attributes according to other constraints in the same rule - otherwise generating 1000 Persons between 18 and 60 will get you about 20 persons for each age.)
You cannot express a constraining value such "current month" and "last month". Such dynamic values would have to come from variables or other facts; you cannot have them in rules (except as names). -W On 1 April 2011 15:37, praveen p <p.prave...@gmail.com> wrote: > Hi W, thanks for the valuable info. To give you more clarity on what my data > generator is trying to do I'll give you examples of some scenario: > > There is property called age in my java application of data type integer for > which 1000 random ages have to be generated. Now there is a rule associated > with this 'age' property inside drools which says 'age should be between 18 > and 60'. The java application has to go, fetch this rule from drools, come > back to the java layer and generate 1000 random integers between the values > 18 and 60. > > There is a property called Date in my java application of data type data for > which 250 random dates have to be generated. Now there is a rule associated > with this 'date' property inside drools which says 'dates should only be > between current month and last month'. The java application has to go, > fetch this rule from drools, come back to java layer and generate 250 random > dates between current and previous month. > > The data generation java functions are written and called based on the given > rule and data type. > > Can operations of these types be achieved with the use of drools? > > Regards, > Praveen. > On Fri, Apr 1, 2011 at 12:34 PM, Wolfgang Laun <wolfgang.l...@gmail.com> > wrote: >> >> Yes, it would be possible, Rules, after compilation, are available as >> Abstract Syntax Trees, representing the conditions. However, to access >> these objects, you need to use classes from the "unstable" part of the >> API, and there won't be much documentation helping you along. >> >> Let me say that this is a very roundabout way of defining limits for >> data generation. A conidtion is nothing but a boolean expression with >> extensions such as "forall", "exists", "not", "collect", "accumulate", >> which (I think) you won't be using anyway. >> >> But I reserve my judgement because I don't know the specification for >> your data generator. >> >> -W >> >> >> On 1 April 2011 08:40, praveen p <p.prave...@gmail.com> wrote: >> > Hi, >> > >> > I'm not using drools to generate data, a java program would do that. I >> > just >> > want to know whether the java program can connect to drools, fetch >> > corresponding rules from it and generate data based on the rule >> > fetched(the >> > conditions for data generation and the upper and lower limits come from >> > rules). Please let me know if this is possible. >> > >> > Regards, >> > Praveen. >> > >> > >> > >> > On Tue, Mar 29, 2011 at 7:17 PM, Wolfgang Laun <wolfgang.l...@gmail.com> >> > wrote: >> >> >> >> Rules do not generate data. Rules can tell you whether existing data >> >> meets >> >> conditions. Now if you create test data randomly, you can run a rule >> >> base >> >> with this data, and at the end of the day, you will know whether you >> >> have a >> >> data set matching a certain rule - or not. But I don't think that this >> >> approach is the way you should go. >> >> -W >> >> >> >> >> >> >> >> >> >> On 29 March 2011 15:12, praveen p <p.prave...@gmail.com> wrote: >> >>> >> >>> Hi, >> >>> >> >>> >> >>> >> >>> We need to make a decision on whether to use Jboss drools for our >> >>> project, please help me out on this. We are planning to develop a tool >> >>> which >> >>> generates random test data based on some conditions. These conditions >> >>> can be >> >>> something like age>18<60, 6 lettered string containing only first four >> >>> letters of an alphabet, Amount=Price*quantity. We are planning to >> >>> store >> >>> these conditions in drools rule engine and generate data based on >> >>> them. The >> >>> java application has to connect to drools, fetch the rule associated >> >>> with a >> >>> property, get back to java layer and generate some output based on >> >>> these >> >>> rules. Is this possible using drools? Please let me know the >> >>> possibility and >> >>> provide some clarity on it. >> >>> >> >>> >> >>> >> >>> Regards, >> >>> >> >>> Praveen. >> >>> >> >>> _______________________________________________ >> >>> rules-dev mailing list >> >>> rules-dev@lists.jboss.org >> >>> https://lists.jboss.org/mailman/listinfo/rules-dev >> >>> >> >> >> >> >> >> _______________________________________________ >> >> rules-dev mailing list >> >> rules-dev@lists.jboss.org >> >> https://lists.jboss.org/mailman/listinfo/rules-dev >> >> >> > >> > >> > _______________________________________________ >> > rules-dev mailing list >> > rules-dev@lists.jboss.org >> > https://lists.jboss.org/mailman/listinfo/rules-dev >> > >> > >> >> _______________________________________________ >> rules-dev mailing list >> rules-dev@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/rules-dev > > > _______________________________________________ > rules-dev mailing list > rules-dev@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-dev > > _______________________________________________ rules-dev mailing list rules-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-dev