简体   繁体   English

OWL类和子类属性继承

[英]OWL Class and Subclass Property Inheritance

I have a confusion about OWL class and subclass property inheritance. 我对OWL类和子类属性继承感到困惑。 Some posts are saying there is no inheritance in OWL ( OWL: How to get inheritance of property relations between two classes from those of superclasses? , http://answers.semanticweb.com/questions/619/rdfs-owl-inheritance-with-josekipellet ). 有些帖子说OWL中没有继承( OWL:如何从超类的两个类之间继承属性关系?http://answers.semanticweb.com/questions/619/rdfs-owl-inheritance-with -josekipellet )。 However, I have found some opposite discussion as well. 但是,我也发现了一些相反的讨论。 For example "A Semantic Web Primer for Object-Oriented Software Developers" page ( https://www.w3.org/TR/sw-oosd-primer/ ) mentioned that for both object-oriented language, OWL & RDF: "Classes can be arranged in a subclass hierarchy with inheritance" (section 3.3). 例如,“面向对象软件开发人员的语义Web入门”页面( https://www.w3.org/TR/sw-oosd-primer/ )提到,对于面向对象语言,OWL和RDF:“类可以在具有继承的子类层次结构中排列“(第3.3节)。 https://www.w3.org/TR/rdf-schema/#ch_subclassof mentioned that "The property rdfs:subClassOf is an instance of rdf:Property that is used to state that all the instances of one class are instances of another." https://www.w3.org/TR/rdf-schema/#ch_subclassof提到“属性rdfs:subClassOf是rdf:Property的一个实例,用于声明一个类的所有实例都是另一个类的实例。 “ Hence, it is confusing to me. 因此,这对我来说很困惑。 Now I have following questions: 现在我有以下问题:

  • Like object-oriented language, is rdfs:subclassOf inherits property from super class? 像面向对象语言一样,rdfs:subclassOf是否从超类继承属性?
  • If not then 如果没有那么

    • What is the meaning of inheritance in RDF/OWL? RDF / OWL中继承的含义是什么?
    • Is it possible to construct object-oriented language type class-subclass inheritance with OWL/RDF? 是否可以使用OWL / RDF构造面向对象的语言类型类 - 子类继承?
    • Consider following example. 考虑以下示例。 Are all the properties of "Lecturer" and "Student" will be available to "Person" class? “讲师”和“学生”的所有属性是否可用于“人”类?

       Example: -------- ### Classes ### :CSModule rdf:type owl:Class ; rdfs:subClassOf :Module . :Lecturer rdf:type owl:Class ; rdfs:subClassOf :Person . :Student rdf:type owl:Class ; rdfs:subClassOf :Person . :Module rdf:type owl:Class . :Person rdf:type owl:Class . ### Object Properties ### :studies rdf:type owl:ObjectProperty ; rdfs:domain :Student ; rdfs:range :Module . :teaches rdf:type owl:ObjectProperty ; rdfs:domain :Lecturer ; rdfs:range :Module . ### Data properties ### :name rdf:type owl:DatatypeProperty ; rdfs:domain :Person ; rdfs:range xsd:string . :staffID rdf:type owl:DatatypeProperty ; rdfs:domain :Lecturer ; rdfs:range xsd:integer . :studentID rdf:type owl:DatatypeProperty ; rdfs:domain :Student ; rdfs:range xsd:integer . ### Individuals ### :CS101 rdf:type owl:NamedIndividual , :CSModule . :Lecturer1 rdf:type owl:NamedIndividual , :Lecturer ; :teaches :CS101 ; :name "Dr.John" ; :staffID 7777 . :Student1 rdf:type owl:NamedIndividual , :Student ; :studies :CS101 ; :name "James" ; :studentID 1234 . 

If someone provide me an answer with a good example that will be very helpful. 如果有人给我一个答案,并提供一个非常有用的好例子。 Thank you in advance. 先感谢您。

Like object-oriented language, is rdfs:subclassOf inherits property from super class? 像面向对象语言一样,rdfs:subclassOf是否从超类继承属性?

To say that the domain of property p is the class D means that when you have a triple 要说属性p的域是D类意味着当你有一个三元组时

x p y

you can infer the triple 你可以推断三重奏

x rdf:type D

There's no notion of inheritance of a property. 没有遗产继承的概念。 If you know that E is a subclass of D, and you see the triples 如果你知道E是D的子类,你会看到三元组

e p y  
e rdf:type E  
E rdfs:subClassOf D

you now have two ways to know that e rdf:type D . 你现在有两种方法可以知道e rdf:D型 The first is because epy implies e rdf:type D . 第一个是因为epy意味着e rdf:D型 The second is because you know that e is an E and E is a subclass of D, e is also a D. 第二个是因为你知道e是E而E是D的子类,e也是D.

What is the meaning of inheritance in RDF/OWL? RDF / OWL中继承的含义是什么?

Classes in RDF and OWL are sets. RDF和OWL中的类是集合。 When you know that E is a subclass of D, it means that every element of E is an element of D; 当你知道E是D的子类时,它意味着E的每个元素都是D的元素; that is, the set of individuals of E is a subset of the set of individuals of D. 也就是说,E的个体集是D的个体集的子集。

Similarly for properties. 同样对于属性。 If q is a subproperty of p, it means that xqy implies xpy . 如果q是p的子属性,则意味着xqy意味着xpy

Is it possible to construct object-oriented language type class-subclass inheritance with OWL/RDF? 是否可以使用OWL / RDF构造面向对象的语言类型类 - 子类继承?

It's not really clear what you mean here. 你在这里的含义并不是很清楚。 You'd need to specify exactly what you mean by OO-langueg type class-subclass inheritance. 您需要准确指定OO-langueg类型类 - 子类继承的含义。 You get a lot of the same behaviors. 你会得到很多相同的行为。 Eg, if you know that every instance of D has a particular, then you know that every instance of E does, too, by virtue of the fact that every instance of E is an instance of DEg, if you have 例如,如果您知道D的每个实例都有特定的,那么您知道E的每个实例也会因为E的每个实例都是 DEg的实例,如果您有

D SubClassOf (hasColor some Color)

then you can infer that 然后你可以推断出来

E SubClassOf (hasColor some Color)

so in that sense there's inheritance. 所以从这个意义上来说就是继承。

Consider following example. 考虑以下示例。 Are all the properties of "Lecturer" and "Student" will be available to "Person" class? “讲师”和“学生”的所有属性是否可用于“人”类?

"Available" might be misleading. “可用”可能会产生误导。 There's no sense in which properties are available or not available to a class (ie, to the individuals in a class). 对于一个类(即类中的个体)可用或不可用的属性没有任何意义。 If you have a hierarchy like: 如果您的层次结构如下:

Lecturer rdfs:subClassOf Person  
teachesCourse rdfs:domain Lecturer
teachesCourse rdfs:range Course

that means that when you see a triple 这意味着当你看到一个三联

Jones teachesCourse Calculus

you can infer that 你可以推断出来

Jones rdf:type Lecturer  
Jones rdf:type Person  
Calculus rdf:type Course

The property teachesCourse is "available" to every Person, in a sense, but as soon as it is used, it means that that Person must be a Lecturer. 在某种意义上,财产教授课程对每个人都是“可用的”,但是一旦使用它,就意味着该人必须是讲师。 That's really pretty similar to what you'd have in an object oriented programming language, isn't it? 这与你在面向对象编程语言中的表现非常相似,不是吗? Eg, if you have in Java: 例如,如果你有Java:

class Person { }

class Lecturer {
  Course[] getCourses() { /* ... */ }
}

then there can be instances of Person that have a getCourses() method. 然后可能存在具有getCourses()方法的Person实例。 It just happens that those instances of Person must be instances of Lecturer , too. 碰巧那些Person的实例也必须是Lecturer的实例。

I'll try and answer some of your questions 我会尝试回答你的一些问题

What is the meaning of inheritance in RDF/OWL? RDF / OWL中继承的含义是什么?
Inheritance in owl works a bit differently than it does in Object-Oriented languages. owl中的继承与面向对象语言中的继承有点不同。 We can think of it in terms of set theory. 我们可以用集合论来思考它。 Owl classes basically denote sets of individuals. 猫头鹰类基本上表示一组个人。 Properties are then used to specify facts about individuals. 然后使用属性来指定有关个人的事实。 So when you "define" a property on an owl class, you are basically saying that individuals of that class have that property (all or some depending on how a property was defined). 因此,当您在owl类上“定义”一个属性时,您基本上是说该类的个体具有该属性(全部或部分取决于属性的定义方式)。
From the post you linked : 从您链接的帖子:
"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" “Subclass表示一个类是另一个类的子集,这意味着一个暗示(通过推理)是一个子类的所有成员都是(超级)类的成员”

Thus if you say a class is a subclass of another, it basically means that any properties on the individuals of the superclass(super-set) can be on individuals of the subclass(sub-set) 因此,如果你说一个类是另一个类的子类,它基本上意味着超类(超集)的个体上的任何属性都可以在子类(子集)的个体上

From your own example, you ask : 从你自己的例子中,你会问:
Are all the properties of "Lecturer" and "Student" will be available to "Person" class? “讲师”和“学生”的所有属性是否可用于“人”类?
Well no, since you have defined Lecutrer and Student to be sub classes (sub-sets) of the class (set) Person. 不,因为你已经将Lecutrer和Student定义为类(集)Person的子类(子集)。 Basically, every Student or Lecturer is a Person but not vice-versa. 基本上,每个学生或讲师都是一个人,但反之亦然。 Thus properties defined on Person can be used by Lecturer and Student. 因此,人员定义的属性可以由讲师和学生使用。

Is it possible to construct object-oriented language type class-subclass inheritance with OWL/RDF 是否可以使用OWL / RDF构造面向对象的语言类型类 - 子类继承
Well yes, but it is a bit difficult. 是的,但是有点困难。 This is all made a bit more murky because of the open world assumption. 由于开放的世界假设,这一切都变得更加模糊。

Hopefully this clears up your confusion a bit. 希望这有点清除你的困惑。 I would recommend playing with an ontology and reasoner to see how these assertions actually behave. 我建议使用本体和推理器来查看这些断言的实际行为。 There is a lot of interesting behavior (partially rooted in DL but mainly due to the open world assumption). 有很多有趣的行为(部分植根于DL,但主要是由于开放世界的假设)。 Protege is an excellent tool for this. Protege是一个很好的工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM