Exemplo n.º 1
0
    def getSafeQueryPlan(self, init=True):
        self.usedSeparatorVars = self.query.getUsedSeparators()
        self.formattedUsedSeparators = [
            self.formatSeparatorVariable(sep)
            for sep in self.usedSeparatorVars]

        self.children = []
        if init:
            for ind, term in enumerate(self.subqueries):
                plan = algorithm.getSafeQueryPlan(term)
                self.children.append(plan)
Exemplo n.º 2
0
    def getSafeQueryPlan(self, init=True):
        self.usedSeparatorVars = self.query.getUsedSeparators()
        self.formattedUsedSeparators = [
            self.formatSeparatorVariable(sep) for sep in self.usedSeparatorVars
        ]

        self.children = []
        if init:
            for ind, term in enumerate(self.subqueries):
                plan = algorithm.getSafeQueryPlan(term)
                self.children.append(plan)
Exemplo n.º 3
0
    def getSafeQueryPlan(self, init=True):
        # we are interested in whether the separator represents
        # a generic inequality constraint - if so, it doesn't matter which
        # component it occurs in, as it must have the same
        # constraint everywhere

        representativeSeparator = self.separator[0]
        if representativeSeparator.isInequality(
        ) and representativeSeparator.getInequalityConstraint().isGeneric():
            self.replacementVal = "generic_%s" % representativeSeparator.getInequalityConstraint(
            ).getConstant()
        else:
            self.replacementVal = algorithm.attCounter()

        # for webkb
        if representativeSeparator.domainSize:
            self.effectiveDomainSize = representativeSeparator.domainSize

        d = self.disjunctiveQuery

        self.usedSeparatorVars = d.getUsedSeparators()

        d.applySeparator(self.separator, self.replacementVal)
        if isinstance(d, query_exp.DisjunctiveQuery):
            cons = []
            for c in d.getComponents():
                cons.append(
                    query_exp.ConjunctiveQuery(
                        query_exp.decomposeComponent(c)))
            self.childDNF = query_exp.DNF(cons)
        else:
            self.childDNF = d

        if init:
            self.child = algorithm.getSafeQueryPlan(self.childDNF)
        else:
            self.child = None
Exemplo n.º 4
0
    def getSafeQueryPlan(self, init=True):
        # we are interested in whether the separator represents
        # a generic inequality constraint - if so, it doesn't matter which
        # component it occurs in, as it must have the same
        # constraint everywhere

        representativeSeparator = self.separator[0]
        if representativeSeparator.isInequality(
        ) and representativeSeparator.getInequalityConstraint().isGeneric():
            self.replacementVal = "generic_%s" % representativeSeparator.getInequalityConstraint(
            ).getConstant()
        else:
            self.replacementVal = algorithm.attCounter()

        # for webkb
        if representativeSeparator.domainSize:
            self.effectiveDomainSize = representativeSeparator.domainSize

        d = self.disjunctiveQuery

        self.usedSeparatorVars = d.getUsedSeparators()

        d.applySeparator(self.separator, self.replacementVal)
        if isinstance(d, query_exp.DisjunctiveQuery):
            cons = []
            for c in d.getComponents():
                cons.append(
                    query_exp.ConjunctiveQuery(
                        query_exp.decomposeComponent(c)))
            self.childDNF = query_exp.DNF(cons)
        else:
            self.childDNF = d

        if init:
            self.child = algorithm.getSafeQueryPlan(self.childDNF)
        else:
            self.child = None