Protege - 指定 RDF 文件的主键和外键
使用 protege,我正在创建 RDF 文件。现在我想知道如何指定一个槽是给定类的主键和外键?提前致谢
Using protege, I am creating RDF file. Now I want to know to how to specify an slot is an primary and foreign keys to the given classes? Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于主键,您必须创建一个名为
owl:InverseFunctionalProperty
的属性。例如,假设类Person
有一个社会安全号码 (SSN) 的主键,那么在我们的本体中我们将有:从逻辑上讲,这意味着如果两个元素 A 和 B 的值为属性
:hasSSN
则 A 和 B 是同一个人。与外键最接近的是
ranges
,因此您可以说谓词:hasSSN
的范围是类:SSN
:Range 有效对于类和数据范围。
在 protege 中,您可以将谓词标记为 owl:InverseFunctionalProperty ,进入“对象属性”面板,有一个复选框。在它旁边,您可以添加范围和域。
For a primary key you have to have to create a property that is
owl:InverseFunctionalProperty
. For instance, imagine that the classPerson
has a primary key for the social security number (SSN) then in our ontology we would have:Logically, this means that if two elements A and B have the value for the property
:hasSSN
then A and B are the same individual.The closest thing to foreign keys are
ranges
, so you could say that the range of the predicate:hasSSN
is the class:SSN
:Range works both for classes and data ranges.
In protege, you can mark a predicate as
owl:InverseFunctionalProperty
going to the Object Properties panel, there is a checkbox for it. Right next to it you can add ranges and domains.