W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2005

possible syntax changes

From: Dave Beckett <dave.beckett@bristol.ac.uk>
Date: Tue, 31 May 2005 12:46:02 +0100
To: RDF Data Access Working Group <public-rdf-dawg@w3.org>
Message-ID: <20050531124602.67a8745c@hoth.ilrt.bris.ac.uk>

I had a skim through
http://www.w3.org/2001/sw/DataAccess/rq23/#grammar
$Revision: 1.367 $ of $Date: 2005/05/31 08:31:36 $


and here are some comments

1. Query verb tokens

tokens [5]-[8] SelectQuery...AskQuery have changed structure a lot.
I'm pretty unlikely to be able to implement them with my current
approach as this part seems to require a lot of look ahead.


2. Optional WHERE

WHERE is still optional.  I prefer not, and won't teach it as
optional, will give syntax warnings when recognising this.  It just
ends up allowing bizarro queries.


3. Optional '.'s

Too many of these,  I can't recall if I've caught them all.  If it
makes my grammar have some shift/reduce conflicts or require
excessive lookahead, I probably won't.


4. Casting support

We lost the foo:bar() vs &foo:bar() distinction some grammars back.
which is syntax for a casting operation and an extension function.

I think overloading these is a mistake.  The spec defines a set of
required casting operations named for their datatype like xsd:byte()
This means you can take any literal and make a datatype of that form,
with the value that the datatype defines.

In RDF itself, you can easily make a lexical form for any RDF
datatyped literal in RDF/XML or other syntax, and you can do that in
in SPARQL if you only want to talk about a constant datatype:
"abc"^^dave:type.

However, if you want to use it in expressions you can't do much
except use constants.  So whereas:
  FILTER "abc"^^dave:type = "abc"^^dave:type
is true by RDF rules, you can't take a variable ?x with the literal
value "abc" and do:

  FILTER ?x^^dave:type = "abc"^^dave:type

however, if dave:type is one of the built-ins, you can:
  FILTER xsd:integer(?x) = "10"^^xsd:integer

but you could previously, when we had syntax for it:
  FILTER dave:type(?x) = "abc"^^abc:type

which does the *make an rdf datatyped literal* operation but is now
used solely for functions.

So, I'd like a new operator CAST
  CAST(URI u, Unicode string s) returning what would be written as s^^u


5. Turtle parts of grammar 

Around tokens [28] to [44] I gave up trying to follow the grammar and
instead used the Turtle grammar itself and the lex+yacc code I
already had for that.  

There were a few minor changes that sparql needs beyond Turtle, such
as []s for variables in places that Turtle doesn't allow, such as
for predicates.

At present Turtle won't be allowing [ :a : b ]. as a triple, only as
an object or '''long literal''' with single quotes (CWM/N3
compatibility issues need to be thought about).


6. ASC, DESC changes

Fine.


7. XML EBNF used

Hurrah for this.

--

Of course, I've implemented no syntax changes since the last WD so
this is all by inspection only.

Dave
Received on Tuesday, 31 May 2005 11:47:28 GMT

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