Class AlgebraicRewriter

  • All Implemented Interfaces:
    IRewriter

    public class AlgebraicRewriter
    extends Rewriter
    Implements the algebraic rewriter class. The idea is that the rewriter gets as input a link specification returns an equivalent yet probably more time-efficient link specification.
    Version:
    1.0
    Author:
    Axel-C. Ngonga Ngomo (ngonga@informatik.uni-leipzig.de)
    • Constructor Detail

      • AlgebraicRewriter

        public AlgebraicRewriter()
    • Method Detail

      • rewrite

        public LinkSpecification rewrite​(LinkSpecification spec)
        Rewrites a Link Specification. The idea is that the rewriter gets as input a link specification returns an equivalent yet probably more time-efficient link specification.
        Parameters:
        spec - , Input link specification
        Returns:
        the input link specification.
      • updateThresholds

        public LinkSpecification updateThresholds​(LinkSpecification spec)
        Updates the thresholds within the input link specification.
        Parameters:
        spec - , The input link specification
        Returns:
        Return spec with updated weights
      • removeDuplicates

        public LinkSpecification removeDuplicates​(LinkSpecification spec)
        Removes duplicated specifications from specification.
        Parameters:
        spec - , The input link specification
        Returns:
        spec, de-duplicated specification
      • removeUnaryOperators

        public LinkSpecification removeUnaryOperators​(LinkSpecification spec)
        Removes unary operators from a specification.
        Parameters:
        spec - , The input link specification
        Returns:
        Cleaned up spec
      • computeAtomicDependency

        public LinkSpecification computeAtomicDependency​(LinkSpecification source,
                                                         LinkSpecification target)
        Checks whether source depends on target, i.e., whether the mapping generated by source is a subset of the mapping generated by target. Returns 0 if no dependency is found, 1 if target is included in source, -1 if source is included in target and +2 if they are equivalent.
        Parameters:
        source - Source link spec
        target - Target link spec
        Returns:
        -1, 0, +1 or +2
      • getProperties

        public List<String> getProperties​(LinkSpecification spec)
        Returns the properties that are used for the comparison. Only works for atomic specifications.
        Parameters:
        spec - , The input specification
        Returns:
        List of properties used in the specification
      • getMeasure

        public String getMeasure​(LinkSpecification spec)
        Returns the measure used in the specification.
        Parameters:
        spec - , The input specification
        Returns:
        Measure used in the specification, null if the specification is not atomic
      • computeAllDependencies

        public LinkSpecification computeAllDependencies​(LinkSpecification spec)
        Updates all dependencies within a specification.
        Parameters:
        spec - , The input specification
        Returns:
        spec, with all dependencies updated
      • computeNonAtomicDependencies

        public LinkSpecification computeNonAtomicDependencies​(LinkSpecification spec)
        Updates the non-atomic dependencies of a link specification.
        Parameters:
        spec - , The input specification
        Returns:
        spec, updated specification with non-atomic dependencies
      • computeAtomicDependencies

        public LinkSpecification computeAtomicDependencies​(LinkSpecification spec)
        Computes all atomic dependencies within a link specification.
        Parameters:
        spec - , The input specification
        Returns:
        spec, updated specification with atomic dependencies
      • collapseSpec

        public LinkSpecification collapseSpec​(LinkSpecification spec)
        Collapses a spec by making use of the dependencies within the specification.
        Parameters:
        spec - , The input specification
        Returns:
        Collapsed spec, i.e., specification where dependencies have been removed