Dear all,
I've recently been digging around inside the SPARQL engine, and have =20
come across some behaviour which I *believe* to be contrary to the =20
SPARQL spec (although I'm very much open to being corrected :)
Given a query WHERE clause such as
{
{ ?s :p1 ?o }
OPTIONAL
{ ?s :p2 ?o2 .
?s :p3 ?o3 .
}
}
RAP parses it into a Query object as expected; two GraphPattern =20
objects, with the latter being marked as the OPTIONAL clause part of =20
the former. However, consider:
{
{ ?s :p1 ?o }
OPTIONAL
{
{ ?s :p2 ?o2 . }
{ ?s :p3 ?o3 . }
}
}
This would appear to be a valid SPARQL construct; the group graph =20
pattern of the right-hand-side of the OPTIONAL clause contains two =20
basic graph patterns within it, each containing a single query triple =20
pattern. However, RAP parses this into a Query opbject equivalent to:
{
{ ?s :p1 ?o }
OPTIONAL
{ }
{ ?s :p2 ?o2 . }
{ ?s :p3 ?o3 . }
}
...effectively saying "?s :p1 ?o; :p2 ?o2; :p3 ?o3, and optionally =20
nothing else". Is this the desired behaviour for the parser? Please =20
feel free to correct me if I've made a mistake; but it appears as if =20
the advent of a new BGP is causing the GGP to be terminated (the spec =20
only provides for the advent of a new BGP to close any previously open =20
BGP, not GGP, as far as I'm aware :)
Thanks very much for any clarification you may be able to offer!
Cheers,
Peter
|