Hi,
 
  Is it possible to mix dsl language and regular rule syntax in a rule file? I am trying to do this, but my rules won't compile. The "unable to expand" error is returned during compilation. I tried adding [*][]"{anything}" = "{anything}" to the dsl file to fix this, but that didnt work. I used this strategy in Drools 4.0.7, but it doesn't seem to work in Drools 5.0.0 M5. Below I provided a simple example of what I would like to do.
 
Thanks,
Dan
 
animal.dslr file

#created on: Mar 12, 2009
package com.fedex.cc.expertsystem.test
import
com.fedex.cc.expertsystem.fact.*

expander animal.dsl

rule "Set dog's ownership"
no-loop
    when
       
There is
an animal lover and dog in the system
   
then 
        The person owns the dog
end

rule "Tell us person doesnt like dogs"
   
when 
        person : Person(animalLover == false)
   
then
       
System.out.println("Person does not like dog");
end

animal.dsl file

[condition][]There is an animal lover and dog in the system=person : Person(animalLover == true) dog : Dog()
[consequence][]The person owns the dog=dog.setOwnerLastName(person.getLastName()); update(dog);

 
Daniel Quinn
Fedex - Custom Critical
Software Specialist I
234.310.4090(x2586)
 


From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Jeff Davis
Sent: Friday, March 20, 2009 10:29 AM
To: rules-users@lists.jboss.org
Subject: [rules-users] Error running DroolsCompilerAntTask in CR1

Hi,

I upgraded everything from M5 to CR1 last night, but noticed that my ant task no longer worked and was returning an error (it had worked previously under M5, and I confirmed by switching everything back to test). The error I now receive is:

[compiler] java.util.zip.ZipException: error in opening zip file
[compiler]     at java.util.zip.ZipFile.open(Native Method)
[compiler]     at java.util.zip.ZipFile.<init>(ZipFile.java:203)
[compiler]     at java.util.zip.ZipFile.<init>(ZipFile.java:234)
[compiler]     at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:1028)
[compiler]     at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.findNextResource(AntClassLoader.java:147)
[compiler]     at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.nextElement(AntClassLoader.java:130)
[compiler]     at org.apache.tools.ant.util.CollectionUtils$CompoundEnumeration.nextElement(CollectionUtils.java:198)
[compiler]     at sun.misc.CompoundEnumeration.nextElement(CompoundEnumeration.java:43)
[compiler]     at org.drools.util.ChainedProperties.loadProperties(ChainedProperties.java:233)
[compiler]     at org.drools.util.ChainedProperties.<init>(ChainedProperties.java:119)
[compiler]     at org.drools.util.ChainedProperties.<init>(ChainedProperties.java:41)
[compiler]     at org.drools.util.ChainedProperties.<init>(ChainedProperties.java:35)
[compiler]     at org.drools.RuleBaseConfiguration.init(RuleBaseConfiguration.java:376)
[compiler]     at org.drools.RuleBaseConfiguration.<init>(RuleBaseConfiguration.java:234)
[compiler]     at org.drools.common.AbstractRuleBase.<init>(AbstractRuleBase.java:149)
[compiler]     at org.drools.reteoo.ReteooRuleBase.<init>(ReteooRuleBase.java:144)
[compiler]     at org.drools.reteoo.ReteooRuleBase.<init>(ReteooRuleBase.java:121)
[compiler]     at org.drools.RuleBaseFactory.newRuleBase(RuleBaseFactory.java:58)
[compiler]     at org.drools.RuleBaseFactory.newRuleBase(RuleBaseFactory.java:38)
[compiler]     at org.drools.contrib.DroolsCompilerAntTask.createWithPackageBuilder(DroolsCompilerAntTask.java:241)
[compiler]     at org.drools.contrib.DroolsCompilerAntTask.execute(DroolsCompilerAntTask.java:170)
[compiler]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[compiler]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[compiler]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[compiler]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[compiler]     at java.lang.reflect.Method.invoke(Method.java:585)
[compiler]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[compiler]     at org.apache.tools.ant.Task.perform(Task.java:348)
[compiler]     at org.apache.tools.ant.Target.execute(Target.java:357)
[compiler]     at org.apache.tools.ant.Target.performTasks(Target.java:385)
[compiler]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[compiler]     at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
[compiler]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[compiler]     at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
[compiler]     at org.apache.tools.ant.Main.runBuild(Main.java:758)
[compiler]     at org.apache.tools.ant.Main.startAnt(Main.java:217)
[compiler]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[compiler]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

My build.xml is:

<project name="test" default="compile">

<path id="drools.path.task">
<fileset dir="C:\Apps\drools-5.0.0.CR1-bin">
<include name="drools-compiler-5.0.0.CR1.jar"/>
<include name="drools-ant-5.0.0.CR1.jar"/>
<include name="drools-core-5.0.0.CR1.jar"/>
<include name="drools-decisiontables-5.0.0.CR1.jar"/>
<include name="drools-api-5.0.0.CR1.jar"/>
</fileset>
<fileset dir="C:\Apps\drools-5.0.0.CR1-bin\lib">
<include name="*.jar"/>
</fileset>
</path>
<path id="drools.path">
<pathelement path="target\classes"/>
<fileset dir="C:\Apps\drools-5.0.0.CR1-bin">
<include name="drools-ant-5.0.0.CR1.jar"/>
<include name="drools-decisiontables-5.0.0.CR1.jar"/>
<include name="drools-api-5.0.0.CR1.jar"/>
</fileset>
</path>

<taskdef name="compiler" classname="org.drools.contrib.DroolsCompilerAntTask" classpathref="drools.path.task" />

    <target name="create.rules.package" >
        <compiler
            srcdir="src\main\rules"
            tofile="target\package\packge.pkg"
            classpathref="drools.path">
            <include name="Sample.drl" />
        </compiler>
    </target>
    
    <target name="clean">
<delete includeemptydirs="true">
<fileset dir="target"/>
</delete>
</target>
<target name="compile" depends="clean">
<mkdir dir="target/classes"/>
<mkdir dir="logs"/>
<javac destdir="target/classes" debug="on" source="1.5" target="1.5">
<src path="src\main\java"/>
<classpath refid="drools.path.task"/>
</javac>
</target>

<target name="init">
<mkdir dir="target/classes"/>
<mkdir dir="target"/>
<mkdir dir="target/wsdl2javasource"/>
</target>
</project>

If anyone has any ideas, they would be much appreciated!

Thanks!

jeff