问题
Let's say we have two classes named People
and Disease
. These classes are related by the Object Property has
.
:People :has :Disease
People
has subclass (or individual) John
, and Disease
has subclass (or individual) Cancer
.
:John a :People
:Cancer a :Disease
How can we get the relationship between these subclasses by inference?
:John :has :Cancer
回答1:
Before you can get to an answer, there are a number of misconceptions you'll need to resolve.
First, subclass and individual are very different concepts. Individuals (instances) are members of classes. Subclass denotes a class is a subset of another class, meaning that an implication (via inference) is that all members of a subclass are members of the (super)class. (Just for reference: there is no concept of inheritance in OWL.)
Second class-level properties, such as :People :has :Disease
have no meaning for class individuals. The way to define a property's relationships to classes is to set the domain and range of the property. (Just using :has
as a property name indicates a wide set of misconceptions, possibly from other types of languages.) So I'd suggest the name :hasDisease
and the assertions:
:hasDisease rdfs:domain :People .
:hasDisease rdfs:range :Disease .
Third, you can assert that :John :hasDisease :Cancer
and infer that John has a disease, given that :Cancer
is a subclass of :Disease
. This requires a standard RDFS reasoner. Also, given the domain and range definitions above, and an assertion :Joy :hasDisease :Gout
, an RDFS reasoner will infer that :Joy a :Person
and :Gout a :Disease
.
There are a few OWL primers out there that you can find via Google. I'd suggest going over some of these to get a basic understanding of how OWL and reasoning profiles work.
来源:https://stackoverflow.com/questions/37141784/owl-how-to-get-inheritance-of-property-relations-between-two-classes-from-those