Скачать презентацию SPARQL with Qualitative Quantitative Preferences Marina Gueroussova Скачать презентацию SPARQL with Qualitative Quantitative Preferences Marina Gueroussova

b1249afb4e11c97e56eb1d3ef61ef090.ppt

  • Количество слайдов: 30

SPARQL with Qualitative & Quantitative Preferences Marina Gueroussova Axel Polleres* Sheila A. Mc. Ilraith SPARQL with Qualitative & Quantitative Preferences Marina Gueroussova Axel Polleres* Sheila A. Mc. Ilraith Department of Computer Science, University of Toronto * Vienna University of Economics and Business (WU Wien), Contact: @Axel. Polleres Ord. Ring 2013 October 21, 20131

Motivation SPARQL Data: • Massive • Produced, shared, consumed by diversity of stakeholders • Motivation SPARQL Data: • Massive • Produced, shared, consumed by diversity of stakeholders • Dynamically integrated • Scope of content often unknown: Queries can lead to the “empty result effect” (no answer) and its opposite “flooding effect” (too many answers), resulting in a time consuming and frustrating manual/iterative search Consider searching for a car to buy – one might prefer a car with a powerful engine, but only if it’s a hybrid, or failing that an electric car if it’s under a certain price … ideally silver, rear camera, but these are less important … Preferences! 2

Challenge: How do we specify and generate preference-based queries in SPARQL 3 Challenge: How do we specify and generate preference-based queries in SPARQL 3

Rich Literature Preferences have been long studies across many fields including economics, philosophy, and Rich Literature Preferences have been long studies across many fields including economics, philosophy, and computer science. Databases (preferences in relational queries & SQL, top-K), e. g. : • Chomicki (2002, 2003, 2011) • Kießling, Endres &Wenzel (2011) , Kießling&Köstler (2002), Kießling (2002), AI (decision theory in AI, CP nets, preference-based planning), e. g. : • Domshlak, Hullermeier, Kaci & Prade (2011) • Boutilier, Brafman, Domshlak, Hoos & Poole (2004) Semantic Web & Linked Data (top-k, qualitative preferences), e. g. : • Siberski, Pan & Thaden (2006) • Wagner, Tran, Ladwig, Harth & Studer (2012) • Magliacane, Bozzon & Della Valle (2011, 2012) 4

Rich Literature Preferences have been long studies across many fields including economics, philosophy, and Rich Literature Preferences have been long studies across many fields including economics, philosophy, and computer science. Databases (preferences in relational queries & SQL, top-K), e. g. : • Chomicki (2002, 2003, 2011) • Kießling, Endres &Wenzel (2011) , Kießling&Köstler (2002), Kießling (2002), AI (decision theory in AI, CP nets, preference-based planning), e. g. : • Domshlak, Hullermeier, Kaci & Prade (2011) • Boutilier, Brafman, Domshlak, Hoos & Poole (2004) Semantic Web & Linked Data (top-k, qualitative preferences), e. g. : • Siberski, Pan & Thaden (2006) • Wagner, Tran, Ladwig, Harth & Studer (2012) • Magliacane, Bozzon & Della Valle (2011, 2012) 5

Contributions • Extend SPARQL Syntax to handle qualitative and quantitative preferences queries • Demonstrate Contributions • Extend SPARQL Syntax to handle qualitative and quantitative preferences queries • Demonstrate that qualitative and conditional preferences can be natively expressed in SPARQL (both 1. 0 and 1. 1) • Illustrate how queries can be rewritten into standard compliant SPARQL queries via filtering. (Contrary to an earlier conjecture predicated on a less expressive SPARQL. ) • Discuss avenues for future work 6

Outline • Example • Pref. SPARQL Grammar • Query Rewriting • Future Work 7 Outline • Example • Pref. SPARQL Grammar • Query Rewriting • Future Work 7

Outline • Example • Pref. SPARQL Grammar • Query Rewriting • Future Work 8 Outline • Example • Pref. SPARQL Grammar • Query Rewriting • Future Work 8

Example * <#appointmt 1> day starts end offers <#mary> rated offers <#appointmt 2> offers Example * <#appointmt 1> day starts end offers <#mary> rated offers <#appointmt 2> offers excellent <#appointmt 3> very-good rated day starts end <#appointmt 4> offers day starts end <#john> offers * Modified from [Siberski et al. , 2006] <#appointmt 5> day starts end Tue 1500 1555 Sun 1600 1655 Sat 1800 1855 Mon 1900 1955 9

Example (cont. ) : mary a : therapist ; : rated : excellent ; Example (cont. ) : mary a : therapist ; : rated : excellent ; : offers : appointmt 1, : appointmt 2, : appointmt 3. : john a : therapist ; : rated : very-good ; : offers : appointmt 4, : appointmt 5. : appointmt 1 : day "Tue"; : starts 1500; : ends 1555. : appointmt 2 : day "Sun"; : starts 1600; : ends 1655. : appointmt 3 : day "Fri"; : starts 1700; : ends 1755. : appointmt 4 : day "Sat"; : starts 1800; : ends 1855. : appointmt 5 : day "Mon"; : starts 1900; : ends 1955. 10

Example Queries QUERY 1: Return all therapist appointments with the following preferences: Prefer excellent Example Queries QUERY 1: Return all therapist appointments with the following preferences: Prefer excellent therapists. Prefer appointments around lunchtime (between 12: 00 and 13: 00). Prefer later appointments over earlier ones provided that both are equal with respect to lunchtime. This is a so-called skyline query that returns an undominated solution. QUERY 2: Return all appointments with the following preferences: Prefer appointments before 6 pm on weekends (Sat & Sun) and appointments after 6 pm on weekdays. 11

How do we specify preference-based queries in SPARQL? 13 How do we specify preference-based queries in SPARQL? 13

Pref. SPARQL Grammar Filter : : = 'FILTER' Constraint | 'PREFERRING' '(' Multidimensional. Pref Pref. SPARQL Grammar Filter : : = 'FILTER' Constraint | 'PREFERRING' '(' Multidimensional. Pref ')' Multidimensional. Pref : : = Prioritized. Pref ('AND' Prioritized. Pref)* Prioritized. Pref : : = Conditional. Or. Atomic. Pref ('PRIOR TO' Conditional. Or. Atomic. Pref)* Conditional. Or. Atomic. Pref : : = Conditional. Pref | Atomic. Pref Conditional. Pref : : = 'IF' Expression 'THEN' Conditional. Or. Atomic. Pref 'ELSE' Conditional. Or. Atomic. Pref : : = Expression | Highest. Pref | Lowest. Pref | Between. Pref | Around. Pref | More. Than. Pref | Less. Than. Pref Highest. Pref : : = 'HIGHEST' Expression Lowest. Pref : : = 'LOWEST' Expression Between. Pref : : = Expression 'BETWEEN' '(' Expression ', ' Expression ')' Around. Pref : : = Expression 'AROUND' Expression More. Than. Pref : : = Expression 'MORE THAN' Expression Less. Than. Pref : : = Expression 'LESS THAN' Expression 14

Pref. SPARQL Grammar Filter : : = 'FILTER' Constraint | 'PREFERRING' '(' Multidimensional. Pref Pref. SPARQL Grammar Filter : : = 'FILTER' Constraint | 'PREFERRING' '(' Multidimensional. Pref ')' Multidimensional. Pref : : = Prioritized. Pref ('AND' Prioritized. Pref)* Prioritized. Pref : : = Conditional. Or. Atomic. Pref ('PRIOR TO' Conditional. Or. Atomic. Pref)* Conditional. Or. Atomic. Pref : : = Conditional. Pref | Atomic. Pref Conditional. Pref : : = 'IF' Expression 'THEN' Conditional. Or. Atomic. Pref 'ELSE' Conditional. Or. Atomic. Pref : : = Expression | Highest. Pref | Lowest. Pref | Between. Pref | Around. Pref | More. Than. Pref | Less. Than. Pref Highest. Pref : : = 'HIGHEST' Expression Lowest. Pref : : = 'LOWEST' Expression Between. Pref : : = Expression 'BETWEEN' '(' Expression ', ' Expression ')' Around. Pref : : = Expression 'AROUND' Expression More. Than. Pref : : = Expression 'MORE THAN' Expression Less. Than. Pref : : = Expression 'LESS THAN' Expression 15

Pref. SPARQL Grammar (Query 1) … Prioritized. Pref : : = Conditional. Or. Atomic. Pref. SPARQL Grammar (Query 1) … Prioritized. Pref : : = Conditional. Or. Atomic. Pref ('PRIOR TO' Conditional. Or. Atomic. Pref)* Conditional. Or. Atomic. Pref : : = Conditional. Pref | Atomic. Pref … Atomic. Pref : : = Expression | Highest. Pref | Lowest. Pref | Between. Pref | Around. Pref | More. Than. Pref | Less. Than. Pref … Between. Pref : : = Expression 'BETWEEN' '(' Expression ', ' Expression ')' Around. Pref : : = Expression 'AROUND' Expression … SELECT ? A WHERE { ? T : rated ? R; offers ? A starts ? S; : end ? E. PREFFERING { ? R = excellent AND { ? S BETWEEN(1200, 1300) AND ? E BETWEEN{1200, 1300) PRIOR TO HIGHEST ? E } } } 17

Pref. SPARQL Grammar (Query 2) … Conditional. Or. Atomic. Pref : : = Conditional. Pref. SPARQL Grammar (Query 2) … Conditional. Or. Atomic. Pref : : = Conditional. Pref | Atomic. Pref Conditional. Pref : : = 'IF' Expression 'THEN' Conditional. Or. Atomic. Pref 'ELSE' Conditional. Or. Atomic. Pref … SELECT ? A WHERE { ? A : day ? D; : starts ? S. PREFERRING ( IF (? D = "Sat" || ? D = "Sun") THEN ? S < 1800 ELSE ? S >= 1800 ) } 18

Outline • Example • Pref. SPARQL Grammar • Query Rewriting • Future Work 19 Outline • Example • Pref. SPARQL Grammar • Query Rewriting • Future Work 19

How do we generate preference-based queries using SPARQL query engines? 20 How do we generate preference-based queries using SPARQL query engines? 20

Approach • [Siberski et al. 2006] realized a subset of qualitative preferences in SPARQL Approach • [Siberski et al. 2006] realized a subset of qualitative preferences in SPARQL using solution modifiers. • It’s easy to imagine how to realize at least some of these references using “stacked optionals”. • Contrary to the conjecture* in [Sibserski et al. 2006], we argue that our Pref. SPARQL queries can be expressed in SPARQL by the following highlevel translation schema in SPARQL 1. 1 **: P PREFERRING Pref P FILTER NOT EXISTS {P’ FILTER (tr(P, P’, Pref))} * Made in 2006, prior to the addition of OPTIONAL to SPARQL ** There is a corresponding translation schema for SPARQL 1. 0 21

Rewriting (simplified version of) Query 1 SELECT ? A WHERE { ? T : Rewriting (simplified version of) Query 1 SELECT ? A WHERE { ? T : rated ? R; : offers ? A : starts ? S; : ends ? E. PREFERRING ( (? R = excellent) AND ((? S >= 1800) || ? E <= 1600) PRIOR TO HIGHEST ? S ))} P PREFERRING Pref P FILTER NOT EXISTS {P’ FILTER (tr(P, P’, Pref))} SELECT ? A WHERE { ? T : rated ? R; : offers ? A : starts ? S; : ends ? E. BIND ( (? R = : excellent) AS ? Pref 1 ) BIND ( (? S >= 1800 || ? E <= 1600) AS ? Pref 2 ) BIND ( ? S AS ? Pref 3 ) FILTER NOT EXISTS { ? T_ : rated ? R_; : offers ? A_ : starts ? S_; : ends ? E_. BIND ( (? R_ = : excellent) AS ? Pref 1_ ) BIND ( (? S_ >= 1600 || ? E_ <= 1600) AS ? Pref 2_ ) BIND ( ? S_ AS ? Pref 3_ ) FILTER( ( (? Pref 1_ > ? Pref 1) && !((? Pref 2_ < ? Pref 2) || (? Pref 3_ < ? Pref 3 && ? Pref 2 = ? Pref 2_ ))) || ( !(? Pref 1_ < ? Pref 1) && ((? Pref 2_ > ? Pref 2) || (? Pref 3_ > ? Pref 3 && ? Pref 2 = ? Pref 2_ ))))}} 22

Rewriting (simplified version of) Query 1 SELECT ? A WHERE { ? T : Rewriting (simplified version of) Query 1 SELECT ? A WHERE { ? T : rated ? R; : offers ? A : starts ? S; : ends ? E. PREFERRING ( (? R = excellent) AND ((? S >= 1800) || ? E <= 1600) PRIOR TO HIGHEST ? S ))} tr(P, P’, Pref 1 AND Pref 23) (Pref 1’ > Pref 1 && Pref 23’ < Pref 23) || (Pref 1’ < Pref 1 && Pref 23’ > Pref 23 ) SELECT ? A WHERE { ? T : rated ? R; : offers ? A : starts ? S; : ends ? E. BIND ( (? R = : excellent) AS ? Pref 1 ) BIND ( (? S >= 1800 || ? E <= 1600) AS ? Pref 2 ) BIND ( ? S AS ? Pref 3 ) FILTER NOT EXISTS { ? T_ : rated ? R_; : offers ? A_ : starts ? S_; : ends ? E_. BIND ( (? R_ = : excellent) AS ? Pref 1_ ) BIND ( (? S_ >= 1600 || ? E_ <= 1600) AS ? Pref 2_ ) BIND ( ? S_ AS ? Pref 3_ ) FILTER( ( (? Pref 1_ > ? Pref 1) && !((? Pref 2_ < ? Pref 2) || (? Pref 3_ < ? Pref 3 && ? Pref 2 = ? Pref 2_ ))) || ( !(? Pref 1_ < ? Pref 1) && ((? Pref 2_ > ? Pref 2) || (? Pref 3_ > ? Pref 3 && ? Pref 2 = ? Pref 2_ ))))}} 23

Rewriting (simplified version of) Query 1 SELECT ? A WHERE { ? T : Rewriting (simplified version of) Query 1 SELECT ? A WHERE { ? T : rated ? R; : offers ? A : starts ? S; : ends ? E. PREFERRING ( (? R = excellent) AND ((? S >= 1800) || ? E <= 1600) PRIOR TO HIGHEST ? S ))} tr(P, P’, Pref 2 PRIOR TO Pref 3) (Pref 2’ > Pref 2) || (Pref 3’ > Pref 3 && Pref 2’ = Pref 2 ) SELECT ? A WHERE { ? T : rated ? R; : offers ? A : starts ? S; : ends ? E. BIND ( (? R = : excellent) AS ? Pref 1 ) BIND ( (? S >= 1800 || ? E <= 1600) AS ? Pref 2 ) BIND ( ? S AS ? Pref 3 ) FILTER NOT EXISTS { ? T_ : rated ? R_; : offers ? A_ : starts ? S_; : ends ? E_. BIND ( (? R_ = : excellent) AS ? Pref 1_ ) BIND ( (? S_ >= 1600 || ? E_ <= 1600) AS ? Pref 2_ ) BIND ( ? S_ AS ? Pref 3_ ) FILTER( ( (? Pref 1_ > ? Pref 1) && !((? Pref 2_ < ? Pref 2) || (? Pref 3_ < ? Pref 3 && ? Pref 2 = ? Pref 2_ ))) || ( !(? Pref 1_ < ? Pref 1) && ((? Pref 2_ > ? Pref 2) || (? Pref 3_ > ? Pref 3 && ? Pref 2 = ? Pref 2_ ))))}} 24

Rewriting (simplified version of) Query 1 SELECT ? A WHERE { ? T : Rewriting (simplified version of) Query 1 SELECT ? A WHERE { ? T : rated ? R; : offers ? A : starts ? S; : ends ? E. PREFERRING ( (? R = excellent) AND ((? S >= 1800) || ? E <= 1600) PRIOR TO HIGHEST ? S ))} P PREFERRING Pref P FILTER NOT EXISTS {P’ FILTER (tr(P, P’, Pref))} SELECT ? A WHERE { FILTER NOT EXISTS can be ? T : rated ? R; : offers ? A : starts ? S; : ends ? E. BIND ( (? R = : excellent) AS ? Pref 1 ) emulated in SPARQL 1. 0 with BIND ( (? S >= 1800 || ? E <= 1600) AS ? Pref 2 ) OPTIONAL + FILTER( !bound(. . . ) ) BIND ( ? S AS ? Pref 3 ) FILTER NOT EXISTS { expressible in SPARQL 1. 0!! ? T_ : rated ? R_; : offers ? A_ : starts ? S_; : ends ? E_. BIND ( (? R_ = : excellent) AS ? Pref 1_ ) BIND ( (? S_ >= 1600 || ? E_ <= 1600) AS ? Pref 2_ ) BIND ( ? S_ AS ? Pref 3_ ) FILTER( ( (? Pref 1_ > ? Pref 1) && !((? Pref 2_ < ? Pref 2) || (? Pref 3_ < ? Pref 3 && ? Pref 2 = ? Pref 2_ ))) || ( !(? Pref 1_ < ? Pref 1) && 25 ((? Pref 2_ > ? Pref 2) || (? Pref 3_ > ? Pref 3 && ? Pref 2 = ? Pref 2_ ))))}}

Rewriting Query 2 (conditional preferences) SELECT ? A WHERE { ? A : day Rewriting Query 2 (conditional preferences) SELECT ? A WHERE { ? A : day ? D; : starts ? S. PREFERRING ( IF (? D = "Sat" || ? D = "Sun") THEN ? S < 1800 ELSE ? S >= 1800 ) } IF E THEN Pref 1 ELSE Pref 2) IF(E, Pref 1, Pref 2) SELECT ? A WHERE { ? A : day ? D; : starts ? S. BIND ( IF( (? D = "Sunday" || ? D = "Saturday"), ? S < 1800, ? S >= 1800) AS ? Pref 1) FILTER NOT EXISTS { ? T_ : rated ? R_; : offers ? A_ : day ? D_; : starts ? S_. BIND ( IF( (? D_ = "Sunday" || ? D_ = "Saturday"), ? S_ < 1800, ? S_ >= 1800) AS ? Pref 1_) FILTER (? Pref 1_ > ? Pref 1)}} Again: FILTER NOT EXISTS can be emulated in SPARQL 1. 0 with OPTIONAL + FILTER( !bound(. . . ) ) expressible in SPARQL 1. 0!! 26

Cost of rewriting? Observe that these queries (use of NOT EXISTS, i. e. OPTIONAL+!bound()) Cost of rewriting? Observe that these queries (use of NOT EXISTS, i. e. OPTIONAL+!bound()) yield non-well-designed patterns [Perez et al. , 2009], [Letelier et al. , 2012]. Similar to well-known trick in in SPARQL to express preferences by simply “stacking optionals”… SELECT ? Contact WHERE { me foaf: knows ? X OPTIONAL {? X foaf: mbox ? Contact} OPTIONAL {? X foaf: homepage ? Contact} } … which is also non-well-designed 27

Summary of Contributions • Extend SPARQL Syntax to handle qualitative and quantitative preferences queries Summary of Contributions • Extend SPARQL Syntax to handle qualitative and quantitative preferences queries • Demonstrate that qualitative and conditional preferences can be natively expressed in SPARQL (both 1. 0 and 1. 1) • Illustrate how queries can be rewritten into standard compliant SPARQL queries via filtering. (Contrary to an earlier conjecture predicated on a less expressive version of SPARQL. ) 28

Ongoing Work • Experimental evaluation of the efficacy of the rewriting approach proposed here. Ongoing Work • Experimental evaluation of the efficacy of the rewriting approach proposed here. • Further investigation of relaxation of the well-designedness principle, which will enable efficient preference query evaluation. • Expanding scope to (better) deal with: – Top-k queries – Ranking within skyline queries – Preferences over endpoints w/ SPARQL 1. 1 Fedration extension – Express SPARQL endpoint preference (SERVICE patterns) – Interactions between preferences and Entailment Regimes [Glimm et al. 2013] 29

Want to know more? SPARQL with Qualitative and Quantitative Preferences (Extended Report). Marina Gueroussova, Want to know more? SPARQL with Qualitative and Quantitative Preferences (Extended Report). Marina Gueroussova, Axel Polleres, Sheila A. Mc. Ilraith. Technical Report CSRG-619, Department of Computer Science, University of Toronto (October 2013). ftp: //ftp. cs. toronto. edu/csrg-technical-reports/619/ 30

 • • • • References Craig Boutilier, Ronen I. Brafman, Carmel Domshlak, Holger • • • • References Craig Boutilier, Ronen I. Brafman, Carmel Domshlak, Holger H. Hoos, David Poole: CP-nets: A Tool for Representing and Reasoning with Conditional Ceteris Paribus Preference Statements. J. Artif. Intell. Res. (JAIR) 21, 135 -191 (2004). Jan Chomicki: Querying with Intrinsic Preferences. EDBT 2002: 34 -51 (2002) Jan Chomicki: Preference formulas in relational queries. ACM Trans. Database Syst. 28(4): 427 -466 (2003) Jan Chomicki: Logical Foundations of Preference Queries. IEEE Data Eng. Bull. 34(2): 3 -10 (2011) Carmel Domshlak, Eyke Hüllermeier, Souhila Kaci, Henri Prade: Preferences in AI: An overview. Artif. Intell. 175(7 -8): 1037 -1052 (2011) Werner Kießling: Foundations of Preferences in Database Systems. VLDB 2002: 311 -322 (2002) Werner Kießling, Markus Endres, Florian Wenzel: The Preference SQL System - An Overview. IEEE Data Eng. Bull. 34(2): 11 -18 (2011) Werner Kießling, Gerhard Köstler: Preference SQL - Design, Implementation, Experiences. VLDB 2002: 990 -1001 (2002) Andrés Letelier, Jorge Pérez, Reinhard Pichler, Sebastian Skritek: Static analysis and optimization of semantic web queries. PODS 2012: 89 -100 (2012) Sara Magliacane, Alessandro Bozzon, Emanuele Della Valle: Efficient Execution of Top-K SPARQL Queries. International Semantic Web Conference (1) 2012: 344 -360 (2012) Jorge Pérez, Marcelo Arenas, Claudio Gutierrez: Semantics and complexity of SPARQL. ACM Trans. Database Syst. 34(3) (2009) Wolf Siberski, Jeff Z. Pan, Uwe Thaden: Querying the Semantic Web with Preferences. International Semantic Web Conference 2006: 612 -624 (2006) Kostas Stefanidis, Georgia Koutrika, Evaggelia Pitoura: A survey on representation, composition and application of preferences in database systems. ACM Trans. Database Syst. 36(3): 19 (2011) Andreas Wagner, Duc Thanh Tran, Günter Ladwig, Andreas Harth, Rudi Studer: Top-k Linked Data Query Processing. 31 ESWC 2012: 56 -71 (2012)

Thank You. Questions? 32 Thank You. Questions? 32