Databases Picture by Jeremy Hiebert - - PowerPoint PPT Presentation

databases
SMART_READER_LITE
LIVE PREVIEW

Databases Picture by Jeremy Hiebert - - PowerPoint PPT Presentation

Databases Picture by Jeremy Hiebert [http://www.flickr.com/photos/jeremyhiebert/] Graph Databases SPARQL and DBPedia Andr Santanch e Patrcia Cavoto Institute of Computing UNICAMP September 2015 Dinosaur Example Namespace Dino


slide-1
SLIDE 1

Databases

Graph Databases

SPARQL and DBPedia André Santanchè e Patrícia Cavoto Institute of Computing – UNICAMP

September 2015

Picture by Jeremy Hiebert [http://www.flickr.com/photos/jeremyhiebert/]

slide-2
SLIDE 2

Dinosaur Example

slide-3
SLIDE 3

Namespace Dino dino: <http://purl.org/dinos/>

slide-4
SLIDE 4

Dinosaur Class

rdfs:Class rdf:type dino:Dinosaur

slide-5
SLIDE 5

Dinosaur Instance

rdfs:Class rdf:type dino:Dinosaur MNHN 1912.20 rdf:type

slide-6
SLIDE 6

SPARQL Query Language for RDF

slide-7
SLIDE 7

Instances of the Dinosaur class (SPARQL)

rdfs:Class rdf:type dino:Dinosaur ?d rdf:type SELECT ?d WHERE { ?d rdf:type dino:Dinosaur }

slide-8
SLIDE 8

Place Class

rdfs:Class rdf:type dino:Dinosaur MNHN 1912.20 rdf:type rdf:type dino:Place

slide-9
SLIDE 9

Place Instance

rdfs:Class rdf:type dino:Dinosaur MNHN 1912.20 rdf:type rdf:type dino:Place Lance Creek rdf:type

slide-10
SLIDE 10

Instances of the Place class (SPARQL)

rdfs:Class rdf:type dino:Place ?pl rdf:type SELECT ?pl WHERE { ?pl rdf:type dino:Place }

slide-11
SLIDE 11

Place Instance

rdfs:Class rdf:type dino:Dinosaur MNHN 1912.20 rdf:type rdf:type dino:Place Lance Creek rdf:type dino:origin

slide-12
SLIDE 12

Origin: Lance Creek

rdfs:Class ?d rdf:type dino:Place Lance Creek rdf:type SELECT ?d WHERE { ?d dino:origin dino:Lance_Creek } dino:origin

slide-13
SLIDE 13

Resources and their origins

?d ?or SELECT ?d ?or WHERE { ?d dino:origin ?or } dino:origin

slide-14
SLIDE 14

Dinosaurs and their origins

rdfs:Class rdf:type Dinosaur ?din rdf:type rdf:type Place ?or rdf:type dino:origin SELECT ?din ?or WHERE { ?din rdf:type dino:Dinosaur . ?din dino:origin ?or }

slide-15
SLIDE 15

Analyzing in the Space

OpenStreetMap

slide-16
SLIDE 16

Triceratops in a Graph

MNHN 1912.20 Dinosaur rdf:type Lance Creek dino:origin Converse County Wyoming USA part of part of part of

slide-17
SLIDE 17

Tyrannosaurus in a Graph

FMNH PR2081

Dinosaur is a Hell Creek dino:origin Cheyenne River Indian Reservation South Dakota USA part of part of part of

slide-18
SLIDE 18

Analyzing in the Space

Hell Creek Cheyenne River Indian Reservation South Dakota USA Lance Creek Converse County Wyoming

slide-19
SLIDE 19

Analyzing in the Space

Hell Creek Cheyenne River Indian Reservation South Dakota USA Lance Creek Converse County Wyoming

slide-20
SLIDE 20

Origin: Lance Creek

?d Lance Creek dino:origin Converse County part of SELECT ?d WHERE { ?d dino:origin dino:Lance_Creek }

slide-21
SLIDE 21

Origin: part of Converse County

?d ?pl Converse County part of SELECT ?d WHERE { ?d dino:origin ?pl . ?pl dino:partOf dino:Converse_County } dino:origin

slide-22
SLIDE 22

Origin: part of Wyoming

?d ?pl Converse County Wyoming part of part of SELECT ?d WHERE { ?d dino:origin ?pl1 . ?pl1 dino:partOf ?pl2 . ?pl2 dino:partOf dino:Wyoming } dino:origin

slide-23
SLIDE 23

Origin: part of USA

?d ?pl Converse County Wyoming USA part of part of part of SELECT ?din WHERE { ?din dino:origin ?pl1 . ?pl1 dino:partOf ?pl2 . ?pl2 dino:partOf ?pl3 . ?pl3 dino:partOf dino:USA } dino:origin

slide-24
SLIDE 24

Origin: Lance Creek or Hell Creek

Hell Creek Lance Creek SELECT ?d WHERE { { ?d dino:origin dino:Lance_Creek } UNION { ?d dino:origin dino:Hell_Creek } } dino:origin dino:origin

slide-25
SLIDE 25

Resources with the part of relationship

?pl Converse County Wyoming USA part of part of part of SELECT ?l1 ?l2 WHERE { ?l1 dino:partOf ?l2 }

slide-26
SLIDE 26

DBPedia

slide-27
SLIDE 27

Wikipedia

Infobox

slide-28
SLIDE 28

DBPedia

Île-de- France France Paris Departments Prefecture Country Region Yvelines Departments Region

slide-29
SLIDE 29

DBPedia (URIs)

http://en.wikipedia.org/wiki/Yvelines http://en.wikipedia.org/wiki/Île-de-France_(region) http://en.wikipedia.org/wiki/Paris http://en.wikipedia.org/wiki/France

slide-30
SLIDE 30

DBPedia – English

▪ 4 million things ▪ 3.22 million classified in a consistent ontology

▫ 832,000 persons ▫ 639,000 places (427,000 populated) ▫ 372,000 creative works

  • 116,000 music albums; 78,000 films; 18,500 video games

▫ 209,000 organizations ▫ 226,000 species ▫ 5,600 diseases.

slide-31
SLIDE 31

DBPedia – International

▪ 119 languages ▪ 24.9 million things ▪ 16.8 million interlinked with English ▪ 12.6 million unique things

slide-32
SLIDE 32

Datasets published following Linked Data ‘format’: 05/2007

Source: http://lod-cloud.net/

Linked Data

slide-33
SLIDE 33

Datasets published following Linked Data ‘format’: 11/2007

Source: http://lod-cloud.net/

Linked Data

slide-34
SLIDE 34

Datasets published following Linked Data ‘format’: 2008

Source: http://lod-cloud.net/

Linked Data

slide-35
SLIDE 35

Datasets published following Linked Data ‘format’: 2009

Source: http://lod-cloud.net/

Linked Data

slide-36
SLIDE 36

Datasets published following Linked Data ‘format’: 2010

Source: http://lod-cloud.net/

Linked Data

slide-37
SLIDE 37

Datasets published following Linked Data ‘format’: 2011

Linked Data

slide-38
SLIDE 38

Source: http://lod-cloud.net/

Linked Data

04/2014

slide-39
SLIDE 39

DBPedia (URIs)

http://dbpedia.org/resource/Paris http://dbpedia.org/resource/France dbpedia-owl:country

slide-40
SLIDE 40

Predefined Namespace Prefixes

http://dbpedia.org/sparql?nsdecl

▪ dbpedia

http://dbpedia.org/resource/ →

▪ dbpedia-owl

→ http://dbpedia.org/ontology/

▪ dbprop

http://dbpedia.org/property/ →

slide-41
SLIDE 41

Paris – France

URIs

dbr:Paris dbr:France dbo:country

slide-42
SLIDE 42

Ontology Classes

http://mappings.dbpedia.org/server/ontology/classes/

Class Examples City Cambridge, Berlin, Manchester Country Spain, Iceland, South Korea Politician George W. Bush, Nicolas Sarkozy, Angela Merkel Musician AC/DC, Diana Ross, Röyksopp Music album Led Zeppelin III, Like a Virgin, Thriller Director Woody Allen, Oliver Stone, Takashi Miike Film The Great Beauty, Hysterical Blindness, Breakfast at Tiffany's Book The Lord of the Rings, The Adventures of Tom Sawyer, the Bible Computer Game Tetris, World of Warcraft, Sam & Max hit the Road Technical Standard HTML, RDF, URI (DBPedia, http://wiki.dbpedia.org/Datasets2014, 09/05/2015)

slide-43
SLIDE 43

Ontology Classes

http://mappings.dbpedia.org/server/ontology/classes/

Class Instances Resource (overall) 4.233.000 Place 735 Person 1.450.000 Work 411 Species 251 Organisation 241 (DBPedia, http://wiki.dbpedia.org/Ontology, 09/05/2015)

slide-44
SLIDE 44

Settlement Class

dbo:Settlement rdf:type dbr:Paris dbr:France dbo:country

The rdf:type edge denotes that a resource (Paris) belongs to a Class (Settlement).

slide-45
SLIDE 45

Property party

dbo:Settlement dbr:Socialist_Party_(France) dbpprop:party rdf:type dbr:Paris dbr:France dbo:country

slide-46
SLIDE 46

DBPedia SPARQL Query Editor http://dbpedia.org/sparql

slide-47
SLIDE 47

Paris Example

slide-48
SLIDE 48

Instances of the Settlement class

dbo:Settlement rdf:type ?sett select distinct ?sett where {?sett a dbo:Settlement}

slide-49
SLIDE 49

Mayor of Paris

SELECT ?m WHERE {dbr:Paris dbo:mayor ?m}

slide-50
SLIDE 50

Mayor of Paris

SELECT ?m WHERE {dbr:Paris dbo:mayor ?m}

slide-51
SLIDE 51

Cities whose mayor was born in Paris

SELECT ?c where {?c dbo:mayor ?m . ?m dbo:birthPlace dbr:Paris}

slide-52
SLIDE 52

Property party

dbo:Settlement dbr:Socialist_Party_(France) dbpprop:party rdf:type dbr:Paris dbr:France dbo:country

slide-53
SLIDE 53

Cities managed by the French Socialist Party

select distinct ?organ where {?organ a dbo:Settlement . ?organ dbp:party <http://dbpedia.org/resource/Socialist_Party_(France)>}

slide-54
SLIDE 54

Tulip Example

slide-55
SLIDE 55

Tulip

▪ http://en.wikipedia.org/wiki/Tulip ▪ dbpedia:Tulip

▫ http://dbpedia.org/resource/Tulip

▪ http://dbpedia.org/page/Tulip

slide-56
SLIDE 56

Tuplip – Class FloweringPlant

the rdf:type edge denotes that a resource (node) belongs to a Class

dbpedia-owl:FloweringPlant dbpedia:Tulip rdf:type dbpedia:Tulip rdf:type dbpedia-owl:FloweringPlant .

slide-57
SLIDE 57

Tuplip – Class FloweringPlant

Triple Representation

dbpedia-owl:FloweringPlant dbpedia:Tulip rdf:type dbpedia:Tulip rdf:type dbpedia-owl:FloweringPlant . rdfs:Class rdf:type dbpedia-owl:FloweringPlant rdf:type rdfs:Class .

slide-58
SLIDE 58

All FloweringPlants

instances of the FloweringPlant class

dbpedia-owl:FloweringPlant ?fl rdf:type select ?fl where {?fl a dbo:FloweringPlant}

slide-59
SLIDE 59

Property ordo

dbpedia-owl:FloweringPlant rdf:type dbr:Liliales dbp:ordo dbpedia:Tulip

slide-60
SLIDE 60

All FloweringPlants ordo Liliales

dbpedia-owl:FloweringPlant ?fl rdf:type dbr:Liliales dbp:ordo SELECT ?fl WHERE { ?fl rdf:type dbo:FloweringPlant ; dbp:ordo dbr:Liliales . }

slide-61
SLIDE 61

Challenge: how to exploit?

geospecies:Liliaceae http://dbpedia.org/resource/Liliaceae skos:closeMatch

slide-62
SLIDE 62

Reptile Example

slide-63
SLIDE 63

Reptile Class

without namespaces

http://dbpedia.org/ontology/Reptile http://dbpedia.org/page/Goniurosaurus rdf:type <http://dbpedia.org/page/Goniurosaurus> rdf:type <http://dbpedia.org/ontology/Reptile>

slide-64
SLIDE 64

Reptile Class

with namespaces

dbo:Reptile http://dbpedia.org/resource/Goniurosaurus rdf:type dbr:Goniurosaurus rdf:type dbo:Reptile

slide-65
SLIDE 65

Nodes of the Reptile Class - SPARQL

without namespaces

http://dbpedia.org/ontology/Reptile ?animal rdf:type SELECT ?animal WHERE {?animal rdf:type <http://dbpedia.org/ontology/Reptile>} ?animal ?animal rdf:type rdf:type

slide-66
SLIDE 66

SPARQL

“a” replacing “rdf:type”

?animal rdf:type SELECT ?animal WHERE {?animal a <http://dbpedia.org/ontology/Reptile>} ?animal ?animal rdf:type rdf:type http://dbpedia.org/ontology/Reptile

slide-67
SLIDE 67

Nodes of the Reptile Class - SPARQL

with namespaces

dbo:Reptile ?animal rdf:type SELECT ?animal WHERE {?animal rdf:type dbo:Reptile} ?animal ?animal rdf:type rdf:type

slide-68
SLIDE 68

SPARQL

“a” replacing “rdf:type”

dbo:Reptile ?animal rdf:type SELECT ?animal WHERE {?animal a dbo:Reptile} ?animal ?animal rdf:type rdf:type

slide-69
SLIDE 69

Reptile Class

http://dbpedia.org/ontology/Reptile rdf:type http://dbpedia.org/resource/Goniurosaurus rdf:type http://dbpedia.org/ontology/Reptile . rdfs:Class rdf:type http://dbpedia.org/ontology/Reptile rdf:type rdfs:Class . http://dbpedia.org/resource/Goniurosaurus

slide-70
SLIDE 70

Property Order: Dinosaur

dbo:Reptile rdf:type dbr:Goniurosaurus dbr:Dinosaur dbo:order

slide-71
SLIDE 71

Nodes of the Reptile Class and Order Dinosaur – SPARQL

dbo:Reptile rdf:type ?animal dbr:Dinosaur dbo:order SELECT ?animal WHERE {?animal rdf:type dbo:Reptile . ?animal dbo:order dbr:Dinosaur}

slide-72
SLIDE 72

Property fossilRange: Early_Cretaceous

dbr:Early_Cretaceous dbp:fossilRange dbr:Embasaurus

slide-73
SLIDE 73

Nodes of the same fossilRange of the Embasaurus – SPARQL

?range dbp:fossilRange dbr:Embasaurus ?dino dbp:fossilRange ?dino dbp:fossilRange SELECT ?dinosaur WHERE {dbr:Embasaurus dbp:fossilRange ?range . ?dinosaur dbp:fossilRange ?range}

slide-74
SLIDE 74

Nodes of the same fossilRange of the Embasaurus – SPARQL

Some Results

dbr:Early_Cretaceous dbp:fossilRange dbr:Embasaurus dbr:Sauroplites dbp:fossilRange dbr:Edgarosaurus dbp:fossilRange SELECT ?dinosaur WHERE {dbr:Embasaurus dbp:fossilRange ?range . ?dinosaur dbp:fossilRange ?range}

slide-75
SLIDE 75

Processing the Query

▪ Process by pattern

▫ Find [species] whose [origin]

( → 0..*) part of → EUA

▪ Process by inference

▫ Find [species] whose [origin]

EUA →

▫ Rules:

  • If (A) origin (B) and (B) part of (C) => (A) origin (C)
  • If (A) part of (B) and (B) part of (C) => (A) part of (C)
slide-76
SLIDE 76

Cypher

MATCH (dn:Dinosaur)-[:Found]->(pl:Place) MATCH (pl)-[:Part_of*0..5]->(pl2:Place) WHERE pl2.id="USA" RETURN dn.id

slide-77
SLIDE 77

SPARQL

slide-78
SLIDE 78

Ontologia ResearchCard

slide-79
SLIDE 79

Propriedade

:Beyond_theory

card:autor

:Liz_Fraley card:author rdfs:Property

rdf:type

slide-80
SLIDE 80

Classe

:Beyond_theory card:BibliographicUnit

rdf:type

card:BibliographicUnit rdfs:Class

rdf:type

slide-81
SLIDE 81
slide-82
SLIDE 82

:Beyond_theory card:autor :Liz_Fraley :Configuration_Management card:autor :Christopher_Seiwald card:autor :Laura_Wingerd :Configuration_Management

Conjunto de Dados

slide-83
SLIDE 83

SELECT ?nome WHERE { ?nome rdf:type vcard:Name }

slide-84
SLIDE 84

SELECT ?publicacao WHERE { ?publicacao card:authors :Liz_Fraley }

slide-85
SLIDE 85

SELECT ?publicacao ?autor WHERE { ?publicacao card:authors ?autor }

slide-86
SLIDE 86

SELECT ?assunto WHERE { ?publicacao card:subjects ?assunto }

slide-87
SLIDE 87

SELECT ?assunto WHERE { ?publicacao card:authors :Liz_Fraley . ?publicacao card:subjects ?assunto }

slide-88
SLIDE 88

SELECT ?assunto WHERE { ?publicacao card:subjects ?assunto . ?assunto subj:superset subj:content_management }

slide-89
SLIDE 89

SELECT ?assunto WHERE { ?assunto rdf:type subj:Subject }

slide-90
SLIDE 90

SELECT ?assunto WHERE { ?assunto rdf:type subj:Subject . ?assunto subj:superset subj:content_management }

slide-91
SLIDE 91

SELECT ?assunto WHERE { ?assunto rdf:type subj:Subject . { { ?assunto subj:superset subj:content_management . } UNION { ?assunto subj:superset ?super . ?super subj:superset subj:content_management } } }

slide-92
SLIDE 92

Generic Examples

▪ All classes

SELECT ?classe WHERE { ?classe rdf:type owl:Class }

▪ All triples (resource, property, value)

SELECT ?r ?p ?v WHERE { ?r ?p ?v }

slide-93
SLIDE 93

SWRL

▪ Place(?pl1), Place(?pl2), Place(?pl3), partOf(?

pl1, ?pl2), partOf(?pl2, ?pl3) -> partOf(?pl1, ? pl3)

slide-94
SLIDE 94

http://dbpedia.org/page/Eye

slide-95
SLIDE 95

Agradecimentos

▪ Luiz Celso Gomes Jr (professor desta disciplina em 2014)

pela contribuição na disciplina e nos slides.

slide-96
SLIDE 96

André Santanchè

http://www.ic.unicamp.br/~santanche

slide-97
SLIDE 97

Property

Label Detail var:origin Origin of the specimen This descriptor has to be used with great precaution...

var:origin

property

slide-98
SLIDE 98

Using the Property

CodedDescription taxa:V_bengalensis.html Label Detail state:asia Asia and austral isles The specimen is from Asia or the austral islands...

var:origin

slide-99
SLIDE 99

Connected Graph

... taxa:V_bengalensis.html state:asia

var:origin

...

var:origin var:origin

slide-100
SLIDE 100

Origin in GeoNames

taxa:V_bengalensis.html http://www.geonames.org/1269750/

var:origin

India

slide-101
SLIDE 101

Geo Tree

http://www.geonames.org/6255147/ http://www.geonames.org/1269750/

gn:parentFeature

India Asia

slide-102
SLIDE 102

Hypergraph

(Jaudete Daltio, 2013)

slide-103
SLIDE 103

Licença

▪ Estes slides são concedidos sob uma Licença Creative

  • Commons. Sob as seguintes condições: Atribuição, Uso Não-

Comercial e Compartilhamento pela mesma Licença.

▪ Mais detalhes sobre a referida licença Creative Commons veja

no link: http://creativecommons.org/licenses/by-nc-sa/3.0/

▪ Fotografia de capa e fundos: web-drops por Jeremy Hiebert [

http://www.flickr.com/photos/jeremyhiebert/] dispinível em http://www.flickr.com/photos/jeremyhiebert/6081389428/