關係約束(PropertyRestriction,暫且這麼翻譯吧,畢竟翻譯成“屬性約束”無論如何是不符合實際的,儘管在字面是這樣),主要分爲Existential Restrictions and Universal Restrictions.
其中ExistentialRestrictions表達的是存在性約束,即表徵某個Class具有某個Property(在這裏勉強可以將其翻譯成“屬性”,但是爲了保持一致,還是建議將其理解成“關係”),同時這個Property是作用於指定的目標(Class orIndividual)。那麼,我們就可以將Existential Restrictions理解成“To describe classes of individuals that participate in atleast one relationship along a specified property to individuals that are members of a specified class”,即至少存在一個,由此也可以看出,Existential Restrictions描述的是必要條件。
相對應的UniversalRestrictions則表達的是一種完備條件。即一個Class的Individual通過指定的Property只能與指定的目標Class中的Individual發生關係。它所表徵的不僅僅是Existential Restrictions裏面的some,而且將其限制到了only。因此它的關鍵字也因此使用only來表示。那麼,我們有“Universal restrictions describe classes of individuals that for agiven property only have relationships along this property to individuals thatare members of a specified class.”。即,存在而且必須是……由此可以看出,Universal Restrictions描述的是完備條件。
至此,貌似事情已經完成了。
可是,細心的人會發現,說好的“充分必要”還沒有出現。那麼接下來就需要說一下Necessary and Sufficient Conditions。其實對於這一條,並沒有被OWL稱爲一種Restriction,而是將其視爲一種Class。
在Manchester的官方文檔中,我們可以找到這一節“Necessary And Sufficient Conditions (Primitive and Defined Classes)”,其在文檔的Ch4.10,Page54。這一部分講述的是PrimitiveClasses和Defined Classes的區別。“A class that only hasnecessary conditions is known as aPrimitive Class.”這是Manchester官方文檔中的定義。它的意思其實很明顯,就是對於只存在Existential Restrictions的Class,只能叫Primitive Class,因爲它不是完備的。而“A classthat has at least one set of necessary and sufficientconditions is known as a Defined Class.”也就是說,充分必要條件其實是通過A Class表達的,這個Class符合Existential Restrictions(at least one, 即some),但是這個Restriction的作用對象是necessary and sufficient conditions.由此我們可以理解,Defined Class是符合充分必要條件的。
那麼如何通過那麼如何通過A Class表徵這種約束呢?OWL提供了一種不同尋常的Class,Equivalent Class。在Manchester的官方文檔中這樣介紹:
Necessary conditionsare simply called Superclasses in Protégé 4.
Necessary and sufficient conditions are called Equivalent classes.
即必要條件,其實說的是一種類似於父類的Class(注意,僅僅是類似,這個Class一般都是有NamedClass作爲其父類的,這兩個概念是不完全相同的)。而充分必要條件,則是一個與這個Class描述相當的Class,而且它有明確的Properties以及這些Properties分別作用的對象,相當於爲這個Class重新描述其定義,而且這個定義是計算機可讀的。
要生成一個EquivalentClass,可以使用Protégé的“Edit”菜單中的“Convert to defined class”項,如上圖所示。但是使用該菜單項之前,需要確定你要爲其生成Equivalent Class的Class被選中,而且已經爲其設定好了足夠的Existential Restrictions,並且他們在被同時符合的時候足以與該Class等價。