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

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Kürzlich hochgeladen (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

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