Thanks Stephen,
This was very helpful!
Albert Jan
2013/3/20 Stephen Masters [via Drools] <
ml-node+s46999n4022923h69(a)n3.nabble.com>
There seem to be a couple of misunderstandings of what in inferred
type is.
Firstly, it's a fact type just like any other fact. You are inserting it
into working memory in your rule. Therefore you need to declare it. I tend
to use declared types for inferred facts. i.e.:
declare IsBadDebtor
debtor: com.invoicestore.domain.Debtor
end
Secondly, it does not need to extend anything. Obviously, you could create
an IsBadDebtor class, which extends the Debtor class, but that's not
required. Note in the above example that debtor is a property of the
IsBadDebtor declared type.
Steve
On 20 Mar 2013, at 07:39, Bharadwaj N <[hidden
email]<http://user/SendEmail.jtp?type=node&node=4022923&i=0>>
wrote:
Can you show me Debtor class ?
On Wed, Mar 20, 2013 at 12:56 PM, ajklunder2 <[hidden
email]<http://user/SendEmail.jtp?type=node&node=4022923&i=1>
> wrote:
> Thanks,
>
> Is that the solution? That seems odd to me because IsBadDebtor is an
> inferred object and should have the class Debtor. When you have to declare
> a class for every type of inferred object you are using that would be
> strange. These classes would extend the class where they are inferred from
> and would be totally empty: no own attributes, nor methods. They would only
> be declared to solve this compilation issue.
>
>
> It seems u have not imported the IsBadDebtor class in your drool file
>>
>
>
>> If it's inner class of Debtor then use as Debtor.IsBadDebtor.drools
>> compiler unable to find IsBadDebtor
>>
>>
>>
>> Thanks,
>>
>> Bharadwaj nakka.
>>
>>
>> On Wed, Mar 20, 2013 at 12:14 PM, ajklunder2 <[hidden
email]<http://user/SendEmail.jtp?type=node&node=4022913&i=0>
>> > wrote:
>>
>>> Hi,
>>>
>>> In the Drools documentation is "the buss pass" example of how to
use
>>> inference.
>>>
>>> rule "Infer Adult"
>>> when
>>> $p : Person( age >= 18 )
>>> then
>>> insert( new IsAdult( $p ) )
>>> end
>>>
>>> However, when I try this myself I get compilation errors on IsAdult and
>>> a
>>> missing ";" after the insert statement. (I am using the Drools
plugin in
>>> Eclipse)
>>>
>>> Here is an example of my own what has the same issue:
>>>
>>> //list any import classes here.
>>> import com.example.vdc.VdcLandingPage;
>>> import com.invoicestore.domain.Debtor;
>>>
>>> //declare any global variables here
>>> global VdcLandingPage UI;
>>>
>>>
>>> rule "Infer bad debtor"
>>>
>>> when
>>> $debtor : Debtor( isBadDebtor() == true )
>>> then
>>> insert( new IsBadDebtor( $debtor ) );
>>> end
>>>
>>>
>>> BuildError: Unable to Analyse Expression drools.insert( new IsBadDebtor(
>>> $debtor ) );:
>>> [Error: Failed to compileShared: 1 compilation error(s):
>>> - (1,16) could not resolve class: IsBadDebtor]
>>> [Near : {... drools.insert( new IsBadDebtor( $debtor ) ); ....}]
>>> ^
>>> [Line: 23, Column: 0]
>>>
>>> I have studied the Drools documentation and cannot find anything what
>>> might
>>> lead to a solution. I have tried to set the dialect to "mvel" but
that
>>> is
>>> not solving the problem.
>>>
>>> Any suggestions how to solve this?
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>>
http://drools.46999.n3.nabble.com/The-buss-pass-example-of-inference-resu...
>>> Sent from the Drools: User forum mailing list archive at
Nabble.com.
>>> _______________________________________________
>>> rules-users mailing list
>>> [hidden email]
<
http://user/SendEmail.jtp?type=node&node=4022913&i=1>
>>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> [hidden email]
<
http://user/SendEmail.jtp?type=node&node=4022913&i=2>
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the
>> discussion below:
>>
>>
http://drools.46999.n3.nabble.com/The-buss-pass-example-of-inference-resu...
>> To unsubscribe from The buss pass example of inference results in
>> compilation errors, how to solve these?, click here.
>>
NAML<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=...
>>
>
>
> ------------------------------
> View this message in context: Re: [rules-users] The buss pass example of
> inference results in compilation errors, how to solve
these?<http://drools.46999.n3.nabble.com/The-buss-pass-example-of-infe...
>
> Sent from the Drools: User forum mailing list
archive<http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.htm...
>
Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> [hidden email] <
http://user/SendEmail.jtp?type=node&node=4022923&i=2>
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
[hidden email] <
http://user/SendEmail.jtp?type=node&node=4022923&i=3>
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
[hidden email] <
http://user/SendEmail.jtp?type=node&node=4022923&i=4>
https://lists.jboss.org/mailman/listinfo/rules-users
------------------------------
If you reply to this email, your message will be added to the discussion
below:
http://drools.46999.n3.nabble.com/The-buss-pass-example-of-inference-resu...
To unsubscribe from The buss pass example of inference results in
compilation errors, how to solve these?, click
here<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=...
.
NAML<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=...