View
10
Download
0
Category
Preview:
Citation preview
1
– 1 – 1
Introduction to the Semantic Web
Alberto Fernández University Rey Juan Carlos alberto.fernandez@urjc.es
– 2 –
2
– 3 –
Profile: • Public University • Founded in 1997 • >29000 students • 4 campus in greater Madrid
Fuenlabrada
Móstoles
Alcorcón
Vicálvaro Medicine & Health
Sciences
Polytechnic
Information and Communication
Sciences
Law & Social Sciences
University Rey Juan Carlos
– 4 –
URJC: Computer Science Studies
• Degrees – Degree in Informatics Engineering – Degree in Hardware Engineering – Degree in Software Engineering – Double Degree in Informatics Engineering + Software Engineering – Double Degree in Informatics + Business Administration – Double Degree in Informatics Engineering + Mathematics – Double Degree in Software Engineering + Mathematics
• Master/Doctorate – Advanced Hardware and Software Systems – Graphics, Games and Virtual Reality – Interactive Informatics and Multimedia – Information Systems Engineering – Telematics and Informatics Systems – Computer Vision
4
3
– 5 –
Introduction to the Semantic Web
1. Introduction to the Semantic Web 2. Ontology languages 3. Querying the Semantic Web 4. Linked Data
– 6 –
The Semantic Web
• What is the Web? – HTTP (how to transfer data)
GET /index.htm – URI (how to address data)
http://www.ia.urjc.es/ – HTML (how to present data to humans)
<html> <head> <title>Artificial Intelligence Group</title> …
• The problem with the Web Millions of different documents online. Problems: – How to find the right documents? – How to extract relevant information (from those documents)? – How to combine information from different sources?
4
– 7 –
How to find the right documents?
What is the publications page of Tim Berners-Lee?
– 8 –
How to extract relevant information?
What is a book about the Web?
What is the price?
5
– 9 –
How to combine information?
I want the cheapest offer of ‘‘A Semantic Web Primer“
– 10 –
How to combine information?
I want the cheapest offer of “A Semantic Web Primer“ including shipping costs Several clicks to get the shipping costs
Alberto Fernandez Universidad Rey Juan Carlos Tulipan s/n Mostoles 28933. Spain
6
– 11 –
The Semantic Web
• Solution – Instead of natural language … – … publish machine-understandable information – Make queries in terms machine-understandable
• How? – Representing knowledge using standardised Ontologíes
• Semantic Web: “the idea of having data on the Web defined and linked in a way that it can be used by machines not just for display purposes, but for automation, integration and reuse of data across various applications”
[W3C Semantic Web Activity (http://www.w3.org/2001/sw/)]
Ingeniería del Conocimiento 4º Ingeniería Informática
– 12 –
Semantic Web Layered Architecture
7
– 13 –
Introduction to the Semantic Web
1. Introduction to the Semantic Web 2. Ontology languages
1. RDF 2. RDF Schema 3. OWL
3. Querying the Semantic Web 4. Linked Data
– 14 –
RDF
• Resource Description Framework • W3C Recommentation
– http://www.w3.org/RDF/ – http://www.w3.org/TR/rdf-primer/
• Data model: semantic net • Sentence = triple (Subject, Predicate, Object)
– Subject: resource (URI) or “blank node” – Predicate/Property: binary relation (URI) – Object: URI, literal or “blank node”
8
– 15 –
RDF: Example
<http://www.example.org/index.html> <http://purl.org/dc/elements/1.1/creator> <http://www.example.org/staffid/85740> . <http://www.example.org/index.html> <http://www.example.org/terms/creation-date> "August 16, 1999" . <http://www.example.org/index.html> <http://purl.org/dc/elements/1.1/language> "en" . more compact (@prefix ex: <http://www.example.org/>.):
ex:index.html dc:creator exstaff:85740 . ex:index.html exterms:creation-date "August 16, 1999" . ex:index.html dc:language "en" .
Notation: Turtle
– 16 –
RDF: XML syntax. Example
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:exterms="http://www.example.org/terms/"> <rdf:Description rdf:about="http://www.example.org/index.html"> <exterms:creation-date>August 16, 1999</exterms:creation-date> </rdf:Description> <rdf:Description rdf:about="http://www.example.org/index.html"> <dc:language>en</dc:language> </rdf:Description> <rdf:Description rdf:about="http://www.example.org/index.html"> <dc:creator rdf:resource="http://www.example.org/staffid/85740"/> </rdf:Description> </rdf:RDF>
<rdf:Description rdf:about="http://www.example.org/index.html"> <exterms:creation-date>August 16, 1999</exterms:creation-date> <dc:language>en</dc:language> <dc:creator rdf:resource="http://www.example.org/staffid/85740"/> </rdf:Description>
9
– 17 –
RDF: Blank Nodes
• Nodes without URI (no needed) • Anonymous resources • Independent among each other
exstaff:85740 exterms:address _:johnaddress . _:johnaddress exterms:street "1501 Grant Avenue" . _:johnaddress exterms:city "Bedford" . _:johnaddress exterms:state "Massachusetts" . _:johnaddress exterms:postalCode "01730" .
– 18 –
RDF: Literals
• Data Types – The only predefined data types is rdf:XMLLiteral – Recommendation: XML Schema datatypes
(xsd=http://www.w3.org/2001/XMLSchema#): • xsd:string, xsd:integer, xsd:date,…
• Example ex:index.html exterms:creation-date "1999-08-16"^^xsd:date .
<creation-date rdf:datatype="http://www.w3.org/2001/XMLSchema#date"> 1999-08-16 </creation-date> <title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
RDF primer </title>
10
– 19 –
RDF: Containers and Collections
• Containers – rdf:Bag: unordered. May contain duplicates. – rdf:Seq: ordered. May contain duplicates. – rdf:Alt: set of alternatives – Note: containers are “open”
• Collections – “Closed” collections – rdf:List, rdf:first ,rdf:rest, rdf:nil
– 20 –
RDF: Reification
• Mechanism to turn a statement into a resource • So we can make statements about other statements • Vocabulary
– Sentence: rdf:Statement – rdf:subject, rdf:predicate, rdf:object
• Example: (ex:index.html dc:creator exstaff:85740 .) ex:triple1 rdf:type rdf:Statement . ex:triple1 rdf:subject ex:index.html . ex:triple1 rdf:predicate dc:creator . ex:triple1 rdf:object exstaff:85740 .
11
– 21 –
Introduction to the Semantic Web
1. Introduction to the Semantic Web 2. Ontology languages
1. RDF 2. RDF Schema 3. OWL
3. Querying the Semantic Web 4. Linked Data
– 22 –
RDF Schema (RDFS)
• In RDF we talk about individual objects (resources) • We would like to reason about classes that define
typos of objects – For instance, to avoid sentences like (allowed in RDF):
• SSIM is taught by SSIM (range restriction) • Porto F.C. is taught by John (domain restriction)
• Solution – Classes, relations, domain and range restrictions, … – Example:
• Courses must be taught by academic staff members only
12
– 23 –
RDF Schema (RDFS)
• W3C Recommendation – http://www.w3.org/TR/rdf-schema/
• RDFS extends RDF con new primitives • Defines a basic language for describing ontologies
– Fixing the semantics of “subclass of” – Classes and Properties hierarchies – Inheritance – Domain and Range restrictions
– 24 –
RDF Schema (RDFS)
• Clases (rdfs:Class) e Instancias (rdf:type) Class definition
<rdf:Description rdf:ID=“Course"> <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/> </rdf:Description>
Or <rdfs:Class rdf:ID="Course"/>
Instances <Asignatura rdf:ID="SSIM "/>
• Class hierarchies (rdfs:subClassOf) <rdfs:Class rdf:ID=”Professor"> <rdfs:subClassOf rdf:resource="#AcademisStaff"/> </rdfs:Class>
13
– 25 –
RDF Schema (RDFS)
• Properties (rdf:Property) <rdf:Property rdf:ID=”taught_by“/>
• Property restrictions (rdfs:domain, rdfs:range) <rdf:Property rdf:ID="taught_by">
<rdfs:domain rdf:resource="#Course"/> <rdfs:range rdf:resource="#AcademicStaff"/>
</rdf:Property>
• Property hierachies (rdfs:subPropertyOf) <rdf:Property rdf:ID=”taught_by">
<rdfs:domain rdf:resource="#Course"/> <rdfs:range rdf:resource="#AcademicStaff"/> <rdfs:subPropertyOf rdf:resource="#involves"/>
</rdf:Property>
– 26 –
RDF Schema (RDFS)
taught_by Academic Staff
Assistant Professor
Professor
Course
property
Class Staff involves
domain
domain
range
range
subClassOf
subClassOf subClassOf
SSIM Eugenio Oliveira
type
type type
RDF Schema
RDF
subPropertyOf
taught_by
14
– 27 –
RDF Schema (RDFS)
• Primitives – Classes
• rdfs:Resource, rdfs:Literal, rdf:XMLLiteral, rdfs:Class, rdf:Property, rdfs:Datatype
– Properties • rdf:type, rdfs:subclassOf, rdf:subPropertyOf, rdfs:domain,
rdfs:range, rdfs:label, rdfs:comment – Containers
• rdfs:Container, rdf:Bag, rdf:Seq, rdf:Alt, rdfs:ContainerMembershipProperty, rdfs:member
– Collections • rdf:List, rdf:first, rdf:rest, rdf:nil
– Reification • rdf:Statement, rdf:predicate, rdf:subject, rdf:object
– Others • rdfs:seeAlso, rdfs:isDefinedBy, rdf:value
– 28 –
RDF Schema (RDFS)
owns
Fish
Person
domain range
Wendy Wanda
type
type
owns
Marmaid?
Restriction violation: the range of owns is Fish.
OR There is not inconsistency: Wanda is a fish!
type
15
– 29 –
RDFS
• RDFS limitations – It basically allows organise vocabularies in hierarchies – Local scope of properties
• Range restrictions cannot be applied to some classes only – It cannot be expressed:
• Disjoint classes – Example: male y female
• Boolean combinations of classes – Example: Person = Man ∪ Woman
• Cardinality restrictions • Special characteristics of properties
– Transitive, symmetric, inverse of, …
– 30 –
Introduction to the Semantic Web
1. Introduction to the Semantic Web 2. Ontology languages
1. RDF 2. RDF Schema 3. OWL
3. Querying the Semantic Web 4. Linked Data
16
– 31 –
OWL
• Web Ontology Language • W3C Recommendation
– http://www.w3.org/2004/OWL/ – http://www.w3.org/TR/owl-guide/
• Language for describing ontologies • Extends RDFS, adding primitives to augment
expressivity
– 32 –
OWL
• Heading – owl:Ontology – owl:imports: URI ontología – owl:versionInfo – owl:priorVersion: URI ontología – owl:backwardCompatibleWith – owl:incompatibleWith: it is not backward compatible – owl:DeprecatedClass – owl:DeprecatedProperty <owl:Ontology rdf:about=""> <owl:versionInfo>v 1.1</owl:versionInfo> <rdfs:comment>An example ontology</rdfs:comment> <owl:imports rdf:resource="http://www.example.org/foo"/> <owl:backwardCompatibleWith rdf:resource="http://www.example.org/vehicle-1.0"/> <owl:priorVersion rdf:resource="http://www.example.org/veh-1.0"/> </owl:Ontology>
17
– 33 –
• Classes – owl:Class
• owl:Class is subclass of rdfs:Class <owl:Class rdf:ID=”Course"/>
– rdfs:subClassOf (v) – owl:Thing: > (superclass of all classes) – owl:Nothing: ? (subclass of all classes)
OWL
– 34 –
• Properties – owl:ObjectProperty – owl:DatatypeProperty – rdfs:subPropertyOf (r1 v r2 in H)
– rdfs:domain (9r.> v C or > v 8r –.C) – rdfs:range (> v 8r –.C)
OWL
18
– 35 –
• Property characteristics – owl:TransitiveProperty: (r+)
• p(x,y) ∧ p(y,z) → p(x,z) (ej: “ancestor of”) – owl:SymmetricProperty: (r ´ r –)
• p(x,y) ↔ p(y,x) (ej: “relative of”) – owl:FunctionalProperty: (> v ≤ 1 r)
• p(x,y) ∧ p(x,z) → y = z (ej: “birth year”) – owl:inverseOf: (r –)
• p1(x,y) ↔ p2(y,x) (ej: p1=“teacher of”, p2=“student of”) – owl:InverseFunctionalProperty: (> v ≤ 1 r -)
• p(y,x) ∧ p(z,x) → y = z (ej: “mobile number”)
OWL
– 36 –
• Property restrictions – owl:Restriction – owl:onProperty – owl:allValuesFrom: (8r.C)
<owl:Class rdf:ID=”Cow"> <rdfs:subClassOf rdf:resource="#Animal"/> <rdfs:subClassOf>
<owl:Restriction> <owl:onProperty rdf:resource="#eats" /> <owl:allValuesFrom rdf:resource="#Plant" /> </owl:Restriction> </rdfs:subClassOf> </owl:Class>
– owl:someValuesFrom: (9r.C) – owl:cardinality – owl:maxCardinality (≤ n r) – owl:minCardinality (≥ n r) – owl:hasValue (9r.{a})
OWL
19
– 37 –
• Complex classes – owl:intersectionOf: (C u D) – owl:unionOf: (C t D) – owl:complementOf: (¬C) – owl:disjointWith: (C v ¬D) disjoint classes – owl:oneOf: ({a,b,c} en O) enumerates individuals that belong to
a class. Example: {Red, Amber, Green}. <owl:Class rdf:ID=“TrafficLightColor">
<owl:oneOf rdf:parseType="Collection">
<Color rdf:about="#Red"/>
<Color rdf:about="#Amber"/>
<Color rdf:about="#Green"/>
</owl:oneOf>
</owl:Class>
OWL
– 38 –
• Ontology mapping – owl:equivalentClass (´) – owl:equivalentProperty (´ in H) – owl:sameAs: ({x}´{x}) two URIs represent the same individual – owl:differentFrom: ({x}´¬{x}) two URIs do not represent the
same individual – owl:AllDifferent – owl:distinctMembers
<owl:AllDifferent>
<owl:distinctMembers rdf:parseType="Collection">
<Color rdf:about="#Red"/>
<Color rdf:about="#Ambar"/>
<Color rdf:about="#Green"/>
</owl:distinctMembers>
</owl:AllDifferent>
OWL
20
– 39 –
• Annotations – rdfs:label – rdfs:comment – rdfs:seeAlso – rdfs:isDefinedBy – owl:AnnotationProperty – owl:OntologyProperty
OWL
– 40 –
OWL: inference examples
• disjointWith example Professor owl:subClassOf AcademicStaff. Book owl:subClassOf Publication . AcademicStaff owl:disjointWith Publication . Inferred: Professor and Book are disjoints
• owl:equivalentClass example Man owl:subClassOf Person Person owl:equivalentClass Human Inferred: Man is a subclass of Human
• Instances example “A Semantic Web Primer” rdf:type Book Book owl:subClassOf Publication Inferred: “A Semantic Web Primer” is a Publication
21
– 41 –
Introduction to the Semantic Web
1. Introduction to the Semantic Web 2. Ontology languages 3. Querying the Semantic Web 4. Linked Data
– 42 –
SPARQL
• Query Language for RDF • W3C Recommendation
– http://www.w3.org/TR/rdf-sparql-query/
• Query language of RDF contents • SQL-like sintax
22
– 43 –
SPARQL
• Basic patterns PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?name ?sur WHERE { ?x :name ?nom. ?x :surname ?ape. ?x rdf:type :Employee. }
• Group Patterns SELECT ?name ?sur WHERE { { ?x :name ?nom. ?x :surname ?ape. } {?x rdf:type :Employee.} }
– 44 –
SPARQL
• Optional patterns (OPTIONAL) SELECT ?name ?sur ?y WHERE { ?x :name ?name. ?x :surname ?sur. ?x rdf:type :Employee. OPTIONAL {?x :birth_year ?y} }
• Alternative patterns(UNION) SELECT ?name ?y WHERE { {?x :name ?name} UNION {?x :surname ?sur}. ?x rdf:type :Employee. ?x :birth_year ?a. }
23
– 45 –
SPARQL
• Restrictions (FILTER) SELECT ?name ?sur WHERE { ?x :name ?name. ?x :surname ?sur. ?x rdf:type :Employee. ?x :birth_year ?y. FILTER (?y >= “1980").}
• Result formats – SELECT – CONSTRUCT: generates an RDF graph – ASK: indicates whether a query pattern matches or not – DESCRIBE: returns RDF graph that describes the resources
found
– 46 –
SPARQL
• Result modifiers – ORDER BY
SELECT ?name ?sur WHERE { ?x :name ?name. ?x :surname?sur. } ORDER BY ?sur
– DISTINCT: avoid duplicates SELECT DISTINCT ?name ?sur
– OFFSET / LIMIT SELECT ?name ?sur WHERE { ?x :name ?name. ?x :surname ?sur.} ORDER BY ?sur LIMIT 5 OFFSET 3
24
– 47 –
Introduction to the Semantic Web
1. Introduction to the Semantic Web 2. Ontology languages 3. Querying the Semantic Web 4. Linked Data
– 48 –
Web of Data (Linked Data)
• We want to query information like: All soccer players, who played as goalkeeper for a club that has a stadium with more than 40.000 seats and who are born in a country with more than 10 million inhabitants
• From the Web of Documents to the Web of Data • Linked Data
– http://linkeddata.org/ – http://www.w3.org/DesignIssues/LinkedData.html – http://www.ted.com/talks/tim_berners_lee_on_the_next_web.html (vídeo 16 min)
25
– 49 –
Web of Data (Linked Data)
• Principles of Linked Data (Tim Berners-Lee) 1. Use URIs as names for things 2. Use HTTP URIs so that people can look up those names. 3. When someone looks up a URI, provide useful information,
using the standards (RDF*, SPARQL) 4. Include links to other URIs so that they can discover more
things.
– 50 –
The Linking Open Data cloud diagram
“Linking Open Data cloud diagram, by Richard Cyganiak and Anja Jentzsch. http://lod-cloud.net/”
May 2007 12 datasets
26
– 51 –
The Linking Open Data cloud diagram
“Linking Open Data cloud diagram, by Richard Cyganiak and Anja Jentzsch. http://lod-cloud.net/”
Sept 2008 45 datasets
– 52 –
The Linking Open Data cloud diagram
“Linking Open Data cloud diagram, by Richard Cyganiak and Anja Jentzsch. http://lod-cloud.net/”
July 2009 95 datasets
27
– 53 –
The Linking Open Data cloud diagram
“Linking Open Data cloud diagram, by Richard Cyganiak and Anja Jentzsch. http://lod-cloud.net/”
Sept. 2009 295 datasets
– 54 –
Linked Data
• Data Generation – From existing repositories, e.g. Relational DB, XML, CSV
and spreadsheets, etc. to Linked Data – Transforming information
• R2O and ODEMapster • OBDI • NOR2O • Jena • geometry2rdf
– Dynamic generation • D2RQ Platform • Triplify • Ultrawrap
28
– 55 –
Linked Data
• Data Publication – Virtuoso Open Source Edition – D2R Server – AllegroGraph RDFStore – Joseki – Sesame
– 56 –
Linked Data
• Data visualisation – Pubby – SNORQL – Disco – Hyperdata Browser
29
– 57 –
Linked Data: data integration
[http://www.w3.org/People/Ivan/CorePresentations/IntroThroughExample/]
[http://www.w3.org/People/Ivan/CorePresentations/IntroThroughExample/]
– 58 –
Linked Data
• Some existing Linked Data data sources – Dbpedia: http://dbpedia.org/sparql – UK Government: http://data.gov.uk/sparql – USA Government: http://semantic.data.gov/sparql – Musicbrainz: http://dbtune.org/musicbrainz/sparql – ...
– 58 –
30
– 59 –
Example: DBPedia
• http://dbpedia.org • Makes available information from Wikipedia • Data generation
– from structured information extracted from Wikipedia
• Data publication – OpenLink Virtuoso – Public SPARQL endpoint: http://DBpedia.org/sparql
– 60 –
Example: DBPedia
• Data visualisation • Leipzig query builder
– http://querybuilder.dbpedia.org • OpenLink Interactive SPARQL Query Builder (iSPARQL)
– http://dbpedia.org/isparql; • SNORQL query explorer
– http://DBpedia.org/snorql • any other SPARQL-aware client(s)
• Other tools – DBpedia Faceted Search
• http://wiki.dbpedia.org/FacetedSearch • Browser: http://dbpedia.neofonie.de/browse/
• Resource example: – http://wikipedia.org/wiki/Berlin à http://dbpedia.org/resource/Berlin
Recommended