0
在the examplehasProperty
從OWL-API庫:測試一個OWL類是否是一個屬性的域/範圍
要測試一個類的實例是否必須有一個屬性,我們創建限制的一些值然後詢問該類別的可滿足性,以及來自限制的這些一些值的補充。如果交叉點是可滿足的,那麼類的實例不必擁有該屬性,否則就是這樣。
所以要檢查,如果一個類的對象屬性的一個領域,我可以用波紋管的片段:
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);
我想知道如何檢查,如果一個類是對象的範圍屬性,並且如果它是數據屬性的域。我可以使用下面的代碼片段(基於上面的例子)來檢查數據屬性域嗎?
OWLClassExpression restriction = dataFactory.getOWLDataSomeValuesFrom(dataProperty, dataFactory.getOWLThing());
OWLClassExpression complement = dataFactory.getOWLDataComplementOf(restriction);
OWLClassExpression intersection = dataFactory.getOWLDataIntersectionOf(cls, complement);
boolean hasDataProperty = !reasoner.isSatisfiable(intersection);