Esteban's Blog

/dev/rnd

Knowledge Agent: Added Support for DSL/DSLR

Finally, knowledge agent now supports DSL and DSLR files. A lot of people voted for this feature and it is finally done!.

What drool’s team needs now are users that test it. So, if you was one of the people who voted this issue or you was waiting it, you can start using it right now!

Adding DSL/DSLR Resources

Adding these type of resources to the knowledge agent’s kbase is as simple as adding any other resource type. You need to identify your resources with DSLR or DSL type:

<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 drools-change-set-5.0.xsd' >
	<add>
		<resource source='http://localhost/rules.drl' type='DSLR' />
		<resource source='http://localhost/myExpander.dsl' type='DSL' />
	</add>
</change-set>

The order of the resources is not important. The agent will always treat DSL resources first.

Modifying DSL or DSLR Resources

DRLR and DSL resources are managed in different ways by the agent.
Whenever the agent notes that a DSLR resource has changed, it would be treated as a regular DLR resource: All its rules will be compiled (using the pre-existent DSL expander) and they will be added to the agent’s kbase.
The tricky part comes when you want to modify a DSL resource. Because DSL resources themselves don’t create any binary content (such as rules, queries, etc.), the only thing the agent does when a resource of this type is modified is to reload its definition. That’s it. No rules are created nor modified. If you want to recreate the rules that were created using the modified DSL resource, you have to modify the DSLR resource as well. If you don’t want to modify the DSLR content, you can just “touch” it (like the unix ‘touch’ command) this will trigger the change set appliance process just like if you were modified the resource’s content.

Conclusion

The Knowledge Agent now supports DSL and DSLR resources. You can add these type of resources using change sets, just like any other resource. When a DSLR resource is modified, the agent will treat it as a regular DRL file; the builder the agent uses will contain all the DSL resource you have previously added. If a DSL resource is modified, nothing will happen until the corresponding DSLR resource/s get modified too.

This feature will be available from 5.1 RC1. If you could test it before that you will be helping me (and all the drool’s team) a lot 😉

Have fun!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on July 4, 2010 by in drools, java and tagged , , , , .
%d bloggers like this: