001package org.dllearner.algorithms.pattern;
002
003import org.semanticweb.owlapi.model.OWLAxiom;
004
005/**
006 * Wraps an OWL axiom that denotes a pattern and whether it's asserted or a generalized version of an asserted
007 * pattern.
008 *
009 * @author Lorenz Buehmann
010 */
011public class OWLAxiomPattern {
012
013        private OWLAxiom axiom;
014        private boolean asserted = true;
015
016        public OWLAxiomPattern(OWLAxiom axiom, boolean asserted) {
017                this.axiom = axiom;
018                this.asserted = asserted;
019        }
020
021        /**
022         * @return the OWL axiom
023         */
024        public OWLAxiom getAxiom() {
025                return axiom;
026        }
027
028        /**
029         * @return whether it's asserted or a generalized version of an asserted
030         * pattern
031         */
032        public boolean isAsserted() {
033                return asserted;
034        }
035
036        @Override
037        public String toString() {
038                return "OWLAxiomPattern{" +
039                                "axiom=" + axiom +
040                                ", asserted=" + asserted +
041                                '}';
042        }
043
044        @Override
045        public boolean equals(Object o) {
046                if (this == o) return true;
047                if (!(o instanceof OWLAxiomPattern)) return false;
048
049                OWLAxiomPattern that = (OWLAxiomPattern) o;
050
051                if (asserted != that.asserted) return false;
052                return axiom != null ? axiom.equals(that.axiom) : that.axiom == null;
053        }
054
055        @Override
056        public int hashCode() {
057                int result = axiom != null ? axiom.hashCode() : 0;
058                result = 31 * result + (asserted ? 1 : 0);
059                return result;
060        }
061}