Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to the Semantic Web - phpCE 2017

Arnout Boks
November 04, 2017

Introduction to the Semantic Web - phpCE 2017

Video recording: https://www.youtube.com/watch?v=WUOuKB0Ji10.
Joind.in: https://joind.in/talk/eb31e

What if we could evolve our web of individual documents and data to a web of interlinked knowledge, a web where machines can automatically combine data from multiple sources and draw conclusions from it?
The Semantic Web technologies from W3C enable us to make sense of the data wilderness on the web and unlock the full potential of the data treasures hidden in it. In this talk, we will see how RDF enables us to formally describe the meaning of data and how such data can be queried with SPARQL. We will look at how OWL lets us make more expressive statements about the world, so that a computer can logically reason about it and infer new information. We will demonstrate these technologies by showing how they can be used to combine data sets in different formats as if they were one and letting a computer draw logical (and perhaps surprising) conclusions for us.

Arnout Boks

November 04, 2017
Tweet

More Decks by Arnout Boks

Other Decks in Technology

Transcript

  1. Introduction to the Semantic Web
    @arnoutboks
    Arnout Boks
    #phpce17
    04 nov 2017

    View full-size slide

  2. @arnoutboks #phpce17
    What this talk is NOT about…

    View full-size slide

  3. @arnoutboks #phpce17
    Finding info on the web
    An example

    View full-size slide

  4. @arnoutboks #phpce17
    “Web 1.0”

    View full-size slide

  5. @arnoutboks #phpce17
    “Web 1.0”

    View full-size slide

  6. @arnoutboks #phpce17
    “Web 1.0”

    View full-size slide

  7. @arnoutboks #phpce17
    Web 1.0
    Web of Documents
    for human consumption

    View full-size slide

  8. @arnoutboks #phpce17
    “Web 2.0”
    Feed of events
    • iCalendar or vCalendar?
    • Different types of events?

    View full-size slide

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

    View full-size slide

  10. @arnoutboks #phpce17
    Web 2.0
    Web of (individual) API’s
    for consumption by
    specialized software

    View full-size slide

  11. @arnoutboks #phpce17
    Semantic web
    • Question to agent (e.g. Siri)
    • Agent searches across different sources
    • Agent combines data
    • Agent answers question

    View full-size slide

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

    View full-size slide

  13. @arnoutboks #phpce17
    Revolutionary?
    Term coined by Tim Berners-Lee in 2001

    View full-size slide

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

    View full-size slide

  15. @arnoutboks #phpce17
    RDF
    Cornerstone of the Semantic Web
    Resource Description Framework
    Cornerstone of the Semantic Web

    View full-size slide

  16. @arnoutboks #phpce17
    Records statements
    about things

    View full-size slide

  17. @arnoutboks #phpce17
    RDF allows
    reading, merging, relaying
    and inferring statements
    without fully understanding them

    View full-size slide

  18. @arnoutboks #phpce17
    RDF (triples)
    Subject Predicate Object

    View full-size slide

  19. @arnoutboks #phpce17
    RDF (triples)
    Subject Predicate Object
    Arnout worksAt Moxio

    View full-size slide

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

    View full-size slide

  21. @arnoutboks #phpce17
    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

    View full-size slide

  22. @arnoutboks #phpce17
    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”

    View full-size slide

  23. @arnoutboks #phpce17
    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”

    View full-size slide

  24. @arnoutboks #phpce17
    Merging RDF (graph)
    Arnout Moxio
    Delft
    @arnoutboks
    worksAt
    basedIn
    The
    Netherlands
    Amsterdam
    hasCapital
    17.000.000
    population

    View full-size slide

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

    View full-size slide

  26. @arnoutboks #phpce17
    Serializing RDF: RDF/XML

    >
    rdf:about="http://www.example.com/#Arnout">
    rdf:datatype="http://www.w3.org/2001/XMLSchema#string">@a
    rnoutboks
    rdf:resource="http://www.example.com/#Moxio"/>
    rdf:resource="http://www.example.com/#Delft"/>



    View full-size slide

  27. @arnoutboks #phpce17
    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"
    } ]
    }, ... ]

    View full-size slide

  28. @arnoutboks #phpce17
    RDF is an abstract
    data model
    with different serialization formats

    View full-size slide

  29. @arnoutboks #phpce17
    Identity
    Because there are multiple things named “Amsterdam”

    View full-size slide

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

    View full-size slide

  31. @arnoutboks #phpce17
    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

    View full-size slide

  32. @arnoutboks #phpce17
    Identity
    The
    Netherlands Amsterdam
    hasCapital
    17.000.000
    population
    42
    Wrecked

    View full-size slide

  33. @arnoutboks #phpce17
    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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  36. @arnoutboks #phpce17
    Three fundamental laws
    of the (Semantic) Web

    View full-size slide

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

    View full-size slide

  38. @arnoutboks #phpce17
    Different name, different concept?
    mi6:007
    mi6:JamesBond

    View full-size slide

  39. @arnoutboks #phpce17
    Nonunique Naming Assumption
    Different names do not
    imply different concepts

    View full-size slide

  40. @arnoutboks #phpce17
    Truth & authority
    Subject Predicate Object
    whitehouse:Obama nsa:tapped whitehouse:Trump
    Donald Trump

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  43. @arnoutboks #phpce17
    (this slide intentionally left blank)

    View full-size slide

  44. @arnoutboks #phpce17
    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

    View full-size slide

  45. @arnoutboks #phpce17
    Open World Assumption
    We never have all information

    View full-size slide

  46. @arnoutboks #phpce17
    SPARQL
    Query language for Semantic Web data

    View full-size slide

  47. @arnoutboks #phpce17
    Triple Store
    Database for RDF triples

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  51. @arnoutboks #phpce17
    Online SPARQL endpoints
    http://dbpedia.org/sparql

    View full-size slide

  52. @arnoutboks #phpce17
    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)

    View full-size slide

  53. @arnoutboks #phpce17
    Online SPARQL endpoints

    View full-size slide

  54. @arnoutboks #phpce17
    RDF Schema
    Schema language for Semantic Web data

    View full-size slide

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

    View full-size slide

  56. @arnoutboks #phpce17
    RDF Schema (RDFS)
    Subject Predicate Object
    :DonaldTrump :isFatherOf :IvankaTrump

    View full-size slide

  57. @arnoutboks #phpce17
    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

    View full-size slide

  58. @arnoutboks #phpce17
    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

    View full-size slide

  59. @arnoutboks #phpce17
    Inference
    Reasoner
    (asserted) triples
    inferred/virtual triples

    View full-size slide

  60. @arnoutboks #phpce17
    Inference
    Reasoner
    (asserted) triples
    inferred/virtual triples

    View full-size slide

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

    View full-size slide

  62. @arnoutboks #phpce17
    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

    View full-size slide

  63. @arnoutboks #phpce17
    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

    View full-size slide

  64. @arnoutboks #phpce17
    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

    View full-size slide

  65. @arnoutboks #phpce17
    Query different sources
    as if they were one

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  68. @arnoutboks #phpce17
    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”)

    View full-size slide

  69. @arnoutboks #phpce17
    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

    View full-size slide

  70. @arnoutboks #phpce17
    RDF Schema vs. JSON/XML Schema

    View full-size slide

  71. @arnoutboks #phpce17
    RDF Schema will never
    consider data to be invalid

    View full-size slide

  72. @arnoutboks #phpce17
    Web Ontology Language (OWL)
    Even smarter inferencing
    Web Ontology Language (OWL)
    Even smarter inferencing

    View full-size slide

  73. @arnoutboks #phpce17
    OWL
    OWL ≈ RDFS++

    View full-size slide

  74. @arnoutboks #phpce17
    OWL
    Power comes at a price…

    View full-size slide

  75. @arnoutboks #phpce17
    OWL: Inverse properties
    Subject Predicate Object
    :DonaldTrump :isParentOf :IvankaTrump
    :isParentOf owl:inverseOf :isChildOf
    :IvankaTrump :isChildOf :DonaldTrump

    View full-size slide

  76. @arnoutboks #phpce17
    OWL: Symmetric properties
    Subject Predicate Object
    :DonaldTrump :isMarriedTo :MelaniaTrump
    :isMarriedTo rdf:type owl:SymmetricProperty
    :MelaniaTrump :isMarriedTo :DonaldTrump

    View full-size slide

  77. @arnoutboks #phpce17
    OWL: Equality
    Subject Predicate Object
    :DonaldTrump :isMarriedTo :MelaniaTrump
    :DonaldTrump owl:sameAs :TheDon
    :TheDon :isMarriedTo :MelaniaTrump

    View full-size slide

  78. @arnoutboks #phpce17
    OWL: Functional properties
    Subject Predicate Object
    :IvankaTrump :hasFather :DonaldTrump
    :IvankaTrump :hasFather :TheDon
    :hasFather rdf:type owl:FunctionalProperty
    :TheDon owl:sameAs :DonaldTrump

    View full-size slide

  79. @arnoutboks #phpce17
    Inconsistency
    Subject Predicate Object
    :IvankaTrump :hasFather :DonaldTrump
    :IvankaTrump :hasFather :TheDon
    :hasFather rdf:type owl:FunctionalProperty
    :TheDon owl:differentFrom :DonaldTrump

    View full-size slide

  80. @arnoutboks #phpce17
    Inconsistency

    View full-size slide

  81. @arnoutboks #phpce17
    Inconsistency

    View full-size slide

  82. @arnoutboks #phpce17
    It’s okay to be inconsistent…
    (remember the AAA slogan)

    View full-size slide

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

    View full-size slide

  84. @arnoutboks #phpce17
    Further steps
    Get going with the Semantic Web

    View full-size slide

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

    View full-size slide

  86. @arnoutboks #phpce17
    Leveraging the Semantic Web
    Network effect

    View full-size slide

  87. @arnoutboks #phpce17
    Leveraging the Semantic Web
    Only useful when multiple parties
    speak the same ‘language’

    View full-size slide

  88. @arnoutboks #phpce17
    Align with existing
    vocabularies

    View full-size slide

  89. @arnoutboks #phpce17
    Leveraging the Semantic Web
    Mapping between vocabularies:
    • rdfs:subclassOf
    • rdfs:subpropertyOf
    • owl:inverseOf
    • owl:sameAs

    View full-size slide

  90. @arnoutboks #phpce17
    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

    View full-size slide

  91. @arnoutboks #phpce17
    Resources
    • Apache Jena
    • 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

    View full-size slide

  92. @arnoutboks #phpce17
    Resources

    View full-size slide

  93. @arnoutboks #phpce17
    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/

    View full-size slide

  94. @arnoutboks #phpce17
    Feedback & Questions
    @arnoutboks
    @arnoutboks
    @aboks
    Arnout Boks
    Please leave your feedback on joind.in

    View full-size slide

  95. @arnoutboks #phpce17
    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://www.flickr.com/photos/borkurdotnet/9682277597

    View full-size slide