SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
The SPARQL Query Graph Model
     for Query Optimization
           Olaf Hartig and Ralf Heese
Postings on the Jena Mailinglist
Question:
                            http://groups.yahoo.com/group/jena-dev/message/21436
                                                                 Date: Mar 8, 2006
       A series of SPARQL queries of the form:
            ... WHERE {
                 { ?family ex:dad ?d .
                    ?d ex:name “Peter” . }
                 { ?family ex:mom ?m .
                    ?m ex:name ”Robin” . } ...

       My queries run very slowly
       Simple queries on a database of 10 000 trees
       describing families

Answer:
       ... Put the more specific part of the query first; it
       makes a significant difference. ...

Reply:
       ... My time went from 33 000 ms to 150 ms ...
                                                                                     2
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
One Query, many ways to execute
{ ?family ex:dad ?d .
  ?d ex:name ”Peter” . }
                                                  { ?family ex:mom ?m .
{ ?family ex:mom ?m .
                                                    ?m ex:name ”Robin” . }
  ?m ex:name ”Robin” . }
                                                  { ?family ex:dad ?d .
{ ?family ex:pet ?p .
                                                    ?d ex:name ”Peter” . }
  ?p ex:name ”Toller” . }
                                                  { ?family ex:pet ?p .
                                                    ?p ex:name ”Toller” . }



                                                { ?family ex:pet ?p .
                                                  ?p ex:name ”Toller” . }
                                                { ?family ex:dad ?d .
                                                  ?d ex:name ”Peter” . }
                                                { ?family ex:mom ?m .
                                                  ?m ex:name ”Robin” . }




                                                                                   3
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
One Query, many ways to execute
{ ?family ex:dad ?d .
  ?d ex:name ”Peter” . }
                                                  { ?family ex:mom ?m .
{ ?family ex:mom ?m .
                                                    ?m ex:name ”Robin” . }
  ?m ex:name ”Robin” . }
                                                  { ?family ex:dad ?d .
{ ?family ex:pet ?p .
                                                    ?d ex:name ”Peter” . }
  ?p ex:name ”Toller” . }
                                                  { ?family ex:pet ?p .
                                                    ?p ex:name ”Toller” . }



                                                { ?family ex:pet ?p .
                                                  ?p ex:name ”Toller” . }
                                                { ?family ex:dad ?d .
                                                  ?d ex:name ”Peter” . }
                                                { ?family ex:mom ?m .
                                                  ?m ex:name ”Robin” . }




                                                                                   4
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Outline


   Query processing in databases
   SPARQL query graph model (SQGM)
   Rewriting SQGMs
   Evaluation
   Conclusion




                                                                                   5
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Outline


   Query processing in databases
   SPARQL query graph model (SQGM)
   Rewriting SQGMs
   Evaluation
   Conclusion




                                                                                   6
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Tasks of the Query Engine


   Query Parsing                                      Query Rewriting

                                                                                       Query
                                                                                    Processing
                                                                                   in Databases

                         SPARQL                                                      SPARQL
                                                                                   Query Graph
                         Query Internal                                               Model
                            representation
                         Graph                                                      Rewriting
                         Model the query
                             of                                                      SQGMs

                                                                                    Evaluation

                                                                                    Conclusion




   QEP Execution                                       QEP Generation


                                           QEP – Query Execution Plan
                                                                                                7
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Outline


   Query processing in databases
   SPARQL query graph model (SQGM)
   Rewriting SQGMs
   Evaluation
   Conclusion




                                                                                   8
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Advantages

                                                        Extensible to new
     Supports all phases                                 concepts of the
     of query processing                                 query language
                                                                                       Query
                                                                                    Processing
                                                                                   in Databases

                           SPARQL                                                    SPARQL
                                                                                   Query Graph
                           Query                                                      Model
                           Graph                                                    Rewriting
                           Model                                                     SQGMs

                                                                                    Evaluation

                                                                                    Conclusion


                                                    Adaptable to
       Stores additional
                                                   changes of the
          information
                                                   query language
       needed for query
           processing


                                                                                                9
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Basic Structures

   Operators
     Process data (sets of variable bindings,
                                                                                       Query
     RDF graphs)                                      Head                          Processing
                                                                                   in Databases
     Head: provided variables                              Body
                                                                                     SPARQL
     Body: operator details                                                        Query Graph
                                                                                      Model

                                                                                    Rewriting
   Dataflows                                                                         SQGMs

     Connects the input and                                                         Evaluation

                                                                                    Conclusion
     the output of two operators



   Directed acyclic graph



                                                                                            10
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Constructing an SQGM
SELECT ?n ?c
FROM http://example.org/university.rdf
WHERE {
  ?s rdf:type ub:GraduateStudent . ?c ?n
  OPTIONAL { ?s ub:takesCourse ?c }                                                      Query
                                       SELECT
  ?s ub:name ?n .                                                                     Processing
                                                                                     in Databases
}                                          ?n,?c
                                                                                       SPARQL
   Graph access operators                                 ?s    ?c    ?n             Query Graph
                                                                                        Model
   Graph pattern operators                                       JOIN
                                                                                      Rewriting
                                        ?s,?c
   Join operators                                                           ?s,?n      SQGMs
                             ?s    ?c
   Select result                                                     ?s    ?n         Evaluation
                                     JOIN
                                                                     ?s ub:name ?n
   operators                                                                          Conclusion
                                                  ?s,?c
                     ?s
                                                      optional
 ?s                                         ?s    ?c
 ?s rdf:type ub:GraduateStudent             ?s ub:takesCourse ?c


                               http://example.org/university.rdf


                                                                                              11
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Operator Types

   Graph selection operators
   Graph merge operators                                  ?c    ?n
                                                                                         Query
                                                                SELECT
   Union operators                                                                    Processing
                                                                                     in Databases
                                                                      ?n,?c
   Solution modifier operators
                                                                                       SPARQL
   Construct result operators                             ?s    ?c    ?n             Query Graph
                                                                                        Model
                                                                 JOIN
   ...
                                                                                      Rewriting
                                        ?s,?c                               ?s,?n      SQGMs
                             ?s    ?c
                                                                     ?s    ?n         Evaluation
                                     JOIN
                                                                     ?s ub:name ?n    Conclusion
                                                  ?s,?c
                     ?s
                                                      optional
 ?s                                         ?s    ?c
 ?s rdf:type ub:GraduateStudent             ?s ub:takesCourse ?c


                               http://example.org/university.rdf


                                                                                              12
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Outline


   Query processing in databases
   SPARQL query graph model (SQGM)
   Rewriting SQGMs
   Evaluation
   Conclusion




                                                                                   13
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Query Rewriting



Goals:
                                                                                       Query
       Faster evaluation of a query                                                 Processing
                                                                                   in Databases
       Provide more options for the generation of query
       plans, e.g.:                                                                  SPARQL
                                                                                   Query Graph
           Data access strategy                                                       Model

           Join order                                                               Rewriting
                                                                                     SQGMs
           Selection of indexes
                                                                                    Evaluation

                                                                                    Conclusion




                                                                                            14
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Transformation Rules
   Currently 26 transformation rules, e.g.:

     MergeJoinedGPOs
                                  ?s    ?n ?c
                                        JOIN                 ?s   ?n   ?c
                                                                                        Query
                     ?s,?c                  ?s,?n            ?s ub:takesCourse ?c    Processing
                                                             ?s ub:name ?n          in Databases
          ?s ?c                        ?s ?n                 regex(?n, quot;^Squot;)
                                       ?s ub:name ?n
          ?s ub:takesCourse ?c                                                        SPARQL
                                       regex(?n, quot;^Squot;)
                                                                                    Query Graph
                                                                                       Model
     SwitchJoinedJoinRightInputs
                                                                                     Rewriting
                                                                                      SQGMs

                                                                                     Evaluation
                                 JOIN                                  JOIN
                                                                                     Conclusion

                         JOIN                                  JOIN




     FindContradiction

                                                                                             15
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Heuristic: Merge Graph Pattern Operators

Heuristic: rewrite strategy based on a set of rules
                                                            ?c    ?n

Graph pattern operators                                                                   Query
                                                                  SELECT
                                                                                       Processing
                                                                                      in Databases
can not be merged                                                          ?n,?c
                                                                                        SPARQL
                                                          ?s     ?c    ?n             Query Graph
                                                                                         Model
                                                                  JOIN
                                                                                       Rewriting
                                        ?s,?c                                ?s,?n      SQGMs
                             ?s    ?c
                                                                      ?s    ?n         Evaluation
                                     JOIN
                                                                      ?s ub:name ?n    Conclusion
                                                  ?s,?c
                     ?s
                                                      optional
 ?s                                         ?s    ?c
 ?s rdf:type ub:GraduateStudent             ?s ub:takesCourse ?c


                               http://example.org/university.rdf


                                                                                               16
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Heuristic: Merge Graph Pattern Operators

But these could be merged if they were
operands of the same join operation.                        ?c    ?n
                                                                                          Query
                                                                  SELECT
                                                                                       Processing
    Apply transformation rules to                                                     in Databases
➔
                                                                           ?n,?c
    restructure the SQGM                                                                SPARQL
                                                          ?s     ?c    ?n             Query Graph
                                                                                         Model
    (SwitchJoinedJoinRightInputs)                                 JOIN
                                                                                       Rewriting
                                        ?s,?n
                                        ?s,?c                                ?s,?n      SQGMs
                             ?s    ?c
                                                                      ?s    ?n         Evaluation
                                     JOIN
                                                                      ?s ub:name ?n    Conclusion
                                                  ?s,?c
                     ?s
                                                      optional
 ?s                                         ?s    ?c
 ?s rdf:type ub:GraduateStudent             ?s ub:takesCourse ?c


                               http://example.org/university.rdf


                                                                                               17
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Heuristic: Merge Graph Pattern Operators

But these could be merged if they were
operands of the same join operation.                        ?c    ?n
                                                                                           Query
                                                                  SELECT
                                                                                        Processing
    Apply transformation rules to                                                      in Databases
➔
                                                                         ?n,?c
    restructure the SQGM                                                                 SPARQL
                                                          ?s     ?c    ?n              Query Graph
                                                                                          Model
    (SwitchJoinedJoinRightInputs)                                 JOIN
                                                                                        Rewriting
                                                                            ?s,?c
                                        ?s,?n
                                        ?s,?c
                                                                                         SQGMs
                                                                            optional
                             ?s    ?n
                                   ?c
                                                           ?s    ?c                     Evaluation
                                     JOIN
                                                           ?s ub:takesCourse ?c
                                                                                        Conclusion
                     ?s                       ?s,?n

 ?s                                          ?s   ?n
 ?s rdf:type ub:GraduateStudent             ?s ub:name ?n


                               http://example.org/university.rdf


                                                                                                18
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Heuristic: Merge Graph Pattern Operators

Apply transformation rule to merge
(MergeJoinedGPOs)                                           ?c    ?n
                                                                                           Query
                                                                  SELECT
                                                                                        Processing
                                                                                       in Databases
                                                                         ?n,?c
                                                                                         SPARQL
                                                          ?s     ?c    ?n              Query Graph
                                                                                          Model
                                                                  JOIN
                                                                                        Rewriting
                                                                            ?s,?c
                                        ?s,?n
                                                                                         SQGMs
                                                                            optional
                             ?s    ?n
                                                          ?s     ?c                     Evaluation
                                     JOIN
                                                          ?s ub:takesCourse ?c          Conclusion
                     ?s                       ?s,?n

 ?s                                          ?s   ?n
 ?s rdf:type ub:GraduateStudent             ?s ub:name ?n


                               http://example.org/university.rdf


                                                                                                19
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Heuristic: Merge Graph Pattern Operators

Apply transformation rule to merge
(MergeJoinedGPOs)                                           ?c    ?n
                                                                                           Query
                                                                  SELECT
                                                                                        Processing
                                                                                       in Databases
                                                                         ?n,?c
                                                                                         SPARQL
                                                          ?s     ?c    ?n              Query Graph
                                                                                          Model
                                                                  JOIN
                                                                                        Rewriting
                                                                            ?s,?c
                             ?s,?n                                                       SQGMs
                                                                            optional
                                                          ?s     ?c                     Evaluation
         ?s   ?n
                                                          ?s ub:takesCourse ?c          Conclusion
        ?s rdf:type ub:GraduateStudent
                  ?s
        ?s ub:name ?n




                               http://example.org/university.rdf


                                                                                                20
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Evaluation Results

Messured query execution time of a selected query:
       Factor ≈ 2.4                       80
                                          70                                            Query
                                                                                     Processing
                                          60                                        in Databases
                                          50


                                Seconds
                                                                                      SPARQL
                                          40                                        Query Graph
            original query
                                                                                       Model
                                          30
            rewritten query
                                          20                                         Rewriting
                                                5.8   2.5                             SQGMs
                                          10                39.4 16.4   77.9 32.3
                                          0                                          Evaluation
                                               UnivBench    UnivBench   UnivBench
                                                                                     Conclusion
                                                 (1.0)        (5.0)       (10.0)
        SELECT ?n ?c
        FROM http://example.org/university.rdf
        WHERE {
          ?s rdf:type ub:GraduateStudent .
          OPTIONAL { ?s ub:takesCourse ?c }
          ?s ub:name ?n .
        }

                                                                                             21
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Evaluation Results ctd.

       Time for transformation between models: < 1 ms

                                                                                       Query
                                                                                    Processing
       Query with contradiction: nearly 100% savings                               in Databases

                                                                                     SPARQL
                                                                                   Query Graph
                                                                                      Model
       Approx. time savings:
                                                                                    Rewriting
                                                                                     SQGMs
         Average: 45%
                                                                                    Evaluation
         Best cases: 95%
                                                                                    Conclusion




                                                                                            22
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Explanation of the Results

Reason: fast path algorithm of Jena
       Perform pattern matching within the underlying
       relational database                                                             Query
                                                                                    Processing
                                                                                   in Databases
       Combined match of multiple basic graph patterns
                                                                                     SPARQL
       possible                                                                    Query Graph
                                                                                      Model
                                                            multiple SQL
... WHERE {                                                                         Rewriting
                                                            queries – one
  ?s rdf:type ub:GraduateStudent .                                                   SQGMs
                                                            for every basic
  OPTIONAL { ?s ub:takesCourse ?c }
                                                                                    Evaluation
                                                            graph pattern
  ?s ub:name ?n .
}                                                                                   Conclusion


                                                            one SQL query
... WHERE {
                                                            combining the
  ?s rdf:type ub:GraduateStudent .
                                                            marked basic
  ?s ub:name ?n .
                                                            graph patterns
  OPTIONAL { ?s ub:takesCourse ?c }
}

                                                                                            23
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Outline


   Query processing in databases
   SPARQL query graph model (SQGM)
   Rewriting SQGMs
   Evaluation
   Conclusion




                                                                                   24
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
Conclusion and Future Work

                                              SPARQL
   SQGM: a query model
                                              Query
         for SPARQL
                                              Graph                                    Query
     Supports all phases of                   Model                                 Processing
     query processing                                                              in Databases

                                                                                     SPARQL
     Easy to extend
                                                                                   Query Graph
                                                                                      Model
     Transformation rules and heuristics for SQGMs
                                                                                    Rewriting
   Implementation illustrated the potential of SQGMs                                 SQGMs

                                                                                    Evaluation

Outlook                                                                             Conclusion

   Develop further heuristics to rewrite SQGMs
   Consider other phases of query processing
   Integrate index selection into the query optimization



                                                                                            25
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
The SPARQL Query Graph Model
                    for Query Optimization
                                  Olaf Hartig and Ralf Heese




                                    Thank you!




                                                                                   26
Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization

Weitere ähnliche Inhalte

Ähnlich wie The SPARQL Query Graph Model for Query Optimization

ESWC 2013 Poster: Representing and Querying Negative Knowledge in RDF
ESWC 2013 Poster: Representing and Querying Negative Knowledge in RDFESWC 2013 Poster: Representing and Querying Negative Knowledge in RDF
ESWC 2013 Poster: Representing and Querying Negative Knowledge in RDFFariz Darari
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and SemanticsTatiana Al-Chueyr
 
2014 spark with elastic search
2014   spark with elastic search2014   spark with elastic search
2014 spark with elastic searchHenry Saputra
 
An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQLOlaf Hartig
 
Rethinking Online SPARQL Querying to Support Incremental Result Visualization
Rethinking Online SPARQL Querying to Support Incremental Result VisualizationRethinking Online SPARQL Querying to Support Incremental Result Visualization
Rethinking Online SPARQL Querying to Support Incremental Result VisualizationOlaf Hartig
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLEmanuele Della Valle
 
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)Olaf Hartig
 

Ähnlich wie The SPARQL Query Graph Model for Query Optimization (7)

ESWC 2013 Poster: Representing and Querying Negative Knowledge in RDF
ESWC 2013 Poster: Representing and Querying Negative Knowledge in RDFESWC 2013 Poster: Representing and Querying Negative Knowledge in RDF
ESWC 2013 Poster: Representing and Querying Negative Knowledge in RDF
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and Semantics
 
2014 spark with elastic search
2014   spark with elastic search2014   spark with elastic search
2014 spark with elastic search
 
An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQL
 
Rethinking Online SPARQL Querying to Support Incremental Result Visualization
Rethinking Online SPARQL Querying to Support Incremental Result VisualizationRethinking Online SPARQL Querying to Support Incremental Result Visualization
Rethinking Online SPARQL Querying to Support Incremental Result Visualization
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
 
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
 

Mehr von Olaf Hartig

LDQL: A Query Language for the Web of Linked Data
LDQL: A Query Language for the Web of Linked DataLDQL: A Query Language for the Web of Linked Data
LDQL: A Query Language for the Web of Linked DataOlaf Hartig
 
A Context-Based Semantics for SPARQL Property Paths over the Web
A Context-Based Semantics for SPARQL Property Paths over the WebA Context-Based Semantics for SPARQL Property Paths over the Web
A Context-Based Semantics for SPARQL Property Paths over the WebOlaf Hartig
 
Tutorial "Linked Data Query Processing" Part 5 "Query Planning and Optimizati...
Tutorial "Linked Data Query Processing" Part 5 "Query Planning and Optimizati...Tutorial "Linked Data Query Processing" Part 5 "Query Planning and Optimizati...
Tutorial "Linked Data Query Processing" Part 5 "Query Planning and Optimizati...Olaf Hartig
 
Tutorial "Linked Data Query Processing" Part 4 "Execution Process" (WWW 2013 ...
Tutorial "Linked Data Query Processing" Part 4 "Execution Process" (WWW 2013 ...Tutorial "Linked Data Query Processing" Part 4 "Execution Process" (WWW 2013 ...
Tutorial "Linked Data Query Processing" Part 4 "Execution Process" (WWW 2013 ...Olaf Hartig
 
Tutorial "Linked Data Query Processing" Part 3 "Source Selection Strategies" ...
Tutorial "Linked Data Query Processing" Part 3 "Source Selection Strategies" ...Tutorial "Linked Data Query Processing" Part 3 "Source Selection Strategies" ...
Tutorial "Linked Data Query Processing" Part 3 "Source Selection Strategies" ...Olaf Hartig
 
Tutorial "Linked Data Query Processing" Part 2 "Theoretical Foundations" (WWW...
Tutorial "Linked Data Query Processing" Part 2 "Theoretical Foundations" (WWW...Tutorial "Linked Data Query Processing" Part 2 "Theoretical Foundations" (WWW...
Tutorial "Linked Data Query Processing" Part 2 "Theoretical Foundations" (WWW...Olaf Hartig
 
Tutorial "Linked Data Query Processing" Part 1 "Introduction" (WWW 2013 Ed.)
Tutorial "Linked Data Query Processing" Part 1 "Introduction" (WWW 2013 Ed.)Tutorial "Linked Data Query Processing" Part 1 "Introduction" (WWW 2013 Ed.)
Tutorial "Linked Data Query Processing" Part 1 "Introduction" (WWW 2013 Ed.)Olaf Hartig
 
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 3 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 3 (...Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 3 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 3 (...Olaf Hartig
 
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...Olaf Hartig
 
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 1 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 1 (...Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 1 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 1 (...Olaf Hartig
 
An Overview on PROV-AQ: Provenance Access and Query
An Overview on PROV-AQ: Provenance Access and QueryAn Overview on PROV-AQ: Provenance Access and Query
An Overview on PROV-AQ: Provenance Access and QueryOlaf Hartig
 
Zero-Knowledge Query Planning for an Iterator Implementation of Link Traversa...
Zero-Knowledge Query Planning for an Iterator Implementation of Link Traversa...Zero-Knowledge Query Planning for an Iterator Implementation of Link Traversa...
Zero-Knowledge Query Planning for an Iterator Implementation of Link Traversa...Olaf Hartig
 
The Impact of Data Caching of on Query Execution for Linked Data
The Impact of Data Caching of on Query Execution for Linked DataThe Impact of Data Caching of on Query Execution for Linked Data
The Impact of Data Caching of on Query Execution for Linked DataOlaf Hartig
 
How Caching Improves Efficiency and Result Completeness for Querying Linked Data
How Caching Improves Efficiency and Result Completeness for Querying Linked DataHow Caching Improves Efficiency and Result Completeness for Querying Linked Data
How Caching Improves Efficiency and Result Completeness for Querying Linked DataOlaf Hartig
 
A Main Memory Index Structure to Query Linked Data
A Main Memory Index Structure to Query Linked DataA Main Memory Index Structure to Query Linked Data
A Main Memory Index Structure to Query Linked DataOlaf Hartig
 
Towards a Data-Centric Notion of Trust in the Semantic Web (A Position Statem...
Towards a Data-Centric Notion of Trust in the Semantic Web (A Position Statem...Towards a Data-Centric Notion of Trust in the Semantic Web (A Position Statem...
Towards a Data-Centric Notion of Trust in the Semantic Web (A Position Statem...Olaf Hartig
 
Brief Introduction to the Provenance Vocabulary (for W3C prov-xg)
Brief Introduction to the Provenance Vocabulary (for W3C prov-xg)Brief Introduction to the Provenance Vocabulary (for W3C prov-xg)
Brief Introduction to the Provenance Vocabulary (for W3C prov-xg)Olaf Hartig
 
Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)Olaf Hartig
 
Answers to usual issues in getting started with consuming Linked Data (2010)
Answers to usual issues in getting started with consuming Linked Data (2010)Answers to usual issues in getting started with consuming Linked Data (2010)
Answers to usual issues in getting started with consuming Linked Data (2010)Olaf Hartig
 
Linked Data on the Web
Linked Data on the WebLinked Data on the Web
Linked Data on the WebOlaf Hartig
 

Mehr von Olaf Hartig (20)

LDQL: A Query Language for the Web of Linked Data
LDQL: A Query Language for the Web of Linked DataLDQL: A Query Language for the Web of Linked Data
LDQL: A Query Language for the Web of Linked Data
 
A Context-Based Semantics for SPARQL Property Paths over the Web
A Context-Based Semantics for SPARQL Property Paths over the WebA Context-Based Semantics for SPARQL Property Paths over the Web
A Context-Based Semantics for SPARQL Property Paths over the Web
 
Tutorial "Linked Data Query Processing" Part 5 "Query Planning and Optimizati...
Tutorial "Linked Data Query Processing" Part 5 "Query Planning and Optimizati...Tutorial "Linked Data Query Processing" Part 5 "Query Planning and Optimizati...
Tutorial "Linked Data Query Processing" Part 5 "Query Planning and Optimizati...
 
Tutorial "Linked Data Query Processing" Part 4 "Execution Process" (WWW 2013 ...
Tutorial "Linked Data Query Processing" Part 4 "Execution Process" (WWW 2013 ...Tutorial "Linked Data Query Processing" Part 4 "Execution Process" (WWW 2013 ...
Tutorial "Linked Data Query Processing" Part 4 "Execution Process" (WWW 2013 ...
 
Tutorial "Linked Data Query Processing" Part 3 "Source Selection Strategies" ...
Tutorial "Linked Data Query Processing" Part 3 "Source Selection Strategies" ...Tutorial "Linked Data Query Processing" Part 3 "Source Selection Strategies" ...
Tutorial "Linked Data Query Processing" Part 3 "Source Selection Strategies" ...
 
Tutorial "Linked Data Query Processing" Part 2 "Theoretical Foundations" (WWW...
Tutorial "Linked Data Query Processing" Part 2 "Theoretical Foundations" (WWW...Tutorial "Linked Data Query Processing" Part 2 "Theoretical Foundations" (WWW...
Tutorial "Linked Data Query Processing" Part 2 "Theoretical Foundations" (WWW...
 
Tutorial "Linked Data Query Processing" Part 1 "Introduction" (WWW 2013 Ed.)
Tutorial "Linked Data Query Processing" Part 1 "Introduction" (WWW 2013 Ed.)Tutorial "Linked Data Query Processing" Part 1 "Introduction" (WWW 2013 Ed.)
Tutorial "Linked Data Query Processing" Part 1 "Introduction" (WWW 2013 Ed.)
 
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 3 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 3 (...Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 3 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 3 (...
 
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 2 (...
 
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 1 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 1 (...Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 1 (...
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 1 (...
 
An Overview on PROV-AQ: Provenance Access and Query
An Overview on PROV-AQ: Provenance Access and QueryAn Overview on PROV-AQ: Provenance Access and Query
An Overview on PROV-AQ: Provenance Access and Query
 
Zero-Knowledge Query Planning for an Iterator Implementation of Link Traversa...
Zero-Knowledge Query Planning for an Iterator Implementation of Link Traversa...Zero-Knowledge Query Planning for an Iterator Implementation of Link Traversa...
Zero-Knowledge Query Planning for an Iterator Implementation of Link Traversa...
 
The Impact of Data Caching of on Query Execution for Linked Data
The Impact of Data Caching of on Query Execution for Linked DataThe Impact of Data Caching of on Query Execution for Linked Data
The Impact of Data Caching of on Query Execution for Linked Data
 
How Caching Improves Efficiency and Result Completeness for Querying Linked Data
How Caching Improves Efficiency and Result Completeness for Querying Linked DataHow Caching Improves Efficiency and Result Completeness for Querying Linked Data
How Caching Improves Efficiency and Result Completeness for Querying Linked Data
 
A Main Memory Index Structure to Query Linked Data
A Main Memory Index Structure to Query Linked DataA Main Memory Index Structure to Query Linked Data
A Main Memory Index Structure to Query Linked Data
 
Towards a Data-Centric Notion of Trust in the Semantic Web (A Position Statem...
Towards a Data-Centric Notion of Trust in the Semantic Web (A Position Statem...Towards a Data-Centric Notion of Trust in the Semantic Web (A Position Statem...
Towards a Data-Centric Notion of Trust in the Semantic Web (A Position Statem...
 
Brief Introduction to the Provenance Vocabulary (for W3C prov-xg)
Brief Introduction to the Provenance Vocabulary (for W3C prov-xg)Brief Introduction to the Provenance Vocabulary (for W3C prov-xg)
Brief Introduction to the Provenance Vocabulary (for W3C prov-xg)
 
Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)Querying Linked Data with SPARQL (2010)
Querying Linked Data with SPARQL (2010)
 
Answers to usual issues in getting started with consuming Linked Data (2010)
Answers to usual issues in getting started with consuming Linked Data (2010)Answers to usual issues in getting started with consuming Linked Data (2010)
Answers to usual issues in getting started with consuming Linked Data (2010)
 
Linked Data on the Web
Linked Data on the WebLinked Data on the Web
Linked Data on the Web
 

Kürzlich hochgeladen

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Kürzlich hochgeladen (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

The SPARQL Query Graph Model for Query Optimization

  • 1. The SPARQL Query Graph Model for Query Optimization Olaf Hartig and Ralf Heese
  • 2. Postings on the Jena Mailinglist Question: http://groups.yahoo.com/group/jena-dev/message/21436 Date: Mar 8, 2006 A series of SPARQL queries of the form: ... WHERE { { ?family ex:dad ?d . ?d ex:name “Peter” . } { ?family ex:mom ?m . ?m ex:name ”Robin” . } ... My queries run very slowly Simple queries on a database of 10 000 trees describing families Answer: ... Put the more specific part of the query first; it makes a significant difference. ... Reply: ... My time went from 33 000 ms to 150 ms ... 2 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 3. One Query, many ways to execute { ?family ex:dad ?d . ?d ex:name ”Peter” . } { ?family ex:mom ?m . { ?family ex:mom ?m . ?m ex:name ”Robin” . } ?m ex:name ”Robin” . } { ?family ex:dad ?d . { ?family ex:pet ?p . ?d ex:name ”Peter” . } ?p ex:name ”Toller” . } { ?family ex:pet ?p . ?p ex:name ”Toller” . } { ?family ex:pet ?p . ?p ex:name ”Toller” . } { ?family ex:dad ?d . ?d ex:name ”Peter” . } { ?family ex:mom ?m . ?m ex:name ”Robin” . } 3 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 4. One Query, many ways to execute { ?family ex:dad ?d . ?d ex:name ”Peter” . } { ?family ex:mom ?m . { ?family ex:mom ?m . ?m ex:name ”Robin” . } ?m ex:name ”Robin” . } { ?family ex:dad ?d . { ?family ex:pet ?p . ?d ex:name ”Peter” . } ?p ex:name ”Toller” . } { ?family ex:pet ?p . ?p ex:name ”Toller” . } { ?family ex:pet ?p . ?p ex:name ”Toller” . } { ?family ex:dad ?d . ?d ex:name ”Peter” . } { ?family ex:mom ?m . ?m ex:name ”Robin” . } 4 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 5. Outline Query processing in databases SPARQL query graph model (SQGM) Rewriting SQGMs Evaluation Conclusion 5 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 6. Outline Query processing in databases SPARQL query graph model (SQGM) Rewriting SQGMs Evaluation Conclusion 6 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 7. Tasks of the Query Engine Query Parsing Query Rewriting Query Processing in Databases SPARQL SPARQL Query Graph Query Internal Model representation Graph Rewriting Model the query of SQGMs Evaluation Conclusion QEP Execution QEP Generation QEP – Query Execution Plan 7 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 8. Outline Query processing in databases SPARQL query graph model (SQGM) Rewriting SQGMs Evaluation Conclusion 8 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 9. Advantages Extensible to new Supports all phases concepts of the of query processing query language Query Processing in Databases SPARQL SPARQL Query Graph Query Model Graph Rewriting Model SQGMs Evaluation Conclusion Adaptable to Stores additional changes of the information query language needed for query processing 9 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 10. Basic Structures Operators Process data (sets of variable bindings, Query RDF graphs) Head Processing in Databases Head: provided variables Body SPARQL Body: operator details Query Graph Model Rewriting Dataflows SQGMs Connects the input and Evaluation Conclusion the output of two operators Directed acyclic graph 10 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 11. Constructing an SQGM SELECT ?n ?c FROM http://example.org/university.rdf WHERE { ?s rdf:type ub:GraduateStudent . ?c ?n OPTIONAL { ?s ub:takesCourse ?c } Query SELECT ?s ub:name ?n . Processing in Databases } ?n,?c SPARQL Graph access operators ?s ?c ?n Query Graph Model Graph pattern operators JOIN Rewriting ?s,?c Join operators ?s,?n SQGMs ?s ?c Select result ?s ?n Evaluation JOIN ?s ub:name ?n operators Conclusion ?s,?c ?s optional ?s ?s ?c ?s rdf:type ub:GraduateStudent ?s ub:takesCourse ?c http://example.org/university.rdf 11 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 12. Operator Types Graph selection operators Graph merge operators ?c ?n Query SELECT Union operators Processing in Databases ?n,?c Solution modifier operators SPARQL Construct result operators ?s ?c ?n Query Graph Model JOIN ... Rewriting ?s,?c ?s,?n SQGMs ?s ?c ?s ?n Evaluation JOIN ?s ub:name ?n Conclusion ?s,?c ?s optional ?s ?s ?c ?s rdf:type ub:GraduateStudent ?s ub:takesCourse ?c http://example.org/university.rdf 12 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 13. Outline Query processing in databases SPARQL query graph model (SQGM) Rewriting SQGMs Evaluation Conclusion 13 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 14. Query Rewriting Goals: Query Faster evaluation of a query Processing in Databases Provide more options for the generation of query plans, e.g.: SPARQL Query Graph Data access strategy Model Join order Rewriting SQGMs Selection of indexes Evaluation Conclusion 14 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 15. Transformation Rules Currently 26 transformation rules, e.g.: MergeJoinedGPOs ?s ?n ?c JOIN ?s ?n ?c Query ?s,?c ?s,?n ?s ub:takesCourse ?c Processing ?s ub:name ?n in Databases ?s ?c ?s ?n regex(?n, quot;^Squot;) ?s ub:name ?n ?s ub:takesCourse ?c SPARQL regex(?n, quot;^Squot;) Query Graph Model SwitchJoinedJoinRightInputs Rewriting SQGMs Evaluation JOIN JOIN Conclusion JOIN JOIN FindContradiction 15 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 16. Heuristic: Merge Graph Pattern Operators Heuristic: rewrite strategy based on a set of rules ?c ?n Graph pattern operators Query SELECT Processing in Databases can not be merged ?n,?c SPARQL ?s ?c ?n Query Graph Model JOIN Rewriting ?s,?c ?s,?n SQGMs ?s ?c ?s ?n Evaluation JOIN ?s ub:name ?n Conclusion ?s,?c ?s optional ?s ?s ?c ?s rdf:type ub:GraduateStudent ?s ub:takesCourse ?c http://example.org/university.rdf 16 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 17. Heuristic: Merge Graph Pattern Operators But these could be merged if they were operands of the same join operation. ?c ?n Query SELECT Processing Apply transformation rules to in Databases ➔ ?n,?c restructure the SQGM SPARQL ?s ?c ?n Query Graph Model (SwitchJoinedJoinRightInputs) JOIN Rewriting ?s,?n ?s,?c ?s,?n SQGMs ?s ?c ?s ?n Evaluation JOIN ?s ub:name ?n Conclusion ?s,?c ?s optional ?s ?s ?c ?s rdf:type ub:GraduateStudent ?s ub:takesCourse ?c http://example.org/university.rdf 17 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 18. Heuristic: Merge Graph Pattern Operators But these could be merged if they were operands of the same join operation. ?c ?n Query SELECT Processing Apply transformation rules to in Databases ➔ ?n,?c restructure the SQGM SPARQL ?s ?c ?n Query Graph Model (SwitchJoinedJoinRightInputs) JOIN Rewriting ?s,?c ?s,?n ?s,?c SQGMs optional ?s ?n ?c ?s ?c Evaluation JOIN ?s ub:takesCourse ?c Conclusion ?s ?s,?n ?s ?s ?n ?s rdf:type ub:GraduateStudent ?s ub:name ?n http://example.org/university.rdf 18 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 19. Heuristic: Merge Graph Pattern Operators Apply transformation rule to merge (MergeJoinedGPOs) ?c ?n Query SELECT Processing in Databases ?n,?c SPARQL ?s ?c ?n Query Graph Model JOIN Rewriting ?s,?c ?s,?n SQGMs optional ?s ?n ?s ?c Evaluation JOIN ?s ub:takesCourse ?c Conclusion ?s ?s,?n ?s ?s ?n ?s rdf:type ub:GraduateStudent ?s ub:name ?n http://example.org/university.rdf 19 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 20. Heuristic: Merge Graph Pattern Operators Apply transformation rule to merge (MergeJoinedGPOs) ?c ?n Query SELECT Processing in Databases ?n,?c SPARQL ?s ?c ?n Query Graph Model JOIN Rewriting ?s,?c ?s,?n SQGMs optional ?s ?c Evaluation ?s ?n ?s ub:takesCourse ?c Conclusion ?s rdf:type ub:GraduateStudent ?s ?s ub:name ?n http://example.org/university.rdf 20 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 21. Evaluation Results Messured query execution time of a selected query: Factor ≈ 2.4 80 70 Query Processing 60 in Databases 50 Seconds SPARQL 40 Query Graph original query Model 30 rewritten query 20 Rewriting 5.8 2.5 SQGMs 10 39.4 16.4 77.9 32.3 0 Evaluation UnivBench UnivBench UnivBench Conclusion (1.0) (5.0) (10.0) SELECT ?n ?c FROM http://example.org/university.rdf WHERE { ?s rdf:type ub:GraduateStudent . OPTIONAL { ?s ub:takesCourse ?c } ?s ub:name ?n . } 21 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 22. Evaluation Results ctd. Time for transformation between models: < 1 ms Query Processing Query with contradiction: nearly 100% savings in Databases SPARQL Query Graph Model Approx. time savings: Rewriting SQGMs Average: 45% Evaluation Best cases: 95% Conclusion 22 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 23. Explanation of the Results Reason: fast path algorithm of Jena Perform pattern matching within the underlying relational database Query Processing in Databases Combined match of multiple basic graph patterns SPARQL possible Query Graph Model multiple SQL ... WHERE { Rewriting queries – one ?s rdf:type ub:GraduateStudent . SQGMs for every basic OPTIONAL { ?s ub:takesCourse ?c } Evaluation graph pattern ?s ub:name ?n . } Conclusion one SQL query ... WHERE { combining the ?s rdf:type ub:GraduateStudent . marked basic ?s ub:name ?n . graph patterns OPTIONAL { ?s ub:takesCourse ?c } } 23 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 24. Outline Query processing in databases SPARQL query graph model (SQGM) Rewriting SQGMs Evaluation Conclusion 24 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 25. Conclusion and Future Work SPARQL SQGM: a query model Query for SPARQL Graph Query Supports all phases of Model Processing query processing in Databases SPARQL Easy to extend Query Graph Model Transformation rules and heuristics for SQGMs Rewriting Implementation illustrated the potential of SQGMs SQGMs Evaluation Outlook Conclusion Develop further heuristics to rewrite SQGMs Consider other phases of query processing Integrate index selection into the query optimization 25 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization
  • 26. The SPARQL Query Graph Model for Query Optimization Olaf Hartig and Ralf Heese Thank you! 26 Olaf Hartig and Ralf Heese - The SPARQL Query Graph Model for Query Optimization