#!

# tests that DISTINCT works when OPTIONAL blocks fail part way through
# we should get only one row with NULLs

$TESTPATH/frontend/4s-query $1 '
PREFIX vocab: <http://www.census.gov/tiger/2002/vocab#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT *
WHERE {
  <http://www.census.gov/tiger/2002/tlid/125030028> vocab:end _:end .
  _:end vocab:long ?endlong .
  _:end vocab:lat ?endlat .
  OPTIONAL {
    ?join vocab:long ?endlong .
    ?join vocab:lat ?endlat .
    ?next vocab:start ?join .
  }
}
ORDER BY ?endlong' | sed 's/_:b[^	]*/BNODE/g' | grep -v '^#'
