Reference Architecture for Semantic CMS - IKS Project

wrendeceitInternet and Web Development

Oct 21, 2013 (3 years and 8 months ago)

108 views

Co
-
funded by the
European Union

Semantic CMS Community

The
Semantic

Web


Part 1

The Vision and Basic
Technologies of the Semantic
Web.

Copyright IKS Consortium

1

Lecturer

Organization


Date
of

presentation

www.iks
-
project.eu

Page:

2

Copyright IKS Consortium

Content Management

The
Semantic

Web

Storing

and
Accessing

Semantic

Data

Semantic

Lifting

Knowledge

Representation

and
Reasoning

Knowledge

Interaction and
Presentation

Part I:
Foundations

Part II:
Semantic


Content Management

Designing

Interactive
Ubiquitous

IS

Semantifying

your

CMS

Reference
Architecture

for

Semantic

CMS

Requirements

Engineering
for

Semantic

CMS

Part III:
Methodologies

www.iks
-
project.eu

Page:

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




Copyright IKS Consortium

3

Content Management

The
Semantic

Web

Part I:
Foundations

www.iks
-
project.eu

Page:

Web evolution

Slide by
Nova
Spivack
, Radar Networks

4

Copyright IKS Consortium

www.iks
-
project.eu

Page:

The Semantic Web


The vision of the Semantic Web has been originally
proposed by Tim Berners
-
Lee




The Semantic 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, ...)

Copyright IKS Consortium

5

www.iks
-
project.eu

Page:

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


Copyright IKS Consortium

Semantic Web Layer Cake, Image source: http://www.w3.org/2007/03/layerCake.svg

6

www.iks
-
project.eu

Page:

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



Copyright IKS Consortium

7

www.iks
-
project.eu

Page:

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
:

Copyright IKS Consortium

8

scheme

authority

path

query

fragment

http://user@example.com:8042/over/there?name=ferret#nose

www.iks
-
project.eu

Page:

How to identify resources?


IRI


Internationalized Resource Identifier [RFC
3987
]


“IRIs are defined similarly to URIs in [RFC
3986
], but the
class of unreserved characters is extended by adding the
characters of the UCS (Universal Character Set,
[ISO
10646
]) ..”


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


Copyright IKS Consortium

9

www.iks
-
project.eu

Page:

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



Copyright IKS Consortium

10

<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

Page:

Why isn
´
t XML enough?


XML tags are only defining the structure of a document


For a machine the tags have no semantics!






Copyright IKS Consortium

11

<ca
r
>


<brand>
Jaguar
</brand>


...

</car>


<ca
t
>


<brand>
Jaguar
</brand>


...

</cat>


The difference in meaning is only
recognized by a human.

www.iks
-
project.eu

Page:

Why isn
´
t XML enough?


The relation among the different tags is not expressed
explicitly






Copyright IKS Consortium

12

<car>





<brand>
Jaguar
</brand>



...


</car>


The relation between “car”, “brand”
and “Jaguar” is only recognizable
by a human.

www.iks
-
project.eu

Page:

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
.




Copyright IKS Consortium

13

www.iks
-
project.eu

Page:

Resource Description
Framework (RDF)


“The Resource 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.



The
Property value

assigns a concrete value to a
property, e.g. “Jaguar” or ““http://example.org/Jaguar”.

Copyright IKS Consortium

http://www.w3schools.com/rdf/

14

www.iks
-
project.eu

Page:

RDF Statements


RDF statements consist of subject (resource), predicate
(property) and object (property value)







Subjects (except Blank Nodes) and Predicates are
always defined by
URIs


Objects can be defined by
URIs

and literals







Copyright IKS Consortium

15

Subject

Object


(
URI
)

Predicate

Object
(literal)

Predicate

www.iks
-
project.eu

Page:

RDF Statements
-

Example


Exemplary statements:


“The brand of the car is Jaguar.”


“The model of the car is XF.”







Copyright IKS Consortium

16

http://example.org/Car

http://example.org/Jaguar

http://example.org/rel/Brand

XF

http://example.org/rel/Model

Subject

Predicate

Object

Object

Predicate

www.iks
-
project.eu

Page:

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


Copyright IKS Consortium

17

www.iks
-
project.eu

Page:

RDF Serialization Formats


RDF/XML


N
3


N
-
Triples


TRiG


TRiX


Turtle


JSON


JSON
-
LD


RDFa

Copyright IKS Consortium

18

www.iks
-
project.eu

Page:

RDF/XML


RDF/XML is the most common serialization format for
RDF statements



Example:

Copyright IKS Consortium

http://www.w3.org/TR/2004/REC
-
rdf
-
syntax
-
grammar
-
20040210/

<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>

19

www.iks
-
project.eu

Page:

Root Element and
Namespaces

Copyright IKS Consortium

<rdf:RDF



xmlns:rdf="http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#"


xmlns:rel="http://example.org/rel/">


....



</rdf:RDF>

<
rdf:RDF
>

Root element of RDF documents

xmlns:rdf


Specifies that elements with the “
牤r
” prefix are using
the namespace “..”

xmlns:abc

Specifies that elements with the “
慢a
” prefix are using
the namespace “..”

Root element of the
RDF/XML document.

Defined namespaces

20

www.iks
-
project.eu

Page:

Description Element

Copyright IKS Consortium

21

<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>




...


</rdf:RDF>

<
rdf:Description
>

Introduces node element (subject).

<
rdf:about
>

Defines the

URI reference for the node element.

Node element

Assigns a resource to

the node element.

www.iks
-
project.eu

Page:

Objects defined by Resources


Assigning resources to objects (property values) in
RDF/XML


Copyright IKS Consortium

22

<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:RDF>

http://example.org/Car

http://example.org/Jaguar

http://example.org/rel/Brand

The object is defined

by a resource.

Defines predicate “Brand”
in namespace “
rel
”.

www.iks
-
project.eu

Page:

Objects defined by Literals


Definition of objects (properties) with constant values
(literals)

Copyright IKS Consortium

23

<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>

http://example.org/Car

XF

http://example.org/rel/Model

The object is defined

by a literal.

www.iks
-
project.eu

Page:

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


Copyright IKS Consortium

24

http://www.w3.org/TR/2004/REC
-
rdf
-
primer
-
20040210/

www.iks
-
project.eu

Page:

Container Element
-

Bag


“A Bag (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.


Copyright IKS Consortium

http://www.w3.org/TR/2004/REC
-
rdf
-
primer
-
20040210/

25

www.iks
-
project.eu

Page:

Container Element
-

Bag

Copyright IKS Consortium

http://example.org/Car

http://www.w3.org/1999/0
2/22
-
rdf
-
syntax
-
ns#Bag

http://www.w
3
.org/
1999
/
02
/
22
-
rdf
-
syntax
-
ns#type

http://example.org/AC

http://example.org/CarRad
io

http://example.org/SeatHe
ating

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#_1

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#_2

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#_3

http://example.org/features#equipment

Blank Node

26

www.iks
-
project.eu

Page:

Container Element
-

Bag

Copyright IKS Consortium

<rdf:RDF

xmlns:rdf="http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#"


xmlns:e="http://example.org/features#">



<rdf:Description rdf:about="http://example.org/Car">


<e:equipment>



<rdf:Bag>



<rdf:li rdf:resource="http://example.org/AC"/>



<rdf:li rdf:resource="http://example.org/CarRadio"/>



<rdf:li rdf:resource="http://example.org/SeatHeating"/>



</rdf: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.

The subject “Car” is
described by the
predicate “equipment”.

The different members
of the Bag container

are listed.

The object is a
container of type “Bag”

27

www.iks
-
project.eu

Page:

Container Element
-

Sequence


“A Sequence 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.

Copyright IKS Consortium

http://www.w3.org/TR/2004/REC
-
rdf
-
primer
-
20040210/

28

www.iks
-
project.eu

Page:

Container Element
-

Sequence

Copyright IKS Consortium

http://example.org/Car

http://www.w3.org/1999/0
2/22
-
rdf
-
syntax
-
ns#Seq

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#type

http://example.org/JohnD
oe

http://example.org/RickMi
ller

http://example.org/Sarah
House

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#_1

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#_2

http://www.w
3
.org/
1999
/
02
/
22
-
rdf
-
syntax
-
ns#_
3

http://example.org/owner#preOwners

29

www.iks
-
project.eu

Page:

Container Element
-

Sequence

Copyright IKS Consortium

<rdf:RDF

xmlns:rdf="http://www.w
3
.org/
1999
/
02
/
22
-
rdf
-
syntax
-
ns#"


xmlns:p="http://example.org/owner#">



<rdf:Description rdf:about="http://example.org/Car">


<p:preOwners>



<rdf:Seq>



<rdf:li rdf:resource="http://example.org/JohnDoe"/>



<rdf:li rdf:resource="http://example.org/RickMiller"/>



<rdf:li rdf:resource="http://example.org/SarahHouse"/>



</rdf:Seq>



</p:preOwners>


</rdf:Description>


</rdf:RDF>

<
x:xyz
>

Defines

predicate “xyz” in namespace “x”.

<
rdf:Seq
>

Defines a container of type “Sequence”.

<
牤昺汩
>

䑥晩湥猠浥浢敲e

潦o卥煵敮捥c捯c瑡楮敲.

The subject “Car” is
described by the
predicate “
preOwners
”.

The different members
of the Sequence
container are listed.

The object is a
container of type
“Sequence”.

30

www.iks
-
project.eu

Page:

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.

Copyright IKS Consortium

http://www.w3.org/TR/2004/REC
-
rdf
-
primer
-
20040210/

31

www.iks
-
project.eu

Page:

Container Element
-

Alternative

Copyright IKS Consortium

32

http://example.org/Car

http://www.w3.org/1999/0
2/22
-
rdf
-
syntax
-
ns#Alt

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#type

http://example.org/Black

http://example.org/White

http://example.org/Green

http://www.w
3
.org/
1999
/
02
/
22
-
rdf
-
syntax
-
ns#_
1

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#_2

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#_3

http://example.org/exterior#colors

www.iks
-
project.eu

Page:

Container Element
-

Alternative

Copyright IKS Consortium

33

<rdf:RDF

xmlns:rdf="http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#"


xmlns:c="http://example.org/exterior#"



<rdf:Description rdf:about="http://example.org/Car">


<c:colors>



<rdf:Alt>



<rdf:li rdf:resource="http://example.org/Black"/>



<rdf:li rdf:resource="http://example.org/White"/>



<rdf:li rdf:resource="http://example.org/Green"/>



</rdf:Alt>



</c:colors>


</rdf:Description>


</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.

The subject “Car” is
described by the
predicate “
colors
”.

The different members
of the Alternative
container are listed.

The object is a
container of type
“Alternative”.

www.iks
-
project.eu

Page:

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.

Copyright IKS Consortium

http://www.w3.org/TR/2004/REC
-
rdf
-
primer
-
20040210/

34

www.iks
-
project.eu

Page:

RDF Collection

Copyright IKS Consortium

35

http://example.org/Car

http://www.w3.org/1999/0
2/22
-
rdf
-
syntax
-
ns#nil

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#rest

http://example.org/AC

http://example.org/CarRa
dio

http://example.org/SeatH
eating

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#_first

http://example.org/features#equipment

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#rest

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#rest

http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#_first

http://www.w
3
.org/
1999
/
02
/
22
-
rdf
-
syntax
-
ns#_first

www.iks
-
project.eu

Page:

RDF Collection

Copyright IKS Consortium

36

<rdf:RDF

xmlns:rdf="http://www.w3.org/1999/02/22
-
rdf
-
syntax
-
ns#"


xmlns:e="http://example.org/features#">



<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

rdf:parseType
=

Collection

>

Defines that the predicate “xyz” is

摥獣物s敤 批 愠捯汬散瑩e渮

q桥 灲p摩捡瑥
“equipment” is described
by a Collection.

www.iks
-
project.eu

Page:

Validation Tool

Copyright IKS Consortium

37

http://www.w3.org/RDF/Validator/

www.iks
-
project.eu

Page:

Semantic Layer Web Cake

Copyright IKS Consortium

38

Semantic Web Layer Cake, Image source: http://www.w3.org/2007/03/layerCake.svg

Unique identification

of resources

A format for specifying structured
data in a machine
-
readable form

A model for describing
resources with properties
and property values.

www.iks
-
project.eu

Page:

RDF


RDF provides a model for describing resources with
properties and property values.


Copyright IKS Consortium

39

@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

Page:

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

Copyright IKS Consortium

40

www.iks
-
project.eu

Page:

Exemplary SPARQL Query

“Return the models and prices for all cars of brand
‘Jaguar’ ”


SPARQL Query:






Exemplary Result:

Copyright IKS Consortium

41

PREFIX

ex: <http://example.org/>

SELECT

?model ?price

WHERE



{ ?car

ex:Brand

ex:Jaguar .


?car

ex:Model

?model .


?car

ex:Price

?price . }

Model

Price

“XJ”

“79.750,00


“XF”

“44.900,00”

Declares namespaces for
abbreviated resources
identifiers.

Identifies the variables to
appear in the query
results.

Provides the basic graph
pattern to match against
the data graph.

www.iks
-
project.eu

Page:

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.

Copyright IKS Consortium

42

WHERE



{ ?car

ex:Brand

ex:Jaguar .


?car

ex:Model

?model .


?car

ex:Price

?price . }

Variables are
defined by
“?
varname
” or
“$
varname


www.iks
-
project.eu

Page:

Group Graph Patterns


“For a
Group Graph Pattern
, a set of graph patterns
must all match”



In a SPARQL query string, a group graph pattern is
delimited with braces: {...}




Copyright IKS Consortium

43

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

Page:

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.

Copyright IKS Consortium

44

http://www.w3.org/TR/rdf
-
sparql
-
query

www.iks
-
project.eu

Page:

Optional Pattern Matching


Example:







Result

Copyright IKS Consortium

45

PREFIX

ex: <http://example.org/>

SELECT

?model ?price

WHERE



{ ?car
ex:Brand

ex:Jaguar

.


?car
ex:Model

?model .




OPTIONAL { ?car
ex:Price

?price . }


}

Model

Price

“XJ”

“79.750,00


“XF”

“44.900,00”

“S
-
Type”

www.iks
-
project.eu

Page:

Scope of Filters


“A constraint, expressed by the keyword
FILTER
, is a
restriction on solutions over the whole group in which
the filter appears.”






Result:

Copyright IKS Consortium

46

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)

}

Model

Price

“XF”

“44.900,00”

www.iks
-
project.eu

Page:

Unary Operators (1/2)

Copyright IKS Consortium

47

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

Page:

Unary Operators (2/2)

Copyright IKS Consortium

48

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

Page:

Binary Operators (1/2)

Copyright IKS Consortium

49

Operator

Type(A)

Type(B)

Result Type

A = B

numeric

simple literal

xsd:string

xsd:boolean

xsd:dateTime

numeric

simple literal

xsd:string

xsd:boolean

xsd:dateTime

xsd:boolean

A != B

A

< B

A > B

A <= B

A >= B

www.iks
-
project.eu

Page:

Binary Operators (2/2)



Filter can be combined by “&&” or “||”


Copyright IKS Consortium

50

Operator

Type(A)

Type(B)

Result Type

sameTERM

(A,B)

RDF term

RDF term

xsd:boolean

langMATCHES
(A,B)

simple literal

simple literal

xsd:boolean

REGEX

(A,B)

simple literal

simple literal

xsd:boolean

www.iks
-
project.eu

Page:

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.


Copyright IKS Consortium

51

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

Page:

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?

Copyright IKS Consortium

52

www.iks
-
project.eu

Page:

Order By


“Following the
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).”

Copyright IKS Consortium

53

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

Page:

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.”



Copyright IKS Consortium

54

www.iks
-
project.eu

Page:

Semantic Web Layer Cake

Copyright IKS Consortium

55

Semantic Web Layer Cake, Image source: http://www.w3.org/2007/03/layerCake.svg

Unique identification

of resources

A format for specifying structured
data in a machine
-
readable form

A model for describing
resources with properties
and property values.

A language for querying
information specified in
RDF.

www.iks
-
project.eu

Page:

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.

Copyright IKS Consortium

56

www.iks
-
project.eu

Page:

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/


Copyright IKS Consortium

57