Tải bản đầy đủ (.pdf) (7 trang)

Ngôn ngữ và công cụ ontolingua

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (695.8 KB, 7 trang )

1
(c) SE/FIT/HUT 2002
Bài 7 Ngôn ngữ và công cụ
Ontology

(c) SE/FIT/HUT 2002
Lịch sử Các ngôn ngữ biểu diễn
 Có nhiều kiểu ngôn ngữ khác nhau được sử dụng để
biểu diễn các ontology
• LOOM [MacGregor, 1991]
• CyCL [Lenat & Guha, 1990]
• F-Logic [Kifer, Lausen, Wu, 1995]
• Conceptual Graphs [Sowa, 1993]
• Ontolingua [Gruber, 1993] and KIF [Genesereth
&Fikes, 1992]
(c) SE/FIT/HUT 2002
Các ngôn ngữ biểu diễn
 Ngày nay có nhiều ngôn ngữ để biểu diễn các ontology hơn
• RDF-Schema [Brickley, Guha, 98]
• UML: Unified Modeling Language
• OIL: Ontology Interchange and Inference [Horrockset al.,
00]
 XOL: Ontology Exchange Language
(cf. />• XRDFS: An Extensible Framework for Modelingontologies in
RDF(S) [Staab et al., 00]
 RML - Rule Markup Language ( /> OWL - Ontology Web Language
(c) SE/FIT/HUT 2002
RDF Resource Description
Frame
 RDF là mô hình đơn giản để mô tả các đối tượng
bằng bộ ba: Đối tượng - Thuộc tính - Giá trị


(c) SE/FIT/HUT 2002
RDF
Mô hình RDF không thể đủ cho dữ liệu lớn, có
nhiều mối quan hệ
(c) SE/FIT/HUT 2002
RDFS (RDF Schema)
 Do số lượng các khái niệm rất lớn, có nhiều mối
quan hệ nên đặt ra yêu cầu xây dựng thành từng
lớp > Xây dựng Ontology
 RDFS dựa trên RDF để định nghĩa tập các lớp và
thuộc tính
 Định nghĩa lớp
<rdfs:Class rdf:ID="Photo">
<rdfs:subClassOf rdf:resource=
" /></rdfs:Class>
2
(c) SE/FIT/HUT 2002
Định nghĩa thuộc tính
RDFS
<rdf:Property rdf:ID="PersonInPhoto">
<rdfs:subPropertyOf
rdf:resource="#objectInPhoto"/>
<rdfs:domain rdf:resource="#Photo"/>
<rdfs:range rdf:resource="#Person"/>
</rdf:Property>
(c) SE/FIT/HUT 2002
Định nghĩa 1cá thể
RDFS
<Person rdf:ID="JoeBlog">
<firstName>Joe</firstName>

<lastName>Blog</lastName>
<age>24</age>
<edu:degreeEarned>PhD</edu:degreeEarned
>
</Person>
(c) SE/FIT/HUT 2002
OWL (Web Ontology Language)
 Được xây dựng từ RDFS và RDF bằng cách đưa
thêm nhiều từ khoá để mô tả chi tiết hơn mối
quan hệ
 Dựa trên ngôn ngữ DAML + OIL
 Chia làm 3 mức: OWL Lite, OWL DL, OWL Full
(c) SE/FIT/HUT 2002
XML/DTD/XML Schemas
OWL
Syntax
Semantics
XML/DTD/XML Schemas
RDF Schema
OWL
Syntax
Semantics
(c) SE/FIT/HUT 2002
Ontology sử dụng OWL là gì ?
 Ontology là một tập hợp các định nghĩa về ngữ nghĩa
xung quanh một lĩnh vực(domain) nào đó.
 OWL là một tập các phần tử và thuộc tính
XML(elements and attributes) đã được chuẩn hoá
dùng để định nghĩa nên các khái niệm và quan hệ
giữa chúng. OWL được mở rộng từ RDF schema.

(c) SE/FIT/HUT 2002
Định nghĩa lớp
OWL cung cấp các cú pháp để định nghĩa các
lớp
 <owl:Class rdf:ID = “Person” />

Lớp con của một lớp
 <owl:Class rdf:ID = “BenhNhan” />
<owl:SubClassOf rdf:resource = “#Person”
/>
</owl:Class>

Trong OWL một lớp có thể được định
nghĩa là một tập của các cá thể
(Individual)
 Owl cung cấp các phép toán như: hợp,
giao, bù trong thao tác với lớp
3
(c) SE/FIT/HUT 2002
Khai báo các thuộc tính
 Mỗi lớp trong Owl đều có các thuộc
tính của nó
 Mỗi thuộc tính đều có giá trị
 Có hai loại thuộc tính
 Thuộc tính kiểu Literal : String, int,
….
 Thuộc tính kiểu Object
 Mỗi thuộc tính đều có Domain và
Range
 Domain: chỉ ra thuộc tính thuộc về

lớp nào
 Range: miền giá trị của thuộc tính
(c) SE/FIT/HUT 2002
Khai báo các thuộc tính
 Trong Owl có sự kế thừa giữa các lớp do đó
các lớp con sẽ mang đầy đủ các thuộc tính của
lớp cha
 Trong mỗi lớp có thể định nghĩa giới hạn lại
Range của thuộc tính cụ thể nào đó
 Có các kiểu thuộc tính sau
 Symmetric propety: thuộc tính kiểu đối
xứng
 Traisitive Property: thuộc tính kiểu bắc cầu
 Functional Property: thuộc tính duy nhất
 Inverse Property: thuộc tính kiểu đảo ngược
 Inverse Funtional Property
(c) SE/FIT/HUT 2002
 DataProperty
<owl:DatatypeProperty rdf:ID="length">
<rdfs:domain rdf:resource="#River"/>
<rdfs:range
rdf:resource=" />gativeInteger"/>
</owl:DatatypeProperty>
 ObjectProperty
<owl:ObjectProperty rdf:ID="emptiesInto">
<rdfs:domain rdf:resource="#River"/>
<rdfs:range rdf:resource="#BodyOfWater"/>
</owl:ObjectProperty>
(c) SE/FIT/HUT 2002
Ưu điểm OWL so với Database

 Mềmdẻo(Extensible): VớiOWLdễ dàng hơn
nhiều khi thêm một thuộc tính mới. Còn
DataBase nếư bạn thêm một cột mới, có thể sẽ
ảnh hưởng tới các Application khác.
 Linh động(Portable): dễ di chuyển1tài liệuOWL
hơn là di chuyển DataBase
 Phù hợp với thế giới thực, bởi ở thế giới thực mọi
thứ có thể bị thay đổi.
(c) SE/FIT/HUT 2002
Ưu điểm của Ontology OWL
 OWL sử dụng cú pháp củaXMLmô tả ngữ nghĩa
 Các Tools thông thường củaXMLcóthể sử dụng
cho OWL
 XSLT, XML APIs (SAX, DOM), XQuery,
(c) SE/FIT/HUT 2002
Khắc phục nhược điểm của
XML
XML
app#1
Semantics: Code
to interpret(giải thích) the data
Action: Code to
process the data
app#2
Semantics: Code
to interpret the data
Action: Code to
process the data
XML
app#1

Action: Code to
process the data
app#2
Action: Code to
process the data
OWL Document
Semantic Definitions
4
(c) SE/FIT/HUT 2002
Hạn chế của các ngôn ngữ trước đây.
<SLR rdf:ID="Olympus-OM-10"
xmlns="#">
<lens>
<Lens>
<focal-length>75-300mm
zoom</focal-length>
<f-stop>4.5-5.6</f-stop>
</Lens>
</lens>
<body>
<Body>
<shutter-speed
rdf:parseType="Resource">
<min>0.002</min>
<max>1.0</max>
<units>seconds</units>
</shutter-speed>
</Body>
</body>
<cost rdf:parseType="Resource">

<rdf:value>325</rdf:value>
<currency>USD</currency>
</cost>
</SLR>
<Camera xmlns:rdf=" />rdf-syntax-ns#"
xmlns="#">
<lens>
<Lens>
<size>75-300mm zoom</size>
<aperture>4.5-5.6</aperture>
</Lens>
</lens>
<body>
<Body>
<shutter-speed rdf:parseType="Resource">
<min>0.002</min>
<max>1.0</max>
<units>seconds</units>
</shutter-speed>
</Body>
</body>
</Camera>
(c) SE/FIT/HUT 2002
Ví dụ ta có kịch bản sau:
 Camera Application đang tìm kiếm
những document thỏa mãn yêu cầu
với những đặc điểm quan trọng sau:
 “I am interested in purchasing a
Camera with a 75-300mm zoom
lens size, that has an aperture of

4.5-5.6, and a shutter speed that
ranges from 1/500 sec. to 1.0 sec”.
(c) SE/FIT/HUT 2002
Mô hình hệ thống
ApplicationInput Data
OWL
Output Data
(c) SE/FIT/HUT 2002
Ví dụ: Xây dựng Demo Camera Ontology
Ontology(. OWL)
Camera
Camera
Application
Hunts.xml
OWL
Genie
(c) SE/FIT/HUT 2002
Truy vấnnàycóthể biểudiễnbằng XML:
<Camera xmlns:rdf=" />xmlns="#">
<lens>
<Lens>
<size>75-300mm zoom</size>
<aperture>4.5-5.6</aperture>
</Lens>
</lens>
<body>
<Body>
<shutter-speed rdf:parseType="Resource">
<min>0.002</min>
<max>1.0</max>

<units>seconds</units>
</shutter-speed>
</Body>
</body>
</Camera>
(c) SE/FIT/HUT 2002
Ta có một tài liệu
<PhotographyStore rdf:ID="Hunts"
xmlns:rdf=" /><store-location>Malden, MA</store-location>
<phone>617-555-1234</phone>
<catalog rdf:parseType="Collection">
<SLR rdf:ID="Olympus-OM-10"
xmlns="#">
<lens>
<Lens>
<focal-length>75-300mm zoom</focal-length>
<f-stop>4.5-5.6</f-stop>
</Lens>
</lens>
<body>
<Body>
<shutter-speed rdf:parseType="Resource">
<min>0.002</min>
<max>1.0</max>
<units>seconds</units>
</shutter-speed>
</Body>
</body>
<cost rdf:parseType="Resource">
<rdf:value>325</rdf:value>

<currency>USD</currency>
</cost>
</SLR>
</catalog>
</PhotographyStore>
A Web Bot is launched to
find camera info. The Bot
finds this document at a
Web site:
5
(c) SE/FIT/HUT 2002
A Match?
Match?
<PhotographyStore rdf:ID="Hunts"
xmlns:rdf="&rdf;#">
<store-location>Malden, MA</store-location>
<phone>617-555-1234</phone>
<catalog rdf:parseType="Collection">
<SLR rdf:ID="Olympus-OM-10"
xmlns="#">
<lens>
<Lens>
<focal-length>75-300mm zoom</focal-length>
<f-stop>4.5-5.6</f-stop>
</Lens>
</lens>
<body>
<Body>
<shutter-speed rdf:parseType="Resource">
<min>0.002</min>

<max>1.0</max>
<units>seconds</units>
</shutter-speed>
</Body>
</body>
<cost rdf:parseType="Resource">
<rdf:value>325</rdf:value>
<currency>USD</currency>
</cost>
</SLR>
</catalog>
</PhotographyStore>
<Camera xmlns:rdf=" />xmlns="#">
<lens>
<Lens>
<size>75-300mm zoom</size>
<aperture>4.5-5.6</aperture>
</Lens>
</lens>
<body>
<Body>
<shutter-speed rdf:parseType="Resource">
<min>0.002</min>
<max>1.0</max>
<units>seconds</units>
</shutter-speed>
</Body>
</body>
</Camera>
(c) SE/FIT/HUT 2002

Relationship?
<SLR rdf:ID="Olympus-OM-10"
xmlns="#">
<lens>
<Lens>
<focal-length>75-300mm zoom</focal-length>
<f-stop>4.5-5.6</f-stop>
</Lens>
</lens>
<body>
<Body>
<shutter-speed rdf:parseType="Resource">
<min>0.002</min>
<max>1.0</max>
<units>seconds</units>
</shutter-speed>
</Body>
</body>
<cost rdf:parseType="Resource">
<rdf:value>325</rdf:value>
<currency>USD</currency>
</cost>
</SLR>
<Camera xmlns:rdf=" />xmlns="#">
<lens>
<Lens>
<size>75-300mm zoom</size>
<aperture>4.5-5.6</aperture>
</Lens>
</lens>

<body>
<Body>
<shutter-speed rdf:parseType="Resource">
<min>0.002</min>
<max>1.0</max>
<units>seconds</units>
</shutter-speed>
</Body>
</body>
</Camera>
Chi tiết
(c) SE/FIT/HUT 2002
Database = Ontology + Instances
My Life and Times
Illusions
First and Last Freedom
Paul McCartney
Richard Bach
J. Krishnamurti
June, 1998
1972
1974
title
author
date
BookCatalogue
<owl:Class rdf:ID="BookCatalogue"/>
<owl:DatatypeProperty rdf:ID="title">
<rdfs:domain rdf:resource="#BookCatalogue"/>
<rdfs:range rdf:resource="&xsd;#string"/>

</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:ID="author">
<rdfs:domain rdf:resource="#BookCatalogue"/>
<rdfs:range rdf:resource="&xsd;#string"/>
</owl:DatatypeProperty>
<owl:DatatypeProperty rdf:ID="date">
<rdfs:domain rdf:resource="#BookCatalogue"/>
<rdfs:range rdf:resource="&xsd;#date"/>
</owl:DatatypeProperty>
<?xml version=“1.0”?>
<BookCatalogue>
<title>My Life and Times</title>
<author>Paul McCartney</author>
<date>June, 1998</date>
</BookCatalogue>
(c) SE/FIT/HUT 2002
Các Tool xây dựng Ontology
 OntoEdit
 Protégé-2000 Ontology Editor
 Text-To-Onto
 Asium
(c) SE/FIT/HUT 2002
Protégé-2000 Ontology
Editor
(c) SE/FIT/HUT 2002
C. Xây dựng Ontology của hệ thống
 Trong hệ thống này chúng ta sẽ xây dựng
Ontology mô tả quá trình khám chữa bênh
của bệnh nhân
 Tất cả các đối tượng như Bệnh Nhân, Bác

Sĩ, Hồ sơ bệnh án, Bệnh đều được tạo
thành các lớp trong các file OWL riêng biệt
 Các lớp này có sự kế thừa lẫn nhau
 Giao diện và Database cũng được định
nghĩa sẵn trong Ontology
6
(c) SE/FIT/HUT 2002
Thiết kế hệ thống Ontology
 Quy trình xây dựng
(c) SE/FIT/HUT 2002
Thiết kế hệ thống Ontology
 Phương pháp luận
 Xác định lĩnh vực và phạmvicủa
Ontology
 Tái sử dụng Ontology
 Xác định các khái niệm quan trọng
 Định nghĩa các lớp và cấu trúc phân cấp
 Xác định các thuộc tính cho các lớp
 Xác định các giá trị cho các thuộc tính
(c) SE/FIT/HUT 2002
Thiết kế hệ thống Ontology
 Mô hình tổng quan
 Mô hình chi tiết
 Person Ontologies
 Document Ontologies
 Medicine Ontologies
 Organization Ontologies
(c) SE/FIT/HUT 2002
Resource
Person Documents Organization Medicine

Top-Level
Middle-Level
Bottom-Level
Patient
Provider
Xét
nghiệm
Khoa Thuốc
Đơn
thuốc
Hội
chứng
Thể hiện
Triệu
Chứng
Individu
al
Individu
al
Individu
al
Khái niệm(C)
Cá thể (I)
Quan hệ cha -con
Quan hệ ràng buộc
Quan hệ khái niệm–thực thể
(c) SE/FIT/HUT 2002
Person & Organization
Ontologies
Person

Patient Provider
Nurse Doctor Physician
Organization
Department
Medicine
Action
(c) SE/FIT/HUT 2002
Documents Ontologies
Document
Đơn thuốc
Nhập viện Xuất viện
Phiếu khám Bệnh lịch
Chuyển Khoa/Viện
Phiếu xét nghiệm
Hoá đơn
Thuốc
Medicine
Daily Note
Indiviual
Indiviual
Xét nghiệm
Indiviual Indiviual
7
(c) SE/FIT/HUT 2002
Medicine Ontologies
Medicine
Action
Bệnh án
Nhóm thuốc
Hội chứng Nhóm triệu chứng

Triệu chứng
Thể hiệnBệnhNhóm xét nghiệm
Xét nghiệm
Ảnh
Thuốc
Indiviual Indiviual
Indiviual

×