[rules-users] Custom operator

Edson Tirelli tirelli at post.com
Mon Oct 25 09:58:27 EDT 2010


   If you look at the implementation of one of the existing operators
(e.g. MatchesEvaluatorDefinition) you will see this in the beginning
of the class:

public static final Operator  MATCHES       =
Operator.addOperatorToRegistry( "matches", false );

   Do the same on your own implementations and it should be fine.

    Edson



2010/10/25 Bruno Freudensprung <bruno.freudensprung at temis.com>:
>
> Hello,
>
> It seems that the logic behind the "operator" drop-down list comes from
> the
> "org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine"
> and "org.drools.eclipse.rulebuilder.modeldriven.HumanReadable" classes.
> That's for the "rule authoring" perspective.
> I've also seen that the business rule editor involves the DrlParser
> class. So, in a "rule parsing" perspective, I guess I need to find a way
> to register my custom operator into the EvaluatorRegistry used by the
> Eclipse plugin (and I don't know where this can be done).
>
> Do you think I am on the right track? Is there a risk that code
> modifications will involve so many classes that, in the end, adding a
> custom operator to the business rule editor will be a difficult task for
> someone very new to Drools (like me)?
>
> Thanks in advance,
> Best regards,
>
> Bruno.
>
> Bruno Freudensprung a écrit :
>> Hello,
>>
>> I'd like to implement a custom "lucenematches" operator that would
>> enable writing conditions like:
>> $d : Doc(text lucenematches "(foo AND bar) OR roam~0.8")
>>
>> As I've taken a look at the following post on athico
>> (http://blog.athico.com/2009/05/imperfect-evaluations.html), and seen
>> that the appendix B of the "Drools JBoss Rules 5.0 Developer's Guide"
>> book that deals with custom operators, I am rather confident that I will
>> find my way in implementing my operator (if not, I'll post here again :-)).
>>
>> However, I wonder if it will be possible to add my "lucenematches"
>> operator to the "operator" drop-down list of the Eclipse's Business Rule
>> Editor.
>> Does anyone have an idea?
>>
>> Best regards,
>>
>> Bruno.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> 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




More information about the rules-users mailing list