Class DelpRule

  • All Implemented Interfaces:
    net.sf.tweety.commons.Formula, net.sf.tweety.commons.util.rules.Rule<net.sf.tweety.logics.fol.syntax.FolFormula,​net.sf.tweety.logics.fol.syntax.FolFormula>, net.sf.tweety.logics.commons.syntax.interfaces.ClassicalFormula, net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula, net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable, net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable, net.sf.tweety.logics.commons.syntax.interfaces.Invertable, net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure, net.sf.tweety.logics.commons.syntax.interfaces.ProbabilityAware, net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula, net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
    Direct Known Subclasses:
    DefeasibleRule, DelpFact, StrictRule

    public abstract class DelpRule
    extends net.sf.tweety.logics.commons.syntax.RelationalFormula
    implements net.sf.tweety.commons.util.rules.Rule<net.sf.tweety.logics.fol.syntax.FolFormula,​net.sf.tweety.logics.fol.syntax.FolFormula>
    This method is the superclass for both a strict rule and a defeasible rule in defeasible logic programming and captures their common attributes and methods.
    Author:
    Matthias Thimm, Tim Janus
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Set<net.sf.tweety.logics.fol.syntax.FolFormula> body
      The body of the rule (these must be a literals).
      protected net.sf.tweety.logics.fol.syntax.FolFormula head
      The head of the rule (this must be a literal).
    • Method Summary

      Modifier and Type Method Description
      void addPremise​(net.sf.tweety.logics.fol.syntax.FolFormula premise)  
      void addPremises​(Collection<? extends net.sf.tweety.logics.fol.syntax.FolFormula> premises)  
      net.sf.tweety.logics.fol.syntax.Conjunction combineWithAnd​(net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable f)  
      net.sf.tweety.logics.fol.syntax.Disjunction combineWithOr​(net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable f)  
      net.sf.tweety.logics.commons.syntax.RelationalFormula complement()  
      boolean containsQuantifier()  
      boolean equals​(Object o)  
      Set<net.sf.tweety.logics.fol.syntax.FolAtom> getAtoms()  
      net.sf.tweety.logics.fol.syntax.FolFormula getConclusion()  
      Set<net.sf.tweety.logics.commons.syntax.Functor> getFunctors()  
      Set<net.sf.tweety.logics.commons.syntax.Predicate> getPredicates()  
      Collection<? extends net.sf.tweety.logics.fol.syntax.FolFormula> getPremise()  
      Set<net.sf.tweety.logics.commons.syntax.Variable> getQuantifierVariables()  
      net.sf.tweety.logics.fol.syntax.FolSignature getSignature()  
      Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getTerms()  
      <C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>
      Set<C>
      getTerms​(Class<C> cls)  
      Set<net.sf.tweety.logics.commons.syntax.Variable> getUnboundVariables()  
      net.sf.tweety.math.probability.Probability getUniformProbability()  
      int hashCode()  
      boolean isApplicable​(Collection<? extends net.sf.tweety.logics.fol.syntax.FolFormula> literals)
      Checks whether this rule is applicaple in the given context literals,
      boolean isClosed()  
      boolean isClosed​(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)  
      boolean isConstraint()  
      boolean isFact()  
      boolean isGround()
      Checks whether there appear any variables in this rule
      boolean isLiteral()  
      boolean isWellBound()  
      boolean isWellBound​(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)  
      void setConclusion​(net.sf.tweety.logics.fol.syntax.FolFormula conclusion)  
      abstract net.sf.tweety.logics.commons.syntax.RelationalFormula substitute​(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t)  
      String toString()  
      • Methods inherited from class net.sf.tweety.logics.commons.syntax.RelationalFormula

        allGroundInstances, allSubstitutions, clone, containsTermsOfType, exchange, getFormula, getPredicateCls, getSatisfactionRatio, isWellFormed, substitute
    • Field Detail

      • head

        protected net.sf.tweety.logics.fol.syntax.FolFormula head
        The head of the rule (this must be a literal).
      • body

        protected Set<net.sf.tweety.logics.fol.syntax.FolFormula> body
        The body of the rule (these must be a literals).
    • Method Detail

      • isApplicable

        public boolean isApplicable​(Collection<? extends net.sf.tweety.logics.fol.syntax.FolFormula> literals)
        Checks whether this rule is applicaple in the given context literals,
        Parameters:
        literals - a set of literals
        Returns:
        true iff this rule is applicaple, i.e., if the body of the rule is a subset of the given set of literals
      • isGround

        public boolean isGround()
        Checks whether there appear any variables in this rule
        Specified by:
        isGround in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Overrides:
        isGround in class net.sf.tweety.logics.commons.syntax.RelationalFormula
        Returns:
        true iff there appears no variable in this rule
      • getPremise

        public Collection<? extends net.sf.tweety.logics.fol.syntax.FolFormula> getPremise()
        Specified by:
        getPremise in interface net.sf.tweety.commons.util.rules.Rule<net.sf.tweety.logics.fol.syntax.FolFormula,​net.sf.tweety.logics.fol.syntax.FolFormula>
      • getConclusion

        public net.sf.tweety.logics.fol.syntax.FolFormula getConclusion()
        Specified by:
        getConclusion in interface net.sf.tweety.commons.util.rules.Rule<net.sf.tweety.logics.fol.syntax.FolFormula,​net.sf.tweety.logics.fol.syntax.FolFormula>
      • combineWithAnd

        public net.sf.tweety.logics.fol.syntax.Conjunction combineWithAnd​(net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable f)
        Specified by:
        combineWithAnd in interface net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable
        Specified by:
        combineWithAnd in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • combineWithOr

        public net.sf.tweety.logics.fol.syntax.Disjunction combineWithOr​(net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable f)
        Specified by:
        combineWithOr in interface net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable
        Specified by:
        combineWithOr in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • complement

        public net.sf.tweety.logics.commons.syntax.RelationalFormula complement()
        Specified by:
        complement in interface net.sf.tweety.logics.commons.syntax.interfaces.Invertable
        Specified by:
        complement in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • getPredicates

        public Set<net.sf.tweety.logics.commons.syntax.Predicate> getPredicates()
        Specified by:
        getPredicates in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
      • getAtoms

        public Set<net.sf.tweety.logics.fol.syntax.FolAtom> getAtoms()
        Specified by:
        getAtoms in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Specified by:
        getAtoms in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • isLiteral

        public boolean isLiteral()
        Specified by:
        isLiteral in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
      • getTerms

        public Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getTerms()
        Specified by:
        getTerms in interface net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure
      • getTerms

        public <C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> Set<C> getTerms​(Class<C> cls)
        Specified by:
        getTerms in interface net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure
      • getQuantifierVariables

        public Set<net.sf.tweety.logics.commons.syntax.Variable> getQuantifierVariables()
        Specified by:
        getQuantifierVariables in interface net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
      • isFact

        public boolean isFact()
        Specified by:
        isFact in interface net.sf.tweety.commons.util.rules.Rule<net.sf.tweety.logics.fol.syntax.FolFormula,​net.sf.tweety.logics.fol.syntax.FolFormula>
      • isConstraint

        public boolean isConstraint()
        Specified by:
        isConstraint in interface net.sf.tweety.commons.util.rules.Rule<net.sf.tweety.logics.fol.syntax.FolFormula,​net.sf.tweety.logics.fol.syntax.FolFormula>
      • setConclusion

        public void setConclusion​(net.sf.tweety.logics.fol.syntax.FolFormula conclusion)
        Specified by:
        setConclusion in interface net.sf.tweety.commons.util.rules.Rule<net.sf.tweety.logics.fol.syntax.FolFormula,​net.sf.tweety.logics.fol.syntax.FolFormula>
      • addPremise

        public void addPremise​(net.sf.tweety.logics.fol.syntax.FolFormula premise)
        Specified by:
        addPremise in interface net.sf.tweety.commons.util.rules.Rule<net.sf.tweety.logics.fol.syntax.FolFormula,​net.sf.tweety.logics.fol.syntax.FolFormula>
      • addPremises

        public void addPremises​(Collection<? extends net.sf.tweety.logics.fol.syntax.FolFormula> premises)
        Specified by:
        addPremises in interface net.sf.tweety.commons.util.rules.Rule<net.sf.tweety.logics.fol.syntax.FolFormula,​net.sf.tweety.logics.fol.syntax.FolFormula>
      • containsQuantifier

        public boolean containsQuantifier()
        Specified by:
        containsQuantifier in interface net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
      • substitute

        public abstract net.sf.tweety.logics.commons.syntax.RelationalFormula substitute​(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v,
                                                                                         net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t)
                                                                                  throws IllegalArgumentException
        Specified by:
        substitute in interface net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula
        Specified by:
        substitute in class net.sf.tweety.logics.commons.syntax.RelationalFormula
        Throws:
        IllegalArgumentException
      • getUnboundVariables

        public Set<net.sf.tweety.logics.commons.syntax.Variable> getUnboundVariables()
        Specified by:
        getUnboundVariables in interface net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
      • isClosed

        public boolean isClosed​(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)
        Specified by:
        isClosed in interface net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
      • isWellBound

        public boolean isWellBound()
        Specified by:
        isWellBound in interface net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
      • isWellBound

        public boolean isWellBound​(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)
        Specified by:
        isWellBound in interface net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
      • getFunctors

        public Set<net.sf.tweety.logics.commons.syntax.Functor> getFunctors()
        Specified by:
        getFunctors in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • getUniformProbability

        public net.sf.tweety.math.probability.Probability getUniformProbability()
        Specified by:
        getUniformProbability in interface net.sf.tweety.logics.commons.syntax.interfaces.ProbabilityAware
        Specified by:
        getUniformProbability in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • toString

        public String toString()
        Specified by:
        toString in class net.sf.tweety.logics.commons.syntax.RelationalFormula
      • equals

        public boolean equals​(Object o)
        Specified by:
        equals in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
        Overrides:
        hashCode in class Object
      • getSignature

        public net.sf.tweety.logics.fol.syntax.FolSignature getSignature()
        Specified by:
        getSignature in interface net.sf.tweety.commons.Formula
        Specified by:
        getSignature in interface net.sf.tweety.commons.util.rules.Rule<net.sf.tweety.logics.fol.syntax.FolFormula,​net.sf.tweety.logics.fol.syntax.FolFormula>