W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > January to March 2007

Re: rq25 review comments

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Thu, 22 Feb 2007 16:58:53 +0000
Message-ID: <45DDCBCD.2060206@hp.com>
To: SOURIPRIYA.DAS@ORACLE.COM
CC: public-rdf-dawg@w3.org



SOURIPRIYA.DAS@ORACLE.COM wrote:
>>> ?	One way to fix the instances of illegal use (enumerated below) probably 
>>> would be to allow use of ?.? optionally as a terminator for (the last triple 
>>> of) a <Bgp>.
>> These uses aren't illegal as noted.
>>
>>> o	I am okay with that workaround. However, for simplicity, my preferred 
>>> solution would be to require use of ?.? as a (mandatory) terminator for each 
>>> triple (thus requiring a ?.? at the end of each <Bgp> as well unlike the R1 
>>> rule above used currently) and maybe also for each <NonTriplesgp> (thus 
>>> requiring, unlike the optional nature of rule R3 above, a ?.? at the end of 
>>> each <constraint>, <OPTIONALgp>, etc.).
>>>
> 
> The workaround I was suggesting was already present. I somehow managed to skip that :-). Thanks for poining that out.
> 
> Regarding the preferred solution I had mentioned, I am not sure if you got a chance to consider it. 

Your original comment was:

 >>> o	I am okay with that workaround. However, for simplicity, my preferred
 >>> solution would be to require use of ?.? as a (mandatory) terminator for
 >>> each triple (thus requiring a ?.? at the end of each <Bgp> as well unlike
 >>> the R1 rule above used currently) and maybe also for each <NonTriplesgp>
 >>> (thus requiring, unlike the optional nature of rule R3 above, a ?.? at
 >>> the end of each <constraint>, <OPTIONALgp>, etc.).

This suggestion is a language change, not just a grammar change.  I considered 
this proposal in light of the the history of the language design, recorded in 
the issues list and in the test suite, and I pointed to the latest approved 
tests in this area from the new test suite that illustrated the decision of 
the working group for BGPs:

http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/syntax-basic-05.rq
http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/syntax-basic-06.rq

and also to some approved tests for other graph patterns:

http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/syntax-struct-03.rq
http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/syntax-struct-05.rq
http://www.w3.org/2001/sw/DataAccess/tests/data-r2/syntax-sparql1/syntax-struct-06.rq

http://lists.w3.org/Archives/Public/public-rdf-dawg/2007JanMar/0047
[[
PROPOSED: To approve the syntax tests referenced by http://www.w3.org/2001/sw/
DataAccess/tests/data-r2/manifest-syntax.ttl conditional on renaming all
negative tests to include -bad-

RESOLVED
]]

The WG and community has seen these language features before in several drafts 
for publication.  These tests are copied over from the development test suite:

e.g.
http://www.w3.org/2001/sw/DataAccess/tests/data/SyntaxFull/syntax-basic-05.rq
http://www.w3.org/2001/sw/DataAccess/tests/data/SyntaxFull/syntax-struct-03.rq

and date back sometime.

 > In terms of Revision 1.18 grammar, it would roughly translate to:
> 
> - adding a (mandatory) '.' after RHS of rules 32,23,24,25,26
> [32] TriplesSameSubject  ::= (VarOrTerm PropertyListNotEmpty | TriplesNode PropertyList) '.'
> [23] OptionalGraphPattern ::= 'OPTIONAL' GroupGraphPattern '.'
> [24] GraphGraphPattern ::= 'GRAPH' VarOrIRIref GroupGraphPattern '.'
> [25] GroupOrUnionGraphPattern ::= GroupGraphPattern ( 'UNION' GroupGraphPattern )* '.'
> [26] Filter ::= 'FILTER' Constraint '.'
> 
> - removing the corresponding uses of '.' as separator or optional terminator from the relevant rules (e.g., rules 20, 21, 31).
> 
> I feel that this could make the where-clause a bit simpler both for composing and understanding because the '.' will appear like the end-marker of an English sentence.

The reason you give is based on the legibility of the written query.

There are two main points here, one for BGPs, one for non-BGPs

1/ The design of SPARQL basic graph patterns is based on N3/Turtle.  In N3 and
Turtle, the final DOT of a BGP is optional and SPARQL follows this.

The DOT is optional - you, as query writer, are free to insert it if you think
that makes the query clearer.

There is a record of this on the issues list:
http://www.w3.org/2001/sw/DataAccess/issues#punctuationSyntax

I observe that there is no uniform style here with people both including and
excluding the final DOT.  It is common to omit the final DOT if there is a
single triple pattern in a BGP:

{
       ?x foaf:mbox ?mbox
       OPTIONAL { ?x foaf:name ?name }
}

It is common to have the DOT when there are multiple triple patterns:

{
       ?x foaf:mbox ?mbox ;
          foaf:name ?name .
}


2/ The grammar allows optional DOTs after all graph pattern elements and after
FILTER so you are free to compose your queries that way.  Being optional,
other people are free to write their queries without trailing DOTs, or even a
mix if they think it makes things clearer.

The tests show each of these styles and that they can be mix-and-matched.

The majority of query writers do not use trailing DOTs after
GraphPatternNotTriples (indeed, personally, I rarely, if ever see, DOTs after
these patterns)  So making the DOT mandatory after all graph patterns
invalidates the majority of SPARQL queries which used anything more than a
single basic graph pattern.

In summary, the current SPARQL language allows the style you propose; it also
allows other styles.

I hope this message explains the design decisions for the language and that 
the style in which you wish to write your queries is supported.  I don't see 
any new information for the WG to reconsider the language design issue.

	Andy

> 
> Thanks,
> - Souri.
Received on Thursday, 22 February 2007 16:59:16 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:36 GMT