cc6202 1 la web de datos primavera 2016 - aidan...

68
CC62021 LA WEB DE D ATOS PRIMAVERA 2016 Lecture 2: RDF Model & Syntax Aidan Hogan [email protected]

Upload: dinhdat

Post on 19-Mar-2018

217 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

CC6202‐1LA WEB DE DATOSPRIMAVERA 2016

Lecture 2: RDF Model & Syntax

Aidan [email protected]

Page 2: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

LAST TIME …

Page 3: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

The “Semantic Web”

Page 4: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

What if we could “structure” everything …

Page 5: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

(1) Data, (2) Query, (3) Rules/Ontologies

Page 6: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

STRUCTURING DATA WITH RDF: RESOURCE DESCRIPTION FRAMEWORK

Page 7: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

(1) Data, (2) Query, (3) Rules/Ontologies

Page 8: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF: Resource Description Framework

Page 9: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Modelling the world with triples

Page 10: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Concatenate to “integrate” new data

Page 11: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF often drawn as a (directed, labelled) graph

Page 12: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Set of triples thus called an “RDF Graph”

Page 13: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

But why triples / graphs?

What is the benefit of triples / graphs?

Page 14: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

NAMING THINGS IN RDF: IRIS

Page 15: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

One symbol, onemeaning …

Page 16: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Need unambiguous symbols/identifiers

• Since we’re on the Web … use Web identifiers

• URL: Uniform Resource Location– The location of a resource on the Web– http://ex.org/Dubl%C3%ADn.html

• URI: Uniform Resource Identifier (RDF 1.0)– Need not be a location, can also be a name– http://ex.org/Dubl%C3%ADn

• IRI: Internationalised Resource Identifier (RDF 1.1)– A URI that allows Unicode characters– http://ex.org/Dublín

Page 17: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

We will use IRIs with prefixes

• http://ex.org/Dublín ↔ ex:Dublín

• “ex:” denotes a prefix for http://ex.org/• “Dublín” is the local name

Page 18: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Frequently used prefixes

Page 19: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

From strings …

Page 20: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

… to IRIs …

Page 21: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

NAMING THINGS IN RDF: LITERALS

Page 22: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

What about numbers?

Should we assign IRIs to numbers, etc.?

Page 23: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF allows “literals” in object position

• Literals are for datatype values, like strings, numbers, booleans, dates, times

• Only allowed in object position

Page 24: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Datatype literals

• “lexical‐value”^^ex:datatype– “200”^^xsd:int– “2014‐12‐13”^^xsd:date– “true”^^xsd:boolean– “this is a string”^^xsd:string

• If the datatype is omitted, it’s a string– “this is a string”– “200” is a string, not a number!

Page 25: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Many datatypes borrowed from XML Schema

Page 26: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Boolean datatype

Page 27: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Numeric datatypes

Page 28: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Temporal datatypes

Page 29: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Text/string datatypes

Page 30: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Text/string datatypes

Page 31: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Language‐Tagged Strings

• Specify that a string is in a given language• “string”@lang‐tag• No datatype!

Page 32: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

(NOT) NAMING THINGS IN RDF:BLANK NODES

Page 33: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Having to name everything is hard work

Page 34: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

For this reason, RDF gives blank nodes

• Syntax: _:blankNode• Represents existence of something

– Often used to avoid giving an IRI (e.g., shortcuts)

• Can only appear in subject or object position

• (More later)

Page 35: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF TERMS: SUMMARY

Page 36: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

A Summary of RDF Terms

1. IRIs (Internationalised Resource Identifiers)– Used to name generic things

2. Literals– Used to refer to datatype values– Strings may have a language tag

3. Blank Nodes– Used to avoid naming things– A little mysterious right now

Page 37: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

MODELLING DATA IN RDF

Page 38: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Let’s model something in RDF …Model the following in RDF:

“Sharknado is the first movie of the Sharknado series. It first aired on July 11, 2013. The movie stars Tara Reid and Ian Ziering. The movie was followed by ‘Sharknado 

2: The Second One’.”

Page 39: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF Properties

• RDF Terms used as predicate• rdf:type, ex:firstMovie, ex:stars, …

Page 40: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF Classes

• Used to conceptually group resources• The predicate rdf:type is used to relate resources to their classes

Page 41: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Modelling in RDF not always so simple

Model the following in RDF:“Sharknado stars Tara Reid in the role of ‘April Wexler’.

Page 42: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Modelling in RDF not always so simple

Model the following in RDF:“The first movie in the Sharknado series is ‘Sharknado’.The second movie is ‘Sharknado 2: The Second One’.

The third movie is ‘Sharknado 3: Oh Hell No!’.

Page 43: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF Collections: Model Ordered Lists

• Standard way to model linked lists in RDF• Use rdf:rest to link to rest of list• Use rdf:first to link to current member• Use rdf:nil to end the list

Page 44: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF Collections: Generic Modelling

• Not just for Sharknado series

Page 45: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

ANOTHER MODELLING EXAMPLE:FROM TABLES TO RDF

Page 46: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

courses.csvmarks.csv

tas.csv

professors.csv

students.csv

Course data as an RDF graph?

How might we model these relational data as an RDF graph?

Page 47: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

courses.csvmarks.csv

tas.csv

professors.csv

students.csv

Course data as an RDF graph?

How might we model these relational data as an RDF graph?

… for example

Page 48: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Graphs vs. Relational Tables

• Graphs more flexible– Just add more nodes and edges

• (possibly with new labels!)

• May be more concise

• Graphs less “structured”– No longer have a clear schema

• May be more verbose

Yes.

Can we model any relational table(s) as an (RDF) graph?Can we model any (RDF) graph as a relational table?

Page 49: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF SYNTAXES: WRITING RDF DOWN

Page 50: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

N‐Triples

• Line delimited format• No shortcuts

Page 51: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF/XML

• Legacy format• Just horrible

Page 52: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDFa

• Embed RDF into HTML• Not so intuitive

Page 53: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

JSON‐LD

• Embed RDF into JSON• Not completely aligned with RDF

Page 54: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Turtle

• Readable format

Page 55: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Turtle: Collections Shortcut

Page 56: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

BLANK NODES ADD COMPLEXITY

Page 57: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Blank nodes names aren’t important …

(Isomorphic)

Page 58: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Blank nodes are local identifiers

How should we combine these two RDF graphs?

Page 59: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Need to perform an RDF merge

How should we combine these two RDF graphs?

Page 60: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Are two RDF graphs the “same”?

(Isomorphic)

Page 61: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Are two RDF graphs the “same”?

Page 62: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Are two RDF graphs the “same”?

Page 63: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RECAP

Page 64: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF: Resource Description Framework

Page 65: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF = Resource Description Framework

• Structure data on the Web!

• RDF based on triples:– subject, predicate, object– A set of triples is called an RDF graph

• Three types of RDF terms:– IRIs (any position)– Literals (object only; can have datatype or language)– Blank nodes (subject or object)

Page 66: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF = Resource Description Framework

• Modelling in RDF:– Describing resources– Classes and properties form core of model– Try to break up higher‐arity relations– Collections: standard way to model order/lists

• Syntaxes:– N‐Triples: simple, line‐delimited format– RDF/XML: legacy format, horrible– RDFa: embed RDF into HTML pages– JSON‐LD: embed RDF into JSON– Turtle: designed to be human friendly

Page 67: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

RDF = Resource Description Framework

• Two operations on RDF graphs:– Merging: keep blank nodes in source graphs apart– Are they the “same” modulo blank node labels: isomorphism check!

Page 68: CC6202 1 LA WEB DE DATOS PRIMAVERA 2016 - Aidan …aidanhogan.com/teaching/cc6202-1-2016/lectures/WdD2016-02.pdf · CC6202‐1 LA WEB DE DATOS PRIMAVERA 2016 Lecture 2: RDF Model

Questions?