Class StratifiedChaseBuilder<RW extends MaterializedData & Writable>

java.lang.Object
fr.inria.rules.integraal.forward_chaining.chase.metachase.stratified.StratifiedChaseBuilder<RW>
Type Parameters:
RW - the writable materialized data type processed by the chase

public class StratifiedChaseBuilder<RW extends MaterializedData & Writable> extends Object
Builder for creating a StratifiedChase. Allows setting various configurations and choosing different stratification methods.
  • Constructor Details

    • StratifiedChaseBuilder

      public StratifiedChaseBuilder()
      Default constructor.
    • StratifiedChaseBuilder

      public StratifiedChaseBuilder(ChaseBuilder<RW> chaseBuilder)
      Constructor with a ChaseBuilder instance.
      Parameters:
      chaseBuilder - the ChaseBuilder instance to use.
  • Method Details

    • defaultBuilder

      public static <RW extends MaterializedData & Writable> StratifiedChaseBuilder<RW> defaultBuilder(ChasableData<RW> fb, RuleBase rb)
      Returns a default StratifiedChaseBuilder initialized with the given FactBase and RuleBase.
      Type Parameters:
      RW - the writable materialized data type processed by the chase
      Parameters:
      fb - the FactBase.
      rb - the RuleBase.
      Returns:
      the default StratifiedChaseBuilder initialized with the given parameters.
    • setChaseBuilder

      public StratifiedChaseBuilder<RW> setChaseBuilder(ChaseBuilder<RW> chaseBuilder)
      Sets the ChaseBuilder instance.
      Parameters:
      chaseBuilder - the ChaseBuilder instance to use.
      Returns:
      this StratifiedChaseBuilder instance.
    • setChasableData

      public StratifiedChaseBuilder<RW> setChasableData(ChasableData<RW> chasableData)
      Sets the FactBase.
      Parameters:
      chasableData - the chasable data.
      Returns:
      this StratifiedChaseBuilder instance.
    • setRuleBase

      public StratifiedChaseBuilder<RW> setRuleBase(RuleBase rb)
      Sets the RuleBase.
      Parameters:
      rb - the RuleBase.
      Returns:
      this StratifiedChaseBuilder instance.
    • setStrata

      public StratifiedChaseBuilder<RW> setStrata(List<RuleBase> strata)
      Sets the strata (list of RuleBase). If this method is used, no stratification method will be applied.
      Parameters:
      strata - the list of RuleBase.
      Returns:
      this StratifiedChaseBuilder instance.
    • usePseudoMinimalStratification

      public StratifiedChaseBuilder<RW> usePseudoMinimalStratification()
      Uses the pseudo-minimal stratification method. Ensures each rule is evaluated at least once, minimizing the number of strata.
      Returns:
      this StratifiedChaseBuilder instance.
    • useStratification

      public StratifiedChaseBuilder<RW> useStratification()
      Uses the default stratification method (by strongly connected components). Ensures correct rule application by grouping strongly connected components.
      Returns:
      this StratifiedChaseBuilder instance.
    • useSingleEvaluationStratification

      public StratifiedChaseBuilder<RW> useSingleEvaluationStratification()
      Uses the single evaluation stratification method. Ensures each rule is evaluated exactly once, assuming the graph is acyclic.
      Returns:
      this StratifiedChaseBuilder instance.
    • addHaltingConditions

      @SafeVarargs public final StratifiedChaseBuilder<RW> addHaltingConditions(HaltingCondition<RW>... conditions)
      Adds halting conditions.
      Parameters:
      conditions - the halting conditions to add.
      Returns:
      this StratifiedChaseBuilder instance.
    • addGlobalPretreatments

      @SafeVarargs public final StratifiedChaseBuilder<RW> addGlobalPretreatments(PreTreatment<RW>... treatments)
      Adds global pretreatments.
      Parameters:
      treatments - the global pretreatments to add.
      Returns:
      this StratifiedChaseBuilder instance.
    • addStepPretreatments

      @SafeVarargs public final StratifiedChaseBuilder<RW> addStepPretreatments(PreTreatment<RW>... treatments)
      Adds step pretreatments.
      Parameters:
      treatments - the step pretreatments to add.
      Returns:
      this StratifiedChaseBuilder instance.
    • addGlobalEndTreatments

      @SafeVarargs public final StratifiedChaseBuilder<RW> addGlobalEndTreatments(EndTreatment<RW>... treatments)
      Adds global end treatments.
      Parameters:
      treatments - the global end treatments to add.
      Returns:
      this StratifiedChaseBuilder instance.
    • addEndOfStepTreatments

      @SafeVarargs public final StratifiedChaseBuilder<RW> addEndOfStepTreatments(EndTreatment<RW>... treatments)
      Adds end of step treatments.
      Parameters:
      treatments - the end of step treatments to add.
      Returns:
      this StratifiedChaseBuilder instance.
    • setFinalPredicates

      public StratifiedChaseBuilder<RW> setFinalPredicates(List<Predicate> predicates)
      Sets the list of final predicates to keep in the fact base.
      Parameters:
      predicates - the list of predicates to keep.
      Returns:
      this StratifiedChaseBuilder instance.
    • debug

      public StratifiedChaseBuilder<RW> debug()
      Enables debug mode.
      Returns:
      this StratifiedChaseBuilder instance.
    • build

      public Optional<Chase<RW>> build()
      Builds the StratifiedChase instance.
      Returns:
      an Optional containing the StratifiedChase if successfully built, otherwise an empty Optional.