[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
Sun Nov 15 13:23:00 EST 2015


    [ https://issues.jboss.org/browse/DROOLS-982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13129022#comment-13129022 ] 

Soumitra Kumar commented on DROOLS-982:
---------------------------------------

I have submitted a pull request https://github.com/droolsjbpm/drools/pull/555 .

I have only modified the Antlr grammar files, and have to checked in the generated sources.

Please review it and let me know what else needs to be done.

> 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