Interface SWRLRule

All Superinterfaces:
Comparable<OWLObject>, HasAnnotationPropertiesInSignature, HasAnnotations, HasAnonymousIndividuals, HasClassesInSignature, HasComponents, HasContainsEntityInSignature, HasDataPropertiesInSignature, HasDatatypesInSignature, HasHashIndex, HasIndex, HasIndividualsInSignature, HasObjectPropertiesInSignature, HasSignature, IsAnonymous, OWLAxiom, OWLLogicalAxiom, OWLObject, Serializable, SWRLObject
All Known Implementing Classes:
SWRLRuleImpl

public interface SWRLRule extends OWLLogicalAxiom, SWRLObject
Represent a rule. A rule consists of a head and a body. Both the head and the body consist of a conjunction of atoms.
Since:
2.0.0
Author:
Matthew Horridge, The University Of Manchester, Medical Informatics Group
  • Method Details

    • components

      default Stream<?> components()
      Specified by:
      components in interface HasComponents
      Returns:
      components as a stream. The stream is ordered (by visit order) but not sorted. Implementations that override components() must ensure the order is compatible with equals() and hashCode().
    • initHashCode

      default int initHashCode()
      Specified by:
      initHashCode in interface OWLObject
      Returns:
      hash code for the object; called on first use, cached by OWLObjectImpl in the default implementation.
    • componentsWithoutAnnotations

      default Stream<?> componentsWithoutAnnotations()
      Specified by:
      componentsWithoutAnnotations in interface HasComponents
      Returns:
      components as a stream; for objects that can have annotations on them, these are skipped. This is useful for comparing axioms without taking annotations into account. Note: annotations on nested objects are not affected. The stream is ordered (by visit order) but not sorted. Implementations that override components() must ensure the order is compatible with equals() and hashCode().
    • componentsAnnotationsFirst

      default Stream<?> componentsAnnotationsFirst()
      Specified by:
      componentsAnnotationsFirst in interface HasComponents
      Returns:
      components as a stream; for objects that can have annotations on them, annotation streams appear first. This is useful in renderers. The stream is ordered (by visit order) but not sorted. Implementations that override components() must ensure the order is compatible with equals() and hashCode().
    • hashIndex

      default int hashIndex()
      Specified by:
      hashIndex in interface HasHashIndex
      Returns:
      index for this type. This is not a hashcode for instances, rather a hashcode for the types.
    • getBody

      default Set<SWRLAtom> getBody()
      Gets the atoms in the body of the rule.
      Returns:
      A set of SWRLAtoms, which represent the atoms in the body of the rule. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
    • bodyList

      default List<SWRLAtom> bodyList()
      Returns:
      body as list
    • headList

      default List<SWRLAtom> headList()
      Returns:
      head as list
    • body

      Stream<SWRLAtom> body()
      Returns:
      stream of the atoms in the body of the rule.
    • getHead

      default Set<SWRLAtom> getHead()
      Gets the atoms in the head of the rule.
      Returns:
      A set of SWRLAtoms, which represent the atoms in the head of the rule. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
    • head

      Stream<SWRLAtom> head()
      Returns:
      stream of the atoms in the head of the rule
    • getSimplified

      SWRLRule getSimplified()
      If this rule contains atoms that have predicates that are inverse object properties, then this method creates and returns a rule where the arguments of these atoms are flipped over and the predicate is the inverse (simplified) property.
      Returns:
      The rule such that any atoms of the form inverseOf(p)(x, y) are transformed to p(x, y).
    • getVariables

      default Set<SWRLVariable> getVariables()
      Gets the variables that appear in this rule.
      Returns:
      A set of variables that appear in this rule. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
    • variables

      Stream<SWRLVariable> variables()
      Returns:
      stream of variables that appear in this rule.
    • containsAnonymousClassExpressions

      boolean containsAnonymousClassExpressions()
      Determines if this rule uses anonymous class expressions in class atoms.
      Returns:
      true if this rule contains anonymous class expression in class atoms, otherwise false.
    • getClassAtomPredicates

      default Set<OWLClassExpression> getClassAtomPredicates()
      Gets the predicates of class atoms.
      Returns:
      A set of class expressions that represent the class class expressions that are predicates of class atoms. The set that is returned is a copy; modifications to the returned set will not be reflected in this object.
    • classAtomPredicates

      Stream<OWLClassExpression> classAtomPredicates()
      Gets the predicates of class atoms.
      Returns:
      stream of class expressions that represent the class class expressions that are predicates of class atoms.
    • getAxiomWithoutAnnotations

      SWRLRule getAxiomWithoutAnnotations()
      Description copied from interface: OWLAxiom
      Gets an axiom that is structurally equivalent to this axiom without annotations. This essentially returns a version of this axiom stripped of any annotations.
      Specified by:
      getAxiomWithoutAnnotations in interface OWLAxiom
      Returns:
      The axiom without annotations
    • accept

      default void accept(OWLObjectVisitor visitor)
      Description copied from interface: OWLObject
      Accepts a visitor
      Specified by:
      accept in interface OWLObject
      Parameters:
      visitor - The visitor
    • accept

      default <O> O accept(OWLObjectVisitorEx<O> visitor)
      Description copied from interface: OWLObject
      Accepts a visitor
      Specified by:
      accept in interface OWLObject
      Type Parameters:
      O - visitor return type
      Parameters:
      visitor - The visitor
      Returns:
      visitor value
    • accept

      default void accept(SWRLObjectVisitor visitor)
      Specified by:
      accept in interface SWRLObject
      Parameters:
      visitor - visitor to accept
    • accept

      default <O> O accept(SWRLObjectVisitorEx<O> visitor)
      Specified by:
      accept in interface SWRLObject
      Type Parameters:
      O - visitor return type
      Parameters:
      visitor - visitor to accept
      Returns:
      visitor value
    • accept

      default void accept(OWLAxiomVisitor visitor)
      Specified by:
      accept in interface OWLAxiom
      Parameters:
      visitor - visitor to accept
    • accept

      default <O> O accept(OWLAxiomVisitorEx<O> visitor)
      Specified by:
      accept in interface OWLAxiom
      Type Parameters:
      O - visitor return type
      Parameters:
      visitor - visitor to accept
      Returns:
      visitor value
    • getAxiomType

      default AxiomType<?> getAxiomType()
      Description copied from interface: OWLAxiom
      Gets the axiom type for this axiom.
      Specified by:
      getAxiomType in interface OWLAxiom
      Returns:
      The axiom type that corresponds to the type of this axiom.