[jboss-jira] [JBoss JIRA] (DROOLS-982) DRL file with a rule having long LHS expression takes very long time to parse

Soumitra Kumar (JIRA) issues at jboss.org
Sat Nov 14 10:02:00 EST 2015


Soumitra Kumar created DROOLS-982:
-------------------------------------

             Summary: DRL file with a rule having long LHS expression takes very long time to parse
                 Key: DROOLS-982
                 URL: https://issues.jboss.org/browse/DROOLS-982
             Project: Drools
          Issue Type: Enhancement
            Reporter: Soumitra Kumar
            Assignee: Mark Proctor


My DRL file is:

package sk.rule.ruleset.r1;

import sk.event.Event;

// Event declaration
declare Event
	@role(event)
	@timestamp(time)
end

rule "Long LHS"
when
	$event : Event ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (contains ("name", "foo") && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) && contains ("name", "foo")) )
then
	// Empty
end

// Event definition
package sk.event

sealed case class Event (time: Long, map: Map [String, String]) {
    def contains (key: String, value: String): Boolean = false
}

// Main class
package sk.apps

import java.io.File

import com.typesafe.scalalogging.LazyLogging

import org.kie.api.io.ResourceType
import org.kie.internal.io.ResourceFactory
import org.kie.internal.builder.KnowledgeBuilderFactory

object DrlParsing extends LazyLogging {
  def main (args: Array [String]): Unit = {
    logger.info (s"Starting KnowledgeBuilder")
    val kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder ()
    args.foreach { fileName =>
      logger.info (s"Adding file $fileName")
      kbuilder.add (ResourceFactory.newFileResource (new File (fileName)), ResourceType.DRL)
    }
    if (kbuilder.hasErrors ())
      logger.error (kbuilder.getErrors ().toString ())
  }
}

The project URL is https://github.com/soumitrak/drl-parsing



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list