Knowledge Representation Part V RDF The representational power of three. Jan Pettersen Nytun, UiA 1
S O P RDF - The Resource Description Framework A Framework For Describing Resources “Resources can be anything, including documents, people, physical objects, and abstract concepts .” [3] Jan Pettersen Nytun, UiA, Ontologies, page 2
S O P The Semantic Web Language Stack Hierarchy of languages, where each layer exploits and uses capabilities of the layers below. / XML Schema Jan Pettersen Nytun, UiA, Ontologies, page 3
S O P Ag Agen enda da • Semantic Networks and Triples • RDF and Triples • Representing RDF with XML • Representing RDF with Turtle • Protégé - Turtle Example Jan Pettersen Nytun, UiA, Ontologies, page 4
S O P Associationist • … meaning of an object is given in terms of a network of associations with objects …perception mapped into a concept which is connected through relationships to other concepts. • Graphs (arcs and nodes) are ideal vehicle for formalizing associationist theories of knowledge. Example: Semantic networks. Jan Pettersen Nytun, UiA, Ontology, page 5
S O P Semantic Networks Represents knowledge in the form of a graph where: - the nodes correspond to facts or concepts - the arcs correspond to relations or associations between the concepts BreastCanser hasSickness hasDiagnosis Christine DiagnosisId_1 hasDiagnosisProbability High Jan Pettersen Nytun, UiA, Ontology, page 6
S O P The use of triples for representation. Example: <Christine, hasDiagnosis, DiagnosisId_1> < DiagnosisId_1, hasSickness, BreastCanser> < DiagnosisId_1, hasDiagnosisProbability, High> BreastCanser hasSickness hasDiagnosis Christine diagnosis_id_1 hasDiagnosisProbability High Jan Pettersen Nytun, UiA, Ontology, page 7
S O P <sub ubject> ject> < <pr pred edicat icate> e> < <ob objec ject> t> A tr triple ple is say aying ng som omet ethin hing g (ob e) , , object ject/valu /value) ab about out some ometh thing ing (s bject) , , (subject in n reg egard ard to to so some meth thing ing (p e/property) . (predicat redicate/property Jan Pettersen Nytun, UiA, Ontology, page 8
S O P Graphical Representation of Triples In general: predicate subject object Example: <NursingReport_1, hasPatient, Kenny> hasPatient NursingReport_1 Kenny Jan Pettersen Nytun, UiA, Ontology, page 9
S O P Ag Agen enda da • Semantic Networks and Triples • RDF and Triples • Representing RDF with XML • Representing RDF with Turtle • Protégé - Turtle Example Jan Pettersen Nytun, UiA, Ontologies, page 10
S O P The Conceptual model of RDF • Triples • Semantic networks Jan Pettersen Nytun, UiA, Ontology, 11
S The following UML class model has been instantiated O P when the object diagram was made: teachIn follows * * Student Course Teacher * * participant taughtBy -courseId -studentId -teacherId -name -name Task: How to represent the following object diagram as triples graphically (and textually). s1:Student c1:Course t1:Teacher studentId = 101 teacherId = 1 courseId = IKT413 name = Ola name = Kari s2:Student studentId = 102 name = Olga Jan Pettersen Nytun, UiA, Ontology, page 12
s1:Student c1:Course t1:Teacher Student studentId = 101 teacherId = 1 courseId = IKT413 name = Ola name = Kari rdf:type s1 rdf:type Student . s2:Student s1 studentId 101 . t1 studentId = 102 name = Olga s1 name “Ola” . teacherId = 1 s1 follows c1 . Name = “Kari” …. participant s1 taughtBy rdf:type follows studentId = 101 c1 Name = “Ola” Student follows studentId = 101 Name = “Ola” rdf:type s2 rdf:type studentId = 102 participant Teacher Name = “Olga”
S O P RDF Triple [7] • An RDF triple contains: – the subject - an RDF URI reference or a blank node – the predicate - an RDF URI reference – the object - an RDF URI reference, a literal (string, number, etc.) or a blank node Jan Pettersen Nytun, UiA, Ontology, 14
S O P Agen enda da • Semantic Networks and Triples • RDF and Triples • Representing RDF with XML • Representing RDF with Turtle • Protégé - Turtle Example Jan Pettersen Nytun, UiA, Ontologies, page 15
S XML - Used as Representational O P Language[6] <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:si ="http://www.w3schools.com/rdf/"> <rdf:Description rdf:about="http://www.w3schools.com"> <si:title>W3Schools.com</si:title> <si:author>Jan Egil Refsnes</si:author> </rdf:Description> </rdf:RDF> Knowledge Representation Part I, JPN, UiA 16
S O P [8]: "there is a Person identified by http://www.w3.org/People/EM/contact#me , whose name is Eric Miller, whose email address is em@w3.org, and whose title is Dr." <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:contact="http://www.w3.org/2000/10/swap/pim/contact#"> <contact:Person rdf:about="http://www.w3.org/People/EM/contact#me"> <contact:fullName>Eric Miller</contact:fullName> <contact:mailbox rdf:resource="mailto:em@w3.org"/> <contact:personalTitle>Dr.</contact:personalTitle> </contact:Person> </rdf:RDF> 17
S Blank Node (Anonymous Resource) O P From Wikipedia In RDF, a blank node (also called bnode ) is a node in an RDF graph representing a resource for which a URI or literal is not given. <foaf:Person rdf:about="http://example.org/Person#John"> <foaf:knows> <foaf:Person rdf:nodeID="b1"/> </foaf:knows> </foaf:Person> <foaf:Person rdf:about="http://example.org/Person#Mary"> <foaf:knows> <foaf:Person rdf:nodeID="b1"/> </foaf:knows> </foaf:Person> Jan Pettersen Nytun, UiA, Ontologies, page 18
S O P Agen enda da • Semantic Networks and Triples • RDF and Triples • Representing RDF with XML • Representing RDF with Turtle • Protégé - Turtle Example Jan Pettersen Nytun, UiA, Ontologies, page 19
S Terse Language for Triples O P Turtle RDF/XML is the originally unique syntax and standard for writing RDF. Turtle is an alternative. Turtle does not rely on XML and is more readable and easier to edit manually than its XML counterpart. Jan Pettersen Nytun, UiA, Ontologies, page 20
S O P A triple is written simply as: Subject Predicate Object . • A URI is often written within angle brackets, e.g., 〈 http://aispace.org 〉 . • The URI 〈〉 refers to the current document, e.g., 〈 #comp_2347 〉 denotes an individual defined in the current document. Jan Pettersen Nytun, UiA, Ontologies, page 21
S O P Example 〈 #comp_2347 〉 〈 #owned_by 〉 〈 #craig 〉 . 〈 #comp_2347 〉 〈 #model 〉 〈 #lemon_laptop_10000 〉 . 〈 #comp_2347 〉 〈 #brand 〉 〈 #lemon_computer 〉 . 〈 #comp_2347 〉 〈 #logo 〉 〈 #lemon_disc 〉 . 〈 #comp_2347 〉 〈 #color 〉 〈 #brown 〉 . 〈 #craig 〉 〈 #room 〉 〈 #r107 〉 . … Jan Pettersen Nytun, UiA, Ontologies, page 22
S O Turtle Abbreviations P A semicolon is used to group predicate-object pairs for the same subject . S P 1 O 1 ; P 2 O 2 . is an abbreviation for S P 1 O 1 . S P 2 O 2 . E.g.: 〈 #comp_3645 〉 〈 #owned_by 〉 〈 #fran 〉 ; 〈 #color 〉 〈 #green 〉 . equals: 〈 #comp_3645 〉 〈 #owned_by 〉 〈 #fran 〉 . 〈 #comp_3645 〉 〈 #color 〉 〈 #green 〉 . Jan Pettersen Nytun, UiA, Ontologies, page 23
S O P Turtle Abbreviations Continues… A comma can group objects with the same subject and predicate . S P O1, O2 . is an abbreviation for S P O1 . S P O2 . E.g.: 〈 #comp_3645 〉 〈 #color 〉 〈 #green 〉 , 〈 #yellow 〉 . equals: 〈 #comp_3645 〉 〈 #color 〉 〈 #green 〉 . 〈 #comp_3645 〉 〈 #color 〉 〈 #yellow 〉 . Jan Pettersen Nytun, UiA, Ontologies, page 24
S O P Turtle Abbreviations Continues… Square brackets can be used to define an individual that is not given an identifier, i.e., a blank node . [P 1 O 1 ; P 2 O 2 ] is an individual that has value O 1 on property P 1 and has value O 2 on property P 2 . Jan Pettersen Nytun, UiA, Ontologies, page 25
S Anonymous individual O P (blank node) - example: 〈 comp_3645 〉 〈 #managed_by 〉 [ 〈 #occupation 〉 〈 #sys_admin 〉 ]. Equals: 〈 comp_3645 〉 〈 #managed_by 〉 〈 i2134 〉 . 〈 i2134 〉 〈 #occupation 〉 〈 #sys_admin 〉 . the made-up URI, 〈 i2134 〉 , cannot be referred to outside the document. As we can see, the anonymous individual can be used as the object of a triple. Jan Pettersen Nytun, UiA, Ontologies, page 26
Recommend
More recommend