property-based testing of sparql queries - dbpl 2017dbpl2017.org/slides/dbpl-2017-7.pdf ·...

21
Property-based Testing of SPARQL queries Jesús M. Almendros-Jiménez Antonio Becerra-Terón University of Almería, SPAIN 16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Upload: others

Post on 25-May-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Property-based Testing of SPARQL queries

Jesús M. Almendros-JiménezAntonio Becerra-Terón

University of Almería, SPAIN

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 2: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type Checking and Testing of SPARQL

• SPARQL program bugs: debugging and testing

• Type Checking

• Wrongly typed(empty answers

• Testing

• Disagreement between expected behavior and answers (

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 3: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type CheckingSELECT ?Person ?Paper ?University

WHERE

{ ?Person

?Person

?Person

?Paper

?Paper

FILTER (

Query:Universities of

Invited Talks of 2-authors papers

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 4: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type CheckingSELECT ?Person ?Paper ?University

WHERE

{ ?Person :attends :DBPL .

?Person :affiliation

FILTER (?na >= 2) }

Wrong typing:has not

type :UniversityWrong typing:

?University has not type :Person

Wrong typing:has not type :Paper

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 5: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

TestingSELECT ?Person ?Paper ?University

WHERE

{ ?Person :attends :DBPL .

?Person :affiliation ?University .

?Paper rfd:type :Invited_talk .

?Paper :numberofAuthors ?na .

FILTER (?na >= 2) }

Missing Triple!

!

Unexpected behavior!Wrong answers!!

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 6: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

TestingSELECT ?Person ?Student ?University

WHERE

{ ?Person :author :Paper .

?Student :author Paper .

?Paper rfd:type :Student_Paper .

FILTER (?age <= 30) }

Wrong Triple!

?Person :age ?age

!

Unexpected behavior!Wrong answers!!

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 7: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

TestingSELECT ?Person ?Paper ?University

{

?Person :attends :DBPL .

?Person :affiliation ?University .

?Paper rfd:type :Invited_talk

?Paper :numberofAuthors ?na

FILTER (?na >= 2)

}

Property:is ?Person the author of

?Paper ?

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 8: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

TestingSELECT ?Person ?Student ?University

WHERE

{ ?Person :author :Paper .

?Student :author Paper .

?Paper rfd:type :Student_paper .

?Person :age ?age.

FILTER (?age <= 30) }

Property: is ?Student

younger than 30?

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 9: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type System for SPARQL

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 10: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Testing of SPARQLOntology to XML Schema Mapping

Test Case Generation

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 11: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type Checking and Testing of SPARQL

• Type Checking using an Ontology Reasoner (Hermit) for

• Testing using an Ontology Reasoner (Hermit) for test cases consistence

• Testing using

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 12: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type Checking and Testing of SPARQL

Type Checking Tool results:

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 13: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type Checking and Testing of SPARQL

Randomly generated test cases

Problem => Inconsistent Test Cases

Example:

:coauthor is irreflexive

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 14: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type Checking and Testing of SPARQL

Testing success

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 15: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type Checking and Testing of SPARQL

Testing fail

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 16: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type Checking and Testing Tool

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

http://minerva.ual.es:8080/SPARQL

Page 17: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Type Checking and Testing Tool

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Pruning and Customization of Test Cases

Page 18: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Benchmarks

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 19: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Benchmarks

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 20: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Conclusions and Future Work

• Testing tool based on Test Case Generation from XML Schema

• Detection of Buggy SPARQL Queries

• Extending the output property set

• White-Box Testing: Constraint Solving

16th International Symposium on Database Programming Languages (DBPL 2017), Munich, Germany

Page 21: Property-based Testing of SPARQL queries - DBPL 2017dbpl2017.org/slides/DBPL-2017-7.pdf · Property-based Testing of SPARQL queries Jes s M. Almendros-Jim nez! Antonio Becerra-Ter

Thanks for your Attention

Jesús M. Almendros-JiménezAntonio Becerra-Terón

University of Almería SPAIN