SPARQL protocol spec checking: query syntax checking works

Regarding...

  ACTION: DanC to extract and machine-check examples

I got as far as checking the syntax of the queries:

With the checked-out sources of
  http://www.w3.org/2001/sw/DataAccess/proto-wd/
as my current directory, and PYTHONPATH set
to the parent of a checked-out copy of
  http://www.w3.org/2000/10/swap/

I get this:

$ python checkspec.py Overview.html
@@found: example query: PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX
dc: <http://purl.org/dc/elements/1.1/> SELECT ?book ?who WHERE { ?book
dc:creator ?who }
@@found: example query: PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?book ?who WHERE { ?book dc:creator ?who }
@@found: example query: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX myfoaf: <http://my.example/jose/foaf.rdf#> CONSTRUCT { myfoaf:jose foaf:depiction <http://my.example/jose/jose.jpg>. myfoaf:jose foaf:schoolHomepage <http://www.edu.example/>. ?s ?p ?o.} WHERE { ?s ?p ?o. myfoaf:jose foaf:nick "Little Jo". FILTER ( ! (?s = myfoaf:kendall && ?p = foaf:knows && ?o = myfoaf:edd ) && ! ( ?s = myfoaf:julia && ?p = foaf:mbox && ?o = <mailto:julia@mail.example> ) && ! ( ?s = myfoaf:julia && ?p = rdf:type && ?o = foaf:Person)) }
[u'And', (u'Not', [u'And', (u'equal', ('Var', s), ('symbol', myfoaf:kendall)), (u'And', (u'equal', ('Var', p), ('symbol', foaf:knows))), (u'And', (u'equal', ('Var', o), ('symbol', myfoaf:edd)))]), (u'And', (u'Not', [u'And', (u'equal', ('Var', s), ('symbol', myfoaf:julia)), (u'And', (u'equal', ('Var', p), ('symbol', foaf:mbox))), (u'And', (u'equal', ('Var', o), ('symbol', mailto:julia@mail.example)))])), (u'And', (u'Not', [u'And', (u'equal', ('Var', s), ('symbol', myfoaf:julia)), (u'And', (u'equal', ('Var', p), ('symbol', rdf:type))), (u'And', (u'equal', ('Var', o), ('symbol', foaf:Person)))]))]
[... lots of FILTER diagnostics ...]
/And: [('union', [('formula', {}, {s notEquals myfoaf:kendall}, {}, [], {}, {}), ('formula', {}, {p notEquals foaf:knows}, {}, [], {}, {}), ('formula', {}, {o notEquals myfoaf:edd}, {}, [], {}, {})]), ('union', [('formula', {}, {s notEquals myfoaf:julia}, {}, [], {}, {}), ('formula', {}, {p notEquals foaf:mbox}, {}, [], {}, {}), ('formula', {}, {o notEquals mailto:julia@mail.example}, {}, [], {}, {})]), ('union', [('formula', {}, {s notEquals myfoaf:julia}, {}, [], {}, {}), ('formula', {}, {p notEquals rdf:type}, {}, [], {}, {}), ('formula', {}, {o notEquals foaf:Person}, {}, [], {}, {})])]
@@found: example query: PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> ASK WHERE { ?book dc:creator "J.K. Rowling"}
@@found: example query: PREFIX books: <http://my.example/book/> DESCRIBE books:book6
['VarOrIRIref', ('symbol', books:book6)]
@@oops... ran into unfinished swap code; dunno if this query is good or not
@@found: example query: PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?who ?g ?mbox WHERE { ?g dc:publisher ?who . GRAPH ?g { ?x foaf:mbox ?mbox } }
@@found: example query: PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?who ?g ?mbox FROM <http://my.example/publishers> FROM NAMED <http://my.example/alice> FROM NAMED <http://my.example/bob> WHERE { ?g dc:publisher ?who . GRAPH ?g { ?x foaf:mbox ?mbox } }
@@found: example query: PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?who ?g ?mbox FROM <http://my.example/publishers> FROM NAMED <http://my.example/john> FROM NAMED <http://my.example/susan> WHERE { ?g dc:publisher ?who . GRAPH ?g { ?x foaf:mbox ?mbox } }
@@found: example query: PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?x foaf:name ?name ORDER BY ?name }

In order to get there, I tweaked the markup of the
draft a bit...

http://www.w3.org/2001/sw/DataAccess/proto-wd/#chlog
Revision 1.63  2005/08/19 19:42:37  connolly
change entity refs to numeric char refs so that
we can check the spec without reading the DTD

Revision 1.62  2005/08/19 14:09:35  connolly
wf fixes


Next steps include
 - checking that the queries in the spec match queries in the
   test suite

 - running the protocol examples against a server


-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E

Received on Friday, 19 August 2005 19:49:49 UTC