您在这里面临的挑战是,您基本上需要对Role 和Location 为SalaryRange 设置一个唯一约束。功能属性实际上是为单个属性定义的 - 除非您通过类表达式对某些功能属性进行建模。
实现此目的的一种简单方法(如果您使用的是 OWL)是通过键约束。我努力理解你的例子。因此,我进一步简化了您的示例,假设您有一个 SalaryRange ,其中 Role 和 Location 需要是唯一的。我认为,如果您了解总体思路,您将能够对其进行修改以完全适合您的示例。
我们有您定义的 Location 和 Role 类。
<owl:Class rdf:about="Location"/>
<owl:Class rdf:about="Role"/>
然后我定义了对象属性role和location如下:
<owl:ObjectProperty rdf:about="location">
<rdfs:domain rdf:resource="SalaryRange"/>
<rdfs:range rdf:resource="Location"/>
</owl:ObjectProperty>
<owl:ObjectProperty rdf:about="role">
<rdfs:domain rdf:resource="SalaryRange"/>
<rdfs:range rdf:resource="Role"/>
</owl:ObjectProperty>
然后为确保SalaryRange 将具有唯一的角色和位置,您可以按如下方式强制执行:
<owl:Class rdf:about="SalaryRange">
<owl:hasKey rdf:parseType="Collection">
<rdf:Description rdf:about="location"/>
<rdf:Description rdf:about="role"/>
</owl:hasKey>
</owl:Class>
您可以与以下人员进行测试:
<owl:NamedIndividual rdf:about="location1">
<owl:sameAs rdf:resource="location2"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="location2"/>
<owl:NamedIndividual rdf:about="role1">
<owl:sameAs rdf:resource="role2"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="role2"/>
<owl:NamedIndividual rdf:about="salaryRange1">
<location rdf:resource="location1"/>
<role rdf:resource="role1"/>
</owl:NamedIndividual>
<owl:NamedIndividual rdf:about="salaryRange2">
<location rdf:resource="location2"/>
<role rdf:resource="role2"/>
</owl:NamedIndividual>
对于这些人,像 Hermit 这样的推理者会推断出 salaryRange1 和 salaryRange2 是同一个人。但是,如果您声明 salaryRange1 和 salaryRange2 是不同个人,则会出现不一致。
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AllDifferent"/>
<owl:distinctMembers rdf:parseType="Collection">
<rdf:Description rdf:about="salaryRange1"/>
<rdf:Description rdf:about="salaryRange2"/>
</owl:distinctMembers>
</rdf:Description>
要解决不一致的问题,您可以声明 role1 和 role2 是不同的个体,或者 location1 和 location2 是不同的个体。