+ All Categories
Home > Documents > Lecture the semantic_web_part_1

Lecture the semantic_web_part_1

Date post: 14-May-2015
Category:
Upload: iks-project
View: 804 times
Download: 1 times
Share this document with a friend
Popular Tags:
57
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
Transcript
Page 1: Lecture the semantic_web_part_1

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 Consortium1

LecturerOrganization

Date of presentation

Page 2: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

Copyright IKS Consortium

Introduction of Content Management

Foundations of Semantic Web Technologies

Storing and Accessing Semantic Data

Knowledge Interaction and Presentation

Knowledge Representation and Reasoning

Semantic Lifting

Designing Interactive Ubiquitous IS

Requirements Engineering for Semantic CMS

Designing Semantic CMS

Semantifying your CMS

Part I: Foundations

Part II: Semantic Content Management

Part III: Methodologies

(2) (1)

(3)

(4)

(5)

(6)

(7)

(8)

(9)

(10)

Page 3: Lecture the semantic_web_part_1

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

Introduction of Content Management

Foundations of Semantic Web Technologies

Part I: Foundations

(2) (1)

Page 4: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

Web evolution

Slide by Nova Spivack, Radar Networks

Web 1.0 Web 2.0

Web 3.0 Web 4.0

4Copyright IKS Consortium

Page 5: Lecture the semantic_web_part_1

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

Page 6: Lecture the semantic_web_part_1

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

Page 7: Lecture the semantic_web_part_1

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

Page 8: Lecture the semantic_web_part_1

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://[email protected]:8042/over/there?name=ferret#nose

Page 9: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

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

Copyright IKS Consortium

9

Page 10: Lecture the semantic_web_part_1

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>

Page 11: Lecture the semantic_web_part_1

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

<car> <brand>Jaguar</brand> ...</car>

<cat> <brand>Jaguar</brand> ...</cat>

The difference in meaning is only recognized by a human.

Page 12: Lecture the semantic_web_part_1

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.

Page 13: Lecture the semantic_web_part_1

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

Page 14: Lecture the semantic_web_part_1

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 Consortiumhttp://www.w3schools.com/rdf/

14

Page 15: Lecture the semantic_web_part_1

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

SubjectObject (URI)

Predicate

Object (literal)

Predicate

Page 16: Lecture the semantic_web_part_1

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/Carhttp://example.org/

Jaguar

http://example.org/rel/Brand

XF

http://example.org/rel/Model

Subject Predicate Object

Object

Predicate

Page 17: Lecture the semantic_web_part_1

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

Page 18: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

RDF Serialization Formats

RDF/XML N3 N-Triples TRiG TRiX Turtle JSON JSON-LD RDFa

Copyright IKS Consortium

18

Page 19: Lecture the semantic_web_part_1

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

Page 20: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

Root Element and Namespaces

Copyright IKS Consortium

<rdf:RDFxmlns: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 “rdf” prefix are using the namespace “..”

xmlns:abc Specifies that elements with the “abc” prefix are using the namespace “..”

Root element of the RDF/XML document.

Defined namespaces

20

Page 21: Lecture the semantic_web_part_1

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.

Page 22: Lecture the semantic_web_part_1

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

Page 23: Lecture the semantic_web_part_1

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.

Page 24: Lecture the semantic_web_part_1

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/

Page 25: Lecture the semantic_web_part_1

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

Page 26: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

Container Element - Bag

Copyright IKS Consortium

http://example.org/Car

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

ns#Bag

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

http://example.org/AC

http://example.org/CarRadio

http://example.org/SeatHeating

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

Page 27: Lecture the semantic_web_part_1

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

Page 28: Lecture the semantic_web_part_1

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

Page 29: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

Container Element - Sequence

Copyright IKS Consortium

http://example.org/Carhttp://www.w3.org/

1999/02/22-rdf-syntax-ns#Seq

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

http://example.org/JohnDoe

http://example.org/RickMiller

http://example.org/SarahHouse

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/owner#preOwners

29

Page 30: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

Container Element - Sequence

Copyright IKS Consortium

<rdf:RDF xmlns:rdf="http://www.w3.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”.

<rdf:li> Defines members of Sequence container.

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

Page 31: Lecture the semantic_web_part_1

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

Page 32: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

Container Element - Alternative

Copyright IKS Consortium

32

http://example.org/Car

http://www.w3.org/1999/02/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.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/exterior#colors

Page 33: Lecture the semantic_web_part_1

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

Page 34: Lecture the semantic_web_part_1

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

Page 35: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

RDF Collection

Copyright IKS Consortium

35

http://example.org/Car

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

ns#nil

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

http://example.org/AC

http://example.org/CarRadio

http://example.org/SeatHeating

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.w3.org/1999/02/22-rdf-syntax-ns#_first

Page 36: Lecture the semantic_web_part_1

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 described by a collection.

The predicate “equipment” is described

by a Collection.

Page 37: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

Validation Tool

Copyright IKS Consortium

37

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

Page 38: Lecture the semantic_web_part_1

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.

Page 39: Lecture the semantic_web_part_1

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:Brandex:Jaguarex:Car1 ex:Colour “Black”ex:Car2 ex:Brandex:Jaguarex:Car2 ex:Colour “White”ex:Car3 ex:Brand ex:VWex:Car3 ex:Colour “Black”

How do I get all

black Jaguars?

Page 40: Lecture the semantic_web_part_1

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

Page 41: Lecture the semantic_web_part_1

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 ?priceWHERE { ?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.

Page 42: Lecture the semantic_web_part_1

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”

Page 43: Lecture the semantic_web_part_1

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 ?priceWHERE { { ?car ex:Brand ex:Jaguar . ?car ex:Model ?model . }

?car ex:Price ?price . }

Page 44: Lecture the semantic_web_part_1

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

Page 45: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

Optional Pattern Matching

Example:

Result

Copyright IKS Consortium

45

PREFIX ex: <http://example.org/> SELECT ?model ?priceWHERE { ?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”

Page 46: Lecture the semantic_web_part_1

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 ?priceWHERE { ?car ex:Brand ex:Jaguar . ?car ex:Model ?model . ?car ex:Price ?price . FILTER (?price < 50.000,00)}

Model Price

“XF” “44.900,00”

Page 47: Lecture the semantic_web_part_1

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

Page 48: Lecture the semantic_web_part_1

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

Page 49: Lecture the semantic_web_part_1

www.iks-project.eu

Page:

Binary Operators (1/2)

Copyright IKS Consortium

49

Operator Type(A) Type(B) Result Type

A = B

numericsimple literal

xsd:stringxsd:boolean

xsd:dateTime

numericsimple literal

xsd:stringxsd:boolean

xsd:dateTime

xsd:boolean

A != B

A < B

A > B

A <= B

A >= B

Page 50: Lecture the semantic_web_part_1

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

Page 51: Lecture the semantic_web_part_1

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 ?officeWHERE { ?x rdf:type ex:CarManufacturer . { ?x ex:Headquarter ?office . } UNION { ?x ex:Office ?office . } }

Page 52: Lecture the semantic_web_part_1

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

Page 53: Lecture the semantic_web_part_1

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 ?priceWHERE { ?car ex:Brand ex:Jaguar .

?car ex:ConstructionYear ?constructionYear . ?car ex:Price ?price . }

ORDER BY DESC(?constructionYear) ?price .

Page 54: Lecture the semantic_web_part_1

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

Page 55: Lecture the semantic_web_part_1

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.

Page 56: Lecture the semantic_web_part_1

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

Page 57: Lecture the semantic_web_part_1

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


Recommended