Knowledge Representation Part V RDF The representational power













![S P O RDF Triple[7] • An RDF triple contains: – the subject - S P O RDF Triple[7] • An RDF triple contains: – the subject -](https://slidetodoc.com/presentation_image/402f5b6f7763963f08f7592620fd3327/image-14.jpg)

![S P O XML - Used as Representational Language[6] <? xml version="1. 0"? > S P O XML - Used as Representational Language[6] <? xml version="1. 0"? >](https://slidetodoc.com/presentation_image/402f5b6f7763963f08f7592620fd3327/image-16.jpg)
![S P O [8]: "there is a Person identified by http: //www. w 3. S P O [8]: "there is a Person identified by http: //www. w 3.](https://slidetodoc.com/presentation_image/402f5b6f7763963f08f7592620fd3327/image-17.jpg)








![S P O Anonymous individual (blank node) - example: �comp_3645� �#managed_by� [�#occupation� �#sys_admin�]. Equals: S P O Anonymous individual (blank node) - example: �comp_3645� �#managed_by� [�#occupation� �#sys_admin�]. Equals:](https://slidetodoc.com/presentation_image/402f5b6f7763963f08f7592620fd3327/image-26.jpg)









![S P O References [1] Book: David Poole and Alan Mackworth, Artificial Intelligence: Foundations S P O References [1] Book: David Poole and Alan Mackworth, Artificial Intelligence: Foundations](https://slidetodoc.com/presentation_image/402f5b6f7763963f08f7592620fd3327/image-36.jpg)
- Slides: 36

Knowledge Representation Part V RDF The representational power of three. Jan Pettersen Nytun, Ui. A 1

S P O 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, Ui. A, Ontologies, page 2

S P O The Semantic Web Language Stack Hierarchy of languages, where each layer exploits and uses capabilities of the layers below. / XML Schema Jan Pettersen Nytun, Ui. A, Ontologies, page 3

S O P Agenda • Semantic Networks and Triples • • RDF and Triples Representing RDF with XML Representing RDF with Turtle Protégé - Turtle Example Jan Pettersen Nytun, Ui. A, Ontologies, page 4

S P O 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 formalizing associationist theories of knowledge. Example: Semantic networks. Jan Pettersen Nytun, Ui. A, Ontology, page 5

S P O 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 has. Sickness Christine has. Diagnosis Breast. Canser Diagnosis. Id_1 has. Diagnosis. Probability High Jan Pettersen Nytun, Ui. A, Ontology, page 6

S P O The use of triples for representation. Example: <Christine, has. Diagnosis, Diagnosis. Id_1> < Diagnosis. Id_1, has. Sickness, Breast. Canser> < Diagnosis. Id_1, has. Diagnosis. Probability, High> has. Sickness Christine has. Diagnosis Breast. Canser diagnosis_id_1 has. Diagnosis. Probability High Jan Pettersen Nytun, Ui. A, Ontology, page 7

S P O <subject> <predicate> <object> A triple is saying something (object/value), about something (subject), in regard to something (predicate/property). Jan Pettersen Nytun, Ui. A, Ontology, page 8

S P O Graphical Representation of Triples In general: subject predicate object Example: <Nursing. Report_1, has. Patient, Kenny> Nursing. Report_1 has. Patient Kenny Jan Pettersen Nytun, Ui. A, Ontology, page 9

S P O Agenda • Semantic Networks and Triples • RDF and Triples • Representing RDF with XML • Representing RDF with Turtle • Protégé - Turtle Example Jan Pettersen Nytun, Ui. A, Ontologies, page 10

S P O The Conceptual model of RDF • Triples • Semantic networks Jan Pettersen Nytun, Ui. A, Ontology, 11

S P O The following UML class model has been instantiated when the object diagram was made: Student -student. Id -name follows * * participant Course -course. Id teach. In * * taught. By Teacher -teacher. Id -name Task: How to represent the following object diagram as triples graphically (and textually). s 1: Student student. Id = 101 name = Ola s 2: Student student. Id = 102 name = Olga c 1: Course course. Id = IKT 413 t 1: Teacher teacher. Id = 1 name = Kari Jan Pettersen Nytun, Ui. A, Ontology, page 12

s 1: Student student. Id = 101 name = Ola s 2: Student student. Id = 102 name = Olga rdf: type c 1: Course course. Id = IKT 413 Student rdf: type s 1 rdf: type Student. s 1 student. Id 101. s 1 name “Ola”. s 1 follows c 1. …. student. Id = 101 Name = “Ola” t 1: Teacher teacher. Id = 1 name = Kari t 1 teacher. Id = 1 Name = “Kari” participant follows taught. By c 1 follows student. Id = 101 s 2 student. Id = 102 Name = “Olga” Name = “Ola” participant rdf: type Teacher
![S P O RDF Triple7 An RDF triple contains the subject S P O RDF Triple[7] • An RDF triple contains: – the subject -](https://slidetodoc.com/presentation_image/402f5b6f7763963f08f7592620fd3327/image-14.jpg)
S P O 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, Ui. A, Ontology, 14

S P O Agenda • Semantic Networks and Triples • RDF and Triples • Representing RDF with XML • Representing RDF with Turtle • Protégé - Turtle Example Jan Pettersen Nytun, Ui. A, Ontologies, page 15
![S P O XML Used as Representational Language6 xml version1 0 S P O XML - Used as Representational Language[6] <? xml version="1. 0"? >](https://slidetodoc.com/presentation_image/402f5b6f7763963f08f7592620fd3327/image-16.jpg)
S P O XML - Used as Representational Language[6] <? xml version="1. 0"? > <rdf: RDF xmlns: rdf="http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: si ="http: //www. w 3 schools. com/rdf/"> <rdf: Description rdf: about="http: //www. w 3 schools. com"> <si: title>W 3 Schools. com</si: title> <si: author>Jan Egil Refsnes</si: author> </rdf: Description> </rdf: RDF> Knowledge Representation Part I, JPN, Ui. A 16
![S P O 8 there is a Person identified by http www w 3 S P O [8]: "there is a Person identified by http: //www. w 3.](https://slidetodoc.com/presentation_image/402f5b6f7763963f08f7592620fd3327/image-17.jpg)
S P O [8]: "there is a Person identified by http: //www. w 3. org/People/EM/contact#me, whose name is Eric Miller, whose email address is em@w 3. org, and whose title is Dr. " <? xml version="1. 0"? > <rdf: RDF xmlns: rdf="http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#" xmlns: contact="http: //www. w 3. org/2000/10/swap/pim/contact#"> <contact: Person rdf: about="http: //www. w 3. org/People/EM/contact#me"> <contact: full. Name>Eric Miller</contact: full. Name> <contact: mailbox rdf: resource="mailto: em@w 3. org"/> <contact: personal. Title>Dr. </contact: personal. Title> </contact: Person> </rdf: RDF> 17

S P O Blank Node (Anonymous Resource) 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: node. ID="b 1"/> </foaf: knows> </foaf: Person> <foaf: Person rdf: about="http: //example. org/Person#Mary"> <foaf: knows> <foaf: Person rdf: node. ID="b 1"/> </foaf: knows> </foaf: Person> Jan Pettersen Nytun, Ui. A, Ontologies, page 18

S P O Agenda • Semantic Networks and Triples • RDF and Triples • Representing RDF with XML • Representing RDF with Turtle • Protégé - Turtle Example Jan Pettersen Nytun, Ui. A, Ontologies, page 19

S P O Terse Language for Triples 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, Ui. A, 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, Ui. A, Ontologies, page 21

S P O Example �#comp_2347� �#owned_by� �#comp_2347� �#model� �#comp_2347� �#brand� �#comp_2347� �#logo� �#comp_2347� �#color� �#craig� �#room� �#craig�. �#lemon_laptop_10000�. �#lemon_computer�. �#lemon_disc�. �#brown�. �#r 107�. … Jan Pettersen Nytun, Ui. A, Ontologies, page 22

S P O Turtle Abbreviations 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, Ui. A, Ontologies, page 23

S P O Turtle Abbreviations Continues… A comma can group objects with the same subject and predicate. S P O 1, O 2. is an abbreviation for S P O 1. S P O 2. E. g. : �#comp_3645� �#color� �#green�, �#yellow�. equals: �#comp_3645� �#color� �#green�. �#comp_3645� �#color� �#yellow�. Jan Pettersen Nytun, Ui. A, Ontologies, page 24

S P O 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, Ui. A, Ontologies, page 25
![S P O Anonymous individual blank node example comp3645 managedby occupation sysadmin Equals S P O Anonymous individual (blank node) - example: �comp_3645� �#managed_by� [�#occupation� �#sys_admin�]. Equals:](https://slidetodoc.com/presentation_image/402f5b6f7763963f08f7592620fd3327/image-26.jpg)
S P O Anonymous individual (blank node) - example: �comp_3645� �#managed_by� [�#occupation� �#sys_admin�]. Equals: �comp_3645� �#managed_by� �i 2134� �#occupation� �#sys_admin�. the made-up URI, �i 2134�, 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, Ui. A, Ontologies, page 26

S P O Complex Example �comp_3645� �#owned_by� �#fran�; �#color� �#green�, �#yellow�; �#managed_by� [ �#occupation� �#sys_admin�; �#serves_building� �#comp_sci�]. �comp_3645� �#owned_by� �#fran�. �comp_3645� �#color� �#green�, �#yellow�. �comp_3645� �#managed_by� [ �#occupation� �#sys_admin�; �#serves_building� �#comp_sci�] . �comp_3645� �#owned_by� �#fran�. �comp_3645� �#color� �#green�. �comp_3645� �#color� �#yellow�. �comp_3645� �#managed_by� <i 2134> �#occupation� �#sys_admin�; �#serves_building� �#comp_sci�]. �comp_3645� �#color� �#green�. �comp_3645� �#color� �#yellow�. �comp_3645� �#managed_by� [ �#occupation� �#sys_admin�; �#serves_building� �#comp_sci�] �comp_3645� �#owned_by� �#fran�. �comp_3645� �#color� �#green�. �comp_3645� �#color� �#yellow�. �comp_3645� �#managed_by� � i 2134 � �#occupation� �#sys_admin�. � i 2134 � �#serves_building� �#comp_sci�]. Jan Pettersen Nytun, Ui. A, Ontologies, page 27

S O P Agenda • • Semantic Networks and Triples RDF and Triples Representing RDF with XML Representing RDF with Turtle • Protégé - Turtle Example Jan Pettersen Nytun, Ui. A, Ontologies, page 28

S P O Example: Some RDF Standard Properties + Turtle Representation Jan Pettersen Nytun, Ui. A, Ontologies, page 29

S P O Jan Pettersen Nytun, Ui. A, Ontologies, page 30

S P O Jan Pettersen Nytun, Ui. A, Ontologies, page 31

S P O Jan Pettersen Nytun, Ui. A, Ontologies, page 32

Some RDF Standard Properties - Turtle Representation Continues… S P O @prefix : <http: //www. uia. no/janpn/medical_1#>. @prefix owl: <http: //www. w 3. org/2002/07/owl#>. @prefix rdf: <http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#>. @prefix xml: <http: //www. w 3. org/XML/1998/namespace>. @prefix xsd: <http: //www. w 3. org/2001/XMLSchema#>. @prefix rdfs: <http: //www. w 3. org/2000/01/rdf-schema#>. @base <http: //www. uia. no/janpn/medical_1> rdf: type owl: Ontology. Jan Pettersen Nytun, Ui. A, Ontologies, page 33

Some RDF Standard Properties - Turtle Representation Continues… S P O ### http: //www. uia. no/janpn/medical_1#has. Name : has. Name rdf: type owl: Datatype. Property ; rdfs: range xsd: string. ### http: //www. uia. no/janpn/medical_1#has. Patient : has. Patient rdf: type owl: Object. Property. : EHealth. Record rdf: type owl: Class. : Patient rdf: type owl: Class. Jan Pettersen Nytun, Ui. A, Ontologies, page 34

Some RDF Standard Properties - Turtle Representation Continues… S P O : ID_JPN rdf: type : Patient , owl: Named. Individual ; rdfs: label "Jan Pettersen Nytun" ; : has. Name "Jan Pettersen Nytun"^^xsd: string. : e. Healt. Record_Jan rdf: type : EHealth. Record , owl: Named. Individual ; rdfs: label "Health Record for Jan Pettersen Nytun" ; : has. Patient : ID_JPN. Jan Pettersen Nytun, Ui. A, Ontologies, page 35
![S P O References 1 Book David Poole and Alan Mackworth Artificial Intelligence Foundations S P O References [1] Book: David Poole and Alan Mackworth, Artificial Intelligence: Foundations](https://slidetodoc.com/presentation_image/402f5b6f7763963f08f7592620fd3327/image-36.jpg)
S P O References [1] Book: David Poole and Alan Mackworth, Artificial Intelligence: Foundations of Computational Agents, Cambridge University Press, 2010, http: //artint. info/ [2] http: //www. w 3. org/TR/swbp-n-ary. Relations/ [3] RDF 1. 1 Primer, W 3 C Working Group Note, 24 June 2014 Jan Pettersen Nytun, Ui. A, Propositional Calculus, page 36