Nuxeo Semantic ECM: from Scribo and Stanbol to valuable applications
The Semantic Web – Part 1: Foundations of Semantic Web Technologies
1. The Semantic
Web – Part 1
Semantic CMS Community
Lecturer
Organization
The Vision and Basic
Date of presentation Technologies of the Semantic
Web.
Co-funded by the
1 Copyright IKS Consortium
European Union
2. Page:
Part I: Foundations
(1) Introduction of Content Foundations of Semantic
(2)
Management Web Technologies
Part II: Semantic Content Part III: Methodologies
Management
Knowledge Interaction Requirements Engineering
(3) (7)
and Presentation for Semantic CMS
(4) Knowledge Representation
and Reasoning
(8)
Designing
Semantic CMS
Semantifying
(5) Semantic Lifting (9) your CMS
Storing and Accessing Designing Interactive
(6) Semantic Data
(10) Ubiquitous IS
www.iks-project.eu Copyright IKS Consortium
3. Page: 3
What is this Lecture about?
Semantic web technologies as a possible solution for
improving the „state of play“ in content management by
making semantics expressable in machine-readable way
The Semantic Web
The vision behind the semantic web
Underlying technologies of the Semantic Web
Part I: Foundations
(1) Introduction of Content Foundations of Semantic
(2)
Management Web Technologies
www.iks-project.eu Copyright IKS Consortium
4. Page:
Web evolution
Slide by Nova Spivack, Radar Networks
www.iks-project.eu Copyright IKS Consortium
4
5. Page: 5
The Semantic Web
Thevision of the Semantic Web has been originally
proposed by Tim Berners-Lee
“TheSemantic Web is not a separate Web but an
extension of the current one, in which information is
given well-defined meaning, better enabling computers
and people to work in cooperation.” [The Semantic
Web, 2001]
Standardized specification techniques for the semantic
annotation of content (RDF, OWL, ...)
www.iks-project.eu Copyright IKS Consortium
6. Page: 6
Semantic Web Stack
W3C provides standardized
specifications for Semantic
Web technologies
Semantic Web Layer Cake
as a conceptual architecture
describes an hierarchy of
languages
Each layer exploits and uses
capabilities of the layers
below
Semantic Web Layer Cake, Image source: http://www.w3.org/2007/03/layerCake.svg
www.iks-project.eu Copyright IKS Consortium
7. Page: 7
Unique Identification of
Resources
“...more fundamental than either HTTP or HTML are
URIs, which are simple text strings that refer to Internet
resources -- documents, resources, people, and
indirectly to anything. URIs are the glue that binds the
Web together. IRIs extend and strengthen the glue, by
allowing people to identify Web resources
in their own language.”
In a “Web of Data” the unique
identification of entities is required
www.iks-project.eu Copyright IKS Consortium
8. Page: 8
How to identify resources?
URI – Uniform Resource Identifier [RFC 3986]
“A Uniform Resource Identifier (URI) is a compact
sequence of characters that identifies an abstract or
physical resource.”
A URI consists of five parts: scheme, authority, path, query
and fragment
URI = scheme ":" authority "/" path [ "?" query ] [ "#"
fragment ]
Example:
http://user@example.com:8042/over/there?name=ferret#nose
scheme authority path query fragment
www.iks-project.eu Copyright IKS Consortium
9. Page: 9
How to identify resources?
IRI – Internationalized Resource Identifier [RFC 3987]
“IRIs are defined similarly to URIs in [RFC3986], but the
class of unreserved characters is extended by adding the
characters of the UCS (Universal Character Set,
[ISO10646]) ..”
Extends the character set used by URIs and thereby
allows the consideration of language specific syntaxes
(e.g. Japanese, Chinese, ...)
Example
Logical Hebrew http://ab. .ij/kl/mn/op.html
ASCII notation http://ab.CDEFGH.ij/kl/mn/op.html
www.iks-project.eu Copyright IKS Consortium
10. Page: 10
Structuring Data
XML – Extensible Markup Language
XML can be used to specify the syntactical structure of
documents or complex data objects in a machine-readable
form
<car>
<brand>Jaguar</brand>
<model>XF</model>
<dimensions>
<length>4961</length>
<width>2070</width>
</dimensions>
<engine>5.0 L V8 Petrol</engine>
</car>
www.iks-project.eu Copyright IKS Consortium
11. Page: 11
Why isn´t XML enough?
XML tags are only defining the structure of a document
For a machine the tags have no semantics!
<car> <cat>
<brand>Jaguar</brand> <brand>Jaguar</brand>
... ...
</car> </cat>
The difference in meaning is only
recognized by a human.
www.iks-project.eu Copyright IKS Consortium
12. Page: 12
Why isn´t XML enough?
The relation among the different tags is not expressed
explicitly
<car>
The relation between “car”, “brand”
and “Jaguar” is only recognizable
<brand>Jaguar</brand> by a human.
...
</car>
www.iks-project.eu Copyright IKS Consortium
13. Page: 13
What do we need?
We want to express the statement:
“The brand of the car is Jaguar.”
We need ...
...a way to address the concrete resource car.
... to express the property brand of the resource car.
... to define the property value Jaguar for the property
brand.
www.iks-project.eu Copyright IKS Consortium
14. Page: 14
Resource Description
Framework (RDF)
“TheResource Description Framework (RDF) identifies
things using Web identifiers (URIs), and describes
resources with properties and property values.”
A Resource is an object that can be identified by an
URI, e.g. “http://example.org/Car”.
A Property describes an aspect of a resource, e.g.
“http://example.org/Brand”. The property is also
identified by an URI.
TheProperty value assigns a concrete value to a
property, e.g. “Jaguar” or ““http://example.org/Jaguar”.
www.iks-project.eu http://www.w3schools.com/rdf/ Copyright IKS Consortium
15. Page: 15
RDF Statements
RDF statements consist of subject (resource), predicate
(property) and object (property value)
Predicate Object
Subject
(URI)
Predicate
Object
(literal)
Subjects (except Blank Nodes) and Predicates are
always defined by URIs
Objects can be defined by URIs and literals
www.iks-project.eu Copyright IKS Consortium
16. Page: 16
RDF Statements - Example
Exemplary statements:
“The brand of the car is Jaguar.”
“The model of the car is XF.”
Subject Predicate Object
http://example.org/rel/Brand
http://example.org/Car http://example.org/Jaguar
http://example.org/rel/Model
XF Predicate
Object
www.iks-project.eu Copyright IKS Consortium
17. Page: 17
Resource Description
Framework (RDF)
“The Resource Description Framework (RDF) is a
language for representing information about
resources...” [RDF Primer]
• W3C Standard (http://www.w3.org/RDF)
RDF provides a graph-based data model
for representing metadata
for describing the semantics of
information in a machine-accessible way
www.iks-project.eu Copyright IKS Consortium
19. Page: 19
RDF/XML
RDF/XML is the most common serialization format for
RDF statements
Example:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rel="http://example.org/rel/">
<rdf:Description rdf:about="http://example.org/Car">
<rel:Brand rdf:resource="http://example.org/Jaguar"/>
</rdf:Description>
<rdf:Description rdf:about="http://example.org/Car">
<rel:Model>XF</rel:Model>
</rdf:Description>
</rdf:RDF>
http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/
www.iks-project.eu Copyright IKS Consortium
20. Page: 20
Root Element and
Namespaces
Root element of the
RDF/XML document.
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rel="http://example.org/rel/">
....
</rdf:RDF> Defined namespaces
<rdf:RDF> Root element of RDF documents
xmlns:rdf Specifies that elements with the “rdf” prefix are using
the namespace “..”
xmlns:abc Specifies that elements with the “abc” prefix are using
the namespace “..”
www.iks-project.eu
Copyright IKS Consortium
21. Page: 21
Description Element
Node element
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rel="http://example.org/rel/">
<rdf:Description rdf:about="http://example.org/Car">
...
</rdf:Description>
...
Assigns a resource to
the node element.
</rdf:RDF>
<rdf:Description> Introduces node element (subject).
<rdf:about> Defines the URI reference for the node element.
www.iks-project.eu Copyright IKS Consortium
22. Page: 22
Objects defined by Resources
Assigning resources to objects (property values) in
RDF/XML
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
Defines predicate “Brand”
xmlns:rel="http://example.org/rel/">
in namespace “rel”.
<rdf:Description rdf:about="http://example.org/Car">
<rel:Brand rdf:resource="http://example.org/Jaguar"/>
</rdf:Description>
</rdf:RDF> object
The is defined
by a resource. http://example.org/rel/Brand
http://example.org/Car http://example.org/Jaguar
www.iks-project.eu Copyright IKS Consortium
23. Page: 23
Objects defined by Literals
Definition of objects (properties) with constant values
(literals)
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rel="http://example.org/rel/">
<rdf:Description rdf:about="http://example.org/Car">
<rel:Model>XF</rel:Model>
</rdf:Description>
</rdf:RDF>
The object is defined http://example.org/Car
by a literal.
http://example.org/rel/Model
XF
www.iks-project.eu Copyright IKS Consortium
24. Page: 24
RDF Container Elements
“A container is a resource that contains things. The
contained things are called members. The members of
a container may be resources (including blank nodes)
or literals.”
Container provide the ability to describe groups of
things, e.g. several authors of a book
RDF defines three types of containers:
Bag
Sequence
Alternatives
http://www.w3.org/TR/2004/REC-rdf-primer-20040210/
www.iks-project.eu Copyright IKS Consortium
25. Page: 25
Container Element - Bag
“ABag (a resource having type rdf:Bag) represents a
group of resources or literals, possibly including
duplicate members, where there is no significance in
the order of the members.”
Example:
Describe equipment features of the car.
http://www.w3.org/TR/2004/REC-rdf-primer-20040210/
www.iks-project.eu Copyright IKS Consortium
27. Page: 27
Container Element - Bag
The subject “Car” is
<rdf:RDF described by the
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
predicate “equipment”.
xmlns:e="http://example.org/features#">
<rdf:Description rdf:about="http://example.org/Car">
<e:equipment>
<rdf:Bag>
The different members
<rdf:li rdf:resource="http://example.org/AC"/>
<rdf:li rdf:resource="http://example.org/CarRadio"/>
of the Bag container
<rdf:li rdf:resource="http://example.org/SeatHeating"/>
are listed.
The object is </rdf:Bag>
a
container of type “Bag”
</e:equipment>
</rdf:Description>
</rdf:RDF>
<x:xyz> Defines predicate “xyz” in namespace “x”.
<rdf:Bag> Defines a container of type “Bag”.
<rdf:li> Defines members of the Bag container.
www.iks-project.eu Copyright IKS Consortium
28. Page: 28
Container Element - Sequence
“ASequence or Seq (a resource having type rdf:Seq)
represents a group of resources or literals, possibly
including duplicate members, where the order of the
members is significant.”
Example:
Describe a list of previous owners of the car in
chronological order.
http://www.w3.org/TR/2004/REC-rdf-primer-20040210/
www.iks-project.eu Copyright IKS Consortium
30. Page: 30
Container Element - Sequence
The subject “Car” is
<rdf:RDF described by the
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
predicate “preOwners”.
xmlns:p="http://example.org/owner#">
<rdf:Description rdf:about="http://example.org/Car">
<p:preOwners>
<rdf:Seq>
The different members
<rdf:li rdf:resource="http://example.org/JohnDoe"/>
<rdf:li rdf:resource="http://example.org/RickMiller"/>
of the Sequence
<rdf:li rdf:resource="http://example.org/SarahHouse"/>
container are listed.
The object is a</rdf:Seq>
</p:preOwners>
container of type
</rdf:Description>
“Sequence”.
</rdf:RDF>
<x:xyz> Defines predicate “xyz” in namespace “x”.
<rdf:Seq> Defines a container of type “Sequence”.
<rdf:li> Defines members of Sequence container.
www.iks-project.eu Copyright IKS Consortium
31. Page: 31
Container Element -
Alternative
“An Alternative or Alt (a resource having type rdf:Alt)
represents a group of resources or literals that are
alternatives (typically for a single value of a property).”
Example:
Describe a list of possible colors of the car.
http://www.w3.org/TR/2004/REC-rdf-primer-20040210/
www.iks-project.eu Copyright IKS Consortium
33. Page: 33
Container Element - Alternative
The subject “Car” is
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
described by the
xmlns:c="http://example.org/exterior#"
predicate “colors”.
<rdf:Description rdf:about="http://example.org/Car">
<c:colors>
<rdf:Alt>
The different members
<rdf:li rdf:resource="http://example.org/Black"/>
<rdf:li rdf:resource="http://example.org/White"/>
of the Alternative
<rdf:li rdf:resource="http://example.org/Green"/>
container are listed.
The object is a</rdf:Alt>
</c:colors>
container of type
</rdf:Description>
“Alternative”.
</rdf:RDF>
<x:xyz> Defines predicate “xyz” in namespace “x”.
<rdf:Alt> Defines a container of type “Alternative”.
<rdf:li> Defines members of Alternative container.
www.iks-project.eu Copyright IKS Consortium
34. Page: 34
RDF Collections
A RDF Container can be used to define groups, but
lacks the ability to “close” them. That means to define
that "these are all the members of the container".
RDF Collections provide the ability to describe
groups, that contain only the specified resources.
“An RDF collection is a group of things represented as
a list structure in the RDF graph.”
Example:
All equipment features of a car.
http://www.w3.org/TR/2004/REC-rdf-primer-20040210/
www.iks-project.eu Copyright IKS Consortium
36. Page: 36
RDF Collection
The predicate
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
“equipment” is described
xmlns:e="http://example.org/features#">
by a Collection.
<rdf:Description rdf:about="http://example.org/Car">
<e:equipment rdf:parseType="Collection">
<rdf:Description rdf:about="http://example.org/AC"/>
<rdf:Description rdf:about="http://example.org/CarRadio"/>
<rdf:Description rdf:about="http://example.org/SeatHeating"/>
</e:equipment>
</rdf:Description>
</rdf:RDF>
<x:xyz Defines that the predicate “xyz” is
rdf:parseType=“Collection”> described by a collection.
www.iks-project.eu Copyright IKS Consortium
38. Page: 38
Semantic Layer Web Cake
A model for describing
resources with properties A format for specifying structured
and property values. data in a machine-readable form
Unique identification
of resources
Semantic Web Layer Cake, Image source: http://www.w3.org/2007/03/layerCake.svg
www.iks-project.eu Copyright IKS Consortium
39. Page: 39
RDF
RDF provides a model for describing resources with
properties and property values.
@prefix ex: <http://www.example.org/>.
ex:Car1 ex:Brand ex:Jaguar
ex:Car1 ex:Colour “Black”
ex:Car2 ex:Brand ex:Jaguar
ex:Car2 ex:Colour “White”
ex:Car3 ex:Brand ex:VW
ex:Car3 ex:Colour “Black”
www.iks-project.eu Copyright IKS Consortium
40. Page: 40
SPARQL
SPARQL Protocol and RDF Query Language
W3C Recommendation since 2008
SPARQL provides a standard for querying
information, that is specified in RDF
SPARQL consists of three specifications
Query language
Query results XML format
Data access protocol
www.iks-project.eu Copyright IKS Consortium
41. Page: 41
Exemplary SPARQL Query
“Return the models and prices for all cars of brand
„Jaguar‟ ” Declares namespaces for
abbreviated resources
SPARQL Query: identifiers.
PREFIX ex: <http://example.org/> Identifies the variables to
SELECT ?model ?price
WHERE appear in the query
{ ?car ex:Brand ex:Jaguar . results.
?car ex:Model ?model .
?car ex:Price ?price . } Provides the basic graph
pattern to match against
Exemplary Result: the data graph.
Model Price
“XJ” “79.750,00”
“XF” “44.900,00”
www.iks-project.eu Copyright IKS Consortium
42. Page: 42
Basic Graph Patterns (BGP)
A SPARQL query contains a set of triple patterns called
a basic graph pattern
Triple patterns are like RDF triples except that each of
the subject, predicate and object may be a variable.
A basic graph pattern matches a subgraph of the RDF
data when RDF terms from that subgraph may be
substituted for the variables and the result is a RDF
graph equivalent to the subgraph.
WHERE Variables are
{ ?car ex:Brand ex:Jaguar . defined by
?car ex:Model ?model . “?varname” or
?car ex:Price ?price . }
“$varname”
www.iks-project.eu Copyright IKS Consortium
43. Page: 43
Group Graph Patterns
“Fora Group Graph Pattern, a set of graph patterns
must all match”
Ina SPARQL query string, a group graph pattern is
delimited with braces: {...}
PREFIX ex: <http://example.org/>
SELECT ?model ?price
WHERE
{ { ?car ex:Brand ex:Jaguar .
?car ex:Model ?model . }
?car ex:Price ?price .
}
www.iks-project.eu Copyright IKS Consortium
44. Page: 44
Optional Pattern Matching
Basic graph patterns allow applications to make queries
where the entire query pattern must match.
It is useful to be able to have queries that allow
information to be added to the solution where the
information is available, but do not reject the solution
because some part of the query pattern does not
match.
If the optional part does not match, it creates no
bindings but does not eliminate the solution.
www.iks-project.eu Copyright IKS Consortium
http://www.w3.org/TR/rdf-sparql-query
46. Page: 46
Scope of Filters
“A constraint, expressed by the keyword FILTER, is a
restriction on solutions over the whole group in which
the filter appears.”
PREFIX ex: <http://example.org/>
SELECT ?model ?price
WHERE
{ ?car ex:Brand ex:Jaguar .
?car ex:Model ?model .
?car ex:Price ?price .
FILTER (?price < 50.000,00)
}
Result:
Model Price
“XF” “44.900,00”
www.iks-project.eu Copyright IKS Consortium
47. Page: 47
Unary Operators (1/2)
Operator Type(A) Result Type
BOUND(A) variable xsd:boolean
IsURI(A) RDF term xsd:boolean
isBLANK(A) RDF term xsd:boolean
isLITERAL(A) RDF term xsd:boolean
www.iks-project.eu Copyright IKS Consortium
48. Page: 48
Unary Operators (2/2)
Operator Type(A) Result Type
STR(A) literal simple literal
STR(A) URI / IRI simple literal
LANG(A) literal simple literal
DATATYPE(A) typed literal URI / IRI
DATATYPE(A) simple literal URI / IRI
www.iks-project.eu Copyright IKS Consortium
49. Page: 49
Binary Operators (1/2)
Operator Type(A) Type(B) Result Type
A= B
A != B
numeric numeric
A<B simple literal simple literal
xsd:string xsd:string xsd:boolean
A> B xsd:boolean xsd:boolean
xsd:dateTime xsd:dateTime
A <= B
A >= B
www.iks-project.eu Copyright IKS Consortium
50. Page: 50
Binary Operators (2/2)
Operator Type(A) Type(B) Result Type
sameTERM
RDF term RDF term xsd:boolean
(A,B)
langMATCHES
simple literal simple literal xsd:boolean
(A,B)
REGEX
simple literal simple literal xsd:boolean
(A,B)
Filter can be combined by “&&” or “||”
www.iks-project.eu Copyright IKS Consortium
51. Page: 51
Alternative Graph Patterns
“SPARQL provides a means of combining graph
patterns so that one of several alternative graph
patterns may match. If more than one of the alternatives
matches, all the possible pattern solutions are found.”
Pattern alternatives are syntactically specified with the
UNION keyword.
PREFIX ex: <http://example.org/>
SELECT ?office
WHERE
{ ?x rdf:type ex:CarManufacturer .
{ ?x ex:Headquarter ?office . } UNION
{ ?x ex:Office ?office . }
}
www.iks-project.eu Copyright IKS Consortium
52. Page: 52
Solution Sequences and
Modifiers
“Query patterns generate an unordered collection of
solutions. These solutions are then treated as a
sequence (a solution sequence), initially in no specific
order; any sequence modifiers are then applied to
create another sequence.”
There are several use cases in which the results shall
be presented in a defined order, e.g. alphabetical order
Shall duplicates be presented or deleted?
www.iks-project.eu Copyright IKS Consortium
53. Page: 53
Order By
“Followingthe ORDER BY clause is a sequence of
order comparators, composed of an expression and an
optional order modifier (either ASC() or DESC()). Each
ordering comparator is either ascending (indicated by
the ASC() modifier or by no modifier) or descending
(indicated by the DESC() modifier).”
PREFIX ex: <http://example.org/>
SELECT ?constructionYear ?price
WHERE { ?car ex:Brand ex:Jaguar .
?car ex:ConstructionYear ?constructionYear .
?car ex:Price ?price . }
ORDER BY DESC(?constructionYear) ?price .
www.iks-project.eu Copyright IKS Consortium
54. Page: 54
Some more Solution Sequence
Modifiers
LIMIT
“The LIMIT clause puts an upper bound on the number of
solutions returned. If the number of actual solutions is greater
than the limit, then at most the limit number of solutions will be
returned.”
OFFSET
“OFFSET causes the solutions generated to start after the
specified number of solutions. An OFFSET of zero has no
effect.”
SELECT DISTINCT
“The DISTINCT solution modifier eliminates duplicate solutions.
Duplicates are eliminated before either limit or offset is applied.”
www.iks-project.eu Copyright IKS Consortium
55. Page: 55
Semantic Web Layer Cake
A language for querying
information specified in
RDF.
A model for describing
resources with properties A format for specifying structured
and property values. data in a machine-readable form
Unique identification
of resources
Semantic Web Layer Cake, Image source: http://www.w3.org/2007/03/layerCake.svg
www.iks-project.eu Copyright IKS Consortium
56. Page: 56
Lessons Learned
Now you should know ...
... the general idea of the Semantic Web and the
differences to the World Wide Web.
... the underlying technologies of the Semantic Web.
... how resources can be identified and specified.
.. the importance of XML for expressing data in a machine-
readable way.
... the concept of the RDF and the way it is expressed
(e.g.: RDF/XML).
... how SPARQL can used to query data specified in RDF.
www.iks-project.eu Copyright IKS Consortium
57. Page: 57
References and Additional
Material
Introduction to RDF
http://www.w3schools.com/rdf/rdf_intro.asp
RDF Syntax Specification
http://www.w3.org/TR/2004/REC-rdf-syntax-grammar-
20040210
RDF Validation Tool
http://www.w3.org/RDF/Validator/
www.iks-project.eu Copyright IKS Consortium