【发布时间】:2017-03-06 17:00:52
【问题描述】:
在来自 owl-api 存储库的 the example hasProperty 中:
为了测试一个类的实例是否必须具有一个属性,我们从限制中创建一些值,然后询问与这些限制中的一些值的补码相交的类的可满足性。如果交集是可满足的,则类的实例不必具有该属性,否则,它们具有。
所以要检查一个类是否是一个对象属性的域,我可以使用下面的 sn-p:
OWLDataFactory dataFactory = manager.getOWLDataFactory();
OWLClassExpression restriction = dataFactory.getOWLObjectSomeValuesFrom(objectProperty, dataFactory.getOWLThing());
OWLClassExpression complement = dataFactory.getOWLObjectComplementOf(restriction);
OWLClassExpression intersection = dataFactory.getOWLObjectIntersectionOf(cls, complement);
boolean hasObjectProperty = !reasoner.isSatisfiable(intersection);
我想知道如何检查一个类是否是一个对象属性的范围,以及它是否是一个数据属性的域。我可以使用以下 sn-p(基于上面的示例)来检查数据属性域吗?
OWLClassExpression restriction = dataFactory.getOWLDataSomeValuesFrom(dataProperty, dataFactory.getOWLThing());
OWLClassExpression complement = dataFactory.getOWLDataComplementOf(restriction);
OWLClassExpression intersection = dataFactory.getOWLDataIntersectionOf(cls, complement);
boolean hasDataProperty = !reasoner.isSatisfiable(intersection);
【问题讨论】:
标签: rdf semantic-web owl owl-api reasoning