简体   繁体   English

如何添加新的OWL实体并将更改保存到OWL文件本身?

[英]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. 我为Protege软件创建了一个插件,以在OWL File中添加新的OWL实体。 The java code works perfectly in Java IDEs and saves the changes in the OWL file. Java代码可在Java IDE中完美运行,并将更改保存在OWL文件中。 But the when I make the same changes using Protege plugin, the changes are not reflected in the OWL file. 但是当我使用Protege插件进行相同的更改时,这些更改不会反映在OWL文件中。

    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类获取活动的本体?

OWLOntologyManager does not have a concept of active ontology - the active ontology is a Protege concept and OWLOntologyManager is an OWLAPI class. OWLOntologyManager没有活动本体的概念-活动本体是Protege概念,而OWLOntologyManager是OWLAPI类。 I believe the class that knows which ontology is 'active' (ie, modifiable) is OWLModelManager . 我相信知道哪个本体是“活动的”(即,可修改的)的类是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. 但是,成功将取决于打开本体的方式以及Protege是否具有对该文件的写入权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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