/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ontology;


	import org.semanticweb.owlapi.apibinding.OWLManager;
	import org.semanticweb.owlapi.io.*;
	import org.semanticweb.owlapi.model.*;
	import org.semanticweb.owlapi.util.SimpleIRIMapper;

	import java.io.File;
	import java.io.FileNotFoundException;
	import java.io.IOException;
	import java.net.URI;
	import java.net.UnknownHostException;
	import java.util.Map;

/**
 *
 * @author Syed
 */
public class ontology {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
       try { 
       
       OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
       IRI ontologyIRI = IRI.create("http://www.test.com/ontologies/testont.owl");
       IRI documentIRI = IRI.create("file:/C:/Users/Syed/Desktop/animal.owl");
       //URI ontologyURI = URI.create("http://www.test.com/ontologies/testont.owl");
       //URI physicalURI = URI.create("file:C:/Users/Syed/Desktop/animal.owl");
       //OWLOntologyIRIMapper mapper = new OWLOntologyIRIMapper(ontologyURI, physicalURI);
       //manager.addIRIMapper(mapper);
       SimpleIRIMapper mapper = new SimpleIRIMapper(ontologyIRI, documentIRI);
       manager.addIRIMapper(mapper);
       OWLOntology ontology = manager.createOntology(ontologyIRI);
       OWLDataFactory factory = manager.getOWLDataFactory();
       OWLClass animal = factory.getOWLClass(IRI.create(ontologyIRI + "#animal"));
       OWLClass herbivore = factory.getOWLClass(IRI.create(ontologyIRI + "#herbivore"));
       OWLClass carnivore = factory.getOWLClass(IRI.create(ontologyIRI + "#carnivore"));
       OWLClass giraffe = factory.getOWLClass(IRI.create(ontologyIRI + "#giraffe"));
       OWLClass lion = factory.getOWLClass(IRI.create(ontologyIRI + "#lion"));
       OWLClass plant = factory.getOWLClass(IRI.create(ontologyIRI + "#plant"));
       OWLClass tree = factory.getOWLClass(IRI.create(ontologyIRI + "#tree"));
       OWLAxiom axiom1 = factory.getOWLSubClassOfAxiom(herbivore,animal);
       OWLAxiom axiom2 = factory.getOWLSubClassOfAxiom(carnivore,animal);
       OWLAxiom axiom3 = factory.getOWLSubClassOfAxiom(giraffe,herbivore);
       OWLAxiom axiom4 = factory.getOWLSubClassOfAxiom(lion,carnivore);
       OWLAxiom axiom5 = factory.getOWLSubClassOfAxiom(tree,plant);
       OWLAxiom axiom6 = factory.getOWLDisjointClassesAxiom(animal,plant);
       AddAxiom addAxiom1 = new AddAxiom(ontology, axiom1);
       manager.applyChange(addAxiom1);
       AddAxiom addAxiom2 = new AddAxiom(ontology, axiom2);
       manager.applyChange(addAxiom2);
       AddAxiom addAxiom3 = new AddAxiom(ontology, axiom3);
       manager.applyChange(addAxiom3);
       AddAxiom addAxiom4 = new AddAxiom(ontology, axiom4);
       manager.applyChange(addAxiom4);
       AddAxiom addAxiom5 = new AddAxiom(ontology, axiom5);
       manager.applyChange(addAxiom5);
       AddAxiom addAxiom6 = new AddAxiom(ontology, axiom6);
       manager.applyChange(addAxiom6);
       manager.saveOntology(ontology);



       }
       catch (OWLException e) {
       e.printStackTrace();
       }

        // TODO code application logic here
    }

}
