阅读带依赖关系的Jena OntModel

时间:2009-02-16 16:06:20

标签: java owl jena

我是本体论和耶拿的新手,所以我不确定我是否正确地说这个......

我需要将一系列连接的owl文件(通过命名空间依赖关系?)读入内存中的Jena模型(OntModel?),以便可以运行推理。我该怎么做呢?文件的顺序是否重要?我是否需要调用特定方法来“运行推理引擎”?

1 个答案:

答案 0 :(得分:2)

这就是我所做的。它似乎工作

    OntModel model = ModelFactory.createOntologyModel();
    for (OwlFile referencedOntology: referencedOntologyList) {
        model.getDocumentManager().addAltEntry( referencedOntology.getNamespace(), referencedOntology.getURI());
    }
    model.read(ontology.getURI());

OwlFile对象包含本体文件的URI及其名称空间。

referencedOntologyList包含引用的OwlFile s

列表

ontology是包含主要本体的OwlFile