4.1.Use the Reasoner
先来看两张图:
这两幅图是从Manchester的官方文档中采用的介绍样例使用Reasoner前后的层次关系图(Ch4.13, Page68)。我们可以很清楚地看出使用Reasoner可以推理Class之间蕴含的Hierarchy,或者说usethe reasoner to automatically compute the superclass-subclass relationship(subsumption relationship)。
这里关于Reasoner的原理,就不说了,毕竟水平有限。对于这一部分,知道如何使用Reasoner是必须的,只是在推理的过程中,如果一些Restrictions、或者Axioms设定出问题的话,那么Reasoner要么直接抛出错误,在左侧的“Class Hierarchy”窗体中以红色字体显示存在错误的Class。但是Reasoner也不是万能的,前面说过,由于Domain和Range设定错误引起的与实际相悖的约束,Reasoner不一定能够发现,那么能够得到的和可能只是一个Unexpected Result,而不是一个红色字体表示的错误。
使用Protégé提供的Reasoner可以单击“Reasoner”菜单,在弹出的下拉菜单中点击“Start Reasoner”。如果使用旧版本的Protégé,那么应该单击“Classify...”,只是名字变了而已,不要在意这些细节。对于4.3版本的Protégé,如果发现没有Pellet,那么可以通过“File”->“Checkfor plugins…”,添加新的Reasoner。
4.2.ClosureAxioms
A closure axiom on a property consists of a universalrestriction that acts along the property to say that it can only be filled bythe specified fillers. The restriction has a filler that is the union of thefillers that occur in the existential restrictions for the property. Forexample, the closure axiom on the hasTopping property for MargheritaPizza is a universalrestriction that acts along the hasTopping property, with a fillerthat is the union of MozzarellaTopping and also TomatoTopping.
上面的文字是拷贝自Ch4.13.1, Page64的原文,因为我感觉没有合适的翻译能够将这段话的意思表述出来。正如上面这段话说的,Closure Axioms表达的是一种UniversalRestricion,这个Restriction通过指定的Property,作用于指定的fillers,而且这个filler是由该Class的Existential Restrictions的union(并集)。
这个操作可以通过选择这个Class生成Closure Axiom的ExistentialRestrictions,然后在它们上面右键,在弹出的菜单中,点击“Create closure axiom”,如下图所示:
由此,在该类的“Equivalent To”中可以看到其变化。当然,也可以使用手动的方法,直接编辑“Equivalent To”中的Equivalent Class来实现,但是这种tedious work如果还用这种手动的方法,岂不是很tedious,相信能make sb. Crazy吧?。
4.3.ValuePartions
Value Partitions are not partof OWL, or any other ontology language, they are a ‘design pattern’.
正如上面这句话所说的,Value Partitions并不是OWL的一部分,但是作为一种“设计模式”,它可以对频繁出现的问题进行建模,这和面向对象的程序设计有点相似。在本体中采用这种方式,对于精简(refine)本体有很大帮助。
Value Partitions通过建立Class为多次出现的对象描述建模,例如为Pizza的辛辣口味建模,并且为其设定Subclasses: Hot, Medium, Mild. 这样便可以用实际上并不是我们关心的Class来描述目标Class的属性。具体操作方法请见Manchester官方文档的Ch4.14, Page68.
4.4.CardinalityRestrictions
其实这一部分本应写到前面的,毕竟这个本质上还是Restriction,但是Manchester官方文档中将其放到了后面介绍,这里也就暂且按照文档的顺序来吧。
根据其名字可以看出,这个约束条件是针对Class的Property的基数的约束,类似于some和only,这里的CardinalityRestrictions分为max和min以及exactly。但是CardinalityRestrictions仅对数量进行限制,并不关心该Property作用的范围。即在设定Cardinality Restrictions时,会是这样:
hasTopping min 3
当然,在最新版的Protégé里,会自动将其转换成:
hasTopping min 3 Thing
这种转换其实更加具体地描述了Cardinality Restrictions,即该约束对于hasTopping这个Property,不论其作用到那个Class均可,而所有的Class都是“Thing”的直接或者间接SubClass。
4.5.QualifiedCardinality Restrictions
那么如果想为某个Class添加一条约束,并且令其作用于特定的对象上呢?那么Qualified Cardinality Restrictions便是答案了。例如:
hasTopping exactly 4 CheeseTopping
这边意味着,受该约束限制的Class只能对CheeseTopping产生4个hasTopping的Property实例,即Relationships,不能多也不能少。由此也可以推理出具有这些特征的其他Class,并推理他们之间的Class Hierarchy,如下图: