简体   繁体   中英

How to add new OWL entities and save the changes to OWL file itself?

I created a plugin for Protege software to add new OWL entities in OWL File. The java code works perfectly in Java IDEs and saves the changes in the OWL file. But the when I make the same changes using Protege plugin, the changes are not reflected in the OWL file.

    manager.saveOntology(ont, new OWLXMLOntologyFormat());

The above code is the one I am using. Also is there a way to fetch active ontology using OWLOntologyManager class?

OWLOntologyManager does not have a concept of active ontology - the active ontology is a Protege concept and OWLOntologyManager is an OWLAPI class. I believe the class that knows which ontology is 'active' (ie, modifiable) is OWLModelManager .

Your code is correct and should save the ontology to its original input file. However success will depend on how the ontology was opened and whether Protege has writing access to the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM