Uploaded image for project: 'AppFormer'
  1. AppFormer
  2. AF-659

SuggestionCompletionEngine: Custom Operators: Build operators dynamically from Drools Expert's registry

    XMLWordPrintable

Details

    • New Feature
    • Resolution: Obsolete
    • Major
    • None
    • None
    • Data Model Oracle
    • None

    Description

      SuggestionCompletionEngine currently has arrays of operators that are applicable for different data-types.

      Edson advises this can be obtained dynamically from an operator registry held within Expert.

      Here's some history (adding new operators for CEP), some narrative and some recommendations:-

      <_manstis> etirelli: BTW can you do "Fact( myDate before XYZ && after ABC)", like you can "Fact( myLong == 1 && ==2 )"
      <etirelli> yes
      <_manstis> damn
      <etirelli>
      <etirelli> all drools operators are handled the same way
      <_manstis> maybe in DRL
      <etirelli> lol

      <etirelli> _manstis: question: are you hardcoding available operators?
      <_manstis> hell yeah, lots and lots and lots (and now even more) of them
      <_manstis> we split into which are applicable for different datatypes
      <_manstis> so matches is not suitable for longs
      <_manstis> etc
      <etirelli> _manstis: ouch...
      <etirelli> _manstis: well, for the future, we should change that and use the operator introspection
      <_manstis> but.... if there's a DroolsOperatorsForDataTypesKnowledgeBuilder somewhere you can tell me.....
      <etirelli> as the KnowledgeBuilderConfiguration tells you all the available operators
      <etirelli> yes
      <_manstis> hmmm. might take a look..... I need to swap them out a bit for your CEP operators (that take additional parameters)
      <etirelli> public boolean supportsType(ValueType type)
      <etirelli> EvaluatorDefinition.supportsType(ValueType type) will tell you if the evaluator supports a given type
      <etirelli> so you can introspect everything, without having to hard code them...
      <_manstis> hmm.....
      <_manstis> KnowledgeBuilderConfiguration is an empty interface, care to mention the implementation so I can have a quick nose?

      • lazarotti (~lazarott@173-166-37-146-newengland.hfc.comcastbusiness.net) has joined #droolsdev
        <_manstis> OK, got it PackageBuilderConfiguration
      • salaboy has quit (salaboy)

      <etirelli> _manstis: KnowledgeBuilderOptionsConfiguration
      <etirelli> the actual method is:
      <etirelli> public <T extends MultiValueKnowledgeBuilderOption> Set<String> getOptionKeys( Class<T> option );
      <etirelli> so you call:
      <etirelli> Set<String> keys = conf.getOptionKeys( EvaluatorOption.class );
      <etirelli> that will give you the keys of all definitions...
      <etirelli> then you do:
      <etirelli> for( String key : keys )

      { EvaluatorDefinition def = conf.getOption( EvaluatorOption.class, key ).getEvaluatorDefinition(); ... }

      <etirelli> a bit verbose but should give you all the info you need

      Attachments

        Issue Links

          Activity

            People

              manstis@redhat.com Michael Anstis
              manstis@redhat.com Michael Anstis
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: