[rules-users] Understanding "no viable alternative ..." errors
Edson Tirelli
ed.tirelli at gmail.com
Wed Jan 13 12:15:48 EST 2010
The error simply means that your syntax is incorrect and the parser
could not understand the character at line 16, character 46. In this case,
you are using "=" instead of the correct "==":
pointId: Point(page == "home", region == "center-content")
Also, remember that constraints can only exist inside a pattern, so your
"properties" constraint must go inside the proper pattern that I guess is
"Content"
content: Content(id=="adslot", properties["type"]=="ad" )
[]s
Edson
2010/1/13 Pritam <infinity2heaven at gmail.com>
>
> While executing the following rule,
>
> rule "home dummy"
> when
> pointId: Point(page == "home", region ="center-content")
> content: Content(id=="adslot")
> properties["type"]=="ad" from content
> then
> filter.put(content.id, true);
> end
>
> I get the following error:
> [ERR 101] Line 16:46 no viable alternative at input 'EQUALS' in rule "home
> dummy" in pattern PointId[18,16]: [ERR 102] Line 18:16 mismatched input
> '"type"' expecting ']' in rule "home dummy" in pattern properties
>
> The documentation explains that this is the most common error but I still
> struggle to understand the correct grammar for writing rules. Can anyone
> point me to a good resource (I even read the book "drools 5) for writing
> the
> following rule in a drl format?
>
> " If a Point has a page, "home" and region, "center-content" and the
> Content
> id is "adslot" with a property, type as "ad" then filter the Content (using
> a global map and passing a boolean flag)
>
> Thanks
> --
> View this message in context:
> http://n3.nabble.com/Understanding-no-viable-alternative-errors-tp119375p119375.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100113/18264c0c/attachment.html
More information about the rules-users
mailing list