Class SimpleExecutionEngine

  • All Implemented Interfaces:
    IExecutionEngine
    Direct Known Subclasses:
    PartialRecallExecutionEngine

    public class SimpleExecutionEngine
    extends ExecutionEngine
    Implements the default execution engine class. The idea is that the engine gets as input a link specification and a planner type, executes the independent parts of the plan returned from the planner sequentially and returns a MemoryMemoryMapping.
    Version:
    1.0
    Author:
    Axel-C. Ngonga Ngomo (ngonga@informatik.uni-leipzig.de), Kleanthi Georgala (georgala@informatik.uni-leipzig.de)
    • Constructor Detail

      • SimpleExecutionEngine

        public SimpleExecutionEngine​(ACache source,
                                     ACache target,
                                     String sourceVar,
                                     String targetVar)
        Constructor for a simple execution engine.
        Parameters:
        source - Source cache
        target - Target cache
        sourceVar - Source variable
        targetVar - Target variable
      • SimpleExecutionEngine

        public SimpleExecutionEngine​(ACache source,
                                     ACache target,
                                     String sourceVar,
                                     String targetVar,
                                     long maxOpt,
                                     double k)
        Constructor for a simple execution engine.
        Parameters:
        source - Source cache
        target - Target cache
        sourceVar - Source variable
        targetVar - Target variable
        maxOpt - , optimization time constraint
        k - , expected selectivity
    • Method Detail

      • executeInstructions

        public AMapping executeInstructions​(Plan plan)
        Implementation of the execution of a plan. It receives a plan as a set of instructions and executes them sequentially. This function does not execute nested plans. In case of a RUN command, the instruction must include an atomic link specification.
        Parameters:
        plan - An execution plan
        Returns:
        The mapping obtained from executing the plan
      • executeRun

        public AMapping executeRun​(Instruction inst)
        Implements the execution of the RUN operator. The input instruction must include an atomic link specification.
        Parameters:
        inst - Atomic RUN instruction
        Returns:
        The mapping obtained from executing the atomic RUN instruction
      • executeFilter

        public AMapping executeFilter​(Instruction inst,
                                      AMapping input)
        Runs the filtering operator.
        Parameters:
        inst - Input instruction with FILTER command
        input - Mapping that is to be filtered
        Returns:
        filtered Mapping
      • executeDifference

        public AMapping executeDifference​(AMapping m1,
                                          AMapping m2)
        Implements the difference between two mappings.
        Parameters:
        m1 - First Mapping
        m2 - Second Mapping
        Returns:
        Difference of m1 and m2
      • executeIntersection

        public AMapping executeIntersection​(AMapping m1,
                                            AMapping m2)
        Implements the intersection between two mappings.
        Parameters:
        m1 - First Mapping
        m2 - Second Mapping
        Returns:
        Intersection of m1 and m2
      • executeUnion

        public AMapping executeUnion​(AMapping m1,
                                     AMapping m2)
        Implements the union between two mappings.
        Parameters:
        m1 - First Mapping
        m2 - Second Mapping
        Returns:
        Intersection of m1 and m2
      • executeStatic

        public AMapping executeStatic​(NestedPlan plan)
        Executes an immutable nested plan in lNr depth first oder. See execute(LinkSpecification, IPlanner). If a plan is atomic, it is executed and the result mapping is returned. If it is complex, the operator is used on the top 2 previously retrieved mappings and the result mapping of the previous step gets filtered using the filtering instruction of the plan (if any).
        Parameters:
        plan - A nested plan created by a static planner (Canonical or Helios)
        Returns:
        The mapping obtained from executing the plan
      • executeDynamic

        public AMapping executeDynamic​(LinkSpecification spec,
                                       DynamicPlanner planner)
        Executes an input link specification L in a dynamic fashion. See execute(LinkSpecification, IPlanner). If L is already executed, then the corresponding mapping is retrieved from the dynamicResults and returned. If L is not executed, then the function checks if there is another previously executed specification A with the same fullExpression ( LinkSpecification.fullExpression but lower threshold. If A exists, then it retrieves the mapping of A, filters it with input link specification threshold and returns the mapping. If A does not exist, the function checks whether L is atomic or not. If L is atomic then the planner creates a nested plan P with a RUN instruction. The function executes P and the retrieved mapping is returned. If L is not atomic, then the planner creates an initial plan P for L and the function executes the first subPlan of P, P1. Then, if L has an OR or XOR operator, the second subPlan of P, P2 is executed, the operator functions is applied to the mappings returned by P1 and P2 and the resulting mapping is filtered and returned. In case of an AND or MINUS operator, the executeDynamic function invokes the planning function again to re-plan the remaining non-executed parts of P (if any). Then it executes the second sub-plan of P, that can vary given from the initial given the intermediate executed steps of the first plan.
        Parameters:
        spec - The input link specification
        planner - , The dynamic planner
        Returns:
        The mapping obtained from executing the link specification.
      • execute

        public AMapping execute​(LinkSpecification spec,
                                IPlanner planner)
        Executes a link specification. The execution engine chooses which execute function is going to be invoked given the planner. For the Canonical and Helios planner, the execution of link specifications has been modeled as a linear process wherein a LS is potentially first rewritten, planned and finally executed. Subsequently, the plan never changes and is simply executed. For the Dynamic planner, we enable a flow of information from the execution engine back to the planner, that uses intermediary execution results to improve plans generated previously.
        Parameters:
        spec - The link specification, after it was re-written
        planner - The chosen planner
        Returns:
        The mapping obtained from executing the plan of the input link specification