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.OWLDataProperty;
027import org.semanticweb.owlapi.model.OWLSubDataPropertyOfAxiom;
028
029@ComponentAnn(name="data subproperty axiom learner", shortName="dplsubprop", version=0.1, description="A learning algorithm data subproperty axioms.")
030public class SubDataPropertyOfAxiomLearner extends DataPropertyHierarchyAxiomLearner<OWLSubDataPropertyOfAxiom> {
031        
032        private final double BETA = 3.0;
033        
034        public SubDataPropertyOfAxiomLearner(SparqlEndpointKS ks){
035                super(ks);
036                
037                super.beta = BETA;
038                
039                axiomType = AxiomType.SUB_DATA_PROPERTY;
040        }
041        
042        /* (non-Javadoc)
043         * @see org.dllearner.core.AbstractAxiomLearningAlgorithm#getExistingAxioms()
044         */
045        @Override
046        protected void getExistingAxioms() {
047                SortedSet<OWLDataProperty> existingSuperProperties = reasoner.getSuperProperties(entityToDescribe);
048                if (existingSuperProperties != null && !existingSuperProperties.isEmpty()) {
049                        for (OWLDataProperty supProp : existingSuperProperties) {
050                                existingAxioms.add(df.getOWLSubDataPropertyOfAxiom(entityToDescribe, supProp));
051                        }
052                        logger.info("Existing axioms:" + existingAxioms);
053                }
054        }
055        
056        /* (non-Javadoc)
057         * @see org.dllearner.algorithms.properties.DataPropertyHierarchyAxiomLearner#getAxiom(org.semanticweb.owlapi.model.OWLDataProperty, org.semanticweb.owlapi.model.OWLDataProperty)
058         */
059        @Override
060        public OWLSubDataPropertyOfAxiom getAxiom(OWLDataProperty property, OWLDataProperty otherProperty) {
061                return df.getOWLSubDataPropertyOfAxiom(property, otherProperty);
062        }
063}