[rules-users] re: NumberGuessExample
Tak-po Li
takpo.li at gmail.com
Wed Jun 10 16:50:02 EDT 2009
I do not get it. What I need is to change the text of "com.sample" in file
Guess.rf. How this can be done in the Drools plugin?
Thanks,
Tak
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/processdrools-processes-5.0.xsd"
type="RuleFlow" name="Number Guess" id="Number Guess" package-name
="com.sample" >
<header>
<imports>
<import name="com.sample.NumberGuessExample.Game" />
<import name="com.sample.NumberGuessExample.GameRules" />
<import name="com.sample.NumberGuessExample.Guess" />
<import name="com.sample.NumberGuessExample.RandomNumber" />
</imports>
</header>
2009/6/10 Mauricio Salatino <salaboy at gmail.com>
> You can change that looking at the properties of the process. Clicking in
> the background of the designer.
>
>
> 2009/6/10 Tak-po Li <takpo.li at gmail.com>
>
>>
>> I look at Guess.rf the xml file. I notice the Package and Import
>> locations are pointing to the old location. After I change them to the new
>> one by hand. The code works.
>>
>> How can I change the above in Eclipse GUI interface?
>>
>> Thanks,
>>
>> Tak
>>
>>
>>
>>
>> 2009/6/10 Mauricio Salatino <salaboy at gmail.com>
>>
>>> *java.lang.IllegalArgumentException: Unknown process ID: Number Guess
>>>
>>>
>>> *
>>> That exceptions means that you probably don't add the process definition
>>> to the current knowledgeBuilder.
>>> To see these kind of problems you probably need to add something like
>>> this after KnowledgeBuilder add calls:
>>>
>>> if ( kbuilder.hasErrors() ) {
>>> System.err.println( builder.getErrors().toString() );
>>> }
>>>
>>>
>>>
>>>
>>>
>>> 2009/6/10 Tak-po Li <takpo.li at gmail.com>
>>>
>>>>
>>>> Mauricio,
>>>>
>>>> I would like to take this example as the base to play around. That is
>>>> what I did:
>>>>
>>>> 1. Make a project "try" that generates the HellowWorld for me in
>>>> Eclipse.
>>>>
>>>> 2. add directory "log"
>>>>
>>>> 3. Move file Guess.java to the Java/com/sample directory. Move
>>>> Guess.drl and Guss.rf to rule directory.
>>>>
>>>> 4. Change Package and Implort location from org/drools/examples to
>>>> com/sample in the above three files.
>>>>
>>>> Eclipse shows compiler error pointing to ShoppingExample.*class. *
>>>> **
>>>> *I did the same to Shopping.java and Shopping.drl and the compiler
>>>> error is removed, and the following is the run time error messages:*
>>>> **
>>>> *
>>>>
>>>> Exception in thread "main"
>>>> java.lang.IllegalArgumentException: Unknown process ID: Number Guess
>>>>
>>>> at org.drools.common.AbstractWorkingMemory.startProcess(
>>>> AbstractWorkingMemory.java:1615)
>>>>
>>>> at org.drools.common.AbstractWorkingMemory.startProcess(
>>>> AbstractWorkingMemory.java:1604)
>>>>
>>>> at org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(
>>>> StatefulKnowledgeSessionImpl.java:267)
>>>>
>>>> at com.sample.NumberGuessExample.main(
>>>> NumberGuessExample.java:38)*
>>>> Could you please point me the right direction?
>>>>
>>>> Thanks,
>>>>
>>>> Tak
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>> **
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> 2009/6/10 Mauricio Salatino <salaboy at gmail.com>
>>>>
>>>> This is only a reference to know in which class loader is the
>>>>> resource... The idea is to know that the resource (in this case: NumberGuess.drl
>>>>> and NumberGuess.rf) is in the same class loader that the
>>>>> ShoppingExample.*class*
>>>>>
>>>>> 2009/6/10 Tak-po Li <takpo.li at gmail.com>
>>>>>
>>>>>>
>>>>>> I am a newbie with Drools rules. I just download the examples. I
>>>>>> notice in line19 of NumberGuessExample.java, there are two statement that
>>>>>> referring to ShoppingExample.*class.*
>>>>>>
>>>>>> It seems this is different example. Could someone help me out?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Tak
>>>>>>
>>>>>>
>>>>>>
>>>>>> kbuilder.add( ResourceFactory.*newClassPathResource*(
>>>>>> "NumberGuess.drl",
>>>>>>
>>>>>> ShoppingExample.
>>>>>> *class* ),
>>>>>>
>>>>>> ResourceType.
>>>>>> *DRL* );
>>>>>>
>>>>>> kbuilder.add( ResourceFactory.*newClassPathResource*(
>>>>>> "NumberGuess.rf",
>>>>>>
>>>>>> ShoppingExample.
>>>>>> *class* ),
>>>>>>
>>>>>> ResourceType.
>>>>>> *DRF* );
>>>>>>
>>>>>> _______________________________________________
>>>>>> rules-users mailing list
>>>>>> rules-users at lists.jboss.org
>>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> - http://salaboy.wordpress.com
>>>>> - http://www.jbug.com.ar
>>>>> - Salatino "Salaboy" Mauricio -
>>>>>
>>>>> _______________________________________________
>>>>> rules-users mailing list
>>>>> rules-users at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>
>>>
>>> --
>>> - http://salaboy.wordpress.com
>>> - http://www.jbug.com.ar
>>> - Salatino "Salaboy" Mauricio -
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
> - http://salaboy.wordpress.com
> - http://www.jbug.com.ar
> - Salatino "Salaboy" Mauricio -
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090610/8ee02e5f/attachment.html
More information about the rules-users
mailing list