SlideShare a Scribd company logo
Semantic Web
Dr. Sebastian Ryszard Kruk

Dec 11th, 2012; Web Tuesday, Zurich
Outline

✤   Quick walk through the history of the Web

✤   The core principles of the Semantic Web

✤   Some vocabularies, schemas and ontologies you should know

✤   Publishing the Web 3.0 way

✤   Consuming semantics

✤   Semantic Web gotchas

✤   Summary: how Semantic Web technologies can help
The history of the Web
Let’s go back in time

✤   1937 - H.G. Wells: “World Brain”
✤   1945 - Vannevar Bush: Memex
✤   1969 - Doug Engelbart: ARPANET, online collaboration, mouse
✤   1989 - sir Tim Berners-Lee: WWW
✤   1995 - Dublin Core: semantics from librarian world
✤   1999 - prof. Stefan Decker: OntoBroker
✤   2000 - DARPA publish DAML specification
✤   2001 - TBL, Handler i Lassila: “The Semantic Web” (SciAm)
✤   2009 - TBL - 20th anniversary: “we’ve got all the tools"
✤   2009 - Google introduces Rich Snippets/RDFa; BestBuy sales
    increase
✤   2010 - Facebook starts Open Graph
✤   2012 - Google announces Knowledge Graph
The blueprints of the Web
The core principles
The “roadmap” cake
RDF is not a format!
RDF is not a format!
        Leather                           made by

 Wood                                     Chair
                                   is a             made


           made of                                               is a

                                                           Carpenter
                                                                           Man
                                          sits on
                                                                        is a
              has
 Back

 Leg
            count       used for

                    4               Sitting
RDF is not a format!
        Leather                           made by

 Wood                                     Chair
                                   is a             made
                             predicate
              subject
           made of                                     object    is a

                                                           Carpenter
                             a statement                                   Man
                                          sits on
                                                                        is a
              has
 Back

 Leg
            count       used for

                    4               Sitting
Resource, Literals and BNodes

✤   Resource - everything identified by URI/IRI

✤   Literal - a value (“four”)

    ✤   with an optional type (4^^xsd:int)

    ✤   or optional lang tag (“four”@en)

✤   BNode - point in the graph with only local _:name

✤   Statement - a triple (subject, predicate, object)

✤   Reification - a statement about the statement
Resource, Literals and BNodes

✤   Resource - everything identified by URI/IRI

✤   Literalns: a value (“four”)
            - <http://test.test/ns> .
     @prefix
     @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
     @prefix xsd: <http://www.w3.org/2001/XMLSchema> .
    ✤   with an optional type (4^^xsd:int)
     ns:Chair ns:has ns:Leg.

     _:sentence a rdf:Statement; tag (“four”@en)
        or optional lang
    ✤

              rdf:subject ns:Chair;
              rdf:predicate ns:has;
✤   BNoderdf:object ns:Leg;the graph with only
                - point in                                 local _:name
              ns:count “4”^^xsd:int.

✤   Statement - a triple (subject, predicate, object)

✤   Reification - a statement about the statement
Vocabularies

✤   Schemes:

    ✤   Taxonomy: narrower/broader

    ✤   Thesaurus: related

    ✤   Folksonomy: “machines are (using) us” Peter Mika [Yahoo]

✤   Ontology: “An ontology is a specification of a conceptualization” Tom
    Gruber, 1993 [*Siri]
Ontology languages


✤   RDF Schema: classes, properties, domains and ranges

✤   OWL (Web Ontology Language) - Lite, DL and Full, and OWL 2: (among
    others) inverse functional property, symmetry, transitiveness and
    disjointness

✤   But also: UML, ERD, ...
Vocabularies and ontologies
Dublin Core

✤   One of the oldest, originates from digital libraries

✤   Goals:

    ✤   semantic and syntactic interoperability

    ✤   shareable descriptions, vocabularies and constrains

✤   Defines:

    ✤   15 basic concepts, such as dc:title, dc:creator

    ✤   Additional classes and concepts in DC Qualifiers
FOAF+SIOC+SKOS




                 http://sioc-project.org
Good Relations

✤   De-facto standard for semantic e-commerce
    ✤   Supported by Google via Rich Snippets
    ✤   BestBuy showed how to increase revenue with it
    ✤   Part of the schema.org specification
✤   Example information:
    ✤   the geo-location of the store
    ✤   the countries the store ships to
    ✤   the payment options the ship accepts
✤   Distribute, open “Amazon”
schema.org



✤   Vocabulary for Rich Snippets and Knowledge Graph

✤   Yahoo+Bing+Google

✤   Microdata vs RDFa (Lite)
Publishing semantics
Linked (Open) Data




  http://linkeddata.org
5-Star Data Rules

✤   URIs = names for things

✤   HTTP URIs = enable look up

✤   Provide useful information
    upon lookup, using the
    standards (RDF*, SPARQL)

✤   Link to other URIs = enable
    discovery of more things.

                                  http://www.w3.org/DesignIssues/LinkedData.html
5-Star Data Rules

✤   URIs = names for things

✤   HTTP URIs = enable look up

✤   Provide useful information
    upon lookup, using the
    standards (RDF*, SPARQL)

✤   Link to other URIs = enable
    discovery of more things.

                                  http://www.w3.org/DesignIssues/LinkedData.html
Content negotiation
RDFa and RDFa Lite

✤   Extension to XHTML/HTML5 for embeding RDF graph semantics in
    HTML syntax:

    ✤   property vs rel

    ✤   resource vs about

    ✤   typeof

    ✤   vocab, prefix
RDFa and RDFa Lite

✤   Extension to XHTML/HTML5 for embeding RDF graph semantics in
    HTML syntax:
    <p vocab="http://schema.org/"
        property vs rel
     ✤ prefix="ov: http://open.vocab.org/terms/"
       resource="#skruk"
       typeof="Person">
       My name is <span property="name">Sebastian Kruk</span>
     ✤  resource vs about
       and you can give me a ring via
       <span property="telephone">+41-78-87-961-89</span>.
       <img property="image" src="http://bit.ly/QAYF10" />
       My favorite animal is the <span property="ov:preferredAnimal">Hamster</span>.
     ✤
    </p>typeof

    ✤   vocab, prefix
Rich Snippets (microdata)

<div class="col-right small" itemid="http://example/" itemtype="http://schema.org/
FurnitureStore">
 <ul class="list"><li><div itemprop="address" itemscope="" itemtype="http://schema.org/
PostalAddress">
  <p>
   <span itemprop="postalCode">5210</span> <span itemprop="addressLocality">Windisch</
span><br>
   <span itemprop="addressCountry">Switzerland</span><br>
  </p>
  <p>
   <a class="email" href="mailto:windisch@kruk.me" itemprop="email">windisch@kruk.me</a>
   <span itemprop="telephone">+41788796189</span><br>
  </p>
 </div></li></ul>
Rich Snippets (RDFa Lite)
<div class="col-right small" resource="http://example.com/" typeof="FurnitureStore"
vocab="http://schema.org/">
 <ul class="list"><li><div property="address" typeof="PostalAddress">
  <p>
   <span property="postalCode">5210</span> <span property="addressLocality">Windisch</
span><br>
   <span property="addressCountry">Switzerland</span><br>
  </p>
  <p>
   <a class="email" href="mailto:windisch@kruk.me" property="email">windisch@kruk.me</a>
   <span property="telephone">+41788796189</span><br>
  </p>
 </div></li></ul>
</div>
Consuming semantics
SPARQL



✤   W3C standard for querying RDF graphs

✤   Purposely made similar to SQL (to the extent possible)

✤   SPARQL endpoint: a standard way to expose (open) data published
    by the service
Path queries



✤   ?a :d “D”.

✤   ?a :a ?b. ?b :e “E”; :f “F”.

✤   ?a :b [ :c “C” ].
Path queries


                                             :c
                                                  C
                                   :b
✤   ?a :d “D”.
                                        :a        :e
                                   ?a        ?b        E
✤   ?a :a ?b. ?b :e “E”; :f “F”.
                                   :d             :f
✤   ?a :b [ :c “C” ].
                                        D         F
SELECT and more

✤   PREFIX dc: <http://purl.org/dc/elements/1.1/>

✤   SELECT ?title
    WHERE { <http://mybook.com> dc:title ?title.}

✤   CONSTRUCT { ?b ns:isKnownBy ?a }
    WHERE { ?a foaf:knows ?b }

✤   ASK { <http://kruk.me/> foaf:knows ?c }

✤   DESCRIBE ?a
    WHERE { ?a foaf:knows <http://kruk.me> }
SPARQL Filtering


✤   OPTIONAL { ?x ns:y ?z }

✤   FILTER ( xsd:dateTime(?date) >
    xsd:dateTime("2010-03-01T00:00:00Z") )

✤   FILTER regex( ?value, "This is a S+", "i" )

✤   isURI/isIRI, isBlank, isLiteral, sameTerm, langMatches

✤   str, lang, datatype
Python RDFLib

from rdflib.graph import Graph, URIRef
from rdflib.namespace import Namespace
from rdflib import plugin

plugin.register('sparql', rdflib.query.Processor,
               'rdfextras.sparql.processor', 'Processor')
plugin.register('sparql', rdflib.query.Result,
               'rdfextras.sparql.query', 'SPARQLQueryResult')
plugin.register('turtle', rdflib.serializer.Serializer,
               'rdflib.plugins.serializers.turtle', 'TurtleSerializer')
namespaces = { 'skos' : Namespace('http://www.w3.org/2004/02/skos/core#'), }

def list_friends(f_name, uri):
    g = Graph()
    g.parse(f_name, format="n3")

   query = "SELECT ?fn WHERE { ?f foaf:knows <%s>; foaf:name ?fn. }" % uri
   return [ f for f in g.query(query, initNs=namespaces) ]
Read RDFa into RDF



from pyRdfa import pyRdfa, Options

def rdf2turtle(url):
       options = Options(output_processor_graph=True)
       turtle = pyRdfa(options=options).rdf_from_source(url, outputFormat='turtle')
       return turtle
Gotchas
Don’t overcomplicate


✤   Gödel’s Incompleteness Theorems

✤   First-Order Logic vs OWL-Full / CYC

✤   Jim Handler: “Little semantics go a long way”

✤   Folksonomies
OOP vs Description Logic


✤   B rdfs:subClassOf A
    C rdfs:domain A
    D rdfs:domain B

✤   Infers:

    ✤   C rdfs:domain B [WRONG!]

    ✤   D rdfs:domain A [OK]
OOP vs Description Logic


✤   B rdfs:subClassOf A
    C rdfs:domain A
    D rdfs:domain B                                 domain
                                            A                C
✤   Infers:                        subClassOf
                                                    domain
                                                B            D
    ✤   C rdfs:domain B [WRONG!]

    ✤   D rdfs:domain A [OK]
Open World Assumptions


✤   RDF is by it’s virtue a distributed being

    ✤   You might only have a part of it

    ✤   The rest is on Linked Data

✤   Unlike in the close world assumption reasoning, if there is no
    statement “Sebastian isFrom Poland” it does not mean, I am not.
RDBMS and NoSQL vs RDF



✤   We can store RDF in RDBMS; even easier in NoSQL

✤   Certain SPARQL path queries can be translated to SQL

✤   Usually no joint queries NoSQL ➡ DIY path querying
How can web semantics help


✤   interoperability

✤   information retrieval

✤   recommendations and matchmaking

✤   SEO
Linked Data is King
Dr. Sebastian Ryszard Kruk

CTO/CRO Knowledge Hives sp. z o.o., sebastian@kruk.me

More Related Content

PPT
Tutorial on Semantic Digital Libraries (ESWC'2007)
PPT
Tutorial on Semantic Digital Libraries (WWW'2007)
PPT
Digital Libraries of the Future: Use of Semantic Web and Social Bookmarking t...
ZIP
Semantic Digital Libraries
PPT
Corrib.org - OpenSource and Research
PPT
Semantic Web Technologies For Digital Libraries
PDF
Linked (Open) Data
PDF
From the Semantic Web to the Web of Data: ten years of linking up
Tutorial on Semantic Digital Libraries (ESWC'2007)
Tutorial on Semantic Digital Libraries (WWW'2007)
Digital Libraries of the Future: Use of Semantic Web and Social Bookmarking t...
Semantic Digital Libraries
Corrib.org - OpenSource and Research
Semantic Web Technologies For Digital Libraries
Linked (Open) Data
From the Semantic Web to the Web of Data: ten years of linking up

What's hot (20)

PPT
JeromeDL - the Semantic Digital Library
PPTX
Development of Semantic Web based Disaster Management System
PDF
Better Search With Structured Knowledge
PPTX
General Introduction for Semantic Web and Linked Open Data
PPTX
semantic web & natural language
PDF
SDA2013 Pundit: Creating, Exploring and Consuming Annotations
PDF
Introduction to the Semantic Web
PPT
Porting Library Vocabularies to the Semantic Web - IFLA 2010
PPTX
NISO/DCMI Webinar: Schema.org and Linked Data: Complementary Approaches to Pu...
PPTX
Semantic web
PPTX
NISO/DCMI September 25 Webinar: Implementing Linked Data in Developing Countr...
PPT
Metadata Training for Staff and Librarians for the New Data Environment
PPTX
NISO/DCMI Webinar: Cooperative Authority Control: The Virtual International A...
PDF
06 gioca-ontologies
PPTX
Lecture linked data cloud & sparql
PPTX
NISO/DCMI May 22 Webinar: Semantic Mashups Across Large, Heterogeneous Insti...
PDF
An introduction to Semantic Web and Linked Data
PDF
Embedding Linked Data Invisibly into Web Pages: Strategies and Workflows for ...
PDF
NISO DCMI Webinar bibframe-20130123
PPT
Linked Data Tutorial
JeromeDL - the Semantic Digital Library
Development of Semantic Web based Disaster Management System
Better Search With Structured Knowledge
General Introduction for Semantic Web and Linked Open Data
semantic web & natural language
SDA2013 Pundit: Creating, Exploring and Consuming Annotations
Introduction to the Semantic Web
Porting Library Vocabularies to the Semantic Web - IFLA 2010
NISO/DCMI Webinar: Schema.org and Linked Data: Complementary Approaches to Pu...
Semantic web
NISO/DCMI September 25 Webinar: Implementing Linked Data in Developing Countr...
Metadata Training for Staff and Librarians for the New Data Environment
NISO/DCMI Webinar: Cooperative Authority Control: The Virtual International A...
06 gioca-ontologies
Lecture linked data cloud & sparql
NISO/DCMI May 22 Webinar: Semantic Mashups Across Large, Heterogeneous Insti...
An introduction to Semantic Web and Linked Data
Embedding Linked Data Invisibly into Web Pages: Strategies and Workflows for ...
NISO DCMI Webinar bibframe-20130123
Linked Data Tutorial
Ad

Similar to Semantic Web (20)

PDF
Semantic web assignment 3
PDF
Eifrem neo4j
PPTX
No Sql Movement
PPTX
Semantic Web and Related Work at W3C
PDF
Memoirs of a Graph Addict: Despair to Redemption
ODP
Grails goes Graph
PDF
Neo4j - The Benefits of Graph Databases (OSCON 2009)
PPTX
CSC 8101 Non Relational Databases
PDF
PDF
Using MongoDB as a high performance graph database
PPTX
An Introduction to NOSQL, Graph Databases and Neo4j
PDF
Metadata is back!
PDF
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
PPTX
Lecture the semantic_web_part_2
PDF
Towards an Interlinked Semantic Wiki Farm
PDF
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
ZIP
The InfoGrid Graph DataBase
PDF
Neo4j -- or why graph dbs kick ass
PPTX
Hacking with Semantic Web
PDF
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
Semantic web assignment 3
Eifrem neo4j
No Sql Movement
Semantic Web and Related Work at W3C
Memoirs of a Graph Addict: Despair to Redemption
Grails goes Graph
Neo4j - The Benefits of Graph Databases (OSCON 2009)
CSC 8101 Non Relational Databases
Using MongoDB as a high performance graph database
An Introduction to NOSQL, Graph Databases and Neo4j
Metadata is back!
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
Lecture the semantic_web_part_2
Towards an Interlinked Semantic Wiki Farm
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
The InfoGrid Graph DataBase
Neo4j -- or why graph dbs kick ass
Hacking with Semantic Web
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
Ad

More from Sebastian Ryszard Kruk (19)

PDF
Sieć Semantyczna w teorii i praktyce
PDF
Web 3.0 w teorii i praktyce
PDF
JeromeDL - Semantic Digital Library
PDF
Knowledge Management with Web 3.0
ZIP
węzełki.pl - knowledge sharing portal on Web 3.0
PDF
Ecdl2008 Jeromedl Evaluation Long
PDF
Rendering Navigation and Information Space with HoneyCombTM
PPT
Building Heterogeneous Networks of Digital Libraries on the Semantic Web
PDF
MultiBeeBrowse - Accessible Browsing on Unstructured Metadata
PPT
JeromeDL Tutorial
PDF
Role of Ontologies in Semantic Digital Libraries
PDF
Search and Browsing Cycle for Knowledge Discovery and Learning
PPT
Semantic Web in Action
PPT
Irish Digital Libraries Summit
PPT
Digital Libraries of the Future
PPT
Social Semantic Digital Libraries in a Nutshell
PPT
Social Semantic Search and Browsing
ODP
Browsing Information with TreeMaps
PPT
Social Semantic Collaborative Filtering
Sieć Semantyczna w teorii i praktyce
Web 3.0 w teorii i praktyce
JeromeDL - Semantic Digital Library
Knowledge Management with Web 3.0
węzełki.pl - knowledge sharing portal on Web 3.0
Ecdl2008 Jeromedl Evaluation Long
Rendering Navigation and Information Space with HoneyCombTM
Building Heterogeneous Networks of Digital Libraries on the Semantic Web
MultiBeeBrowse - Accessible Browsing on Unstructured Metadata
JeromeDL Tutorial
Role of Ontologies in Semantic Digital Libraries
Search and Browsing Cycle for Knowledge Discovery and Learning
Semantic Web in Action
Irish Digital Libraries Summit
Digital Libraries of the Future
Social Semantic Digital Libraries in a Nutshell
Social Semantic Search and Browsing
Browsing Information with TreeMaps
Social Semantic Collaborative Filtering

Recently uploaded (20)

PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PDF
My India Quiz Book_20210205121199924.pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
PDF
advance database management system book.pdf
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PDF
Trump Administration's workforce development strategy
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PPTX
Computer Architecture Input Output Memory.pptx
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PPTX
20th Century Theater, Methods, History.pptx
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
My India Quiz Book_20210205121199924.pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
TNA_Presentation-1-Final(SAVE)) (1).pptx
advance database management system book.pdf
B.Sc. DS Unit 2 Software Engineering.pptx
Trump Administration's workforce development strategy
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Computer Architecture Input Output Memory.pptx
LDMMIA Reiki Yoga Finals Review Spring Summer
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
AI-driven educational solutions for real-life interventions in the Philippine...
FORM 1 BIOLOGY MIND MAPS and their schemes
20th Century Theater, Methods, History.pptx
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf

Semantic Web

  • 1. Semantic Web Dr. Sebastian Ryszard Kruk Dec 11th, 2012; Web Tuesday, Zurich
  • 2. Outline ✤ Quick walk through the history of the Web ✤ The core principles of the Semantic Web ✤ Some vocabularies, schemas and ontologies you should know ✤ Publishing the Web 3.0 way ✤ Consuming semantics ✤ Semantic Web gotchas ✤ Summary: how Semantic Web technologies can help
  • 3. The history of the Web
  • 4. Let’s go back in time ✤ 1937 - H.G. Wells: “World Brain” ✤ 1945 - Vannevar Bush: Memex ✤ 1969 - Doug Engelbart: ARPANET, online collaboration, mouse ✤ 1989 - sir Tim Berners-Lee: WWW ✤ 1995 - Dublin Core: semantics from librarian world ✤ 1999 - prof. Stefan Decker: OntoBroker ✤ 2000 - DARPA publish DAML specification ✤ 2001 - TBL, Handler i Lassila: “The Semantic Web” (SciAm) ✤ 2009 - TBL - 20th anniversary: “we’ve got all the tools" ✤ 2009 - Google introduces Rich Snippets/RDFa; BestBuy sales increase ✤ 2010 - Facebook starts Open Graph ✤ 2012 - Google announces Knowledge Graph
  • 8. RDF is not a format!
  • 9. RDF is not a format! Leather made by Wood Chair is a made made of is a Carpenter Man sits on is a has Back Leg count used for 4 Sitting
  • 10. RDF is not a format! Leather made by Wood Chair is a made predicate subject made of object is a Carpenter a statement Man sits on is a has Back Leg count used for 4 Sitting
  • 11. Resource, Literals and BNodes ✤ Resource - everything identified by URI/IRI ✤ Literal - a value (“four”) ✤ with an optional type (4^^xsd:int) ✤ or optional lang tag (“four”@en) ✤ BNode - point in the graph with only local _:name ✤ Statement - a triple (subject, predicate, object) ✤ Reification - a statement about the statement
  • 12. Resource, Literals and BNodes ✤ Resource - everything identified by URI/IRI ✤ Literalns: a value (“four”) - <http://test.test/ns> . @prefix @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema> . ✤ with an optional type (4^^xsd:int) ns:Chair ns:has ns:Leg. _:sentence a rdf:Statement; tag (“four”@en) or optional lang ✤ rdf:subject ns:Chair; rdf:predicate ns:has; ✤ BNoderdf:object ns:Leg;the graph with only - point in local _:name ns:count “4”^^xsd:int. ✤ Statement - a triple (subject, predicate, object) ✤ Reification - a statement about the statement
  • 13. Vocabularies ✤ Schemes: ✤ Taxonomy: narrower/broader ✤ Thesaurus: related ✤ Folksonomy: “machines are (using) us” Peter Mika [Yahoo] ✤ Ontology: “An ontology is a specification of a conceptualization” Tom Gruber, 1993 [*Siri]
  • 14. Ontology languages ✤ RDF Schema: classes, properties, domains and ranges ✤ OWL (Web Ontology Language) - Lite, DL and Full, and OWL 2: (among others) inverse functional property, symmetry, transitiveness and disjointness ✤ But also: UML, ERD, ...
  • 16. Dublin Core ✤ One of the oldest, originates from digital libraries ✤ Goals: ✤ semantic and syntactic interoperability ✤ shareable descriptions, vocabularies and constrains ✤ Defines: ✤ 15 basic concepts, such as dc:title, dc:creator ✤ Additional classes and concepts in DC Qualifiers
  • 17. FOAF+SIOC+SKOS http://sioc-project.org
  • 18. Good Relations ✤ De-facto standard for semantic e-commerce ✤ Supported by Google via Rich Snippets ✤ BestBuy showed how to increase revenue with it ✤ Part of the schema.org specification ✤ Example information: ✤ the geo-location of the store ✤ the countries the store ships to ✤ the payment options the ship accepts ✤ Distribute, open “Amazon”
  • 19. schema.org ✤ Vocabulary for Rich Snippets and Knowledge Graph ✤ Yahoo+Bing+Google ✤ Microdata vs RDFa (Lite)
  • 21. Linked (Open) Data http://linkeddata.org
  • 22. 5-Star Data Rules ✤ URIs = names for things ✤ HTTP URIs = enable look up ✤ Provide useful information upon lookup, using the standards (RDF*, SPARQL) ✤ Link to other URIs = enable discovery of more things. http://www.w3.org/DesignIssues/LinkedData.html
  • 23. 5-Star Data Rules ✤ URIs = names for things ✤ HTTP URIs = enable look up ✤ Provide useful information upon lookup, using the standards (RDF*, SPARQL) ✤ Link to other URIs = enable discovery of more things. http://www.w3.org/DesignIssues/LinkedData.html
  • 25. RDFa and RDFa Lite ✤ Extension to XHTML/HTML5 for embeding RDF graph semantics in HTML syntax: ✤ property vs rel ✤ resource vs about ✤ typeof ✤ vocab, prefix
  • 26. RDFa and RDFa Lite ✤ Extension to XHTML/HTML5 for embeding RDF graph semantics in HTML syntax: <p vocab="http://schema.org/" property vs rel ✤ prefix="ov: http://open.vocab.org/terms/" resource="#skruk" typeof="Person"> My name is <span property="name">Sebastian Kruk</span> ✤ resource vs about and you can give me a ring via <span property="telephone">+41-78-87-961-89</span>. <img property="image" src="http://bit.ly/QAYF10" /> My favorite animal is the <span property="ov:preferredAnimal">Hamster</span>. ✤ </p>typeof ✤ vocab, prefix
  • 27. Rich Snippets (microdata) <div class="col-right small" itemid="http://example/" itemtype="http://schema.org/ FurnitureStore"> <ul class="list"><li><div itemprop="address" itemscope="" itemtype="http://schema.org/ PostalAddress"> <p> <span itemprop="postalCode">5210</span> <span itemprop="addressLocality">Windisch</ span><br> <span itemprop="addressCountry">Switzerland</span><br> </p> <p> <a class="email" href="mailto:windisch@kruk.me" itemprop="email">windisch@kruk.me</a> <span itemprop="telephone">+41788796189</span><br> </p> </div></li></ul>
  • 28. Rich Snippets (RDFa Lite) <div class="col-right small" resource="http://example.com/" typeof="FurnitureStore" vocab="http://schema.org/"> <ul class="list"><li><div property="address" typeof="PostalAddress"> <p> <span property="postalCode">5210</span> <span property="addressLocality">Windisch</ span><br> <span property="addressCountry">Switzerland</span><br> </p> <p> <a class="email" href="mailto:windisch@kruk.me" property="email">windisch@kruk.me</a> <span property="telephone">+41788796189</span><br> </p> </div></li></ul> </div>
  • 30. SPARQL ✤ W3C standard for querying RDF graphs ✤ Purposely made similar to SQL (to the extent possible) ✤ SPARQL endpoint: a standard way to expose (open) data published by the service
  • 31. Path queries ✤ ?a :d “D”. ✤ ?a :a ?b. ?b :e “E”; :f “F”. ✤ ?a :b [ :c “C” ].
  • 32. Path queries :c C :b ✤ ?a :d “D”. :a :e ?a ?b E ✤ ?a :a ?b. ?b :e “E”; :f “F”. :d :f ✤ ?a :b [ :c “C” ]. D F
  • 33. SELECT and more ✤ PREFIX dc: <http://purl.org/dc/elements/1.1/> ✤ SELECT ?title WHERE { <http://mybook.com> dc:title ?title.} ✤ CONSTRUCT { ?b ns:isKnownBy ?a } WHERE { ?a foaf:knows ?b } ✤ ASK { <http://kruk.me/> foaf:knows ?c } ✤ DESCRIBE ?a WHERE { ?a foaf:knows <http://kruk.me> }
  • 34. SPARQL Filtering ✤ OPTIONAL { ?x ns:y ?z } ✤ FILTER ( xsd:dateTime(?date) > xsd:dateTime("2010-03-01T00:00:00Z") ) ✤ FILTER regex( ?value, "This is a S+", "i" ) ✤ isURI/isIRI, isBlank, isLiteral, sameTerm, langMatches ✤ str, lang, datatype
  • 35. Python RDFLib from rdflib.graph import Graph, URIRef from rdflib.namespace import Namespace from rdflib import plugin plugin.register('sparql', rdflib.query.Processor, 'rdfextras.sparql.processor', 'Processor') plugin.register('sparql', rdflib.query.Result, 'rdfextras.sparql.query', 'SPARQLQueryResult') plugin.register('turtle', rdflib.serializer.Serializer, 'rdflib.plugins.serializers.turtle', 'TurtleSerializer') namespaces = { 'skos' : Namespace('http://www.w3.org/2004/02/skos/core#'), } def list_friends(f_name, uri): g = Graph() g.parse(f_name, format="n3") query = "SELECT ?fn WHERE { ?f foaf:knows <%s>; foaf:name ?fn. }" % uri return [ f for f in g.query(query, initNs=namespaces) ]
  • 36. Read RDFa into RDF from pyRdfa import pyRdfa, Options def rdf2turtle(url): options = Options(output_processor_graph=True) turtle = pyRdfa(options=options).rdf_from_source(url, outputFormat='turtle') return turtle
  • 38. Don’t overcomplicate ✤ Gödel’s Incompleteness Theorems ✤ First-Order Logic vs OWL-Full / CYC ✤ Jim Handler: “Little semantics go a long way” ✤ Folksonomies
  • 39. OOP vs Description Logic ✤ B rdfs:subClassOf A C rdfs:domain A D rdfs:domain B ✤ Infers: ✤ C rdfs:domain B [WRONG!] ✤ D rdfs:domain A [OK]
  • 40. OOP vs Description Logic ✤ B rdfs:subClassOf A C rdfs:domain A D rdfs:domain B domain A C ✤ Infers: subClassOf domain B D ✤ C rdfs:domain B [WRONG!] ✤ D rdfs:domain A [OK]
  • 41. Open World Assumptions ✤ RDF is by it’s virtue a distributed being ✤ You might only have a part of it ✤ The rest is on Linked Data ✤ Unlike in the close world assumption reasoning, if there is no statement “Sebastian isFrom Poland” it does not mean, I am not.
  • 42. RDBMS and NoSQL vs RDF ✤ We can store RDF in RDBMS; even easier in NoSQL ✤ Certain SPARQL path queries can be translated to SQL ✤ Usually no joint queries NoSQL ➡ DIY path querying
  • 43. How can web semantics help ✤ interoperability ✤ information retrieval ✤ recommendations and matchmaking ✤ SEO
  • 44. Linked Data is King Dr. Sebastian Ryszard Kruk CTO/CRO Knowledge Hives sp. z o.o., sebastian@kruk.me