Re: [rules-users] drl problem

2012-04-02 Thread Michael Anstis
Rational Application Developer?

The generated DRL (from using Guvnor 5.2) is flawed, so it won't run
anywhere.

If you write the DRL by hand it should work on 5.2 (I don't believe there
have been any major enhancements since then that would affect what you
want).

If you can use Guvnor 5.4 (the generated DRL will be correct), or use the
"from" construct the DRL should work anywhere too.

I don't know where or how you're trying to run the rules you are now trying
to author so find it difficult to answer any further.

With kind regards,

Mike

On 2 April 2012 16:43, arup  wrote:

> ok...then you are saying that this code should work on RAD
> perfectly...sorry
> i'm asking so silly questions because i dont have the required files to run
> the code at present...so cant check it myself
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/drl-problem-tp3877814p3878059.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] drl problem

2012-04-02 Thread arup
ok...then you are saying that this code should work on RAD perfectly...sorry
i'm asking so silly questions because i dont have the required files to run
the code at present...so cant check it myself

--
View this message in context: 
http://drools.46999.n3.nabble.com/drl-problem-tp3877814p3878059.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] drl problem

2012-04-02 Thread Michael Anstis
If you must use 5.2 you can try using "from" to access the PhoneTypecode,
rather than (I assume) an expression:-

$p : Phone( )
$tc : PhoneTypecode( ... ) from $p.phoneTypeCode

etc.

On 2 April 2012 16:36, Michael Anstis  wrote:

> Unfortunately this appears to be a problem with 5.2.
>
> There is an additional space in "phoneTypeCode .tc" which should read
> "phoneTypecode.tc".
>
> I have confirmed this does not happen in 5.4.CR1 (and possibly earlier):-
>
> 1.|rule "r2"2. |dialect "mvel"3.| when4.|Phone( $ac :
> areaCode, $tc : ptc.tc) 5.|Phone( areaCode == $ac , ptc.tc != $tc
> )6. |then7.|end
>
>
> On 2 April 2012 16:15, arup  wrote:
>
>> Thanks againg for replying so quickly.
>>
>> 1. view source:
>>
>> #created on: Mar 27, 2012
>> 2. |
>> 3. | #list any import classes here.
>> 4. |
>> 5. | import com.gpm.domain.*;
>> 6. | import com.gpm.rules.vo.*;
>> 7. |
>> 8. |
>> 9. | #declare any global variables here
>> 10. | global DataDifferenceVO dataDifferenceVO;
>> 11. |
>> 12. |
>> 13. | rule "Phone_AreaCode_Rule"
>> 14. | when
>> 15. | Phone( $areaCode1 : areaCode, $tc1 : phoneTypeCode .tc )
>> 16. | Phone( areaCode == $areaCode1 , phoneTypeCode .tc != $tc1 )
>> 17. | then
>> 18. |
>> dataDifferenceVO.getDataDiffArray().add("Party/Phone/AreaCode");
>> 19. | end
>>
>> 2. guvnor version is 5.2 final
>>
>> 3. actual class:
>>
>> public class Phone {
>>
>>@XmlElement(name = "PhoneKey")
>>protected String phoneKey;
>>@XmlElement(name = "PhoneTypeCode")
>>protected PhoneTypeCode phoneTypeCode;
>>@XmlElement(name = "AreaCode")
>>protected String areaCode;
>>@XmlElement(name = "DialNumber")
>>protected String dialNumber;
>>@XmlElement(name = "Ext")
>>protected String ext;
>>.
>>.
>>.
>> }
>>
>>
>> public class PhoneTypeCode {
>>
>>@XmlValue
>>protected String value;
>>@XmlAttribute
>>protected String tc;
>>
>> ...}
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/drl-problem-tp3877814p3877957.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] drl problem

2012-04-02 Thread Michael Anstis
Unfortunately this appears to be a problem with 5.2.

There is an additional space in "phoneTypeCode .tc" which should read
"phoneTypecode.tc".

I have confirmed this does not happen in 5.4.CR1 (and possibly earlier):-

1.|rule "r2"2.|dialect "mvel"3.|when4.|Phone( $ac :
areaCode, $tc : ptc.tc)5.|Phone( areaCode == $ac , ptc.tc != $tc )6.
|then7.|end

On 2 April 2012 16:15, arup  wrote:

> Thanks againg for replying so quickly.
>
> 1. view source:
>
> #created on: Mar 27, 2012
> 2. |
> 3. | #list any import classes here.
> 4. |
> 5. | import com.gpm.domain.*;
> 6. | import com.gpm.rules.vo.*;
> 7. |
> 8. |
> 9. | #declare any global variables here
> 10. | global DataDifferenceVO dataDifferenceVO;
> 11. |
> 12. |
> 13. | rule "Phone_AreaCode_Rule"
> 14. | when
> 15. | Phone( $areaCode1 : areaCode, $tc1 : phoneTypeCode .tc )
> 16. | Phone( areaCode == $areaCode1 , phoneTypeCode .tc != $tc1 )
> 17. | then
> 18. |
> dataDifferenceVO.getDataDiffArray().add("Party/Phone/AreaCode");
> 19. | end
>
> 2. guvnor version is 5.2 final
>
> 3. actual class:
>
> public class Phone {
>
>@XmlElement(name = "PhoneKey")
>protected String phoneKey;
>@XmlElement(name = "PhoneTypeCode")
>protected PhoneTypeCode phoneTypeCode;
>@XmlElement(name = "AreaCode")
>protected String areaCode;
>@XmlElement(name = "DialNumber")
>protected String dialNumber;
>@XmlElement(name = "Ext")
>protected String ext;
>.
>.
>.
> }
>
>
> public class PhoneTypeCode {
>
>@XmlValue
>protected String value;
>@XmlAttribute
>protected String tc;
>
> ...}
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/drl-problem-tp3877814p3877957.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] drl problem

2012-04-02 Thread arup
Thanks againg for replying so quickly.

1. view source:

#created on: Mar 27, 2012  
2. |  
3. | #list any import classes here.  
4. |  
5. | import com.gpm.domain.*;  
6. | import com.gpm.rules.vo.*;  
7. |  
8. |  
9. | #declare any global variables here  
10. | global DataDifferenceVO dataDifferenceVO;  
11. |  
12. |  
13. | rule "Phone_AreaCode_Rule"  
14. | when  
15. | Phone( $areaCode1 : areaCode, $tc1 : phoneTypeCode .tc )  
16. | Phone( areaCode == $areaCode1 , phoneTypeCode .tc != $tc1 )  
17. | then  
18. |
dataDifferenceVO.getDataDiffArray().add("Party/Phone/AreaCode");  
19. | end 
 
2. guvnor version is 5.2 final

3. actual class:

public class Phone {

@XmlElement(name = "PhoneKey")
protected String phoneKey;
@XmlElement(name = "PhoneTypeCode")
protected PhoneTypeCode phoneTypeCode;
@XmlElement(name = "AreaCode")
protected String areaCode;
@XmlElement(name = "DialNumber")
protected String dialNumber;
@XmlElement(name = "Ext")
protected String ext;
.
.
.
}


public class PhoneTypeCode {

@XmlValue
protected String value;
@XmlAttribute
protected String tc;

...}

--
View this message in context: 
http://drools.46999.n3.nabble.com/drl-problem-tp3877814p3877957.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] drl problem

2012-04-02 Thread Michael Anstis
Can you "View source" and paste it?

Also, what version of Guvnor are you using?

Please also include your actual class model - not that I assume to be the
case.

Thanks,

On 2 April 2012 15:53, arup  wrote:

> thanks manstis.  i tried as u said. but when i'm adding this rule to guvnor
> and trying to validate it im getting this errors:
>
> Unable to create reader for 'phoneTC .tc':[Error: no such identifier:
> phoneTC ]
> [Near : {... phoneTC .tc }] ^[Line: 1, Column: 1]
>  [DataDifference] Unable to Analyse Expression phoneTC .tc != $tc1:
> [Error: no such identifier: phoneTC ]
> [Near : {... phoneTC .tc != $tc1 }] ^
> [Line: 1, Column: 1]
>  [DataDifference] Unable to wire compiled classes, probably related to
> compilation failures:[Error: no such identifier: phoneTC ]
> [Near : {... phoneTC .tc }] ^[Line: 1, Column: 1]
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/drl-problem-tp3877814p3877904.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] drl problem

2012-04-02 Thread arup
thanks manstis.  i tried as u said. but when i'm adding this rule to guvnor
and trying to validate it im getting this errors:

Unable to create reader for 'phoneTC .tc':[Error: no such identifier:
phoneTC ]
[Near : {... phoneTC .tc }] ^[Line: 1, Column: 1] 
 [DataDifference] Unable to Analyse Expression phoneTC .tc != $tc1:
[Error: no such identifier: phoneTC ]
[Near : {... phoneTC .tc != $tc1 }] ^
[Line: 1, Column: 1] 
 [DataDifference] Unable to wire compiled classes, probably related to
compilation failures:[Error: no such identifier: phoneTC ]
[Near : {... phoneTC .tc }] ^[Line: 1, Column: 1] 
 
 


--
View this message in context: 
http://drools.46999.n3.nabble.com/drl-problem-tp3877814p3877904.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] drl problem

2012-04-02 Thread Michael Anstis
Assuming:-

Phone() {
  String number;
  PhoneTC phoneTc;
}

PhoneTC() {
  String tc;
}

Then something like this should work:-

when
  Phone( $n1 : number, $tc : phoneTc.tc )
  Phone( number == $n1, phoneTc.tc != $tc )
then


On 2 April 2012 15:19, arup  wrote:

> Hi,
> i'm having some problems(more like i'm just getting confused) while
> creating
> a rule for my project.
> I have 2 classes say Phone() and PhoneTC() like below:
>
> Phone()
> {
> String number;
> }
>
> PhoneTC()
> {
> String tc;
> }
>
> also PhoneTC() is inside the Phone() class. like:
>
> Phone()--String number
> PhoneTC()String tc
>
>
>
> now i need to create a rule like this
>
> when phone numbers are same and the tc values are different for that number
> then do something.
>
> will this work??
>
> when
> ph1: Phone(number1 : number)
> phtc1: PhoneTC(tc1 : tc)
> Phone(number == number1) and PhoneTC(tc != tc1)
> then
> 
>
>
> can u suggest better rule for the requirement?? thanks in advance... :)
> :) :)
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/drl-problem-tp3877814p3877814.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


[rules-users] drl problem

2012-04-02 Thread arup
Hi,
i'm having some problems(more like i'm just getting confused) while creating
a rule for my project.
I have 2 classes say Phone() and PhoneTC() like below:

Phone()
{
String number;
}

PhoneTC()
{
String tc;
}

also PhoneTC() is inside the Phone() class. like:

Phone()--String number
 PhoneTC()String tc



now i need to create a rule like this

when phone numbers are same and the tc values are different for that number
then do something.

will this work??

when
ph1: Phone(number1 : number)
phtc1: PhoneTC(tc1 : tc)
Phone(number == number1) and PhoneTC(tc != tc1)
then



can u suggest better rule for the requirement?? thanks in advance... :)
:) :)

--
View this message in context: 
http://drools.46999.n3.nabble.com/drl-problem-tp3877814p3877814.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