在Eclipse中使用OWL API检索单个的数据属性 [英] Retrieve Data Properties of An Individual using OWL API in eclipse

查看:709
本文介绍了在Eclipse中使用OWL API检索单个的数据属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检索使用猫头鹰API的类的个人设置的所有数据属性。在code我用的是

I want to retrieve all data properties set for an individual of any class using owl api. The code i have used is

OWLNamedIndividual inputNoun = df.getOWLNamedIndividual(IRI.create(prefix + "Cow"));


            for (OWLDataProperty prop: inputNoun.getDataPropertiesInSignature())
            {
               System.out.println("the properties for Cow are " + prop);    //line 1
            }

这code。与成功,但1号线打印什么都没有编译。应该是什么正确的语法。已经彻底一派,无法找到任何东西值得。

This code compiles with success but line 1 print nothing at all. What should be the correct syntax. Have thoroughly googled and couldnt find any thing worth it.

推荐答案

OWLNamedIndividual :: getDataPropertiesInSignature()不返回该个人有填料的特性,返回出现在对象本身的属性。对个人而言,这是通常是空的。该方法是 OWLObject 接口,这包括像类和属性前pressions和本体的东西,因为它有一个更为有用的输出上。

OWLNamedIndividual::getDataPropertiesInSignature() does not return the properties for which the individual has a filler, it returns the properties that appear in the object itself. For an individual this is usually empty. The method is on the OWLObject interface, which covers things like class and property expressions and ontologies, for which it has a more useful output.

如果你想用一个实际的填充单个数据属性,使用 OWLOntology :: getDataPropertyAssertionAxioms(OWLIndividual),就像这样:

If you want the data properties with an actual filler for an individual, use OWLOntology::getDataPropertyAssertionAxioms(OWLIndividual), like this:

OWLNamedIndividual input = ...
Set<OWLDataPropertyAssertionAxiom> properties=ontology.getDataPropertyAssertionAxioms(input);
for (OWLDataPropertyAssertionAxiom ax: properties) {
    System.out.println(ax.getProperty());
}

这篇关于在Eclipse中使用OWL API检索单个的数据属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆