I have made an ontology using Protege and i have inserted 300 instances.I have used two object properties in my ontology i.e isSynonymOf and isAntonymOf . I want to handle my ontology using java Eclipse. I have imported ontology in Eclipse.
- I want to add some instances of a specific class using user input
- I also want to remove existing some instances
And i also want to edit some individual and properties
I am beginer in java and do not know how to do it. It might be simple but i am beginer.So sorry in advance
My initial code is as follows
public class OntMgt { public static void main(String[] args){ OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); IRI iri = IRI.create("http://word.owl"); OWLOntology WordOntology = manager.loadOntologyFromOntologyDocument(iri); System.out.println("Loaded ontology: " + WordOntology.getOntologyID()); ConsoleProgressMonitor progressMonitor = new ConsoleProgressMonitor(); OWLReasonerConfiguration config = new SimpleConfiguration(); OWLReasoner reasoner = (OWLReasoner) reasonerFactory.createReasoner(WordOntology, config); boolean consistent = reasoner.isConsistent(); System.out.println("Consistent: " + consistent); String fileName="C:\Users\Word.owl"; OntModel model =ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF); InputStream in = FileManager.get().open(fileName); model.read(in, ""); System.out.println("model called sucessfully"); } }
