# Algebra

Copyright © 2010 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, and document use rules apply.

## Abstract

This page describes W3C SPARQL Working Group's SPARQL 1.0 test suite.

### Contributing Tests

The test manifests and entries are built automatically from manifest.ttl using a Rake task. Tests may be contributed via pull request to https://github.com/w3c/rdf-tests with suitable changes to the manifest.ttl and referenced files.

### Distribution

Distributed under both the W3C Test Suite License and the W3C 3-clause BSD License. To contribute to a W3C Test Suite, see the policies and contribution forms.

### Disclaimer

UNDER BOTH MUTUALLY EXCLUSIVE LICENSES, THIS DOCUMENT AND ALL DOCUMENTS, TESTS AND SOFTWARE THAT LINK THIS STATEMENT ARE PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.

## Test Descriptions

nested-opt-1: Nested Optionals - 1

  Nested-optionals with a shared variable that does not appear in the middle pattern (a not well-formed query pattern as per "Semantics and Complexity" of SPARQL

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    two-nested-opt.srx
nested-opt-2: Nested Optionals - 2

  OPTIONALs parse in a left-associative manner

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    two-nested-opt-alt.srx
opt-filter-1: Optional-filter - 1

  A FILTER inside an OPTIONAL can reference a variable bound in the required part of the OPTIONAL

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    opt-filter-1.srx
opt-filter-2: Optional-filter - 2 filters

  FILTERs inside an OPTIONAL can refer to variables from both the required and optional parts of the construct.

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    opt-filter-2.srx
opt-filter-3: Optional-filter - scope of variable

  FILTERs in an OPTIONAL do not extend to variables bound outside of the LeftJoin(…) operation

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    opt-filter-3.srx
filter-place-1: Filter-placement - 1

  FILTER placed after the triple pattern that contains the variable tested

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    filter-placement-1.srx
filter-place-2: Filter-placement - 2

  FILTERs are scoped to the nearest enclosing group - placement within that group does not matter

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    filter-placement-2.srx
filter-place-3: Filter-placement - 3

  FILTERs are scoped to the nearest enclosing group - placement within that group does not matter

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    filter-placement-3.srx
filter-nested-1: Filter-nested - 1

  A FILTER is in scope for variables bound at the same level of the query tree

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    filter-nested-1.srx
filter-nested-2: Filter-nested - 2

  A FILTER in a group { … } cannot see variables bound outside that group

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    filter-nested-2.srx
filter-scope-1: Filter-scope - 1

  FILTERs in an OPTIONAL do not extend to variables bound outside of the LeftJoin(…) operation

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    filter-scope-1.srx
join-scope-1: Join scope - 1

  Variables have query scope.

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    var-scope-join-1.srx
join-combo-1: Join operator with OPTs, BGPs, and UNIONs

  Tests nested combination of Join with a BGP / OPT and a BGP / UNION

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    join-combo-1.srx
join-combo-2: Join operator with Graph and Union

  Tests combination of Join operator with Graph on LHS and Union on RHS

  type
    mf:QueryEvaluationTest
  approval
  action
  result
    join-combo-2.srx