All Downloads are FREE. Search and download functionalities are using the official Maven repository.

unife.utilities.InfoOntology Maven / Gradle / Ivy

/**
 *  This file is part of BUNDLE.
 * 
 *  BUNDLE is a probabilistic reasoner for OWL 2 ontologies.
 * 
 *  BUNDLE is a module of the LEAP system, but can be used as standalone.
 * 
 *  LEAP was implemented as a plugin of DL-Learner http://dl-learner.org, 
 *  but some components can be used as stand-alone.
 * 
 *  LEAP and all its modules are free software; you can redistribute the and/or modify
 *  them under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 * 
 *  LEAP and all its parts are distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 * 
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see .
 * 
 */
package unife.utilities;

import java.io.File;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;

/**
 * Utility class that returns the number of individuals and the number of axioms
 * contained into a knowledge base
 *
 * @author Giuseppe Cota , Riccardo Zese
 * 
 */
public class InfoOntology {

    /**
     * @param args the command line arguments
     * @throws org.semanticweb.owlapi.model.OWLOntologyCreationException
     */
    public static void main(String[] args) throws OWLOntologyCreationException {
        if (args.length != 1) {
            System.out.println("ERROR: wrong number of arguments!");
            System.out.println("Usage: info_ontology.sh ");
            System.exit(1);
        }
        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
        OWLOntology ontology = manager.loadOntologyFromOntologyDocument(new File(args[0]));
        int numIndividuals = ontology.getIndividualsInSignature(true).size();
        System.out.println("Number of individuals: " + numIndividuals);
        // migliorare ques'ultimo comando per poter contare anche gli assiomi importati
        int numAxioms = ontology.getLogicalAxiomCount();
        System.out.println("Number of logical axioms: " + numAxioms);
        numAxioms = ontology.getAxiomCount();
        System.out.println("Number of axioms: " + numAxioms);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy