001/**
002 * Copyright (C) 2007 - 2016, Jens Lehmann
003 *
004 * This file is part of DL-Learner.
005 *
006 * DL-Learner is free software; you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation; either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * DL-Learner is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package org.dllearner.algorithms.properties;
020
021import java.util.SortedSet;
022
023import org.dllearner.core.ComponentAnn;
024import org.dllearner.kb.SparqlEndpointKS;
025import org.semanticweb.owlapi.model.AxiomType;
026import org.semanticweb.owlapi.model.OWLEquivalentObjectPropertiesAxiom;
027import org.semanticweb.owlapi.model.OWLObjectProperty;
028
029@ComponentAnn(name="equivalent object properties axiom learner", shortName="oplequiv", version=0.1, description="A learning algorithm for equivalent object properties axioms.")
030public class EquivalentObjectPropertyAxiomLearner extends ObjectPropertyHierarchyAxiomLearner<OWLEquivalentObjectPropertiesAxiom> {
031        
032        private final double BETA = 1.0;
033        
034        public EquivalentObjectPropertyAxiomLearner(SparqlEndpointKS ks){
035                super(ks);
036                
037                setBeta(BETA);
038                
039                axiomType = AxiomType.EQUIVALENT_OBJECT_PROPERTIES;
040        }
041        
042        /* (non-Javadoc)
043         * @see org.dllearner.core.AbstractAxiomLearningAlgorithm#getExistingAxioms()
044         */
045        @Override
046        protected void getExistingAxioms() {
047                SortedSet<OWLObjectProperty> existingEquivalentProperties = reasoner.getEquivalentProperties(entityToDescribe);
048                if (existingEquivalentProperties != null && !existingEquivalentProperties.isEmpty()) {
049                        for (OWLObjectProperty eqProp : existingEquivalentProperties) {
050                                existingAxioms.add(df.getOWLEquivalentObjectPropertiesAxiom(entityToDescribe, eqProp));
051                        }
052                        logger.info("Existing axioms:" + existingAxioms);
053                }
054        }
055        
056        /* (non-Javadoc)
057         * @see org.dllearner.algorithms.properties.ObjectPropertyHierarchyAxiomLearner#getAxiom(org.semanticweb.owlapi.model.OWLObjectProperty, org.semanticweb.owlapi.model.OWLObjectProperty)
058         */
059        @Override
060        public OWLEquivalentObjectPropertiesAxiom getAxiom(OWLObjectProperty property, OWLObjectProperty otherProperty) {
061                return df.getOWLEquivalentObjectPropertiesAxiom(property, otherProperty);
062        }
063}