Documente Academic
Documente Profesional
Documente Cultură
Curs 8
Modelul cunostintelor structurate
Retele semantice
Unitati
Web semantic
Description logics elemente de baza
OWL - exemple
2
1. Modelul RETELELOR
SEMANTICE
Gruparea in entitati
Radu
Ocupatie (radu, student)
Trimite (radu, ioana, scrisoare)
Adresa (radu, luterana - 15)
Ioana
Ocupatie (ioana, eleva)
Trimite (radu, ioana, scrisoare)
Radu
Ocupatie: student
Adresa: luterana-15
Ioana
Ocupatie: elev
Radu
ISA:
Persoana
student
Adresa: luterana-15
Ocupatie:
Ioana
ISA:
Persoana
Ocupatie: elev
T1
ISA:
Eveniment-trimitere
Expeditor: Radu
Destinatar: Ioana
Obiect: scrisoare
Eveniment-trimitere
AKO:
Eveniment
Expeditor:
Persoana
Destinatar: Persoana
ClasaObiect
Obiect:
Persoana
AKO: Fiinta
Ocupatie: (student, elev, inginer)
Adresa: string
9
culoare
are
poate
aripi
zbura
galben
(a)
Eveniment
student
Ocupatie
Adresa
Radu
AKO
Eveniment-trimitere
luterana-15
ISA
ISA
Expeditor
T1
Persoana
Destinatar
Obiect
scrisoare
Ioana
(b)
ISA
Ocupatie
elev
12
Forma
Consistenta
AKO
Piramida
Caramida
ISA
ISA
Piramida18
mare
Caramida12
Forma
dreptung
Perspective
Cub
ISA
ISA
Cub12
Scop
sustine
Perspectiva
de structura
Scop
joaca
Jucarie
ISA
Perspectiva
de jucat
Cadou
ISA
Perspectiva
de daruit
Scop
placere
Fatete
Caramida
ISA
Caramida12
Culoare
ISA
rosie
Caramida0
Culoare
alba
Strategia N
Algoritm: Strategia N de determinare a valorii unui
atribut
Algoritmul determina valoarea unui atribut
al unei instante O utilizind strategia N.
DetValN (O, A, V)
1. daca DetVal (O,A,V) = SUCCES
atunci intoarce SUCCES
2. daca DetValImp (O,A,V) = SUCCES
atunci intoarce SUCCES
3. daca DetProcNec (O,A,V) = SUCCES
atunci intoarce SUCCES
4. intoarce INSUCCES
sfarsit.
Strategia Z
Algoritm: Strategia Z de determinare a valorii unui
atribut.
Algoritmul determina valoarea unui atribut
unei instante O utilizind strategia Z.
DetValZ (O, A, V)
1. Formeaza o lista L cu nodul O si toate nodurile
de O prin relatia ISA
2. cat timp L != [ ] executa
2.1. Elimina primul nod, N, din lista L
2.2. daca fateta valoare a atributului A a
este V
atunci
2.2.1. Depune V in nodul punctat de
atributul A al obiectului O
2.2.2. intoarce SUCCES
A al
legate
nodului N
2. Modelul Unitatilor
Retele semantice
Unitati
AKO
SuperClasses
SubClasses
ISA
MemberOf
24
25
Sloturi
Tipuri de sloturi
sloturi membru - MemberSlot - descriu
atributele fiecarul membru al clasei
sloturi proprii - OwnSlot - descriu atributele
ce caracterizeaza clasa ca un intreg
26
Unit Camion
SuperClasses: Vehicul
SubClasses: CamionMare, CamionMediu, CamionMic
MemberOf: ObiecteFizice
Unit CamionMare
SuperClasses: Camion
SubClasses: CamionMareRosu, CamionMareRemorca
Unit CamionMareRosu
SuperClasses: CamionMare
MemberSlot: Sofer
Value: necunoscut
MemberSlot: Inaltime
Value: necunoscut
MemberSlot: Culoare
Value: rosie
MemberSlot: Pret
Value: necunoscut
OwnSlot: CelMaiMare
Value: CMR10
OwnSlot: CelMaiScump
27
Value: CMR210
Unit CMR1
MemberOf: CamionMareRosu, ProprietateFirmaX
OwnSlot: Sofer
Value: Paul
OwnSlot: Inaltime
Value: 1.75
OwnSlot: Culoare
Value: rosie
OwnSlot: Pret
Value: 30 000
OwnSlot: Proprietar
Value: X
Unit CMR2
MemberOf: CamionMareRosu
OwnSlot: Sofer
Value: Tudor
OwnSlot: Inaltime
Value: 1.80
OwnSlot: Culoare
Value: rosie
28
OwnSlot: Pret
Fatete
Unit CamionMareRosu
SuperClasses: CamionMare
MemberSlot: Sofer
Value: necunoscut
/*fateta valoare */
ValueClass: Persoana
/*fateta domeniu de
unitatea Persoana */
Cardinality: 2
/*fateta numar de valori;
soferi posibili */
Default: Paul /*fateta valoare implicita*/
Restrict: (oneof Paul, Tudor, Gelu, Mihai, Barbu)
/*fateta de descriere a restrictiei */
MemberSlot: Inaltime
Value: necunoscut
ValueClass: real
Cardinality: 1
Restrict: X.Inaltime > 1.50
MemberSlot: Culoare
Value: rosie
ValueClass: string
Cardinality: 1
Comment: "Culoarea tuturor membrilor unitatii"
/*fateta comentariu */
valori; indica
un camion poate avea doi
AKO (SuperClasses)
Unit Pasare
Slot: Zboara
Value: da
Unit Strut
Slot: Zboara
Value: nu
ISA (MemberOf)
AKO (SuperClasses)
Unit PasareZoo
Unit Fifi
Slot: Zboara
Value: necunoscut
ISA (MemberOf)
Probleme
Zboara Fifi?
AKO
Unit Pasare
Slot: Zboara
Value: da
Unit Strut
Slot: Zboara
Value: nu
AKO
AKO
Unit StrutPenat
Unit PasareZoo
AKO
Unit StrutPenatAlb
ISA
Cea mai mica
distanta inferentiala
Probleme
Unit Fifi
Slot: Zboara
Value: necunoscut
ISA
Zboara Fifi? nu
Algoritm:
Mostenirea atributelor bazata pe distanta inferentiala
Algoritmul determina valoarea V a slotului S al unitatii U
1. Formeaza o lista L cu unitatea U si toate unitatile legate de U
relatia MemberOf
2. Formeaza o lista de candidati CAND = [ ]
3. cat timp L != [ ] executa
3.1. Elimina prima unitate, X, din lista L
3.2. daca slotul S al lui X are valoare
atunci CAND = CAND {X}
3.3. altfel adauga in lista L toate unitatile legate de X prin
SuperClass
4. pentru fiecare unitate C CAND executa
4.1. Verifica daca exista un alt element C CAND cu o
inferentiala fata de U mai mica decat cea a lui C
4.2. daca C' exista
atunci elimina C din CAND
prin
relatia
distanta
3. Web semantic
40
Web semantic
Semantic Web
Necesita o reprezentare a continutului
Semantica cum reprezentam?
Adnotari
Conventii asupra semnificatiei adnotarilor
Utilizarea ontologiilor pt a specifica adnotarile
Vocabular de termeni
Noi termeni care se formeaza din cei
exsitenti + relatii intre termeni
Semantica specificata formal
3.1 Ontologie
3.2 RDF
XML
Specifica un arbore al documentului
Nu identifica continutul documentului
Un literal este
O valoare (string, integer, ..)
Nu i se poate da o descriere
Exista literali cu tip: sirul + referinta URI la o XML Schema care
descrie tipul
RDF
RDF
areColeg
Io
n
Miha
i
Io
n
areColeg
areColeg
Irina
Miha
i
arePaginaPersonala
http://www.cs.pub.ro/~mihai
RDF Schema
47
RDF Schema
Class
Property
type
subClassOf
range
domain
48
Inferences: classication of
concepts - subconcept/superconcept relationships
(subsumption)
individuals - whether a given individual is always an
49
instance of a concept
Description Logics
A
DL
system
TBox the terminology, i.e., the vocabulary of an application domain
= concepts (set of individuals) + roles
ABox assertions about named individuals in terms of this vocabulary
TBox
Description
Language
Reasoning
ABox
KB
Application
Programs
Rules
51
Example of TBox
Woman Person Female
Man Person Woman
Mother Woman hasChild.Person
Father Man hasChild.Person
Parent Father Mother
Grandmother Mother hasChild.Parent
MotherWithManyChildren Mother
MotherWithoutDaughter Mother
hasChild.Woman
Wife Woman
3 hasChild
hasHusband.Man
52
Example of ABox
Woman Person Female
Man Person Woman
Mother Woman hasChild.Person
Father Man
hasChild.Person
Woman(mary)
Man(tom)
Father(peter)
hasChild(mary, peter)
hasChild(peter, harry)
hasChild(mary, paul)
53
54
56
3 hasChild
Mother(mary)
hasChild(mary, bob)
hasChild(mary, hellen)
hasChild(mary, tom)
MotherWithManyChildren(mary)?
2. DL Language
Elementary descriptions:
atomic concepts (A,B)
atomic roles (R)
Complex descriptions of concepts (C,D)
concept constructors, or of roles role
constructors
Basic language Attribute Language AL
Description languages are distinguished by
the constructors they provide (syntactic rules
of concept formation)
58
Different extensions of AL
Syntax
C, D A |
T |
|
A |
C D
AL
R.C
R.T
C D
ALU
R.C
ALE
C |
ALC
nR
ALN
nR
AL[U][E][N][C]
(atomic concept)
(universal concept)
(bottom concept)
(atomic negation)
|
|
|
|
|
(intersection)
(value restriction)
(limited existential quantification)
(union)
(full existential quantification)
(negation of concepts)
(number restrictions)
59
Examples
Atomic concepts: Pers, Fem
Atomic role: hasChild
Pers Fem
Pers
Fem
Pers hasChild.T
Pers hasChild.
Pers hasChild.Fem
60
Semantics
Interpretation I is a tuple I = (I , I)
where
I- the domain of the interpretation ( a set)
I - an interpretation function (a mapping) that
maps (assigns)
names of objects (individuals) to elements of I
names of atomic concept (A) to subsets of I
( AI I )
Names of atomic roles (R) a binary relation
RI I x I
61
62
Semantics
The interpretation function is extended to concept
definitions by the following inductive definitions:
Pers
hasChild.Fem
hasChild.T
Pers
63
Semantics
Pers
hasChild.Fem
Fem
3 hasChild
Pers
Fem
64
3. Terminologies (TBox)
TBox
Example of TBox
Woman Person Female
Man Person Woman
Mother Woman hasChild.Person
Father Man hasChild.Person
Parent Father Mother
Grandmother Mother hasChild.Parent
MotherWithManyChildren Mother
MotherWithoutDaughter Mother
hasChild.Woman
Wife Woman
3 hasChild
hasHusband.Man
67
5. Reasoning services in DL
69
3.3 OWL
OWL
Clase
<owl:Class rdf:ID="Student"/>
<owl:Class rdf:ID="Department"/>
<owl:Class rdf:ID="Course"/>
Indivizi
<Department rdf:ID="CS"/>
Proprietati
<owl:ObjectProperty rdf:ID="takes">
<rdfs:domain rdf:resource="#Student"/>
<rdfs:range rdf:resource="#Course"/>
</owl:ObjectProperty>
71
Clase OWL
Cum se construieste o clasa?
(a) Prin specificarea unui nume de clasa
<owl:Class rdf:ID="Student"/>
Clase OWL
Clase OWL
<owl:ObjectProperty rdf:ID="urmeaza">
<rdfs:domain rdf:resource="#Student"/>
<rdfs:range rdf:resource="#Curs"/>
</owl:ObjectProperty>
<owl:Restriction>
<owl:onProperty rdf:resource="#urmeaza"/>
<owl:minCardinality
rdf:datatype="&xsd;nonNegativeInteger"> 1
</owl:minCardinality>
</owl:Restriction>
Clasa Student
<owl:Class rdf:about="Student">
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#urmeaza"/>
<owl:minCardinality
rdf:datatype="&xsd;nonNegativeInteger">
1
</owl:minCardinality>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
75
Clasa StudentBun
<owl:Class rdf:ID="StudentBun">
<owl:IntersectionOf rdf:parseType="Collection">
<rdfs:Class rdf:about="#Student"/>
<owl:Restriction>
<owl:onProperty rdf:resource="#urmeaza"/>
<owl:minCardinality
rdf:datatype="&xsd;nonNegativeInteger">
3
</owl:minCardinality>
<owl:maxCardinality
rdf:datatype="&xsd;nonNegativeInteger">
5
</owl:maxCardinality>
</owl:Restriction>
</owl:IntersectionOf>
</owl:Class>
76
77