W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > April 2012

BindingClause for Subqueries

From: Stephen Allen <sallen@apache.org>
Date: Tue, 17 Apr 2012 16:58:23 -0700
Message-ID: <CAPTxtVNbJjj084k0d5Z1_0u-uXFtyZ-7cq+HnCJmosjBESZ1TA@mail.gmail.com>
To: public-rdf-dawg-comments@w3.org
Dear WG,

While writing queries that utilize SPARQL 1.1's BINDINGS clause, I've
found that the feature is really helpful for doing joins with other
non-RDF data sources.  However, one stumbling block I found was the
inability to specify bindings for variables in subqueries.  Because of
the bottom-up nature of SPARQL's subquery evaluation combined with the
join semantics of BINDINGS, it is difficult to work around this issue.

One possible solution would be to modify the spec to allow a
BindingClause to appear on a SubSelect.  This has the benefit of
minimal changes to the grammar/spec.  I note that the WG is already
discussing the issue, and a message from Andy [1] indicates that
BindingClauses on groups are being considered.  I believe his would be
a more general solution than mine and would cover my use-case if such
a clause could be placed inside a subquery.

This change I think also addresses the use-case appearing in Aidan
Hogan's comment [2].  His query could be rewritten to [3].

Regards,
Stephen


[1] http://lists.w3.org/Archives/Public/public-rdf-dawg/2012AprJun/0024.html
[2] http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2012Mar/0018.html
[3]
SELECT *
WHERE
{
  {
    SELECT * WHERE { }
    BINDINGS ?dayIDCheck ?dayName
    {
      (0 "Sunday"@en)
      (1 "Monday"@en)
      (2 "Tuesday"@en)
      (3 "Wednesday"@en)
      (4 "Thursday"@en)
      (5 "Friday"@en)
      (6 "Saturday"@en)
    }
  }
  BIND (0 AS ?dayID)
  FILTER (?dayIDCheck = ?dayID)
}
Received on Tuesday, 17 April 2012 23:59:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 17 April 2012 23:59:16 GMT