
 
 
 
 
 
 
Table 1: Rewriting rules for optimizing coreSPARQL queries (cont.). 
Comparison operators: 
 
•  FILTER(?x op1 C1). FILTER(?x op2 C2).  => 
 
     FILTER(?x op1 C1).,  
 
if ((op1=op2 ∧ (C1 op1 C2)  ∧ op1∈{<, <=, >=, >}) ∨ ((C1 op1 C2) ∧ C1≠C2 ∧  
                                             (op1, op2∈{<, <=} ∨ op1, op2∈{>=, >})) ∨ (C1=C2 ∧ ((op1=‘<’ ∧ op2=‘<=’) ∨  
                                             (op1= ‘>’ ∧ op2= ‘>=’)))) 
 
     FILTER(?x op2 C2).,  if ((op1=op2 ∧ (C2 op1 C1) ∧ op1∈{<, <=, >=, >}) ∨ ((C2 op2 C1) ∧ C1≠C2 ∧  
                                             (op1, op2∈{<, <=} ∨ op1, op2 ∈ {>=, >})) ∨ (C1=C2 ∧ ((op2=‘<’ ∧ op1=‘<=’) ∨  
                                             (op2= ‘>’ ∧ op1= ‘>=’))))  
 
     FILTER(false).,          if ((C1>C2 ∧ op1∈{>, >=} ∧ op2∈{<, <=} ) ∨ (C1<C2 ∧ op1∈{<, <=} ∧ op2∈{ >, >=}) ∨    
                                             (C1=C2 ∧ op1≠op2 ∧ (op1, op2∈{=, !=} ∨ op1, op2∈{<,>})))  
 
      FILTER(?x op1 C1). FILTER(?x op2 C2)., otherwise. 
 
E.g. Filter(?x>10). Filter(?x>30). => Filter(?x>30).;  Filter(?x>30). Filter(?x<10). => Filter(false). 
Operators ||, ! and ¬ 
 
•  E || true => true            •   false || false => false           •   E || E => E         •    !(A1 op A2)  => A1 ¬(op) A2 
 
•  ?x op1 C1 || ?x op2 C2 => 
 
     ?x op1 c1,   if ((op1=op2 ∧ (C2 op1 C1) ∧ op1∈ {<, <=, >, >=}) ∨ ((C2 op1 C1) ∧ C1≠C2 ∧ (op1, op2∈{<, <=} ∨ 
                              op1, op2∈{>=, >})) ∨ (C1=C2 ∧ ((op1=‘<=’ ∧ op2=‘<’) ∨ (op1=‘>=’ ∧ op2=‘>’)))  
 
     ?x op2 C2,   if ((op1=op2 ∧ (C1 op1 C2) ∧ op1∈{<, <=, >, >=}) ∨ ((C1 op2 C2) ∧ c1≠c2 ∧ (op1, op2∈{<, <=} ∨  
                              op1, op2∈{>=, >})) ∨ (C1=C2 ∧ ((op2=‘<=’ ∧ op1=‘<’) ∨ (op2= ‘>=’ ∧ op1=‘>’))))  
 
     Bound(?x) ,  if (op1=¬(op2) ∧ C1=C2),  
 
     ?x op1 C1 || ?x op2 C2, otherwise 
 
•  ¬(=)  =>  !=       •  ¬(!=)  =>  =      •  ¬(<)  =>  >=       •  ¬(<=)  =>  >      •  ¬(>)  =>  <=       •  ¬(>=)  =>  < 
 
REFERENCES 
Arasu, A., Babu, S., Widom, J., 2006. The CQL 
continuous query language: semantic foundations and 
query execution. VLDB Journal, 15(2): 121-142. 
Beckett, D. (editor), 2004. RDF/XML Syntax 
Specification (Revised), W3C Recommendation, 10th 
February 2004. 
Bernstein, A., Stocker, M., Kiefer, C., 2007. SPARQL 
Query Optimization Using Selectivity Estimation. 
ISWC’07. 
Broekstra, J., Kampman, A., van Harmelen., 2002. 
Sesame: A Generic Architecture for Storing and 
Querying RDF and RDF Schema. ISWC’02. 
Chaudhuri, S., 1998. An Overview of Query Optimization 
in Relational Systems, In ACM PODS’98. 
Chebotko, A., Lu, S., Fotouhi, F., 2007. Semantics 
Preserving SPARQL-to-SQL Translation. Technical 
report TR-DB-112007-CLF. 
Chong, E. I., Das S., Eadon G., Srinivasan J., 2005. An 
Efficient SQL-based RDF Querying Scheme, VLDB’05.  
Cyganiak, R., 2005. A relational algebra for SPARQL. 
Technical report HPL-2005-170. 
Groppe, S.,  Groppe, J., Kukulenz, D., Linnemann, V., 
2007a. A SPARQL Engine for Streaming RDF Data, 
3rd International Conference on Signal-Image 
Technology & Internet-Based Systems (SITIS’07).  
Groppe, J., Groppe, S., Ebers, S., Linnemann, V., 2009. 
Efficient Processing of SPARQL Joins in Memory by 
Dynamically Restricting Triple Patterns. ACM SAC’09.  
Groppe, S., Groppe, J., Linnemann, V., 2007b. Using an 
Index of Precomputed Joins in order to Speed Up 
SPARQL Processing, ICEIS’07. 
Haase, P., Broekstra, J., Eberhart, A., Volz, R., 2004. A 
Comparison of RDF Query Languages. in ISWC'04. 
Ioannidis, Y. E., 1996. Query optimization, In ACM 
Computing Surveys, Vol. 28, No. 1. 
Jarke, M., Koch, J., 1984. Query Optimization in Database 
Systems, In ACM Computing Surveys, Vol. 16, No. 2. 
Pérez, J. Arenas, M., Gutierrez C., 2006. Semantics and 
Complexity of SPARQL. ISWC’06. 
Prud’hommeaux E., Seaborne A., 2007. SPARQL Query 
Language for RDF, W3C Recommendation, 15 Jan. 
2007. 
Weiss, C., Karras, P., Bernstein, A., 2008. Hexastore: 
Sextuple Indexing for Semantic Web Data 
Management, VLDB’08. 
Wilkinson, K., Sayers, C., Kuno, H. A., Reynolds, D. 
2003.  Efficient RDF Storage and Retrieval in Jena2. 
In SWDB’03 co-located with VLDB’03. 
ICEIS 2009 - International Conference on Enterprise Information Systems
112