Re: [rules-users] KnowledgeAgent doesn't load dsl files and dslr file from a change-set correctly - JIRA:JBRULES-2377 updated

2010-01-27 Thread Esteban Aliverti
I think it is related with https://jira.jboss.org/jira/browse/JBRULES-2350

On Wed, Jan 27, 2010 at 1:20 AM, Pegram, Macon zmpeg...@choosehmc.comwrote:


 I have updated the JIRA ticket with more detailed information.   If this
 issue is important to you, please vote up its importance so that we can
 hopefully capture the attention of the development team.

 You can find the JIRA ticket at:
 https://jira.jboss.org/jira/browse/JBRULES-2377

 Thanks!
 Macon

 -Original Message-
 From: rules-users-boun...@lists.jboss.org
 [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Pritham
 Sent: Tuesday, January 26, 2010 4:29 PM
 To: rules-users@lists.jboss.org
 Subject: Re: [rules-users] KnowledgeAgent doesn't load dsl files and
 dslr file from a change-set correctly


 Thanks for the heads up. I can even load the same change-set.xml via
 kbuilder
 and get the rules to fire and work, turns out that KnowledgeAgent has an
 issue.

 On a larger note, looking at 5.1M1, KnowledgeAgentImpl has changed a lot
 (Mark Proctor) and a lot of todos and comments were uncommented in the
 newer one. Is it recommended to try the class in an older distribution?
 --
 View this message in context:
 http://n3.nabble.com/KnowledgeAgent-doesn-t-load-dsl-files-and-dslr-file
 -from-a-change-set-correctly-tp139702p139849.html
 Sent from the Drools - User mailing list archive at Nabble.com.
 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users

 CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
 for the sole use of the intended recipient(s) and may contain confidential
 and privileged information or otherwise protected by law.  Any unauthorized
 review, use, disclosure or distribution is prohibited.  If you are not the
 intended recipient, please contact the sender by reply e-mail and destroy
 all copies of the original message.



 ___
 rules-users mailing list
 rules-users@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users




-- 


Esteban Aliverti
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] KnowledgeAgent doesn't load dsl files and dslr file from a change-set correctly

2010-01-26 Thread Pritham

I have a folder in classpath:

dsl/global.dsl
rules/section-A.dslr
rules/section-A/page-1.dslr

I create a knowledge base like this:

public KnowledgeBase createKnowledgeBase() throws DroolsParserException,
IOException {

KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder();

knowledgeBuilder.add(ResourceFactory
.newClassPathResource(dsl/global.dsl),
ResourceType.DSL);
knowledgeBuilder.add(ResourceFactory
.newClassPathResource(rules/section-A.dslr),
ResourceType.DSLR);
knowledgeBuilder.add(ResourceFactory
.newClassPathResource(rules/section-A/page-1.dslr),
ResourceType.DSLR);   

if (knowledgeBuilder.hasErrors()) {
throw new RuntimeException(knowledgeBuilder.getErrors().toString());
}

KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
   
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());

return knowledgeBase;
}

// code
knowledgeBase = createKnowledgeBase();
session = knowledgeBase.newStatefulKnowledgeSession();
// insert facts
session.fireAllRules();
session.dispose();  

The above code works and I can get a unit test to work that processes rules
accordingly. I can see my dslr converting to a drl using the drl viewer
correctly (provided I temporarily place the dsl file in the same location
since expander doesn't accept a relative path).

The problem, however is when I use a change-set.xml and a KnowledgeAgent,
things don't work 

code for loading via knowledgeAgent

public static KnowledgeBase loadKnowledgeBase() throws
DroolsParserException, IOException {
agent = KnowledgeAgentFactory.newKnowledgeAgent(msll agent);
   
agent.applyChangeSet(ResourceFactory.newClassPathResource(change-set.xml));

return agent.getKnowledgeBase();
}   


change-set xmlns='http://drools.org/drools-5.0/change-set'
 xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
 xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd'

   add
   resource source='classpath:dsl/' type='DSL' /  
   resource source='classpath:rules/' type='DSLR' /
   resource source='classpath:rules/section-A/' type='DSLR' /
/add
/change-set


I get the following generic drools errors:
ERR 103] Line 4:0 rule 'rule_key' failed predicate:
{(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule[7,0]: [ERR 101]
Line 7:0 no viable alternative at input 'import' in rule Con in rule
attribute
...
...

The rules are same, folder location is the same. I believe that drools has a
problem resolving path (expander global.dsl) from the dslr file when using a
KnowlegeAgent since in the earlier strategy, one could build a dsl into the
knowledgeBuilder directly from the classpath.

Pl suggest.
-- 
View this message in context: 
http://n3.nabble.com/KnowledgeAgent-doesn-t-load-dsl-files-and-dslr-file-from-a-change-set-correctly-tp139702p139702.html
Sent from the Drools - User 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] KnowledgeAgent doesn't load dsl files and dslr file from a change-set correctly

2010-01-26 Thread Steve Ronderos
Pritham,

I've experienced this issue before as well.  It has to do with the way 
that the KnowledgeAgent subscribes to resources.  I believe behind the 
scenes the resources are loaded in an arbitrary order.  There is a JIRA 
bug report already filed:

https://jira.jboss.org/jira/browse/JBRULES-2377

Hope this helps,

Steve

rules-users-boun...@lists.jboss.org wrote on 01/26/2010 01:07:29 PM:

 [image removed] 
 
 [rules-users] KnowledgeAgent doesn't load dsl files and dslr file 
 from a change-set correctly
 
 Pritham 
 
 to:
 
 rules-users
 
 01/26/2010 01:10 PM
 
 Sent by:
 
 rules-users-boun...@lists.jboss.org
 
 Please respond to Rules Users List
 
 
 I have a folder in classpath:
 
 dsl/global.dsl
 rules/section-A.dslr
 rules/section-A/page-1.dslr
 
 I create a knowledge base like this:
 
 public KnowledgeBase createKnowledgeBase() throws DroolsParserException,
 IOException {
 
 KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory
 .newKnowledgeBuilder();
 
 knowledgeBuilder.add(ResourceFactory
 .newClassPathResource(dsl/global.dsl),
 ResourceType.DSL);
 knowledgeBuilder.add(ResourceFactory
 .newClassPathResource(rules/section-A.dslr),
 ResourceType.DSLR);
 knowledgeBuilder.add(ResourceFactory
 .newClassPathResource(rules/section-A/page-1.dslr),
 ResourceType.DSLR); 
 
 if (knowledgeBuilder.hasErrors()) {
 throw new 
RuntimeException(knowledgeBuilder.getErrors().toString());
 }
 
 KnowledgeBase knowledgeBase = 
KnowledgeBaseFactory.newKnowledgeBase();
 
 
knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages());
 
 return knowledgeBase;
 }
 
 // code
 knowledgeBase = createKnowledgeBase();
 session = knowledgeBase.newStatefulKnowledgeSession();
 // insert facts
 session.fireAllRules();
 session.dispose(); 
 
 The above code works and I can get a unit test to work that processes 
rules
 accordingly. I can see my dslr converting to a drl using the drl 
viewer
 correctly (provided I temporarily place the dsl file in the same 
location
 since expander doesn't accept a relative path).
 
 The problem, however is when I use a change-set.xml and a 
KnowledgeAgent,
 things don't work 
 
 code for loading via knowledgeAgent
 
 public static KnowledgeBase loadKnowledgeBase() throws
 DroolsParserException, IOException {
 agent = KnowledgeAgentFactory.newKnowledgeAgent(msll agent);
 
 
agent.applyChangeSet(ResourceFactory.newClassPathResource(change-set.xml));
 
 return agent.getKnowledgeBase();
 } 
 
 
 change-set xmlns='http://drools.org/drools-5.0/change-set'
  xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
 xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd'
 
add
resource source='classpath:dsl/' type='DSL' / 
resource source='classpath:rules/' type='DSLR' / 
resource source='classpath:rules/section-A/' type='DSLR' /
 /add
 /change-set
 
 
 I get the following generic drools errors:
 ERR 103] Line 4:0 rule 'rule_key' failed predicate:
 {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule[7,0]: [ERR 
101]
 Line 7:0 no viable alternative at input 'import' in rule Con in rule
 attribute
 ...
 ...
 
 The rules are same, folder location is the same. I believe that drools 
has a
 problem resolving path (expander global.dsl) from the dslr file when 
using a
 KnowlegeAgent since in the earlier strategy, one could build a dsl into 
the
 knowledgeBuilder directly from the classpath.
 
 Pl suggest.
 -- 
 View this message in context: http://n3.nabble.com/KnowledgeAgent-
 doesn-t-load-dsl-files-and-dslr-file-from-a-change-set-correctly-
 tp139702p139702.html
 Sent from the Drools - User 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] KnowledgeAgent doesn't load dsl files and dslr file from a change-set correctly

2010-01-26 Thread Pegram, Macon
That's actually my ticket, and I've been hoping to get it resolved for
awhile now.  I've posted to this mailing list as well as the actual
ticket but haven't heard responses from anyone.

 

I've recently done more research into the issue, and have some updated
information that needs to be attached to the ticket (I'll try to get it
in shortly) but what it boils down to is a collision of two problems...

 

Problem 1: DSL and DSLR need to be in the same folder, but if you don't
explicitly list the resources for each item in the changeset, you can't
define an independent resource type.This is kind of silly and in my
mind defeats the benefits of the change-set.  The benefit in my mind of
a change set is being able to point it at a folder and have it scan for
new rule additions as well as changes. 

 

Problem 2: Internally the identified resources in the change set are
held in a hashmap.  Since there's no ordering to a hashmap, when they're
pulled out and added to the knowledgebuilder they could be added in any
order.  In order for a DSL and DSLR to work, they have to be added to
the KnowledgeBuilder in the proper order (DSL first then DSLR).  It does
not matter what order you list them in the change set, the rebuild code
in the KnowledgeAgent framework does not enforce any concept of ordering
or priority to resource types.

 

The documentation (since 5.0.1) has suggested that at some point they
plan to have autodetection of file types which would solve for problem
#1, but problem #2 would remain without some priority given to how the
KnowledgeBuilder is being instructed to construct rule sets.  This
problem is present even in the latest 5.1 milestone.

 

Unfortunately this has driven us to choose between having a DSL or
having hot deployment of rules (we've chosen the later)

 

Macon

 



From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Steve Ronderos
Sent: Tuesday, January 26, 2010 2:58 PM
To: Rules Users List
Subject: Re: [rules-users] KnowledgeAgent doesn't load dsl files and
dslr file from a change-set correctly

 


Pritham, 

I've experienced this issue before as well.  It has to do with the way
that the KnowledgeAgent subscribes to resources.  I believe behind the
scenes the resources are loaded in an arbitrary order.  There is a JIRA
bug report already filed: 

https://jira.jboss.org/jira/browse/JBRULES-2377
https://jira.jboss.org/jira/browse/JBRULES-2377  

Hope this helps, 

Steve 

rules-users-boun...@lists.jboss.org wrote on 01/26/2010 01:07:29 PM:

 [image removed] 
 
 [rules-users] KnowledgeAgent doesn't load dsl files and dslr file 
 from a change-set correctly 
 
 Pritham 
 
 to: 
 
 rules-users 
 
 01/26/2010 01:10 PM 
 
 Sent by: 
 
 rules-users-boun...@lists.jboss.org 
 
 Please respond to Rules Users List 
 
 
 I have a folder in classpath:
 
 dsl/global.dsl
 rules/section-A.dslr
 rules/section-A/page-1.dslr
 
 I create a knowledge base like this:
 
 public KnowledgeBase createKnowledgeBase() throws
DroolsParserException,
 IOException {
 
 KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory
 .newKnowledgeBuilder();
 
 knowledgeBuilder.add(ResourceFactory
 .newClassPathResource(dsl/global.dsl),
 ResourceType.DSL);
 knowledgeBuilder.add(ResourceFactory
 .newClassPathResource(rules/section-A.dslr),
 ResourceType.DSLR);
 knowledgeBuilder.add(ResourceFactory
 .newClassPathResource(rules/section-A/page-1.dslr),
 ResourceType.DSLR);   
 
 if (knowledgeBuilder.hasErrors()) {
 throw new
RuntimeException(knowledgeBuilder.getErrors().toString());
 }
 
 KnowledgeBase knowledgeBase =
KnowledgeBaseFactory.newKnowledgeBase();


knowledgeBase.addKnowledgePackages(knowledgeBuilder.getKnowledgePackages
());
 
 return knowledgeBase;
 }
 
 // code
 knowledgeBase = createKnowledgeBase();
 session = knowledgeBase.newStatefulKnowledgeSession();
 // insert facts
 session.fireAllRules();
 session.dispose();   
 
 The above code works and I can get a unit test to work that processes
rules
 accordingly. I can see my dslr converting to a drl using the drl
viewer
 correctly (provided I temporarily place the dsl file in the same
location
 since expander doesn't accept a relative path).
 
 The problem, however is when I use a change-set.xml and a
KnowledgeAgent,
 things don't work 
 
 code for loading via knowledgeAgent
 
 public static KnowledgeBase loadKnowledgeBase() throws
 DroolsParserException, IOException {
 agent = KnowledgeAgentFactory.newKnowledgeAgent(msll agent);


agent.applyChangeSet(ResourceFactory.newClassPathResource(change-set.xm
l));
 
 return agent.getKnowledgeBase();
 }   
 
 
 change-set xmlns='http://drools.org/drools-5.0/change-set'
  xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'

xs:schemaLocation='http

Re: [rules-users] KnowledgeAgent doesn't load dsl files and dslr file from a change-set correctly

2010-01-26 Thread Pritham

Thanks for the heads up. I can even load the same change-set.xml via kbuilder
and get the rules to fire and work, turns out that KnowledgeAgent has an
issue.

On a larger note, looking at 5.1M1, KnowledgeAgentImpl has changed a lot
(Mark Proctor) and a lot of todos and comments were uncommented in the
newer one. Is it recommended to try the class in an older distribution?
-- 
View this message in context: 
http://n3.nabble.com/KnowledgeAgent-doesn-t-load-dsl-files-and-dslr-file-from-a-change-set-correctly-tp139702p139849.html
Sent from the Drools - User 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] KnowledgeAgent doesn't load dsl files and dslr file from a change-set correctly

2010-01-26 Thread Pegram, Macon
I did my trace (which led to the comments below) on 5.1M1, but the I
noticed the problem originally on 5.0.1 so I don't believe there's any
version that will work for you at this time.

Macon

-Original Message-
From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Pritham
Sent: Tuesday, January 26, 2010 4:29 PM
To: rules-users@lists.jboss.org
Subject: Re: [rules-users] KnowledgeAgent doesn't load dsl files and
dslr file from a change-set correctly


Thanks for the heads up. I can even load the same change-set.xml via
kbuilder
and get the rules to fire and work, turns out that KnowledgeAgent has an
issue.

On a larger note, looking at 5.1M1, KnowledgeAgentImpl has changed a lot
(Mark Proctor) and a lot of todos and comments were uncommented in the
newer one. Is it recommended to try the class in an older distribution?
-- 
View this message in context:
http://n3.nabble.com/KnowledgeAgent-doesn-t-load-dsl-files-and-dslr-file
-from-a-change-set-correctly-tp139702p139849.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential and 
privileged information or otherwise protected by law.  Any unauthorized review, 
use, disclosure or distribution is prohibited.  If you are not the intended 
recipient, please contact the sender by reply e-mail and destroy all copies of 
the original message.



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] KnowledgeAgent doesn't load dsl files and dslr file from a change-set correctly - JIRA:JBRULES-2377 updated

2010-01-26 Thread Pegram, Macon

I have updated the JIRA ticket with more detailed information.   If this
issue is important to you, please vote up its importance so that we can
hopefully capture the attention of the development team.

You can find the JIRA ticket at:
https://jira.jboss.org/jira/browse/JBRULES-2377

Thanks!
Macon

-Original Message-
From: rules-users-boun...@lists.jboss.org
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Pritham
Sent: Tuesday, January 26, 2010 4:29 PM
To: rules-users@lists.jboss.org
Subject: Re: [rules-users] KnowledgeAgent doesn't load dsl files and
dslr file from a change-set correctly


Thanks for the heads up. I can even load the same change-set.xml via
kbuilder
and get the rules to fire and work, turns out that KnowledgeAgent has an
issue.

On a larger note, looking at 5.1M1, KnowledgeAgentImpl has changed a lot
(Mark Proctor) and a lot of todos and comments were uncommented in the
newer one. Is it recommended to try the class in an older distribution?
-- 
View this message in context:
http://n3.nabble.com/KnowledgeAgent-doesn-t-load-dsl-files-and-dslr-file
-from-a-change-set-correctly-tp139702p139849.html
Sent from the Drools - User mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential and 
privileged information or otherwise protected by law.  Any unauthorized review, 
use, disclosure or distribution is prohibited.  If you are not the intended 
recipient, please contact the sender by reply e-mail and destroy all copies of 
the original message.



___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users