Querying the RDF: Small Case Study in the Bicycle Sale Domain

32
Querying the RDF: Small Case Study in the Bicycle Sale Domain Ondřej Šváb, Vojtěch Svátek, Martin Kavalec, Martin Labský VŠE, University of Economics, Prague

description

Querying the RDF: Small Case Study in the Bicycle Sale Domain. Ond řej Šváb, Vojtěch Svátek, Martin Kavalec, Martin Labský VŠE, University of Economics, Prague. Content. 1. Integration of web analytic tools 2. RDF/S 3. Bicycle Sale Domain in RDF/S 4. Sesame 5. RDF query languages - PowerPoint PPT Presentation

Transcript of Querying the RDF: Small Case Study in the Bicycle Sale Domain

Page 1: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Querying the RDF: Small Case Study in the

Bicycle Sale Domain

Ondřej Šváb, Vojtěch Svátek,

Martin Kavalec, Martin Labský

VŠE, University of Economics, Prague

Page 2: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

2

Content

• 1. Integration of web analytic tools

• 2. RDF/S

• 3. Bicycle Sale Domain in RDF/S

• 4. Sesame

• 5. RDF query languages

• 6. Example of HTML interface usage

Page 3: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

3

1. Integration of web analytic tools

• Analytic tools from RAINBOW

• http://rainbow.vse.cz

Page 4: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

4

Page 5: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

5

2. RDF/S

• RDF – Resource description framework– Assertional language for information representation– Reification– RDF graph– Several types of serialization: RDF/XML, N-Triples,

N3

• RDFS – Resource description framework schema– Semantic language for RDF– „core vocabulary“, enables to define properties, classes

and their taxonomy (hierarchy)

Page 6: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

6

3. Bicycle Sale Domain in RDF/S

• Typical extracted attributes:– Name of bike, price, picture, components

<rdf:Description rdf:about="http://www.bikepedlar.co.uk/Giant_terrago.htm"><bike:hasCompany rdf:resource="http://www.bikepedlar.co.uk"/><bike:hasName>Giant Terrago F/S 3</hasName><bike:hasPrice>350.00</hasPrice><bike:hasBikePart rdf:resource="http://rainbow.vse.cz/bikes/bikes.rdf#alivio"/>

</rdf:Description>

Page 7: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

7

Page 8: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

8

Page 9: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

9

Page 10: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

10

Example of reification

Page 11: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

11

Page 12: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

12

4. Sesame

• System for manipulating with RDF/S– http://www.openrdf.org

• Four functional modules:– Query Module– Admin Module– Extract Module– Explore Module

Page 13: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

13

Page 14: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

14

5. RDF query languages

• RDQL– Implemented according to HP specification

• RQL– Original proposal by ICS-FORTH

• SeRQL– Developed as part of system Sesame

Page 15: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

15

Pros/Cons RDQL RQL SeRQL

Path expr. + + +

RDFS support

- ++ +

Optional path exp.

- + ++

Reified statements

+ + ++

Strings comp.

- + +

Features of RDF query languages

Page 16: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

16

Path expressions:

Page 17: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

17

Namespaces in queries

using namespaceweb = <!http://rainbow.vse.cz/schema/webpage.rdfs#>,xsd = <!http://www.w3.org/2001/XMLSchema#>,bike = <!http://rainbow.vse.cz/schema/bikes.rdfs#>,comp = <!http://rainbow.vse.cz/schema/company.rdfs#>,meta = <!http://rainbow.vse.cz/schema/meta.rdfs#>,pict = <!http://rainbow.vse.cz/schema/picture.rdfs#>,rdfs = <!http://www.w3.org/2000/01/rdf-schema#>,rdf = <!http://www.w3.org/1999/02/22-rdf-syntax-ns#>

Page 18: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

18

RQL/SeRQL 1

RQL

select domain(@predicate), @predicate, range(@predicate)

from {} @predicate {}where @predicate =

pict:hasWidth

SeRQL

select domain, rangefrom {<pict:hasWidth>} <rdfs:domain> {domain},{<pict:hasWidth>} <rdfs:range> {range}

1Q: Find restrictions (domain and range) of property hasWidth.

Page 19: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

19

RQL/SeRQL 2

RQL

select X, name, picture, widthfrom {X : bike:RetailOffer }

bike:hasName {name},{X} bike:hasPicture {picture}.

pict:hasWidth {width}

where name like "l*" and width < 70

2Q: Find all retail offers with name starting with letter ”l” and having a picture with width lower than 70.

SeRQL

select X, name, picture, width from {X} <serql:directType> {<bike:RetailOffer>}, {X} <bike:hasName> {name}, {X} <bike:hasPicture> {Y} <pict:hasWidth> {width}

where name like "l*" and width < "70"^^<xsd:integer>

Page 20: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

20

RQL 3/13Q: Find all retail offers of bicycles that have a concrete bike component. Output

the name of company that offers the bike, the picture of retail offer, the price of bike (offer). Retrieve the retail offer even if the URL of picture is not known.

(select web, company, price, picture, namefrom {X : bike:RetailOffer } bike:hasCompany {web : comp:Company }. comp:companyName {company}, {X} bike:hasPrice {price}, {X} bike:hasPicture {picture}, {X} bike:hasBikeProduct {idtyp}. bike:name {name}where idtyp=data:part1)Union …

Page 21: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

21

Union

(select web, company, price, null, name

from {X : bike:RetailOffer } bike:hasCompany

{web : comp:Company }. comp:companyName {company},

{X} bike:hasPrice {price},

{X} bike:hasBikeProduct {idtyp}. bike:name {name}

where idtyp=data:part1 and not

(X in select X

from {X} bike:hasPicture {picture}))

RQL 3/2

Operator “in” - subquery

Result = S1un. S2

Page 22: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

22

SeRQL 3

select prv, web, company, price, picture, namefrom {prv} <serql:directType> {<bike:RetailOffer>}; <bike:hasPrice> {price}; [<bike:hasPicture> {picture}]; <bike:hasBikeProduct> {idtyp}, {idtyp} <bike:name> {name}, {prv} <bike:hasCompany> {web} <rdf:type> {<comp:Company>}; <comp:companyName>

{company}where idtyp = <data:part1>

Page 23: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

23

RQL 4 – query over reified statements

select X, obj, certainty

from {X : rdf:Statement } rdf:subject {reifSubj},

{X} rdf:predicate {reifPred},

{X} rdf:object {reifObj},

{X} meta:hasMeta {obj}. meta:certainty {certainty}

where certainty > "0.9"

4Q: Find all statements that have certainty higher than 0.9.

Page 24: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

24

SeRQL 4 –query reified statements

select obj, certainty

from { {reifSubj} reifPred {reifObj} }

<meta:hasMeta> {obj} <meta:certainty> {certainty}

where certainty > "0.9"^^<xsd:double>

Page 25: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

25

6. Example of HTML interface (usage)

- Three parts

- First for specifying the query

- Second for result

- Third for „detailed“ results in certain regard

Page 26: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

26

HTML interface

Page 27: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

27

Initial query

Page 28: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

28

Following query – [About]

Page 29: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

29

Following query – [Picture]

Page 30: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

30

Page 31: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Dateso 04

Querying the RDF: Small Case Study in the Bicycle Sale Domain

31

Future work

– Integration, transformation– More active cooperation with Sesame– HTML interface and better querying – Testing with greater amount of real-world data

Page 32: Querying the RDF: Small Case Study in the Bicycle Sale Domain

Thank you for your attention