OWL: 许多属性中只有一个 属性 存在
OWL: only one property among many properties exists
我想在OWL中表达XSD中的xs:choice
元素:
XML Schema choice element allows only one of the elements contained in the declaration to be present within the containing element.
我想也许我应该先在OWL中定义一个属性组,然后指定只允许组中的一个属性存在。有帮助吗?
I think maybe I should first define a property group in OWL, and then
specify only one of the properties in the group is allowed exists. Any
help?
OWL 中没有 "property group" 的概念,但您可以使用子属性和不相交的属性获得类似的效果。例如,您可以有一个像这样的 属性 层次结构:
- 有车辆选择
- 有车
- 有卡车
然后,你可以声明hasCar和hasTruck是不相交的。这意味着一个人不能对两个属性具有 相同的值。这意味着你不能说:
x hasCar vechicle72
x hasTruck vechicle72
但这还不足以说明它们不能有不同的值。你仍然可以
x hasCar vechicle72
x hasTruck vechicle75
为了避免这种情况,您可以使 hasVehicleChoice 成为函数式 属性(这意味着每个人都有 0 或 1 个值,但仅此而已),或者使用有限制的子类公理,如
Person subClassOf(hasVehicleChoice 恰好为 1)
那么,每个人只能选择一种交通工具,因为 hasCar 和 hasTruck 是不相交的,所以这个人不能有两个。
综上所述,这不是 OWL 本体中的常见模式,也没有特别方便的编码方式。如果您不经常需要它,那么直接使用子类公理和 属性 限制可能会更好。例如,
Person subClassOf ((hasCar 正好是 1) and (hasTruck 正好是 0)) 或 ((hasCar 正好是 0) and (hasTruck 正好是 1))
我想在OWL中表达XSD中的xs:choice
元素:
XML Schema choice element allows only one of the elements contained in the declaration to be present within the containing element.
我想也许我应该先在OWL中定义一个属性组,然后指定只允许组中的一个属性存在。有帮助吗?
I think maybe I should first define a property group in OWL, and then specify only one of the properties in the group is allowed exists. Any help?
OWL 中没有 "property group" 的概念,但您可以使用子属性和不相交的属性获得类似的效果。例如,您可以有一个像这样的 属性 层次结构:
- 有车辆选择
- 有车
- 有卡车
然后,你可以声明hasCar和hasTruck是不相交的。这意味着一个人不能对两个属性具有 相同的值。这意味着你不能说:
x hasCar vechicle72
x hasTruck vechicle72
但这还不足以说明它们不能有不同的值。你仍然可以
x hasCar vechicle72
x hasTruck vechicle75
为了避免这种情况,您可以使 hasVehicleChoice 成为函数式 属性(这意味着每个人都有 0 或 1 个值,但仅此而已),或者使用有限制的子类公理,如
Person subClassOf(hasVehicleChoice 恰好为 1)
那么,每个人只能选择一种交通工具,因为 hasCar 和 hasTruck 是不相交的,所以这个人不能有两个。
综上所述,这不是 OWL 本体中的常见模式,也没有特别方便的编码方式。如果您不经常需要它,那么直接使用子类公理和 属性 限制可能会更好。例如,
Person subClassOf ((hasCar 正好是 1) and (hasTruck 正好是 0)) 或 ((hasCar 正好是 0) and (hasTruck 正好是 1))