Slide 1

Slide 1 text

Introduction to the Semantic Web @arnoutboks Arnout Boks #010php 14-02-2019

Slide 2

Slide 2 text

@arnoutboks #010php What this talk is NOT about…

Slide 3

Slide 3 text

@arnoutboks #010php Finding info on the web An example

Slide 4

Slide 4 text

@arnoutboks #010php “Web 1.0”

Slide 5

Slide 5 text

@arnoutboks #010php “Web 1.0”

Slide 6

Slide 6 text

@arnoutboks #010php “Web 1.0”

Slide 7

Slide 7 text

@arnoutboks #010php Web 1.0 Web of Documents for human consumption

Slide 8

Slide 8 text

@arnoutboks #010php “Web 2.0” Feed of events • iCalendar or vCalendar? • Different types of events?

Slide 9

Slide 9 text

@arnoutboks #010php “Web 2.0” Weather forecast API • XML or JSON? • Which fields and properties? • Which units?

Slide 10

Slide 10 text

@arnoutboks #010php Web 2.0 Web of (individual) API’s for consumption by specialized software

Slide 11

Slide 11 text

@arnoutboks #010php Semantic web • Question to agent (e.g. Siri, Google Assistant) • Agent searches across different sources • Agent combines data • Agent answers question

Slide 12

Slide 12 text

@arnoutboks #010php Semantic Web (“Web 3.0”?) Web of Linked Data for consumption by intelligent agents/PA’s

Slide 13

Slide 13 text

@arnoutboks #010php Revolutionary? Term coined by Tim Berners-Lee in 2001

Slide 14

Slide 14 text

@arnoutboks #010php Revolutionary? Based on W3C-standards • RDF (1998) • RDFS (1998) • SPARQL (2008) • OWL (2004) • …

Slide 15

Slide 15 text

@arnoutboks #010php RDF Cornerstone of the Semantic Web Resource Description Framework Cornerstone of the Semantic Web

Slide 16

Slide 16 text

@arnoutboks #010php Records statements about things

Slide 17

Slide 17 text

@arnoutboks #010php RDF allows reading, merging, relaying and inferring statements without fully understanding them

Slide 18

Slide 18 text

@arnoutboks #010php RDF (triples) Subject Predicate Object

Slide 19

Slide 19 text

@arnoutboks #010php RDF (triples) Subject Predicate Object Arnout worksAt Moxio

Slide 20

Slide 20 text

@arnoutboks #010php RDF (triples) Subject Predicate Object Arnout worksAt Moxio Arnout twitterHandle “@arnoutboks” Arnout livesIn Delft Delft cityIn The Netherlands Moxio basedIn Delft

Slide 21

Slide 21 text

@arnoutboks #010php RDF (graph) Arnout Moxio Delft @arnoutboks worksAt basedIn The Netherlands Subject Predicate Object Arnout worksAt Moxio Arnout twitterHandle “@arnoutboks” Arnout livesIn Delft Delft cityIn The Netherlands Moxio basedIn Delft

Slide 22

Slide 22 text

@arnoutboks #010php Merging RDF (triples) Subject Predicate Object Arnout worksAt Moxio Arnout twitterHandle “@arnoutboks” Arnout livesIn Delft Delft cityIn The Netherlands Moxio basedIn Delft Subject Predicate Object The Netherlands hasCapital Amsterdam The Netherlands population “17.000.000”

Slide 23

Slide 23 text

@arnoutboks #010php Merging RDF (triples) Subject Predicate Object Arnout worksAt Moxio Arnout twitterHandle “@arnoutboks” Arnout livesIn Delft Delft cityIn The Netherlands Moxio basedIn Delft The Netherlands hasCapital Amsterdam The Netherlands population “17.000.000”

Slide 24

Slide 24 text

@arnoutboks #010php Merging RDF (graph) Arnout Moxio Delft @arnoutboks worksAt basedIn The Netherlands Amsterdam hasCapital 17.000.000 population

Slide 25

Slide 25 text

@arnoutboks #010php Serializing RDF: Turtle @prefix : . @prefix rdf: . @prefix xsd: . @base . :Arnout :livesIn :Delft ; :worksAt :Moxio ; :twitterHandle "@arnoutboks"^^xsd:string . :Delft :cityIn :The_Netherlands . :Moxio :basedIn :Delft .

Slide 26

Slide 26 text

@arnoutboks #010php Serializing RDF: RDF/XML > @a rnoutboks

Slide 27

Slide 27 text

@arnoutboks #010php Serializing RDF: JSON-LD [ { "@id" : "http://www.example.com/#Arnout", "http://www.example.com/#livesIn" : [ { "@id" : "http://www.example.com/#Delft" } ], "http://www.example.com/#twitterHandle" : [ { "@value" : "@arnoutboks" } ], "http://www.example.com/#worksAt" : [ { "@id" : "http://www.example.com/#Moxio" } ] }, ... ]

Slide 28

Slide 28 text

@arnoutboks #010php RDF is an abstract data model with different serialization formats

Slide 29

Slide 29 text

@arnoutboks #010php Identity Because there are multiple things named “Amsterdam”

Slide 30

Slide 30 text

@arnoutboks #010php Identity Subject Predicate Object Amsterdam numberOfGuns “42” Amsterdam status Wrecked National Maritime Museum (“Scheepvaartmuseum”)

Slide 31

Slide 31 text

@arnoutboks #010php Identity Subject Predicate Object Amsterdam numberOfGuns “42” Amsterdam status Wrecked Subject Predicate Object The Netherlands hasCapital Amsterdam The Netherlands population “17.000.000” National Maritime Museum (“Scheepvaartmuseum”) Lonely Planet

Slide 32

Slide 32 text

@arnoutboks #010php Identity The Netherlands Amsterdam hasCapital 17.000.000 population 42 Wrecked

Slide 33

Slide 33 text

@arnoutboks #010php URI’s for namespacing National Maritime Museum (“Scheepvaartmuseum”) https://www.hetscheepvaartmuseum.nl/ships/Amsterdam https://www.hetscheepvaartmuseum.nl/ships/numberOfGuns Lonely Planet https://www.lonelyplanet.com/Amsterdam https://www.lonelyplanet.com/hasCapital

Slide 34

Slide 34 text

@arnoutboks #010php Prefixes & QNames lonelyplanet:Amsterdam === https://www.lonelyplanet.com/Amsterdam QName URI local name local name namespace prefix

Slide 35

Slide 35 text

@arnoutboks #010php Prefixes & QNames National Maritime Museum (“Scheepvaartmuseum”) nmm:Amsterdam nmm:numberOfGuns Lonely Planet lonelyplanet:Amsterdam lonelyplanet:hasCapital

Slide 36

Slide 36 text

@arnoutboks #010php Three fundamental laws of the (Semantic) Web

Slide 37

Slide 37 text

@arnoutboks #010php Different name, different concept? lonelyplanet-en:Brussels lonelyplanet-nl:Brussel lonelyplanet-fr:Bruxelles lonelyplanet-zh:布魯塞爾

Slide 38

Slide 38 text

@arnoutboks #010php Different name, different concept? mi6:007 mi6:JamesBond

Slide 39

Slide 39 text

@arnoutboks #010php Nonunique Naming Assumption Different names do not imply different concepts

Slide 40

Slide 40 text

@arnoutboks #010php Truth & authority Subject Predicate Object whitehouse:Obama nsa:tapped whitehouse:Trump Donald Trump

Slide 41

Slide 41 text

@arnoutboks #010php Truth & authority Subject Predicate Object php-fig:CakePHP fw:isBetterThan php-fig:Symfony Donald Trump

Slide 42

Slide 42 text

@arnoutboks #010php The AAA Slogan “[On the web] Anyone can say Anything about Any topic”

Slide 43

Slide 43 text

@arnoutboks #010php (this slide intentionally left blank)

Slide 44

Slide 44 text

@arnoutboks #010php Absence of information Subject Predicate Object whitehouse:Trump fw:knows php-fig:Symfony whitehouse:Trump fw:knows php-fig:CakePHP whitehouse:Trump fw:knows php-fig:CodeIgniter

Slide 45

Slide 45 text

@arnoutboks #010php Open World Assumption We never have all information

Slide 46

Slide 46 text

@arnoutboks #010php SPARQL Query language for Semantic Web data

Slide 47

Slide 47 text

@arnoutboks #010php Triple Store Database for RDF triples

Slide 48

Slide 48 text

@arnoutboks #010php SPARQL SELECT ?employee ?company WHERE { ?employee :worksAt ?company . ?company :basedIn :Delft . }

Slide 49

Slide 49 text

@arnoutboks #010php SPARQL SELECT ?employee ?company WHERE { ?employee :worksAt ?company . ?company :basedIn :Delft . } ?employee ?company :Arnout :Moxio

Slide 50

Slide 50 text

@arnoutboks #010php SPARQL SELECT ?employee ?company ?city WHERE { ?employee :worksAt ?company . ?company :basedIn ?city . ?employee :livesIn ?city . } ?employee ?company ?city :Arnout :Moxio :Delft

Slide 51

Slide 51 text

@arnoutboks #010php Online SPARQL endpoints http://dbpedia.org/sparql

Slide 52

Slide 52 text

@arnoutboks #010php Online SPARQL endpoints

Slide 53

Slide 53 text

@arnoutboks #010php Online SPARQL endpoints PREFIX dbo: PREFIX dbr: SELECT ?song ?runtime WHERE { ?song dbo:artist dbr:The_Beatles . ?song dbo:runtime ?runtime . ?song rdf:type dbo:Song . } ORDER BY DESC (?runtime)

Slide 54

Slide 54 text

@arnoutboks #010php Online SPARQL endpoints

Slide 55

Slide 55 text

@arnoutboks #010php Online SPARQL endpoints PREFIX dbo: PREFIX dbr: SELECT ?ancestor WHERE { dbr:Willem-Alexander_of_the_Netherlands dbo:parent+ ?ancestor . }

Slide 56

Slide 56 text

@arnoutboks #010php RDF Schema Schema language for Semantic Web data

Slide 57

Slide 57 text

@arnoutboks #010php RDF Schema (RDFS) Describes the structure of RDF-data… in RDF • Classes • Properties • Domain and range of properties • Inheritance of classes • ‘Inheritance’ of properties

Slide 58

Slide 58 text

@arnoutboks #010php RDF Schema (RDFS) Subject Predicate Object :DonaldTrump :isFatherOf :IvankaTrump

Slide 59

Slide 59 text

@arnoutboks #010php RDF Schema (RDFS) Subject Predicate Object :DonaldTrump :isFatherOf :IvankaTrump :isFatherOf rdfs:range :Person :isFatherOf rdfs:domain :Father :Father rdfs:subclassOf :Parent :Parent rdfs:subclassOf :Person :isFatherOf rdfs:subpropertyOf :isParentOf

Slide 60

Slide 60 text

@arnoutboks #010php RDF Schema & Inference Subject Predicate Object :DonaldTrump :isFatherOf :IvankaTrump :isFatherOf rdfs:range :Person :isFatherOf rdfs:domain :Father :Father rdfs:subclassOf :Parent :Parent rdfs:subclassOf :Person :isFatherOf rdfs:subpropertyOf :isParentOf :IvankaTrump rdf:type :Person :DonaldTrump rdf:type :Father :DonaldTrump rdf:type :Parent :DonaldTrump rdf:type :Person :DonaldTrump :isParentOf :IvankaTrump

Slide 61

Slide 61 text

@arnoutboks #010php Inference Reasoner (asserted) triples inferred/virtual triples

Slide 62

Slide 62 text

@arnoutboks #010php Inference Reasoner (asserted) triples inferred/virtual triples

Slide 63

Slide 63 text

@arnoutboks #010php SPARQL & Inference SELECT ?person WHERE { ?person rdf:type :Person . } ?person :IvankaTrump :DonaldTrump

Slide 64

Slide 64 text

@arnoutboks #010php Combining data using inference Subject Predicate Object a:DonaldTrump rdf:type a:Person Datasource A Subject Predicate Object b:MelaniaTrump rdf:type b:Human Datasource B

Slide 65

Slide 65 text

@arnoutboks #010php Combining data using inference Subject Predicate Object a:DonaldTrump rdf:type a:Person Datasource A Subject Predicate Object b:MelaniaTrump rdf:type b:Human Datasource B Subject Predicate Object a:Person rdfs:subclassOf b:Human b:Human rdfs:subclassOf a:Person Mapping rules

Slide 66

Slide 66 text

@arnoutboks #010php Combining data using inference Subject Predicate Object a:DonaldTrump rdf:type a:Person b:MelaniaTrump rdf:type b:Human a:Person rdfs:subclassOf b:Human b:Human rdfs:subclassOf a:Person a:DonaldTrump rdf:type b:Human b:MelaniaTrump rdf:type a:Person

Slide 67

Slide 67 text

@arnoutboks #010php Query different sources as if they were one

Slide 68

Slide 68 text

@arnoutboks #010php RDF Schema vs. JSON/XML Schema Subject Predicate Object mi6:JamesBond rdf:type mi6:SecretAgent mi6:JamesBond nmm:numberOfGuns “1” MI6 files

Slide 69

Slide 69 text

@arnoutboks #010php RDF Schema vs. JSON/XML Schema Subject Predicate Object mi6:JamesBond rdf:type mi6:SecretAgent mi6:JamesBond nmm:numberOfGuns “1” MI6 files

Slide 70

Slide 70 text

@arnoutboks #010php RDF Schema vs. JSON/XML Schema Subject Predicate Object mi6:JamesBond rdf:type mi6:SecretAgent mi6:JamesBond nmm:numberOfGuns “1” MI6 files Subject Predicate Object nmm:numberOfGuns rdf:domain nmm:Ship National Maritime Museum (“Scheepvaartmuseum”)

Slide 71

Slide 71 text

@arnoutboks #010php RDF Schema vs. JSON/XML Schema Subject Predicate Object mi6:JamesBond rdf:type mi6:SecretAgent mi6:JamesBond nmm:numberOfGuns “1” nmm:numberOfGuns rdf:domain nmm:Ship mi6:JamesBond rdf:type nmm:Ship

Slide 72

Slide 72 text

@arnoutboks #010php RDF Schema vs. JSON/XML Schema

Slide 73

Slide 73 text

@arnoutboks #010php RDF Schema will never consider data to be invalid

Slide 74

Slide 74 text

@arnoutboks #010php Web Ontology Language (OWL) Even smarter inferencing Web Ontology Language (OWL) Even smarter inferencing

Slide 75

Slide 75 text

@arnoutboks #010php OWL OWL ≈ RDFS++

Slide 76

Slide 76 text

@arnoutboks #010php OWL Power comes at a price…

Slide 77

Slide 77 text

@arnoutboks #010php OWL: Inverse properties Subject Predicate Object :DonaldTrump :isParentOf :IvankaTrump :isParentOf owl:inverseOf :isChildOf :IvankaTrump :isChildOf :DonaldTrump

Slide 78

Slide 78 text

@arnoutboks #010php OWL: Symmetric properties Subject Predicate Object :DonaldTrump :isMarriedTo :MelaniaTrump :isMarriedTo rdf:type owl:SymmetricProperty :MelaniaTrump :isMarriedTo :DonaldTrump

Slide 79

Slide 79 text

@arnoutboks #010php OWL: Equality Subject Predicate Object :DonaldTrump :isMarriedTo :MelaniaTrump :DonaldTrump owl:sameAs :TheDon :TheDon :isMarriedTo :MelaniaTrump

Slide 80

Slide 80 text

@arnoutboks #010php OWL: Functional properties Subject Predicate Object :IvankaTrump :hasFather :DonaldTrump :IvankaTrump :hasFather :TheDon :hasFather rdf:type owl:FunctionalProperty :TheDon owl:sameAs :DonaldTrump

Slide 81

Slide 81 text

@arnoutboks #010php Inconsistency Subject Predicate Object :IvankaTrump :hasFather :DonaldTrump :IvankaTrump :hasFather :TheDon :hasFather rdf:type owl:FunctionalProperty :TheDon owl:differentFrom :DonaldTrump

Slide 82

Slide 82 text

@arnoutboks #010php Inconsistency

Slide 83

Slide 83 text

@arnoutboks #010php Inconsistency

Slide 84

Slide 84 text

@arnoutboks #010php It’s okay to be inconsistent… (remember the AAA slogan)

Slide 85

Slide 85 text

@arnoutboks #010php It’s okay to be inconsistent… (remember the AAA slogan) …but the reasoner won’t help you anymore

Slide 86

Slide 86 text

@arnoutboks #010php Self-test Subject Predicate Object :George :hasChild :Michelle :George :hasChild :James How many children does George have?

Slide 87

Slide 87 text

@arnoutboks #010php Reification Adding more nuance

Slide 88

Slide 88 text

@arnoutboks #010php Reifying a statement Subject Predicate Object php-fig:CakePHP fw:isBetterThan php-fig:Symfony

Slide 89

Slide 89 text

@arnoutboks #010php Reifying a statement Subject Predicate Object php-fig:CakePHP fw:isBetterThan php-fig:Symfony Subject Predicate Object :Statement1 rdf:subject php-fig:CakePHP :Statement1 rdf:predicate fw:isBetterThan :Statement1 rdf:object php-fig:Symfony Reification

Slide 90

Slide 90 text

@arnoutboks #010php Talking about a statement rather than making it

Slide 91

Slide 91 text

@arnoutboks #010php Use cases for reification Subject Predicate Object :Statement1 rdf:subject php-fig:CakePHP :Statement1 rdf:predicate fw:isBetterThan :Statement1 rdf:object php-fig:Symfony

Slide 92

Slide 92 text

@arnoutboks #010php Use cases for reification Subject Predicate Object :Statement1 rdf:subject php-fig:CakePHP :Statement1 rdf:predicate fw:isBetterThan :Statement1 rdf:object php-fig:Symfony whitehouse:Trump :says :Statement1

Slide 93

Slide 93 text

@arnoutboks #010php Use cases for reification Subject Predicate Object :Statement1 rdf:subject php-fig:CakePHP :Statement1 rdf:predicate fw:isBetterThan :Statement1 rdf:object php-fig:Symfony whitehouse:Trump :says :Statement1 :Statement1 :reliability "0.1"

Slide 94

Slide 94 text

@arnoutboks #010php Use cases for reification Subject Predicate Object :Statement1 rdf:subject php-fig:CakePHP :Statement1 rdf:predicate fw:isBetterThan :Statement1 rdf:object php-fig:Symfony whitehouse:Trump :says :Statement1 :Statement1 :reliability "0.1" :Statement1 :validUntil "2010-01-01"

Slide 95

Slide 95 text

@arnoutboks #010php Use cases for reification Subject Predicate Object :Statement1 rdf:subject php-fig:CakePHP :Statement1 rdf:predicate fw:isBetterThan :Statement1 rdf:object php-fig:Symfony whitehouse:Trump :says :Statement1 :Statement1 :reliability "0.1" :Statement1 :validUntil "2010-01-01"

Slide 96

Slide 96 text

@arnoutboks #010php Let’s get meta

Slide 97

Slide 97 text

@arnoutboks #010php Let’s get meta Subject Predicate Object :Statement1 rdf:subject php-fig:CakePHP :Statement1 rdf:predicate fw:isBetterThan :Statement1 rdf:object php-fig:Symfony :Statement2 rdf:subject whitehouse:Trump :Statement2 rdf:predicate :says :Statement2 rdf:object :Statement1 whitehouse:PressSec :says :Statement2

Slide 98

Slide 98 text

@arnoutboks #010php Further steps Get going with the Semantic Web

Slide 99

Slide 99 text

@arnoutboks #010php Leveraging the Semantic Web Network effect

Slide 100

Slide 100 text

@arnoutboks #010php Leveraging the Semantic Web Only useful when multiple parties speak the same ‘language’

Slide 101

Slide 101 text

@arnoutboks #010php Align with existing vocabularies

Slide 102

Slide 102 text

@arnoutboks #010php Leveraging the Semantic Web Mapping between vocabularies: • rdfs:subclassOf • rdfs:subpropertyOf • owl:inverseOf • owl:sameAs

Slide 103

Slide 103 text

@arnoutboks #010php Existing vocabularies • Dublin Core • Metadata about publications and authors • Friend of a Friend • People, connections, social networks • GoodRelations • Products, prices, eCommerce • CB-NL • Construction, infrastructure, spatial planning • QUDT • Quantities, units, dimensions, conversions

Slide 104

Slide 104 text

@arnoutboks #010php Resources • Apache Jena (includes Fuseki triple store) • Semantic web framework/tools (written in Java) • easyrdf/easyrdf • RDF parser/writer for PHP • semsol/arc2 • PHP RDF library and MySQL-based triple store • FaCT++, HermiT & Pellet • Open source OWL reasoners • Protégé • RDF/OWL IDE with various reasoner plugins

Slide 105

Slide 105 text

@arnoutboks #010php Resources

Slide 106

Slide 106 text

@arnoutboks #010php Resources • https://www.w3.org/2013/data/ • https://www.w3.org/2001/sw/wiki/ • https://www.w3.org/TR/rdf11-primer/ • https://www.w3.org/TR/owl2-primer/ • https://www.w3.org/TR/sparql11-query/ • http://wiki.dbpedia.org/OnlineAccess • https://www.data.gov/ • http://lod-cloud.net/

Slide 107

Slide 107 text

@arnoutboks #010php Feedback & Questions @arnoutboks @arnoutboks @aboks Arnout Boks Please leave your feedback on joind.in: https://joind.in/talk/53955

Slide 108

Slide 108 text

@arnoutboks #010php Image Credits • https://www.flickr.com/photos/lex-photographic/32521124574 • https://www.flickr.com/photos/flamesworddragon/19686463141 • https://www.flickr.com/photos/littlehuw/15236543728 • https://www.flickr.com/photos/crdominguez/422517106 • https://www.flickr.com/photos/pamwood707/5646757752 • https://www.flickr.com/photos/blair25/3240686470 • https://www.flickr.com/photos/tylerbeaulawrence/15167523690 • https://www.flickr.com/photos/23975018@N04/3675503072 • https://pixabay.com/nl/nuance-stalen-kleur-pantone-1074766/ • https://www.flickr.com/photos/borkurdotnet/9682277597