Class TreeEngine

java.lang.Object
com.aquima.interactions.dtree.impl.TreeEngine
All Implemented Interfaces:
ITreeEngine

public class TreeEngine extends Object implements ITreeEngine
Decision tree engine implementation, which hold the various (static) definitions of the defined decision trees.
Since:
5.0
Author:
F. van der Meer
  • Constructor Details

    • TreeEngine

      public TreeEngine(IParserFactory parser, IComposer composer, IMetaModel metamodel, ITreeEngineDS datasource)
      Constructs the tree engine with the required arguments.
      Parameters:
      parser - Parser factory that should be used to create expression parsers.
      composer - The composer containing asset and container definitions.
      metamodel - The meta model definitions.
      datasource - The data-source containing the information of the decision trees that need to be added.
      Throws:
      InitializationException - This exception is thrown when the tree engine could not be initialized due to a fatal exception.
  • Method Details

    • getTreeByName

      public IDecisionTree getTreeByName(String name)
      Description copied from interface: ITreeEngine
      Retrieves the tree by it's name.
      Specified by:
      getTreeByName in interface ITreeEngine
      Parameters:
      name - The name of the decision tree that is requested.
      Returns:
      the decision tree when found.
    • getInternalTreeByName

      protected DecisionTree getInternalTreeByName(String name)
    • evaluateWith

      public ITreeResponse evaluateWith(String treeName, IAnswers answers, InferenceContext context)
      Description copied from interface: ITreeEngine
      Evaluate a decision tree with the context passed. The answers interface will instruct the tree engine to skip asking certain questions and continue down the tree until it can find an answer.
      Specified by:
      evaluateWith in interface ITreeEngine
      Parameters:
      treeName - The decision tree that should be evaluated.
      answers - The answers that have been given so far.
      context - current context.
      Returns:
      The response can never be null
    • searchDecisionTrees

      public ISearchResult searchDecisionTrees(String searchText, ILanguage language, int maximumResults, double threshold)
      Description copied from interface: ITreeEngine
      This function will search all Decision Trees and try to find the best matching tree matching to the symptomText. Standard this function will return up matching decision trees.
      Specified by:
      searchDecisionTrees in interface ITreeEngine
      Parameters:
      searchText - A symptom text of at least 1 character.
      language - The language that should be used when searching for a matching symptom.
      maximumResults - indicates what the maximum results count should be, this number is expected to be 1 or larger.
      threshold - the minimum score of the matched decision tree
      Returns:
      A search result object holding the matching trees and their scores.
    • searchDecisionTrees

      public ISearchResult searchDecisionTrees(String searchText, ILanguage language, int maximumResults, double threshold, boolean returnNonExposedTrees, IUserData userData)
      Description copied from interface: ITreeEngine
      This function will search all Decision Trees and try to find the best matching tree matching to the symptomText. Standard this function will return up matching decision trees.
      Specified by:
      searchDecisionTrees in interface ITreeEngine
      Parameters:
      searchText - A symptom text of at least 1 character.
      language - The language that should be used when searching for a matching symptom.
      maximumResults - indicates what the maximum results count should be, this number is expected to be 1 or larger.
      threshold - the minimum score of the matched decision tree
      returnNonExposedTrees - boolean whether to return decision trees that are not exposed as a webservice.
      userData - user data object which contains information about the current user.
      Returns:
      A search result object holding the matching trees and their scores.
    • getTreeNames

      public String[] getTreeNames()
      Description copied from interface: ITreeEngine
      Retrieves the tree names.
      Specified by:
      getTreeNames in interface ITreeEngine
      Returns:
      the names of all the decision trees, never null, may be an empty array.