You are on page 1of 8

RDF( Resources Description Framework) Nn tng ca web ng ngha Ban u Web c to ra con ngi thao tc: c, hiu...

.. Mc d my c th c c mi th trn Web, nhng n khng hiu c d liu trn Web. Gii php c a ra l dng meta data m t d liu trn web my c th hiu c chng. Meta data l mt dng d liu dng m t d liu khc. Hay ni cch khc meta data l nhng thng tin m t ti nguyn trn web. Chng hn nh, sch l mt loi ti nguyn trn web ( http://www.amazon.com/Spring.htm), khi cc thng tin m t cho ti nguyn ny: tn tc gi, tn ta sch, ngy xut bn,... chnh l meta data. RDF l nn tng ca Semantic Web, l linh hn ca Semantic Web v x l meta data. RDF cho php trao i thng tin gia cc ng dng trn Web m my c th hiu c. Nu XML cung cp c php m ha d liu, th RDF l mt c cu ch ra iu g v d liu. Nh tn gi, RDF l mt m hnh biu din d liu v mi th trn web. Mi th y chnh l cc ti nguyn trong RDF vocabulary. M hnh d liu c s ca RDF th n gin, bn cnh ti nguyn (resources) RDF cn cha thuc tnh (properties) v cu pht biu (statements). Mt property m mt kha cnh, tnh cht, thuc tnh, hay mi lin h m t cho mt ti nguyn. Mt statament bao gm mt ti nguyn ring bit, mt thuc tnh c t tn, v gi tr thuc tnh cho ti nguyn . Gi tr ny c bn c th l mt ti nguyn khc hay mt gi tr mang tnh ngha en (literal value) hay dng text ty (free text). RDF s dng URI xc nh cc ti nguyn. RDF m t cc ti nguyn bng cc thuc tnh v gi tr ca thuc tnh. V d v vic s dng RDF

M t thuc tnh ca cc sn phm trong shop, v d nh gi, cn hng hay khng M t lch trnh cho cc s kin web M t thng tin v trang web M t ni dung v nh gi cho nhng hnh nh ca web M t ni dung cho Search engines M t th vin in t

... M hnh RDF M hnh c bn ca RDF gm ba i tng sau:

Ti nguyn (Resources): l tt c nhng g c m t bng biu tc RDF. N c th l mt trang Web, v d nh http://www.ptit.edu.vn/giao-vu.htm , cng c th l mt phn ca trang Web, hoc l mt tp cc trang Web... Thuc tnh (Properties): thuc tnh, c tnh, hoc quan h dng m t tnh cht ca ti nguyn. Pht biu (Statements): mi pht biu gm 3 phn: Subject (Ti nguyn): a ch hay v tr ti nguyn mun m t, thng thng th y l chui nh URL hoc URI. Prediacate( V ng): xc nh tnh cht ca ti nguyn. Object (B ng): ni dung gn cho thuc tnh.

Mi mt pht biu (subject, predicate, object) cn gi l mt b ba (triple). V d: http://www.example.org/index.html has a creator whose value is John Smith Pht biu trn c phn ra thnh cc phn sau: Subject Predicate Object http://www.example.org/index.html http://purl.org/dc/elements/1.1/creator http://www.example.org/staffid/85740

Pht biu trn c biu din di dng mt tripple nh sau:


<http://www.example.org/index.html> <http://purl.org/dc/elements/1.1/creator> <http://www.example.org/staffid/85740>

th RDF (RDF Graph)


Tp cc triple hp li to thnh th RDF( RDF Graph). Cc node trong th c th l cc subject v object trong triple v cc cung (arc) trong th l cc predicate. Cho nn mt triple cn c th c m t di dng node-arc-node. Hng ca th rt quan trng. Cung ca th lun bt u t subject n object.
Subject

Predicate

Object

V d: Ta c cc pht biu sau cho cng mt subject http://www.example.org/index.html has a creation-date whose value is August 16, 1999 http://www.example.org/index.html has a language whose value is English

c phn ra thnh cc thnh phn sau: Subject http://www.example.org/index. html Predicate http://purl.org/dc/elements/1. 1/creator Object http://www.example.org/staffid /85740

http://www.example.org/index. http://www.example.org/term August 16, 1999 html s/creation-date http://www.example.org/index. html http://purl.org/dc/elements/1. 1/language En

Lc ny cc pht biu c biu din di mt th nh sau:

http://example.org/index.html http://www.example.org/terms/creation-date http://purl.org/dc/elements/1.1/creator

http://purl.org/dc/elements/1.1/language

August 16,1999

http://www.example.org/staffid/85740

EN

Cu trc RDF/XML
RDF da trn c php XML. V d : Xt pht biu ex:index.html exterms:creation-date "August 16, 1999" . C php RDF/XML biu din cho pht biu trn nh sau: 1. <?xml version="1.0"?>

2. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 3. xmlns:exterms="http://www.example.org/terms/"> 4. <rdf:Description rdf:about="http://www.example.org/index.html"> 5. <exterms:creation-date>August 16, 1999</exterms:creation-date> 6. </rdf:Description> 7. </rdf:RDF> Trong : Dng 1: l khai bo XML, cho bit ni dung theo sau da trn c php XML v phin bn XML c dng. Dng 2 v 3: bt u vi th rdf:RDF , cho bit rng ni dung XML tip theo m t RDF. T kha ny xc nh ti liu ny c biu din di dng RDF. Tip theo l phn khai bo XML namespace c s dng trong ti liu, ty vo nhu cu v mc ch s dng m ta c th dng cc namespace khc nhau cho tng ti liu. Dng 4, 5, 6: m t nhng mnh RDF. m t bt k pht biu no dng RDF/XML c th dng rdf:Description, v rdf:about , y chnh l subject ca pht biu. Th bt u rdf:Description trong dng 4 cho bit bt u m t v mt resource, v tip tc nh danh resource ny dng thuc tnh rdf:about ch ra URI ca subject resource. Dng 5 cung cp 1 phn t thuc tnh, vi Qname exterms:creationdate nh l th ca n. Ni dung ca phn t thuc tnh ny l object ca statement, c gi tr l kiu plain literal August 19, 1999 . Dng 7: cho bit kt thc ca th rdf:RDF bt u dng 2 v cng l th kt thc ca ti liu RDF. Trong ti liu RDF, tt c cc phn t c tip u ng l rdf c dng m t ti nguyn. Chng s dng mt khng gian tn c t chc W3C qui nh: http://www.w3.org/1999/02/22-rdf-syntax-ns v d trn ta ch m t ti liu cho mt pht biu n gin, vi mt ti liu gm nhiu pht biu, vic m t n cng tht s n gin: V d: ex:index.html ex:index.html ex:index.html exterms:creation-date dc:language dc:creator August 16,1999" . "en" . exstaff:85740

C php RDF c m t nh sau: <?xml version="1.0"?>

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:exterms="http://www.example.org/terms/"> <rdf:Description rdf:about="http://www.example.org/index.html"> <exterms:creation-date>August 16, 1999</exterms:creation-date> </rdf:Description> <rdf:Description rdf:about="http://www.example.org/index.html"> <dc:language>en</dc:language> </rdf:Description> <rdf:Description rdf:about="http://www.example.org/index.html"> <dc:creator rdf:resource="http://www.example.org/staffid/85740"/> </rdf:Description> Nh vy vi mt pht biu ta c th dng t kha rdf:Description m t cho n. Tuy nhin ta thy 3 pht biu trn c cng mt subject (http://www.example.org/index.html) nn ta c th gp 3 pht biu ny li vi nhau dng mt th rdf:Description chung nh sau: 1. <?xml version="1.0"?> 2. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 3. 4. 5. 6. 7. 8. 9. xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:exterms="http://www.example.org/terms/"> <rdf:Description rdf:about="http://www.example.org/index.html"> <exterms:creation-date>August 16, 1999</exterms:creation-date> <dc:language>en</dc:language> <dc:creator rdf:resource="http://www.example.org/staffid/85740"/> </rdf:Description>

10. </rdf:RDF>

V d: Ngha, Lan, Hng, t, Linh l sinh vin nm th t khoa Cng ngh thng tin, Hc vin Cng ngh Bu chnh Vin thng. Ngha ang hc mn cng ngh phn mm. Lan v Hng ang hc mn tr tu nhn to. Ti liu ca mn hc cng ngh phn mm l cun sch Introduction to software engineering ca Schach. Ti liu ca mn hc tr tu nhn to l cun Artificial Intelligence cu Russell v Norvig. Ngha c im mn Vi x l v Lp trnh C l 9. Lan v Hng c im Vi x l v Lp trinh C l 5, t v Linh c im Tng tc ngi my l 5 <?xml version="1.0"?> <rdf:RDF xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:s= "http://ptit.edu.vn/students #" xmlns:tl= "http://ebook.com#" xmlns:monhoc= "http://ptit.edu.vn/monhoc#"> <rdf:Description rdf:about="http://ptit.edu.vn/courses/2008"> <s:students> <rdf:Bag> <rdf:li rdf:resource= "http://ptit.edu.vn/students/Nghia"/> <rdf:li rdf:resource="http://ptit.edu.vn/students/Lan"/> <rdf:li rdf:resource="http://ptit.edu.vn/students/Hung"/> <rdf:li rdf:resource="http://ptit.edu.vn/students/Dat"/> <rdf:li rdf:resource="http://ptit.edu.vn/students/Linh"/> </rdf:Bag> </s:students> </rdf:Description> <rdf:Description rdf:about= "http://ptit.edu.vn/monhoc/cnpm"> <monhoc:student>Nghia</monhoc:student>

<monhoc:tailieu>Introduction to software engineering</monhoc:tailieu> </rdf:Description> <rdf:Description rdf:about= "http://ebook.com/Introductiontosoftwareengineering"> <tl:tacgia>Schach</tl:tacgia> </rdf:Description> <rdf:Description rdf:about= "http://ptit.edu.vn/monhoc/ttnt"> <monhoc:student>Lan,Hung</monhoc:student> <monhoc:tailieu>Artificial Intelligence</monhoc:tailieu> </rdf:Description> <rdf:Description rdf:about = "http://ebook.com/ArtificialIntelligence"> <tl:tacgia>Russell, Norvig</tl:tacgia> </rdf:Description> <rdf:Description rdf:about= "http://ptit.edu.vn/students/Nghia"> <s:monhoc>Vi xu ly, Lap trinh</s:monhoc> <s:diem>9</s:diem> </rdf:Description> <rdf:Description rdf:about="http://ptit.edu.vn/students"> <s:student>Lan, Hung</s:student> <s:monhoc>Vi xu ly, Lap trinh </s:monhoc> <s:diem>5 </s:diem> </rdf:Description> </rdf:RDF>

Biu din Graph

http://ptit.edu.vn /courses/2008

http://ptit.edu.vn/students#students

http://ptit.edu.vn/students /Nghia

Nghia

Lan

Hung

You might also like