Пример #1
0
    def getFunctors(self) -> Set[Functor]:
        '''
        Returns set of functors.

        :rtype: set of Functor
        '''
        return unionSets(map(lambda atom: atom.getFunctors(), self.atoms))
Пример #2
0
    def getLiterals(self) -> Set[Literal]:
        '''
        Returns set of literals.

        :rtype: set of Literal
        '''
        return unionSets(clause.literals for clause in self.clauses)
Пример #3
0
    def getConstants(self) -> Set[Constant]:
        '''
        Returns set of constants.

        :rtype: set of Constant
        '''
        return unionSets(atom.getConstants() for atom in self.atoms)
Пример #4
0
    def getGroundLiterals(self) -> Set[Literal]:
        '''
        Returns set of ground literals.

        :rtype: set of Literal
        '''
        return unionSets(clause.getGroundLiterals() for clause in self.clauses)
Пример #5
0
    def getPositiveLiterals(self) -> Set[Literal]:
        '''
        Returns set of positive literals.

        :rtype: set of Literal
        '''
        return unionSets(clause.getPositiveLiterals() for clause in self.clauses)
Пример #6
0
    def getPredicates(self) -> Set[Predicate]:
        '''
        Returns set of predicates in the CNF.

        :rtype: set of Predicate
        '''
        return unionSets(clause.getPredicates() for clause in self.clauses)
Пример #7
0
    def getConstants(self) -> Set[Constant]:
        '''
        Returns set of constants of the atom.

        :rtype: set of Constant
        '''
        return unionSets(term.getConstants() for term in self.terms)
Пример #8
0
    def getVariables(self) -> Set[Variable]:
        '''
        Returns set of variables in the atom.

        :rtype: set of Variable
        '''
        return unionSets(term.getVariables() for term in self.terms)
Пример #9
0
    def getConstants(self) -> Set[Constant]:
        '''
        Returns all constants in the dataset.

        :rtype: set of Constant
        '''
        return tools.unionSets(
            map(lambda sample: sample.data.getConstants(), self.samples))
Пример #10
0
    def getPredicates(self) -> Set[Predicate]:
        '''
        Returns set of all predicates used in the dataset.

        :rtype: set of Predicate
        '''
        return tools.unionSets(
            map(lambda sample: sample.data.getPredicates(), self.samples))
Пример #11
0
 def getFunctors(self) -> Set[Functor]:
     '''
     Returns all functors in the dataset.
     
     :rtype: set of Functor 
     '''
     return tools.unionSets(
         map(lambda sample: sample.data.getFunctors(), self.samples))
Пример #12
0
    def getVariables(self) -> Set[Variable]:
        '''
        Returns set of variables in the clause.

        :rtype: set of Variable
        '''
        if not self.literals:
            return set()
        return unionSets(literal.getVariables() for literal in self.literals)
Пример #13
0
    def getFunctors(self) -> Set[Functor]:
        '''
        Returns set of functors.

        :rtype: set of Functor
        '''
        result = set()
        result.add(self.functor)
        result = result.union(unionSets(map(lambda term: term.getFunctors(), self.terms)))
        return result