THE SEMANTIC WEB AN INTRODUCTION LUIGI DE RUSSIS THE WEB IS A WEB OF DOCUMENT FOR PEOPLE, NOT FOR MACHINES THE SEMANTIC WEB IS A WEB OF DATA Linking Open Data cloud diagram, by Richard Cyganiak and Anja Jentzsch. http://lod-cloud.net/ LET’S THINK! EXERCISE: BUILD A MUSIC CATALOG Comprehensive guide to music across the world Web-based With always-updated information about each artist HOW? WHAT ARE THE PROBLEMS? WHAT ABOUT DATA REPLICATION? WHAT ABOUT DATA SYNCHRONIZATION? SOLUTION #1 HOW? Site editors roam the Web for new facts and update the site manually WHAT ARE THE PROBLEMS? A lot of people need to continuously roam the Web; the site will get soon out-of-date WHAT ABOUT DATA? Data is replicated and not up-to-date with new facts SOLUTION #2 HOW? Site editors roam the Web for new data and write a program to extract the information WHAT ARE THE PROBLEMS? Code needs to be updated each time a new site is found; the site will get out-of-date, soon or later… WHAT ABOUT DATA? Data is replicated and not up-to-date SOLUTION #3 HOW? Site editors browse the Web for new data via APIs, and write some code to incorporate the information WHAT ARE THE PROBLEMS? Code needs to be updated each time a new site is found and/or an API is changed; the site will get out-of-date, soon or later… WHAT ABOUT DATA? Data is replicated and not up-to-date SOLUTION #4 HOW? Site editors choose to use some external, public datasets (e.g., Wikipedia, MusicBrainz, …) WHAT ARE THE PROBLEMS? WHAT ABOUT DATA? No problem Data is immediately available, not as APIs or hidden on a Web site. Information can be extracted using standard queries or HTTP requests. SOLUTION #4 IN SHORT… Use the Web of Data as a Content Management System Use the community at large as content editor AN EXAMPLE: BBC MUSIC http://www.bbc.co.uk/music DATA ON THE WEB IS NOT ENOUGH! we need a proper infrastructure DATA SHOULD BE AVAILABLE ON THE WEB accessible via standard Web technologies DATA SHOULD BE INTERLINKED OVER THE WEB i.e., data can be integrated over the Web FUNDAMENTALS To a computer, the Web is a flat, boring world, devoid of meaning. This is a pity, as in fact documents on the Web describe real objects and imaginary concepts. […] Adding semantics to the Web involves two things: allowing documents which have information in machine-readable forms, and allowing links to be created with relationship values. Only when we have this extra level of semantics we will be able to use computer power to help us exploit the information to a greater extent than our own reading. TIM BERNERS-LEE, WHAT IS THE RELATIONSHIP WITH AI? INFLUENCE Some technologies in the Semantic Web benefited a lot from AI research and development (and viceversa) DIFFERENT GOALS Artificial Intelligence approach: build smarter machines, teach computers to infer the meaning of data Semantic Web approach: have smarter data, make data easier for machines to find, access and process RESOURCE AND DESCRIPTION RESOURCE every document “reachable” on the Web no matter the content, format, language, etc. RESOURCE DESCRIPTION independent from the format standard language (metadata) RESOURCE AND DESCRIPTION Resources RESOURCE AND DESCRIPTION Descriptio n RESOURCE AND DESCRIPTION Title Author Date Topic Quality Descriptio n Title Date Author Topic URIS unambiguous names for resources RDF a common data model to connect and describe resources SPARQL access to the data model OWL, RIF reasoning (mainly logic inference) RDFS, OWL common description languages MODELING DATA EXAMPLE: BOOKSTORE Represent the following data about the AI book as a set of relations Title: “Artificial Intelligence: A Modern Approach” Author: Russel, Stuart and Norvig, Peter Publisher: Prentice Hall ISBN: 978-0136042594 EXAMPLE: BOOKSTORE http://...isbn/9780136042594 Resource EXAMPLE: BOOKSTORE Artificial Intelligence: A Modern Approach http://...isbn/9780136042594 Literal EXAMPLE: BOOKSTORE http://...isbn/9780136042594 title Artificial Intelligence: A Modern Approach EXAMPLE: BOOKSTORE title http://...isbn/9780136042594 Artificial Intelligence: A Modern Approach publisher author Prentice Hall author Norvig, Peter Russel, Stuart RDF: RESOURCE DESCRIPTION FRAMEWORK STRUCTURED IN STATEMENTS PREDICATE a verb, property or relationship SUBJECT a resource (URI) OBJECT a resource or a literal string EXAMPLE: BOOKSTORE Subject Predicate title http://...isbn/9780136042594 Predicate Object Artificial Intelligence: A Modern Approach Predicate publisher author Object Prentice Hall Object author Norvig, Peter Object Russel, Stuart EXAMPLE: BOOKSTORE http://...isbn/9780136042594 title Artificial Intelligence: A Modern Approach RDF IN XML SYNTAX <rdf:RDF xmlns:rdf=http://www.w3.org/…/22-rdf-syntax-ns#> <rdf:Description about=“http://... isbn/9780136042594”> <title>Artificial Intelligence: A Modern Approach</title> </rdf:Description> </RDF> EXAMPLE: BOOKSTORE http://...isbn/9780136042594 title Artificial Intelligence: A Modern Approach RDF IN TURTLE <http://... isbn/9780136042594> title “Artificial Intelligence: A Modern Approach” LINKIN’ DATA EXAMPLE: BOOKSTORE Represent the following data about the Italian translation of the AI book as a set of relations Title: “Intelligenza artificiale. Un approccio moderno” Author: Russel, Stuart and Norvig, Peter Publisher: Prentice Hall ISBN: 978-8871925936 Original ISBN: 978-0136042594 EXAMPLE: BOOKSTORE title http://...isbn/9788871925936 Intelligenza Artificiale. Un approccio moderno publisher original Prentice Hall http://...isbn/9780136042594 creator creator Russel, Stuart Norvig, Peter EXAMPLE: BOOKSTORE http://...isbn/9788871925936 title Intelligenza Artificiale. Un approccio moderno publisher original Prentice Hall http://...isbn/9780136042594 http://...isbn/9780136042594 title publisher Artificial Intelligence: A Modern Approach Prentice Hall EXAMPLE: BOOKSTORE title http://...isbn/9788871925936 Intelligenza Artificiale. Un approccio moderno publisher original Prentice Hall http://...isbn/9780136042594 same URI, same resource title http://...isbn/9780136042594 creator Artificial Intelligence: A Modern Approach Prentice Hall EXAMPLE: BOOKSTORE Intelligenza Artificiale. Un approccio moderno title http://...isbn/9788871925936 publisher Prentice Hall original http://...isbn/9780136042594 author Russel, Stuart author creator creator title publisher Artificial Intelligence: A Modern Approach Prentice Hall Norvig, Peter Russel, Stuart Norvig, Peter EXAMPLE: BOOKSTORE Intelligenza Artificiale. Un approccio moderno title http://...isbn/9788871925936 publisher Prentice Hall original merging creator and author? What about In RDF, it is not possible! title http://...isbn/9780136042594 author Russel, Stuart author creator creator publisher Artificial Intelligence: A Modern Approach Prentice Hall Norvig, Peter Russel, Stuart Norvig, Peter PROBLEM: FIELD NAMES ARE ARBITRARY Synonyms : author or creator or maker or contributor or… Singular or plural: author or authors SOLUTION: STANDARDS general or domain-specific DUBLIN CORE GENERAL VOCABULARY Dublin Core Metadata Initiative (DCMI) http://dublincore.org BUILDING BLOCKS TO DEFINE METADATA FOR THE SEMANTIC WEB Define title, contributor, publisher, license, date, language, etc. PROBLEM: FIELD VALUES ARE ARBITRARY Value type: string, date, integer, … Value format: “Norvig, Peter” or “Norvig, P.” or “Peter Norvig” or… Value restrictions: one value or multiple values (how many?) SOLUTIONS Standards Controlled vocabulary (close list of terms) Semantically rich descriptions to support search (RDFS and/or OWL) FRIEND OF A FRIEND (FOAF) GENERAL ONTOLOGY Describe persons, their activities and their relations to other people and objects http://www.foaf-project.org BUILDING BLOCKS TO DEFINE STRUCTURED RELATIONS BETWEEN PEOPLE Define name, familyName, givenName, knows, age, nick, etc. EXAMPLE: BOOKSTORE dc:title http://...isbn/9780136042594 dc:creator dc:publisher dc:creator foaf:name Prentice Hall foaf:name Norvig, Peter Artificial Intelligence: A Modern Approach foaf:name Russel, Stuart foaf: http://xmlns.com/foaf/spec dc: http://purl.org/dc/terms WHY? http://...isbn/9780136042594 http://...isbn/9780136042594 dc:creator author Norvig, Peter foaf:name Norvig, Peter RDF SCHEMA RDF SCHEMA SCHEMA Definition of the nodes and predicates used in a RDF document DOMAIN AND RANGE RDFS describes properties in terms of classes of resource to which they apply (from a “domain” to a “range”) EXAMPLE RDF data http://elite.polito.it/people/derussis teaches http.//bit.ly/lingambmult EXAMPLE Person subClassOf domain Teacher range teaches type http://elite.polito.it/people/derussis Course type teaches RDF schema RDF data http.//bit.ly/lingambmult BACK TO THE BOOKSTORE EXAMPLE… http://...isbn/9780136042594 http://...isbn/9780136042594 dc:creator author Norvig, Peter foaf:name Norvig, Peter BACK TO THE BOOKSTORE EXAMPLE… http://...isbn/9780136042594 http://...isbn/9780136042594 dc:creator author Norvig, Peter anonymous class foaf:name Norvig, Peter dc:creator has range Agent, i.e. a class (resource), not a literal: we use an anonymous class for this scope. Finally, foaf:Name has range rdfs:Literal. RDFS EXPRESSIVITY SIMPLE RELATIONSHIP BETWEEN THINGS RDFS provides a vocabulary to express relationship between things (e.g., subClassOf or type) AVOID COMPLEX RELATIONSHIP RDFS cannot describe data in terms of set of operations (e.g., unionOf), equivalence (e.g., sameAs) or cardinality (e.g., allValueFrom) OWL WEB ONTOLOGY LANGUAGE WHAT? OWL (version 2): a knowledge representation language Designed to formulate, exchange and reason with knowledge about a domain of interest WEB ONTOLOGY LANGUAGE INDIVIDUALS, CLASSES AND PROPERTIES “Politecnico di Torino is a university” “Politecnico di Torino has a professor named Elio Piccolo” “Politecnico di Torino” is a object: an individual in OWL2 “university” is a category: a class in OWL2 “has a professor” is a relation: a property in OWL2 “Elio Piccolo” is an individual, too WEB ONTOLOGY LANGUAGE EXPRESSIVITY Designed to represent rich and complex knowledge about things, group of things, and their relations LOGIC-BASED Knowledge expressed in OWL can be reasoned with a computer program to verify its consistency or to make implicit knowledge explicit WEB ONTOLOGY LANGUAGE LINKED Ontologies in OWL can be published on the Web and may refer or be referred from other OWL ontologies CHOOSE THE SYNTAX YOU LIKE Various syntaxes available for OWL, for different purposes (RDF/XML, Turtle, Manchester, etc.) EXAMPLE: BOOKSTORE dc:title http://...isbn/9788871925936 rdfs:type dc:publisher Libro Intelligenza Artificiale. Un approccio moderno Prentice Hall owl:sameAs Book rdf:type dc:title Artificial Intelligence: A Modern Approach http://...isbn/9780136042594 dc:publisher Prentice Hall HANDS ON OWL EXAMPLE: BOOKSTORE It is time to sell the books we modeled. Users must have the possibility to search in our book catalog. We need to describe our store and add some other information about the books. GoodRelations helps in realizing such an example: http://www.heppnetz.de/projects/goodrelations/ “EUR” gr:hasCurrency 120.0 1.0 gr:hasCurrencyValue gr:amountOfThisGood gr:Sell UnitPriceSpecification_1 gr:hasBusinessFunction TypeAndQuantity Node_1 gr:hasPriceSpecification Bookstore_1 gr:typeOfGood Offering_1 gr:offers gr:ActualProductOrServiceInstance AIBook_en rdf:type rdf:type gr:Offering rdf:type gr:includeObject item:hasTotalPages QuantitativeValue Integer_1 gr:hasValue 1132 item:Book rdfs:subClassOf gr:ProductOrService DESCRIBE THE BUSINESS ENTITY default:BookStore_1 a gr:BusinessEntity ; gr:legalName “bookstore.com Ltd.”^^xsd:string . Bookstore_1 DESCRIBE THE OFFERED ITEMS AIBook_en default:AIBook_en a item:Book, gr:ActualProductOrServiceInstance ; item:hasTotalPages default:QuantitativeValueInteger_1 . default:QuantitativeValueInteger_1 a gr:QuantitativeValueInteger ; gr:hasValue “1132”^^xsd:integer . QuantitativeValue Integer_1 DESCRIBE THE OFFER Offering_1 default:Offering_1 a gr:Offering ; gr:hasBusinessFunction gr:Sell ; gr:hasPriceSpecification default:UnityPriceSpecification_1 ; gr:includeObject default:TypeAndQuantityNode_1 . LINK THE OFFER TO THE BUSINESS ENTITY default:BookStore_1 gr:offers default:Offering_1 DESCRIBE THE OFFER default:TypeAndQuantityNode_1 a gr:TypeAndQuantityNode ; gr:amountOfThisGood “1.0”^^xsd:float ; gr:typeOfGood default:AIBook_en . TypeAndQuantity Node_1 default:UnitPriceSpecification_1 a gr:UnitPriceSpecification ; gr:hasCurrency “EUR”^^xsd:string ; gr:hasCurrencyValue “120.0”^^xsd:float . UnitPriceSpecification_1 QUERY THE WHOLE! How to get all the available offer for the book? SPARQL PREFIX gr: <http://purl.org/goodrelations/v1#> PREFIX item: <http://www.elite.polito.it/ontologies/example/item#> SELECT ?offering WHERE { ?offering rdf:type gr:Offering . ?offering gr:includesObject ?object . ?object gr:typeOfGood ?item . ?item rdf:type item:Book . } QUERY THE WHOLE! SPARQL ?item rdf:type item:Book . ?item rdf:type item:Book QUERY THE WHOLE! SPARQL ?object gr:typeOfGood ?item . ?object gr:typeOfGood AIBook_en rdf:type item:Book QUERY THE WHOLE! SPARQL ?offering gr:includesObject ?object . TypeAndQuantity Node_1 gr:typeOfGood ?offering gr:includeObject AIBook_en rdf:type item:Book QUERY THE WHOLE! SPARQL ?offering rdf:type gr:Offering . TypeAndQuantity Node_1 gr:typeOfGood ?offering gr:includeObject AIBook_en rdf:type gr:Offering rdf:type item:Book QUERY THE WHOLE! SPARQL SELECT ?offering TypeAndQuantity Node_1 gr:typeOfGood Offering_1 gr:includeObject AIBook_en rdf:type gr:Offering rdf:type item:Book REFERENCES Semantic Web standards: http://w3c.org/standards/semanticweb Semantic Web Wiki: http://semanticweb.org Semantic Web FAQ: http://www.w3c.org/2001/sw/SW-FAQ Book: A Semantic Web Primer (http://www.semanticwebprimer.org) Book: Semantic Web Programming (http://semwebprogramming.org) Last access: 04 June 2013 THANKS! Luigi De Russis http://elite.polito.it LICENSE This work is licensed under the Creative Commons “Attribution-NonCommercialShareAlike Unported (CC BY-NC-SA 3,0)” License. You are free: to Share - to copy, distribute and transmit the work to Remix - to adapt the work Under the following conditions: Attribution - You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial - You may not use this work for commercial purposes. Share Alike - If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. To view a copy of this license, visit http://creativecommons.org/licenses/by-ncsa/3.0/