<<

Introduction to a Web of

WEEK 2: The RDF Data Model Towards a Global Knowledge Graph

Catherine Faron Zucker WEEK 2: The RDF Data Model

1. Describing resources 2. A triple model and a graph model 3. Serialization syntaxes 4. Values, types and languages 5. Groups 6. Naming graphs 7. RDF schemas

1 WEEK 2: The RDF Data Model

1. Describing resources 2. A triple model and a graph model 3. Serialization syntaxes 4. Values, types and languages 5. Groups 6. Naming graphs 7. RDF schemas

2 Original Proposal

3 Schema

4 A Web of Resources

5 Various Kinds of Links

6 Describing Resources on the Web

communication HTTP web

reference address

URI

7 RDF: Basic Model

RDF communication HTTP web of data reference address

URI Stack of standards W3C®

8 Stack of standards

Semantic Web Stack of standards W3C®

9 Stack of standards

Semantic Web Stack of standards W3C®

10 Stack of standards

Semantic Web Stack of standards W3C®

11 Stack of standards

Semantic Web Stack of standards W3C®

12 Stack of standards

Semantic Web Stack of standards W3C®

13 Stack of standards

RDF communication HTTP web of data reference address

URI Semantic Web Stack of standards W3C®

14 dc:creator

ex:ingredient rdfs:label

rdf:about ex:weight rdf:type Picture credits

• Tim Berners-Lee's proposal, CERN, http://info.cern.ch/Proposal-fr.html • Semantic Web stack of standards, W3C® • Villars Noir 72, Tablette de Choc, 26/10/2014 http://www.tablettedechoc.com/2014/10/villars-noir-72.html

16 WEEK 2: the RDF Data Model

1. Describing resources 2. A triple model and a graph model 3. Serialization syntaxes 4. Values, types and languages 5. Groups 6. Naming graphs 7. RDF schemas

17 RDF means

Resource

Description

Framework

18 RDF means

Resource: pages, chairs, persons, ideas... all that can have a URI Description

Framework

19 RDF means

Resource: pages, chairs, persons, ideas... all that can have a URI Description: attributes, characteristics, and relations between resources Framework

20 RDF means

Resource: pages, chairs, persons, ideas... all that can have a URI Description: attributes, characteristics, and relations between resources Framework: model, language and syntaxes for these descriptions

21 RDF decomposes descriptions into triples

( subject , predicate , object )

22 RDF decomposes descriptions into triples

( subject , predicate , object )

E.g.: "doc.html has for authors Fabien, Catherine and Olivier and has for topic the Web of data"

23 RDF decomposes descriptions into triples

( subject , predicate , object )

E.g.: doc.html has for author Fabien doc.html has for author Catherine doc.html has for author Olivier doc.html has for topic Web of data

24 RDF decomposes descriptions into triples

( subject , predicate , object )

( doc.html , author , Fabien ) ( doc.html , author , Catherine ) ( doc.html , author , Olivier ) ( doc.html , topic , Web of data)

25 RDF : triples are knowledge atoms Predicate

Object

Subject 26 Composition Rules for RDF Triples

1. The subject is always a resource (and not a literal)

( subject , , )

27 Composition Rules for RDF Triples

1. The subject is always a resource (and not a literal) 2. The type of the binary property is identified by a URI

( subject , predicate , )

28 Composition Rules for RDF Triples

1. The subject is always a resource (and not a literal) 2. The type of the binary property is identified by a URI 3. The value is a resource or a literal

( subject , predicate , object )

29 WEEK 2: The RDF Data Model

1. Describing resources 2. A triple model and a graph model 3. Serialization syntaxes 4. Values, types and languages 5. Groups 6. Naming graphs 7. RDF schemas

30 RDF : triples form graph edges

( subject , predicate , object ) → (node, edge, node)

31 RDF is a graph model

Catherine ( doc.html , author, Catherine ) ( doc.html , topic, Web of Data) author

doc.html

topic

Web of Data 32 RDF is an oriented labeled multigraph model

Catherine

author

doc.html

topic

Web of Data 33 RDF is an oriented labeled multigraph model

Catherine several edges can connect the same two nodes author

doc.html

defines topic

Web of Data 34 RDF is an oriented labeled multigraph model

Catherine edges are oriented: the head is the object author the tail is the subject

doc.html

topic

Web of Data 35 RDF is an oriented labeled graph multigraph model

Catherine edges and nodes are labeled author

doc.html

topic

Web of Data 36 RDF graphs are labeled by resources and literals

http://ns.inria.fr/catherine.faron#me

http://inria.fr/schema#author

http://inria.fr/rr/doc.html

http://inria.fr/schema#topic

Web of Data 37 RDF graphs are labeled by resources and literals

http://ns.inria.fr/catherine.faron#me

http://inria.fr/schema#author

http://inria.fr/rr/doc.html

http://inria.fr/schema#topic

"Web of Data" 38 RDF Graphs are labeled by resources and literals

A resource is either a URI or an anonymous resource () Existential quantification: there is a resource such that… { r ; …}

∃ _:a

http://inria.fr/schema#author

http://ns.inria.fr/catherine.faron#me http://inria.fr/schema#topic

"Web of data" 39 RDF is an Open Model

• Extensible vocabulary based on URIs • Authorizes anyone to declare anything about any resource http://my_site.org/my_type

40 RDF Global Giant Graph (GGG)

http://ns.inria.fr/catherine.faron#me

http://inria.fr/schema#author http://inria.fr/rr/doc.html

http://inria.fr/rr/doc.html http://inria.fr/schema#topic

"Web of Data" 41 RDF Global Giant Graph (GGG) Open and link data across the Web

42 Several Views on a Graph There are many ways to process RDF data

r r S O b 1 a b a 2 a c r 3 c a r c

43 Picture credits

• W3C Semantic Web Logo, W3C, http://www.w3.org/2001/sw/ • Ruler, mbnachhilfe_de, https://pixabay.com/p-1023726/ CC0 Public Domain • Hitman barcode.svg, Io Interactive, https://commons.wikimedia.org/wiki/File:Hitman_barcode.svg • icon, Octicons by Github - MIT License, iconfinder.com • ADSL e banda minima garantita, come tutelarsi, Tom’s Hardware, 09/12/2010 http://www.tomshw.it/cont/articolo/adsl-e-banda-minima- garantita-come-tutelarsi/28490/1.html • W3C Semantic Web Logo, W3C, http://www.w3.org/2001/sw/

44 WEEK 2: the RDF Data Model

1. Describing resources 2. A triple model and a graph model 3. Serialization syntaxes 4. Values, types and languages 5. Groups 6. Naming graphs 7. RDF Schemas

45 RDF has a historical XML syntax and several other syntaxes: Turtle, TriG, JSON-LD, N-Triples, N-Quads

W3C ©

46 RDF N-Triples: a minimalist syntax

W3C ©

47 RDF N-Triples: easy parsing of triple lists - URIs between less-than and greater-than signs - Literal values between double quotes - Triples separated by full stops

.

"Web" . 48 RDF Turtle: the most popular RDF syntax

W3C ©

49 RDF Turtle: a very concise syntax

@prefix rdf: . @prefix inria: .

inria:author ; inria:topic "Web of data" .

50 R D F Turtle: prefix declaration

@prefix rdf: . @prefix inria: .

inria:author ; inria:topic "Web of data" .

51 R D F Turtle: or qualified name

@prefix rdf: . @prefix inria: .

inria:author ; inria:topic "Web of data" .

52 R D F Turtle: one (.) or several properties (;) or values (,)

@prefix rdf: . @prefix inria: .

inria:author ; inria:topic "Web of data", "Semantic Web".

53 R D F Turtle: [ anonymous resources ]

@prefix rdf: . @prefix inria: . [ inria:author ; inria:topic "Web of data" . ]

54 RDF /XML: the historical XML syntax

W3C ©

55 R D F /XML: capturing graphs into trees

rdf:about="http://inria.fr/rr/doc.html"> http://inria.fr/rr/doc.html

Web of Data http://ns.inria.fr/catherine.faron#me http://inria.fr/schema#topic

"Web of Data" 56 R D F /XML: a root

rdf:about="http://inria.fr/rr/doc.html"> http://inria.fr/rr/doc.html

Web of Data http://ns.inria.fr/catherine.faron#me http://inria.fr/schema#topic

"Web of Data" 57 R D F /XML: descriptions of resources

rdf:about="http://inria.fr/rr/doc.html"> http://inria.fr/rr/doc.html

Web of Data http://ns.inria.fr/catherine.faron#me http://inria.fr/schema#topic

"Web of Data" 58 R D F /XML: anonymous resources (blank nodes)

"http://ns.inria.fr/catherine.faron#me"/> http://inria.fr/schema#author Web of Data http://ns.inria.fr/catherine.faron#me http://inria.fr/schema#topic "Web of Data" : 59 R D F /XML: links between resources

rdf:about="http://inria.fr/rr/doc.html"> http://inria.fr/rr/doc.html

Web of Data http://ns.inria.fr/catherine.faron#me http://inria.fr/schema#topic

"Web of Data" 60 R D F /XML: literal values

rdf:about="http://inria.fr/rr/doc.html"> http://inria.fr/rr/doc.html

Web of Data http://ns.inria.fr/catherine.faron#me http://inria.fr/schema#topic

"Web of Data" 61 R D F /XML: many syntactic variations

Web of Data 62 R D F /XML: many syntactic variations

63 R D F /XML: many syntactic variations

Catherine

64 R D F /XML: many syntactic variations

65 Picture credits

• RDF 1.0 and 1.1 serialization formats, W3C® http://www.w3.org/TR/rdf11-new/ • Database icon, Octicons by Github - MIT License, Iconfinder.com

66 WEEK 2: the RDF data model

1. Describing resources 2. A triple model and a graph model 3. Serialization syntaxes 4. Values, types and languages 5. Groups 6. Naming graphs 7. RDF Schemas

67 "XML Schema Datatypes" for Typing Literals Literals are by default considered as character strings, of type xsd:string

68 "XML Schema Datatypes" for Typing Literals Literals are by default considered as character strings, of type xsd:string

http://inria.fr/rr/doc.html

http://inria.fr/schema#date

"1995-09-18"^^xsd:date 69 "XML Schema Datatypes" for Typing Literals Literals are by default considered as character strings, of type xsd:string @prefix (…) Turtle inria:date "1995-09-18"^^xsd:date .

http://inria.fr/rr/doc.html

http://inria.fr/schema#date

"1995-09-18"^^xsd:date 70 "XML Schema Datatypes" for Typing Literals Literals are by default considered as character strings, of type xsd:string @prefix (…) Turtle inria:date "1995-09-18"^^xsd:date .

RDF/XML 1995-09-18 http://inria.fr/rr/doc.html http://inria.fr/schema#date

"1995-09-18"^^xsd:date 71 "XML Schema Datatypes" for Typing Literals W3C © http://www.w3.org/TR/xmlschema-2/

72 Indicating the Language of Textual Values Literals can be associated to a language

http://inria.fr/rr/doc.html

http://inria.fr/schema#topic

73 "Web of Data"@en "Web de données"@fr Indicating the Language of Textual Values Literals can be associated to a language @prefix (…) Turtle inria:topic "Web of Data"@en ; inria:topic "Web de données"@fr .

http://inria.fr/rr/doc.html

http://inria.fr/schema#topic

74 "Web of Data"@en "Web de données"@fr Indicating the Language of Textual Values Literals can be associated to a language @prefix (…) Turtle inria:topic "Web of Data"@en ; inria:topic "Web de données"@fr .

RDF/XML Web of Data Web de données http://inria.fr/rr/doc.html

http://inria.fr/schema#topic

75 "Web of Data"@en "Web de données"@fr Typing Resources Property rdf:type links the URIs of resources to the URIs of their classes

http://inria.fr/schema#Woman rdf:type

http://ns.inria.fr/catherine.faron#me rdf:type

http://inria.fr/schema#Researcher

76 Typing Resources Property rdf:type links the URIs of resources to the URIs of their classes @prefix (…) Turtle a inria:Woman, inria:Researcher. http://inria.fr/schema#Woman rdf:type

http://ns.inria.fr/catherine.faron#me rdf:type

http://inria.fr/schema#Researcher

77 Typing Resources Property rdf:type links the URIs of resources to the URIs of their classes @prefix (…) Turtle a inria:Woman, inria:Researcher. http://inria.fr/schema#Woman rdf:type

http://ns.inria.fr/catherine.faron#me rdf:type

http://inria.fr/schema#Researcher RDF/XML 78 Picture credits

• Built-in datatypes, W3C® http://www.w3.org/TR/xmlschema-2/

79 WEEK 2: the RDF Data Model

1. Describing resources 2. A triple model and a graph model 3. Serialization syntaxes 4. Values, types and languages 5. Groups 6. Naming graphs 7. RDF Schemas

80 Bags (rdf:Bag) of Resources or Literals Simple groups, without any order

inria:author http://inria.fr/rr/doc.html rdf:type rdf:Bag rdf:_1 _:a "Fabien" rdf:_2 "Catherine" rdf:_3 "Olivier"

81 Bags (rdf:Bag) of Resources or Literals Simple groups, without any order @prefix (…) Turtle inria:author [ a rdf:Bag ; rdf:li "Fabien", "Catherine", "Olivier" . ] .

82 Bags (rdf:Bag) of Resources or Literals Simple groups, without any order @prefix (…) Turtle inria:author [ a rdf:Bag ; rdf:li "Fabien", "Catherine", "Olivier" . ] .

RDF/XML Fabien Catherine Olivier 83 Sequences (rdf:Seq) Ordered groups of resources or literals @prefix (…) Turtle inria:author [ a rdf:Seq ; rdf:li "Fabien", "Catherine", "Olivier" . ] .

RDF/XML Fabien Catherine Olivier 84 Alternatives (rdf:Alt) E.g. the same value in different languages @prefix (…) Turtle inria:theme [ a rdf:Alt ; rdf:li "Web of D:ata"@en, "Web de données"@fr . ] .

RDF/XML Web of Data Web de données : 85 Collections Exhaustive and ordered lists

http://inria.fr/rr/doc.html

inria:author rdf:first _:a #Fabien

rdf:type rdf:rest

rdf:first rdf:List _:b #Catherine rdf:type rdf:rest rdf:type rdf:first _:c #Olivier rdf:rest

rdf:nil 86 Collections Exhaustive and ordered lists @prefix (…) Turtle inria:author ( <#Fabien> <#Catherine> <#Olivier> ).

RDF/XML 87 WEEK 2: the RDF Data Model

1. Describing resources 2. A triple model and a graph model 3. Serialization syntaxes 4. Values, types and languages 5. Groups 6. Naming graphs 7. RDF Schemas

88 Named Graphs Grouping triples in subgraphs identified by URIs

http://ns.inria.fr/catherine.faron#me

http://inria.fr/schema#author

http://inria.fr/rr/doc.html http://inria.fr/people

http://inria.fr/rr/doc.html

http://inria.fr/schema#topic

"Web of Data" http://inria.fr/topics 89 RDF has the TriG and N-Quads syntaxes to enable the representation of contexts

W3C ©

90 Named Graphs in TriG

@prefix rdf: . @prefix inria: .

GRAPH { inria:author . }

GRAPH { inria:topic "Web of Data" . }

91 Named Graphs in N-Quads

.

"Web of Data" .

92 Picture credits

• RDF 1.0 and 1.1 serialization formats, W3C® http://www.w3.org/TR/rdf11-new/

93 WEEK 2: the RDF Data Model

1. Describing resources 2. A triple model and a graph model 3. Serialization syntaxes 4. Values, types and languages 5. Groups 6. Naming graphs 7. RDF schemas

94 Stack of standards

RDFS communication HTTP web of data reference address

URI Semantic Web Stack of standards W3C®

95 RDFS Means RDF Schema

• RDFS provides standard vocabulary to declare in RDF vocabularies to be used in RDF descriptions • RDFS reuses the vocabulary of RDF and introduces additional constructs • An RDF vocabulary is a set of property declarations and class declarations

96 Associating a Namespace to a Vocabulary

@prefix rdf: @prefix rdfs: @base (…)

(…)

97 Declaring Classes of Resources

Person

• Naming classes • Organizing them into hierarchies Woman

98 Declaring Classes of Resources

@prefix rdfs: @base Person a rdfs:Class ; rdfs:subClassOf , .

Woman

99 Declaring Classes of Resources

@prefix rdfs: @base Person a rdfs:Class ; rdfs:subClassOf , .

Woman

100 Declaring Classes of Resources

@prefix rdfs: @base Person a rdfs:Class ; rdfs:subClassOf , .

101 Declaring Types of Properties

hasParent

• Naming types of properties • Organizing them into hierarchies hasMother

102 Declaring Types of Properties Class Property is in the RDF namespace since properties are the key of RDF triples

@prefix rdf: hasParent @prefix rdfs: @base a rdf:Property ; rdfs:subPropertyOf . hasMother

103 Declaring Types of Properties Class Property is in the RDF namespace since properties are the key of RDF triples

@prefix rdf: hasParent @prefix rdfs: @base a rdf:Property ; rdfs:subPropertyOf . hasMother

104 Declaring Types of Properties Class Property is in the RDF namespace since properties are the key of RDF triples

@prefix rdf: hasParent @prefix rdfs: @base a rdf:Property ; rdfs:subPropertyOf .

105 Declaring Property Signatures

@prefix rdf: @prefix rdfs: @base a rdf:Property ; rdfs:subPropertyOf ; hasParent rdfs:domain ; rdfs:range .

hasMother Person Mother

106 Documenting Class and Property Declarations

@prefix rdf: @prefix rdfs: @base a rdfs:Class ; rdfs:label "woman"@en ; rdfs:comment "an adult female person"@en . a rdf:Property ; rdfs:label "has for mother"@en ; rdfs:comment "to have a woman for mother"@en .

107 Referencing and Using Schemas in the description of a resource

@prefix h: @base a h:Woman; h:hasMother .

108 Referencing and Using Schemas in the description of a resource

@prefix h: @base a h:Woman; h:hasMother .

109 Referencing and Using Schemas in the description of a resource

@prefix h: @base a h:Woman; h:hasMother .

110

Stack of standards

Semantic Web Stack of standards W3C®

111 Picture credits

• Semantic Web stack of standards, W3C® • Right icon, Aleksandra Wolska - Free for commercial use, Iconfinder.com

112