Re: [rules-users] Guvnor Help !!

2012-07-04 Thread Michael Anstis
You don't need to create a global.

You do however need to add an import for the class in the POJO JAR.

This can be accomplished on the same screen. Ensure you save the package
after adding the import.

Ideally, when importing a POJO model from the Global Area, the imports
should be added automatically.

Please feel free to raise a JIRA at
https://issues.jboss.org/browse/GUVNORrequesting this feature if you
like.

With kind regards,

Mike

On 3 July 2012 14:40, abhinay_agarwal  wrote:

>  hey mike,
>
> To /use a POJO model in a specific package after importing /it from Global,
> /we need to create a Global variable inside the EDIT -> Configuration part
> of the package/...
> Only after this is done can i make rules inside the package using the
> imported model..
>
> But, in drools-expert doc its said that "/It is strongly discouraged to set
> or change a global value from inside your rules/"..and..."/Globals are not
> designed to share data between rules and they should never be used for that
> purpose/"
>
> but again you told me that "/*Rules are assets so the same principle
> applies: if you have a rule you want to share in multiple packages, define
> it in the the Global Area and then import it into the packages in which it
> is needed*/"
>
>
> M a bit confused..can yu please explain !!
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018429.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-07-03 Thread abhinay_agarwal
 hey mike,

To /use a POJO model in a specific package after importing /it from Global,
/we need to create a Global variable inside the EDIT -> Configuration part
of the package/...
Only after this is done can i make rules inside the package using the
imported model..

But, in drools-expert doc its said that "/It is strongly discouraged to set
or change a global value from inside your rules/"..and..."/Globals are not
designed to share data between rules and they should never be used for that
purpose/"

but again you told me that "/*Rules are assets so the same principle
applies: if you have a rule you want to share in multiple packages, define
it in the the Global Area and then import it into the packages in which it
is needed*/"


M a bit confused..can yu please explain !!



--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018429.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-28 Thread abhinay_agarwal
The main question is how do i make a $1M ?? ;)

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018319.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-28 Thread Michael Anstis
>From a Guvnor perspective, there aren't any other advantages.

>From a maintenance perspective, when you make your $1M and leave the
company and someone else has to look after what you leave behind, it could
make their life easier ;)

On 28 June 2012 10:49, abhinay_agarwal  wrote:

> hey,
>
> thanks mike, now i am somewhat pratically more clear.
>
> Now, in the example you gave, what is advantage that i get by uploading a
> "Mortgage Model" in the global area(and there in importing it into the
> packages) and uploading it in all the four packages that you referred to.
>
> I advantage that i can think of is when i have to make changes in the
> Mortgage Model, i ll just have to update the Global area, and not
> individually. :)
>
> is there any other advantage apart from  it ???
>
> Thanks,
> Abhinay
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018317.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-28 Thread abhinay_agarwal
hey,

thanks mike, now i am somewhat pratically more clear.

Now, in the example you gave, what is advantage that i get by uploading a
"Mortgage Model" in the global area(and there in importing it into the
packages) and uploading it in all the four packages that you referred to.

I advantage that i can think of is when i have to make changes in the
Mortgage Model, i ll just have to update the Global area, and not
individually. :)

is there any other advantage apart from  it ???

Thanks,
Abhinay

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018317.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-28 Thread Michael Anstis
Hi,

You're basically right, but your terminology confused.

Firstly, I'd be surprised if the package in Guvnor would compile without
importing the POJO Model from the Global Area into package XYZ.

When attempting to compile package XYZ with rule "age and status" the
Classes used therein will not be found and hence compilation fail.

Secondly, the "Model" (whether POJO, as you are doing, or otherwise)
contains Classes. Not Objects. Nothing will fire even if everything else is
correct.

If you have not already done so, and I am beginning to feel you have not,
please read the Drools Expert user-guide. This explains how the Rule Engine
functions.

Thirdly, an example of where you might want to share a single POJO Model
between packages could be:-

Mortgage Model containing Classes for: Applicant, Property, MortgageOffer

Packages: org.yourco.mortgages.england.south,
org.yourco.mortgages.england.north, org.yourco.mortgages.england.west,
org.yourco.mortgages.england.east

With kind regards,

Mike

On 28 June 2012 09:49, abhinay_agarwal  wrote:

> hey mike,
>
> Rules are applied on the POJO models which we upload, nw if i upload a
> model
> in global area n write a rule based on it.
>
> Now, if i import the rule in any package, i would need the pojo model in
> the
> package..isn't it ?
>
> Because if i dont have data, then where m i supposed to apply rules on ??
>
> for example:
>
> I upload into global a jar og the following class
>
> public class person
> {
>  private int age;
>  private String status;
> // getters and setters;
> }
>
> i make a rule in global area:
>
> rule "age and status"
>   when
> $p: Person(age>18)
>   then
>  $p.status="accepted"
> end
>
> Now i import the rule in package XYZ, bt ma package doesnt have the POJO
> model,
> now the rule in the package XYZ is a waste..ri8 ?? coz it will neva be
> fired..
>
> Can you give me an exmple where i would like to use a POJO model in two
> different packages!!!
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018311.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-28 Thread abhinay_agarwal
hey mike,

Rules are applied on the POJO models which we upload, nw if i upload a model
in global area n write a rule based on it.

Now, if i import the rule in any package, i would need the pojo model in the
package..isn't it ?

Because if i dont have data, then where m i supposed to apply rules on ??

for example:

I upload into global a jar og the following class

public class person
{
  private int age;
  private String status;
// getters and setters;
}

i make a rule in global area:

rule "age and status"
   when
 $p: Person(age>18)
   then
  $p.status="accepted"
end

Now i import the rule in package XYZ, bt ma package doesnt have the POJO
model, 
now the rule in the package XYZ is a waste..ri8 ?? coz it will neva be
fired..

Can you give me an exmple where i would like to use a POJO model in two
different packages!!!



--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018311.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-28 Thread Michael Anstis
The Global Area is a container for assets you might like to share across
different packages.

For example, you might have a POJO Model that you want to use in two
different packages.

Assets in the Global Area are *not* in packages unless you import them into
the package.

Rules are assets so the same principle applies: if you have a rule you want
to share in multiple packages, define it in the the Global Area and then
import it into the packages in which it is needed.

With kind regards,

Mike

On 28 June 2012 05:16, abhinay_agarwal  wrote:

> hey vincent/manstis/davide,
>
> actually as i said its jzz been a few days that i ve been learning GUVNOR ,
> so i make mistakes while asking questions..pardon me for that...
>
> (by uploading facts..i meant uploading POJO models jar) :P
>
>
> Now, as you said, rules are used to modify the working memory,i get that...
>
> In Knowledge base, when i create a rule, it asks me to either create the
> rule in some package or in Global area..
>
> What is the use/advantage of creating a rule in Global area ??
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018306.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-27 Thread abhinay_agarwal
hey vincent/manstis/davide,

actually as i said its jzz been a few days that i ve been learning GUVNOR ,
so i make mistakes while asking questions..pardon me for that...

(by uploading facts..i meant uploading POJO models jar) :P


Now, as you said, rules are used to modify the working memory,i get that...

In Knowledge base, when i create a rule, it asks me to either create the
rule in some package or in Global area..

What is the use/advantage of creating a rule in Global area ??

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018306.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-27 Thread abhinay_agarwal
hey mike,

from uploading facts i meant uploading the jars with classes.. 

when you say that "Think of the Global Area as a place where assets can be
stored to share across packages"..does it mean that if i make a rule in
GLOBAL AREA..will that rule be taken into consideration for all the other
packages ???

--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018305.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-27 Thread Davide Sottara
Historically, knowledge bases (e.g. think of basic prolog or ontologies) are
more "static" and contain both facts and rules. Maybe it would be more
appropriate to think of those facts as "initial" rather than "global". 
In fact, you can write a rule :

rule "Init" 
when 
then 
 insert( new X(..) );   
 insert( new Y(..) );
end

I think it could be desirable to support a more compact syntax, e.g.

declare fact X( val1, val2, ... )

or maybe, more mvel-like:

declare fact X().{ field=val, ... }

As always, open to discussion on feature requests :)
Davide


--
View this message in context: 
http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290p4018303.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-27 Thread Vincent LEGENDRE
@ abhinay_agarwal : 
more generally, it is a nonsense to say "upload facts to a package", global or 
not. 
package contains rules, and are used to create a session, in which you then add 
facts. 
may be a confusion with Guvnor's test scenario ? 

this is also a nonsense to tell "a rule used to fire other rules" ... 
The only thing that can be considered as close is the forward chaining. A rule 
can modify the working memory so that a new rule can then trigger (because its 
condition part becomes true, not because the previous rule has fired). Rules 
system is a kind of declarative programming. 
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Guvnor Help !!

2012-06-27 Thread Michael Anstis
Think of the Global Area as a place where assets can be stored to share
across packages.

When you build a package assets linked from the Global Area will be
included. This package is the KnowledgeBase, the runtime, with which rules
will lead to activations.

It is impossible to upload FACTS to Guvnor, only their definitions i.e. the
model.

With kind regards,

Mike

On 27 June 2012 15:21, abhinay_agarwal  wrote:

> Hey,
>
> I’ve been using GUVNOR for uploading JARS and creating rules using FACTS..
>
> Now I thing I wanna know is  - a rule which is GLOBAL AREA, can it be used
> to fire rules which are there in some different package ?? (same facts may
> be uploaded in both GLOBAL AREA and the PACKAGE !! .. if requirement asks
> for it  !!! )
>
> Thanks,
> Abhinay
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Guvnor-Help-tp4018290.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users