Class ChaseBuilder<RW extends MaterializedData & Writable>

java.lang.Object
fr.inria.rules.integraal.forward_chaining.chase.ChaseBuilder<RW>
Type Parameters:
RW - the writable materialized data type handled by the chase

public class ChaseBuilder<RW extends MaterializedData & Writable> extends Object
Builds and configures chase algorithms.
Author:
Florent Tornil

Builder to create a parameterized chase algorithm

  • Constructor Details

    • ChaseBuilder

      public ChaseBuilder()
      Creates a builder with the default chase configuration.
  • Method Details

    • defaultBuilder

      public static ChaseBuilder<FactBase> defaultBuilder(FactBase fb, RuleBase rb)
      Builder initialized with the default chase and mandatory parameters
      Parameters:
      fb - the factbase to saturate
      rb - the rule to apply
      Returns:
      the builder initialized with the given parameters
    • defaultBuilder

      public static <RW extends MaterializedData & Writable> ChaseBuilder<RW> defaultBuilder(ChasableData<RW> chasableData, RuleBase rb)
      Builder initialized with the default chase and mandatory parameters
      Type Parameters:
      RW - the writable materialized data type handled by the builder
      Parameters:
      chasableData - the chasable data to saturate
      rb - the rule to apply
      Returns:
      the builder initialized with the given parameters
    • defaultChase

      public static Chase<FactBase> defaultChase(FactBase fb, RuleBase rb)
      Chase initialized with the default parameters and the given mandatory parameters
      Parameters:
      fb - the factbase to saturate
      rb - the rule to apply
      Returns:
      the default chase initialized with the given parameters
    • defaultChase

      public static <RW extends MaterializedData & Writable> Chase<RW> defaultChase(ChasableData<RW> chasableData, RuleBase rb)
      Chase initialized with the default parameters and the given mandatory parameters
      Type Parameters:
      RW - the writable materialized data type handled by the chase
      Parameters:
      chasableData - the chasable data to saturate
      rb - the rule to apply
      Returns:
      the default chase initialized with the given parameters
    • chase

      public static Chase<FactBase> chase(FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... chaseParams) throws IGParameterException
      Chase initialized with the given parameters
      Parameters:
      fb - the factbase to saturate
      rb - the rule to apply
      chaseParams - the chase parameter
      Returns:
      the chase initialized with the given parameters
      Throws:
      IGParameterException - if one of the supplied parameters is invalid
    • build

      public Optional<Chase<RW>> build()
      The minimal configuration requires :
      * a QueryableWritableData to saturate
      * a RuleBase to get Rules from
      * a TermFactory to create new terms

      Default behavior is :
      * a GRDScheduler for rules
      * a TriggerRuleApplier with :
      * * a SemiNaiveTriggerComputer with a default GenericFOQueryEvaluator
      * * a SemiObliviousChecker
      * * a Applier with :
      * * * a FreshRenamer
      * * * a DirectApplication
      * HaltingConditions :
      * * CreatedFactsAtPreviousStep
      * * HasRulesToApply
      Returns:
      the created chase or an empty optional if the configuration is incorrect
    • useTriggerRuleApplier

      public ChaseBuilder<RW> useTriggerRuleApplier()
      Use a breadth first trigger applier
      Returns:
      this
    • useGenericFOQueryEvaluator

      public ChaseBuilder<RW> useGenericFOQueryEvaluator()
      Use the generic query evaluator
      Returns:
      this
    • useSmartFOQueryEvaluator

      public ChaseBuilder<RW> useSmartFOQueryEvaluator()
      Use the smart query evaluator
      Returns:
      this
    • useNaiveRuleScheduler

      public ChaseBuilder<RW> useNaiveRuleScheduler()
      Use a naive rule scheduler
      Returns:
      this
    • useGRDRuleScheduler

      public ChaseBuilder<RW> useGRDRuleScheduler()
      Use a rule scheduler based on the GRD
      Returns:
      this
    • useAllTransformer

      public ChaseBuilder<RW> useAllTransformer()
      Use a transformation that keep all variables as answer variables when evaluating a rule's body
      Returns:
      this
    • useFrontierTransformer

      public ChaseBuilder<RW> useFrontierTransformer()
      Use a transformation that keep only the variables of the frontier as answer variables when evaluating a rule's body
      Returns:
      this
    • useNaiveComputer

      public ChaseBuilder<RW> useNaiveComputer()
      Use a naive method to compute triggers
      Returns:
      this
    • useRestrictedComputer

      public ChaseBuilder<RW> useRestrictedComputer()
      Use a restricted method to compute triggers
      Returns:
      this
    • useSemiNaiveComputer

      public ChaseBuilder<RW> useSemiNaiveComputer()
      Use the semi naive method to compute triggers
      Returns:
      this
    • useTwoStepComputer

      public ChaseBuilder<RW> useTwoStepComputer()
      Use the two-steps method to compute triggers
      Returns:
      this
    • useSourceDelegatedDatalogApplication

      public ChaseBuilder<RW> useSourceDelegatedDatalogApplication()
      Use a method of delegating to the source the application of the datalog rules
      Returns:
      this
    • useAlwaysTrueChecker

      public ChaseBuilder<RW> useAlwaysTrueChecker()
      Use an always true criteria for the triggers
      Returns:
      this
    • useObliviousChecker

      public ChaseBuilder<RW> useObliviousChecker()
      Use a oblivious criteria for the triggers
      Returns:
      this
    • useSemiObliviousChecker

      public ChaseBuilder<RW> useSemiObliviousChecker()
      Use a semi oblivious criteria for the triggers
      Returns:
      this
    • useRestrictedChecker

      public ChaseBuilder<RW> useRestrictedChecker()
      Use a restricted criteria for the triggers
      Returns:
      this
    • useEquivalentChecker

      public ChaseBuilder<RW> useEquivalentChecker()
      Use an equivalent criteria for the triggers
      Returns:
      this
    • useFreshNaming

      public ChaseBuilder<RW> useFreshNaming()
      Use a fresh name for the existentials
      Returns:
      this
    • useBodySkolem

      public ChaseBuilder<RW> useBodySkolem()
      Use a skolem of the body as name for the existentials
      Returns:
      this
    • useFrontierSkolem

      public ChaseBuilder<RW> useFrontierSkolem()
      Use a skolem of the body, limited to the frontier as name for the existentials
      Returns:
      this
    • useFrontierByPieceSkolem

      public ChaseBuilder<RW> useFrontierByPieceSkolem()
      Use a skolem of the body, limited to the frontier of the piece as name for the existentials
      Returns:
      this
    • setChasableData

      public ChaseBuilder<RW> setChasableData(ChasableData<RW> chasableData)
      Sets the QueryableWritableData
      Parameters:
      chasableData - the chasable data
      Returns:
      this
    • setRuleBase

      public ChaseBuilder<RW> setRuleBase(RuleBase rb)
      Sets the RuleBase
      Parameters:
      rb - the RuleBase
      Returns:
      this
    • setTermFactory

      public ChaseBuilder<RW> setTermFactory(TermFactory tf)
      Sets the TermFactory
      Parameters:
      tf - the TermFactory
      Returns:
      this
    • setRuleScheduler

      public ChaseBuilder<RW> setRuleScheduler(RuleScheduler rsc)
      Sets the RuleScheduler
      Parameters:
      rsc - the RuleScheduler
      Returns:
      this
    • setFOQueryEvaluator

      public ChaseBuilder<RW> setFOQueryEvaluator(FOQueryEvaluator<FOFormula, QueryableData> eval)
      Sets the FOQueryEvaluator
      Parameters:
      eval - the FOQueryEvaluator
      Returns:
      this
    • setRuleApplier

      public ChaseBuilder<RW> setRuleApplier(RuleApplier<RW> ra)
      Sets the RuleApplier
      Parameters:
      ra - the RuleApplier
      Returns:
      this
    • setBodyToQueryTransformer

      public ChaseBuilder<RW> setBodyToQueryTransformer(BodyToQueryTransformer transf)
      Sets the BodyToQueryTransformer
      Parameters:
      transf - the BodyToQueryTransformer
      Returns:
      this
    • setTriggerComputer

      public ChaseBuilder<RW> setTriggerComputer(TriggerComputer<RW> tc)
      Sets the TriggerComputer
      Parameters:
      tc - the TriggerComputer
      Returns:
      this
    • setTriggerChecker

      public ChaseBuilder<RW> setTriggerChecker(TriggerChecker<RW> tch)
      Sets the TriggerChecker
      Parameters:
      tch - the TriggerChecker
      Returns:
      this
    • setTriggerApplier

      public ChaseBuilder<RW> setTriggerApplier(TriggerApplier<RW> ta)
      Sets the TriggerApplier
      Parameters:
      ta - the TriggerApplier
      Returns:
      this
    • setExistentialsRenamer

      public ChaseBuilder<RW> setExistentialsRenamer(TriggerRenamer tr)
      Sets the TriggerRenamer
      Parameters:
      tr - the TriggerRenamer
      Returns:
      this
    • setNewFactsHandler

      public ChaseBuilder<RW> setNewFactsHandler(FactsHandler<RW> fh)
      Sets the FactsHandler
      Parameters:
      fh - the FactsHandler
      Returns:
      this
    • addStandardHaltingConditions

      public ChaseBuilder<RW> addStandardHaltingConditions()
      Adds the standard halting conditions
      Returns:
      this
    • addHaltingConditions

      @SafeVarargs public final ChaseBuilder<RW> addHaltingConditions(HaltingCondition<RW>... hcs)
      Adds the given halting conditions
      Parameters:
      hcs - halting conditions
      Returns:
      this
    • addHaltingConditions

      public ChaseBuilder<RW> addHaltingConditions(Collection<HaltingCondition<RW>> hcs)
      Adds the given halting conditions
      Parameters:
      hcs - halting conditions
      Returns:
      this
    • addGlobalPretreatments

      @SafeVarargs public final ChaseBuilder<RW> addGlobalPretreatments(PreTreatment<RW>... pts)
      Adds the given Global pretreatment
      Parameters:
      pts - Global pretreatment
      Returns:
      this
    • addGlobalPretreatments

      public ChaseBuilder<RW> addGlobalPretreatments(Collection<PreTreatment<RW>> pts)
      Adds the given Global pretreatment
      Parameters:
      pts - Global pretreatment
      Returns:
      this
    • addStepPretreatments

      @SafeVarargs public final ChaseBuilder<RW> addStepPretreatments(PreTreatment<RW>... pts)
      Adds the given Step pretreatment
      Parameters:
      pts - Step pretreatment
      Returns:
      this
    • addStepPretreatments

      public ChaseBuilder<RW> addStepPretreatments(Collection<PreTreatment<RW>> pts)
      Adds the given Step pretreatment
      Parameters:
      pts - Step pretreatment
      Returns:
      this
    • addGlobalEndTreatments

      public ChaseBuilder<RW> addGlobalEndTreatments(EndTreatment<RW>... ets)
      Adds the given Global end treatement
      Parameters:
      ets - Step Global end treatement
      Returns:
      this
    • addGlobalEndTreatments

      public ChaseBuilder<RW> addGlobalEndTreatments(Collection<EndTreatment<RW>> ets)
      Adds the given Global end treatement
      Parameters:
      ets - Step Global end treatement
      Returns:
      this
    • addStepEndTreatments

      @SafeVarargs public final ChaseBuilder<RW> addStepEndTreatments(EndTreatment<RW>... ets)
      Adds the given Step end treatement
      Parameters:
      ets - Step end treatement
      Returns:
      this
    • addStepEndTreatments

      public ChaseBuilder<RW> addStepEndTreatments(Collection<EndTreatment<RW>> ets)
      Adds the given Step end treatement
      Parameters:
      ets - Step end treatement
      Returns:
      this
    • useStratifiedChase

      public StratifiedChaseBuilder<RW> useStratifiedChase()
      Returns a StratifiedChaseBuilder for creating a StratifiedChase, with this ChaseBuilder in parameter. Transfers the QueryableWritableData and RuleBase if they are already set.
      Returns:
      a new StratifiedChaseBuilder instance.
    • useByPredicateRuleScheduler

      public ChaseBuilder<RW> useByPredicateRuleScheduler()
      Uses the scheduler that groups rule applications by predicate.
      Returns:
      this builder
    • useBreadthFirstApplier

      public ChaseBuilder<RW> useBreadthFirstApplier()
      Use a breadth-first application of the triggers
      Returns:
      this
    • useParallelApplier

      public ChaseBuilder<RW> useParallelApplier()
      Use a parallel application of the triggers
      Returns:
      this
    • useMultiThreadRuleApplier

      public ChaseBuilder<RW> useMultiThreadRuleApplier()
      Use a multi-threaded rule applier for parallel application of rules. This may not work with stores that do not support concurrent matching or queries
      Returns:
      this
    • useSourceDelegatedDatalogApplier

      public ChaseBuilder<RW> useSourceDelegatedDatalogApplier()
      Use a method of delegating to the source the application of the datalog rules
      Returns:
      this
    • useSORestrictedChecker

      public ChaseBuilder<RW> useSORestrictedChecker()
      Use a combined semi oblivious and restricted criteria for the triggers
      Returns:
      this
    • setParams

      public ChaseBuilder<RW> setParams(IGParameter<InteGraalKeywords, ?>... chaseParams) throws IGParameterException
      Sets (and check) the parameter configuration
      The chase parameter list is considered in the given order. Two kinds of parameters are considered : - exclusive ones (only one value is considered): when such a parameter occurs several times in the list, only the last value is retained - cumulative ones (several values are possible) that are CHASEHALTER and INTERSTEPTREATMENT: when such a parameter occurs several times in the list, all its values are accumulated
      Parameters:
      chaseParams - the chase parameters
      Returns:
      this
      Throws:
      IGParameterException - if one of parameters is invalid for the chase