Re: Whitespace in Turtle after ^^

* Stian Soiland-Reyes <soiland-reyes@cs.manchester.ac.uk> [2015-01-19 16:05+0000]
> Hi, I somehow have come over some "evil" Turtle that seems to be on the form:
> 
> <http://example.com/s2> <http://example.com/p> "false"^^
> <http://www.w3.org/2001/XMLSchema#boolean> .
> 
> (One word: PHP)
> 
> 
> Now, as bad style as this might look - I could not figure out from the
> RDF Turtle 1.1 grammar why it shouldn't be valid.

What lead you to believe it was invalid? I've tried a few Turtle and
SPARQL parsers ('cause they use the same productions) and they all
accepted it. For example 
[[
ASK { FILTER ("false"^^
<http://www.w3.org/2001/XMLSchema#boolean>)
    }
]]
passes <http://sparql.org/query-validator.html>.


> http://www.w3.org/TR/turtle/#grammar-production-RDFLiteral
> 
> [128s] RDFLiteral ::= String (LANGTAG | '^^' iri)?
> 
> vs.
> 
> [7] predicateObjectList ::= verb objectList (';' (verb objectList)?)*
> 
> 
> We "all know" that whitespace is allowed around ; - and not around ^^
> - yet I can't see this reflected in these rules. Perhaps my grammar
> understanding is a bit rusty.
> 
> 
> http://www.w3.org/TR/turtle/#sec-grammar-ws says:
> 
> > White space (production WS) is used to separate two terminals which would otherwise be (mis-)recognized as one terminal. Rule names below in capitals indicate where white space is significant; these form a possible choice of terminals for constructing a Turtle parser.
> 
> > White space is significant in the production String.
> 
> 
> Neither RDFLiteral or predicateObjectList are listed under Terminals.
> 
> 
> So there's a special WS production - but that's only used between [ ]
> - e.g. so you can do
> 
> [ a foaf:Person ]  #someone
>   foaf:knows  # Someone (else?)
>   [ a foaf:Person ] .
> 
> 
> 
> String is
> 
> 
> [17] String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE |
> STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE
> 
> 
> 
> Can anyone enlighten me?
> 
> 
> 
> -- 
> Stian Soiland-Reyes, myGrid team
> School of Computer Science
> The University of Manchester
> http://soiland-reyes.com/stian/work/ http://orcid.org/0000-0001-9842-9718
> 

-- 
-ericP

office: +1.617.599.3509
mobile: +33.6.80.80.35.59

(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.

There are subtle nuances encoded in font variation and clever layout
which can only be seen by printing this message on high-clay paper.

Received on Monday, 19 January 2015 16:53:02 UTC