Smurf
文章50
标签0
分类6
OWL

OWL

  1. 1. 1. Introduction to Knowledge Graph Representation (II)
    1. 1.1. 1.1 Write RDF in Turtle for the part circled by the red line. All resources are defined in the namespace, and the prefix of its QName is “sw”.
    2. 1.2. 1.2 Represent the following sentence graphically by means of the blank node: Wikipedia said that Tolkien wrote Lord of the Rings.
    3. 1.3. 1.3 What can be inferred from the following triples using RDFS semantics?
    4. 1.4. 1.4 New Exercises:
      1. 1.4.1. 1.4.1 Use a RDF graph to represent the sentence “John is working in a company located in Sydney” (bland node can be considered).
      2. 1.4.2. 1.4.2 2. Does the datatype “3.14”^^xsd:string equal to “+03.14”^^xsd:string? If not, why?
  2. 2. 2. owl
    1. 2.1. 2.1 Def
    2. 2.2. 2.2 Why do we need OWL?
    3. 2.3. 2.3 What is Ontology?
      1. 2.3.1. Def:
    4. 2.4. 2.4 Details
      1. 2.4.1. 2.4.1 Equivalence between classes, individuals, and properties: 一些等价关系
      2. 2.4.2. 2.4.2 Disjointness between classes: 类别不相交关系
      3. 2.4.3. 2.4.3 Intersection of classes: 交集
      4. 2.4.4. 2.4.4 Negation of a class: 类别取反
      5. 2.4.5. 2.4.5 Property definitions: object property and data property.对属性的定义(谓词)
      6. 2.4.6. 2.4.6 Transitive property: 传递性
      7. 2.4.7. 2.4.7 Functional property:
      8. 2.4.8. 2.4.8 inverse functional property 具有反函数特性
      9. 2.4.9. 2.4.9 Symmetric property 对称特性
      10. 2.4.10. 2.4.10 Inverse relations between properties
      11. 2.4.11. 2.4.11 Constraints on properties: universal quantifier ∀任意(谓词限定词)
      12. 2.4.12. 2.4.12 Constraints on properties: existential quantifier ∃ 存在
      13. 2.4.13. 2.4.13 Constraints on properties: cardinalities 基数约束
    5. 2.5. 2.5 Exercise
      1. 2.5.1. 2.5.1
      2. 2.5.2. 2.5.2
    6. 2.6. 2.6 OWL Sub-Languages
      1. 2.6.1. OWL2

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

1. Introduction to Knowledge Graph Representation (II)

1.1 Write RDF in Turtle for the part circled by the red line. All resources are defined in the namespace, and the prefix of its QName is “sw”.

1
2
3
sw:John sw:is_a sw:professors . 
sw:John sw:has_name “John Doe” .
sw:John sw:has_id “987654321” .
1
2
3
sw:John sw:is_a sw:professors ; 
sw:has_name “John Doe” ;
sw:has_id “987654321” .

1.2 Represent the following sentence graphically by means of the blank node: Wikipedia said that Tolkien wrote Lord of the Rings.

1.3 What can be inferred from the following triples using RDFS semantics?

1
2
3
4
5
1) ex:Postgraduate_student rdfs:subClassOf ex:Student 
2) ex:Professor rdfs:subClassOf ex:Academic_staff
3) ex:Supervise rdfs:domain ex:Professor
4) ex:Supervise rdfs:range ex:Postgraduate_student
5) ex:John ex:Supervise ex:Mary
1
2
3
4
3)5) → ex:John rdf:type ex:Professor (6) 
4)5) → ex:Mary rdf:type ex:Postgraduate_student (7)
2)6) → ex:John rdf:type ex:Academic_staff
1)7) → ex:Mary rdf:type ex:Student

1.4 New Exercises:

1.4.1 Use a RDF graph to represent the sentence “John is working in a company located in Sydney” (bland node can be considered).

  • 这里的空白节点是一个实例(区别于上一题是一个三元组)

  • 不能用located in修饰company,因为这里的company只是一个概念,不是所有company都在Sydney

1.4.2 2. Does the datatype “3.14”^^xsd:string equal to “+03.14”^^xsd:string? If not, why?

Answer:不是;这是字符串形式,字符串要考虑每个character,明显两个字符串不一样。

2. owl

2.1 Def

  • A more expressive vocabulary definition language.词汇定义语言。

2.2 Why do we need OWL?

  • RDFS does not have constraints on property domain and range: 对谓词没有约束
    • For “Human”, the range of “hasChild” should be “Human”;
    • For “Elephant”, the range of “hasChild” should be “Elephant”.
  • RDFS does not have cardinality constraints: 没有一个基数约束
    • The number of “Father” for one person should be one; One person has at most two parent. (property: “hasParent”)
  • RDFS does not have descriptions on property characteristics:
    • transitivity 传递性, symmetry对称性, functionality函数性, relations to other properties (inverse, equivalence)…
  • RDFS lacks definitions on equivalence: 缺少对等价的定义
    • equivalence on individuals, classes, and properties

2.3 What is Ontology?

  • 可以理解为就是Schema。

Def:

  • formal : machine-readable 机器可理解
  • explicit : unambiguous vocabulary definitions 没有歧义
  • shared : widely accepted and reused 公认的
  • conceptualization :特定领域建模

整体理解就是一种机器可理解、清晰无歧义、公认的、特定领域建模的语言

2.4 Details

2.4.1 Equivalence between classes, individuals, and properties: 一些等价关系

1
2
3
exp:Athlete owl:equivalentClass exp:SportsPlayer . 
exp:obtain owl:equivalentProperty exp:acquire .
exp:SportsPlayerA owl:sameAs exp:Thomas .

2.4.2 Disjointness between classes: 类别不相交关系

1
exp:Man owl:disjointWith exp:Woman .

2.4.3 Intersection of classes: 交集

1
2
exp:Mother rdf:type owl:class ; 
owl:intersectionOf (exp:Woman exp:Parent) .
  • 这里括号里面可以有更多类别

2.4.4 Negation of a class: 类别取反

1
2
exp:ABC rdf:type owl:class ; 
owl:complementOf exp:Meat .

2.4.5 Property definitions: object property and data property.对属性的定义(谓词)

1
2
ex:friendOf rdf:type owl:ObjectProperty . 
ex:age rdf:type owl:DataProperty .

2.4.6 Transitive property: 传递性

1
exp:ancestor rdf:type owl:TransitiveProperty .
  • Given triples
1
2
exp:Thmoas exp:ancestor exp:Jimmy . 
exp:Jimmy exp:ancestor exp:Michael .
  • Then what can we infer from them?
1
exp:Thmoas exp:ancestor exp:Michael .

2.4.7 Functional property:

1
exp:hasMother rdf:type owl:FunctionalProperty .
  • Please explain using natural language:
    Everyone has only one mother.

  • 谓词的函数特性表示他的range取值只能有一个

2.4.8 inverse functional property 具有反函数特性

1
exp:postgraduateSupervisor rdf:type owl:InverseFunctionalProperty .
  • Please explain using natural language:

Each post-graduate student has only one supervisor.

  • 这表示谓语的定义域只能有一个

2.4.9 Symmetric property 对称特性

1
exp:friendOf rdf:type owl:SymmetricProperty .
  • Given a triple
1
exp:Thmoas exp:friendOf exp:Lisa .
  • Then what can we infer from it?
1
exp:Lisa exp:friendOf exp:Thmoas .

2.4.10 Inverse relations between properties

1
exp:ancestor owl:inverseOf exp:descendant .
  • Given a triple
1
exp:Thmoas exp:ancestor exp:Jimmy .
  • Then what can we infer from it?
1
exp:Jimmy exp:descendant exp:Thmoas .

2.4.11 Constraints on properties: universal quantifier ∀任意(谓词限定词)

1
2
3
exp:Person rdf:type owl:Restriction ; 
owl:onProperty exp:hasMother ; #表示Person可以充当hasMother的主语
owl:allValuesFrom exp:Women . #表示前一句谓语的range的取值范围
  • What do we know from the above triples?
  • If the subject of exp:hasMother comes from the class exp:Person, then the object can be only from the class exp:Women

2.4.12 Constraints on properties: existential quantifier ∃ 存在

1
2
3
exp:SemanticWebPapers rdf:type owl:Restriction ; 
owl:onProperty exp:publishedIn ;
owl:someValuesFrom exp:AAAIPapers . #存在一部分的发表在AAAIPapers
  • What do we know from the above triples?
  • If the subject of exp:publishedIn comes from the class exp:SemanticWebPapers, then the object may be (at least one) from the class exp:AAAIPapers.

  • A part of the Semantic Web papers were published in AAAI.

2.4.13 Constraints on properties: cardinalities 基数约束

1
2
3
exp:Person rdf:type owl:Restriction ; 
owl:onProperty exp:hasParent ;
owl:cardinality “2”^^xsd:integer . #限定hasParent的range只能有两个
  • Please explain using natural language:
  • Each person should have two parents.

  • cardinality也可以换成owl:maxCardinality/ owl:minCardinality,表示最多或者最少

2.5 Exercise

2.5.1

  • Please explain the following triples using natural language:
1
2
3
4
5
6
7
8
9
10
@prefix sw: <http://semanticweb.org/> 
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .

sw:Giraffe rdfs:subClassOf _:x .
_:x rdfs:subClassOf sw:Animal ;
rdf:type owl:Restriction ;
owl:onProperty sw:eat ;
owl:allValuesFrom sw:Leaf .
  • Giraffe is a kind of animal which eats leaves.

2.5.2

  • Please write the corresponding RDF triples (in Turtle) of the following sentence: “ChildlessPersons are the persons who are not parents”. Note that classes “ChildlessPerson”, “Person”, “Parent” are defined in the namespace http://semanticweb.org/ with the prefix “SW”.
1
2
3
4
5
_:x0 rdf:type owl:class;
owl:complement owl:Parent.
_:x1 rdf:type owl:class;
owl:intersectionOf (sw:Person _:x0);
owl:equivalentClass sw:ChildlessPerson.

2.6 OWL Sub-Languages

  • OWL Lite
  • OWL DL
  • OWL Full

OWL2

image-20210825194430401

本文作者:Smurf
本文链接:http://example.com/2021/08/15/knowledge%20engineering/3.%20OWL/
版权声明:本文采用 CC BY-NC-SA 3.0 CN 协议进行许可