你的意思不是所谓的“属性”,而是前缀声明。下次,最好提供一些如何加载/保存本体的代码:
OWLOntologyFormat format = manager.getOntologyFormat(YOUR_FIRST_ONTOLOGY);
// save the merged ontology in RDF/XML format
RDFXMLDocumentFormat newFormat = new RDFXMLDocumentFormat();
// will copy the prefixes over so that we have nicely abbreviated IRIs
// in the new ontology document
if (format.isPrefixOWLOntologyFormat()) {
newFormat.copyPrefixesFrom(format.asPrefixOWLOntologyFormat());
}
manager.saveOntology(YOUR_MERGED_ONTOLOGY, newFormat, IRI.create(file.toURI()));
复制本体注释:
manager.applyChanges(
ontology1.getAnnotations().stream()
.map(an -> new AddOntologyAnnotation(mergedOntology, an))
.collect(Collectors.toList()));
关于本体的合并,使用现有方法要容易得多:
Set<OWLOntology> ontologies = ...
OWLOntology mergedOntology = manager.createOntology(mergedOntologyIRI, ontologies, false);
或者直接使用这个类
org.semanticweb.owlapi.util.OWLOntologyMerger
...