- From: Dan Connolly <connolly@w3.org>
- Date: Thu, 09 Feb 2006 17:48:31 -0600
- To: Tim Berners-Lee <timbl@w3.org>
- Cc: Eric Prud'hommeaux <eric@w3.org>, Yosi Scharf <syosi@MIT.EDU>, public-cwm-talk@w3.org, Robert Crowell <crowell@MIT.EDU>
On Thu, 2006-02-09 at 16:21 -0500, Tim Berners-Lee wrote: [...] > >>> <- http://www.w3.org/2001/sw/DataAccess/rq23/parsers/ > ...I would like it in RDF, using the same > context-free grammar ontology please, but any syntax out of RDF/XML or > any subset of N3. OK. I couldn't help working on that for much of today: http://www.w3.org/2001/sw/DataAccess/rq23/parsers/sparql.rdf http://www.w3.org/2001/sw/DataAccess/rq23/parsers/sparql.ttl The .ttl looks like: [[ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. @prefix : <http://www.w3.org/2001/sw/DataAccess/rq23/parsers/sparql#>. @prefix g: <http://www.w3.org/2001/sw/DataAccess/rq23/parsers/grammar@@#>. #@@ case insensitivity of 'BASE' and the like is not expressed. :Query rdfs:label "Query"; rdf:value "1"; rdfs:comment "[1] Query ::= Prolog( SelectQuery | ConstructQuery | DescribeQuery | AskQuery )"; a g:NonTerminal; g:seq ( :Prolog [ g:alt ( :SelectQuery :ConstructQuery :DescribeQuery :AskQuery ) ] ) . :Prolog rdfs:label "Prolog"; rdf:value "2"; rdfs:comment "[2] Prolog ::= BaseDecl? PrefixDecl*"; a g:NonTerminal; g:seq ( [ g:opt :BaseDecl ] [ g:star :PrefixDecl ] ) . ]] I haven't done a conversion back to BNF from RDF; it should be a simple --strings thingy or XSLT transformation. I don't think I can argue to throw away the BNF and use the RDF as the source; it's pretty unwieldy and verbose, even in turtle format. (DAWG business: There's the question of the full URI of terms like :Query and :Prolog themselves. If this thing is to become part of the SPARQL Recommendation, I guess their URIs will have to be approved by the WG. I suppose a namespace outside /DataAccess/ and outside /TR/... somewhere in /2006/02/... like the SPARQL protocol namespace, is best. ) I made up my own EBNF ontology because I couldn't figure out the swap/grammar one; I suspect the terms match 1-1. I like mine better. :) Let's switch, shall we? Perhaps: first one to make a decent write-up wins? I saw somebody... Bjoren H. maybe... ask that the BNF notation section of the XML spec get published independently. Maybe this would be the way to do it. I wrote a converter: http://www.w3.org/2001/sw/DataAccess/rq23/bnf2turtle.py Anyway... so this .rdf version has not been checked against the SPARQL test suite. Yosi, do you think you could update the SPARQL parser you put in cwm to be mechanically generated from sparql{.ttl,.rdf} and try it against some of the tests? It would involve compiling the :Terminal nodes to regexs, probably in python. Jos, it might be fun to have euler derive proofs that strings are in the language generated by this grammar. I grabbed http://www.w3.org/2005/01/yacker/uploads/SPARQL/bnf and checked that in; as I understand it, that's the "truth" that EricP and/or AndyS and/or Yosi work from. I check that the .ttl doesn't have anything that goes beyond RDF expressiveness like this: connolly@dirk:~/w3ccvs/WWW/2001/sw/DataAccess/rq23$ make check-gram python bnf2turtle.py parsers/sparql.bnf >parsers/sparql.ttl python ../../../../2000/10/swap/cwm.py parsers/sparql.ttl --rdf >parsers/sparql.rdf python ../../../../2000/10/swap/cwm.py parsers/sparql.ttl --n3 >,g1.n3 python ../../../../2000/10/swap/cwm.py parsers/sparql.rdf --n3 >,g2.n3 diff -u ,g1.n3 ,g2.n3 [[some diffs in comments about base URI; is there a way to suppres those comments in N3 output?]] -- Dan Connolly, W3C http://www.w3.org/People/Connolly/ D3C2 887B 0F92 6005 C541 0875 0F91 96DE 6E52 C29E
Received on Thursday, 9 February 2006 23:48:39 UTC