开发者

Protege - Specifying primary key and foregin key for RDF file

Using protege, I am cr开发者_高级运维eating 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


For a primary key you have to have to create a property that is owl:InverseFunctionalProperty. For instance, imagine that the class Person has a primary key for the social security number (SSN) then in our ontology we would have:

:hasSSN  rdf:type  owl:InverseFunctionalProperty .

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:

:hasSSN  rdfs:range :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.

Protege - Specifying primary key and foregin key for RDF file

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜