<div dir="ltr">Hello Edson,<br><br>thank you for your support.<br><br>Your suggestions work very well.<br><br>In my case the &quot;Compound Value Restriction&quot; is exactly what I was looking for.<br><br>This is the way I will use it in my domain:<br>
<br>a : Abbreviation( pos1 == &#39;A&#39; &amp;&amp; ( pos2 not in (&#39;-&#39;,&#39;D&#39;,&#39;H&#39;) || pos3 != &#39;-&#39; || pos4 not in (&#39;O&#39;, &#39;R&#39;, &#39;U&#39;, &#39;L&#39;)) )<br><br>Thank you very much.<br>
<br>Cheers Pete<br><br><div class="gmail_quote">On Tue, Jul 29, 2008 at 5:15 PM, Edson Tirelli <span dir="ltr">&lt;<a href="mailto:tirelli@post.com">tirelli@post.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr"><br>&nbsp;&nbsp; If you have each character in a different attribute, you can use &quot;in&quot; and &quot;not in&quot; to list the valid/invalid characters:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a : Abbreviation( pos1 == &#39;A&#39;, pos2 in (&#39;-&#39;,&#39;D&#39;,&#39;H&#39;), pos3 == &#39;-&#39;, pos4 in (&#39;O&#39;, &#39;R&#39;, &#39;U&#39;, &#39;L&#39;) )<br>



&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a : Abbreviation( pos1 == &#39;A&#39;, pos2 not in (&#39;-&#39;,&#39;D&#39;,&#39;H&#39;), pos3 != &#39;-&#39;, pos4 not in (&#39;O&#39;, &#39;R&#39;, &#39;U&#39;, &#39;L&#39;) )<br>
<br>&nbsp; Also, if you have a String storing the sequence of characters you are using, you can use &quot;matches&quot; and &quot;not matches&quot; with appropriate regexps:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a : Abbreviation( stringRepresentation matches &quot;A[-DH]-[ORUL]&quot; )<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a : Abbreviation( stringRepresentation not matches &quot;A[-DH]-[ORUL]&quot; )<br>
<br>&nbsp; Cheers,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2008/7/28 Pete Crenshaw <span dir="ltr">&lt;<a href="mailto:Pete.Crenshaw@gmx.de" target="_blank">Pete.Crenshaw@gmx.de</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">
<div dir="ltr">Hello Droolers,<br><br>I&#39;m a Drools novice and I&#39;m stuck with a basic rule problem.<br><br>In my domain I use a list of abbreviations to describe the conditions of a system.<br>Before I can check the state of my system I have to verify all applied abbreviations.<br>


<br>The List of abbreviations is not a fixed list it&#39;s more like a combination of chars, combined in different ways on fixed positions.<br><br>This is a small cutout:<br><br>A cutout of possible chars at Position 1: A B C D F H<br>


A cutout of possible chars at Position 2: - A C s n b<br>A cutout of possible chars at Position 3: - A B E F M<br>A cutout of possible chars at Position 4: - H L O R U<br><br>Now it is allowed to combine the following abbreviations:<br>


(another small cutout)<br><br>A--O&nbsp;&nbsp;&nbsp;&nbsp; A--R&nbsp;&nbsp;&nbsp;&nbsp; A--U&nbsp;&nbsp;&nbsp; A--L<br>BAAO&nbsp;&nbsp;&nbsp;&nbsp; BAAR&nbsp;&nbsp;&nbsp;&nbsp; BAAU&nbsp;&nbsp;&nbsp; BAAL<br><br>but it is not allowed to combine this:<br><br>AA**&nbsp;&nbsp;&nbsp;&nbsp; B-** (* stands for all possible chars on a position)<br><br>Now I have 2 basic Questions:<br>


<br>1) How can I pick abbreviations that are NOT allowed?<br>&nbsp;&nbsp; I think it&#39;s easy to say:<br><br>&nbsp;&nbsp; rule &quot;Rule 1&quot;<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a : Abbreviation( pos1 == &#39;A&#39;, pos2 == &#39;-&#39;, pos3 == &#39;-&#39;, pos4 == &#39;O&#39; )<br>


&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # do something positiv<br>&nbsp;&nbsp; end<br><br>&nbsp;&nbsp; But how can I pick up all the wrong combinations without hardcoding them?<br>&nbsp;&nbsp; This would end up in a never-ending story.<br><br>2) Upgrading the &quot;Rule 1&quot; from my 1st Question I&#39;m looking for a way to make the<br>


&nbsp;&nbsp; Rules more generic.<br>&nbsp;&nbsp; I don&#39;t want to hardcode all possible abbreviation combinations.<br>&nbsp;&nbsp; How can I realise something like this VERY INFORMAL notation:<br><br>&nbsp;&nbsp; rule &quot;Rule 2&quot;<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a : Abbreviation( pos1 == &#39;A&#39;, pos2 == [&#39;-&#39;,&#39;D&#39;,&#39;H&#39;], pos3 == &#39;-&#39;, pos4 == [&#39;O&#39;, &#39;R&#39;, &#39;U&#39;, &#39;L&#39;] )<br>


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # If abbreviation looks like A--O, AD-O, AD-U, AH-R, etc. everything is fine.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # It&#39;s time for &quot;Rule 2&quot; to do something positiv<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # do something positiv<br>&nbsp;&nbsp; end<br><br>&nbsp;&nbsp; &quot;Rule 2&quot; should find all the abbreviations that are build up according to a set of allowed char combinations.<br>


<br>&nbsp;&nbsp; OR<br><br>&nbsp;&nbsp; rule &quot;Rule 3&quot;<br>&nbsp;&nbsp;&nbsp; when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a : Abbreviation( pos1 == &#39;A&#39;, pos2 != [&#39;-&#39;,&#39;D&#39;,&#39;H&#39;], pos3 != &#39;-&#39;, pos4 != [&#39;O&#39;, &#39;R&#39;, &#39;U&#39;, &#39;L&#39;] )<br>


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # If abbreviation looks like AA-O, AB-U, A-AO, A--K, etc. something is wrong.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # It&#39;s time for &quot;RULE 3&quot; to announce something negative<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # announce something negative<br>&nbsp;&nbsp; end<br>


<br>&nbsp;&nbsp; &quot;Rule 3&quot; should filter all the abbreviations that are violating a set of allowed char combinations.<br><br>Thanx 2 all droolers in advance.<br><font color="#888888"><br>Pete</font></div>
<br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
</div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br></div>