SPARQL protocol query examples thrown through rasqal and ARQ

I hacked on DanC's checkspec.py to just invoke the command line tools
for rasqal and ARQ.  Snippet:

def checkQuerySyntax(txt):

    qtxt=txt.replace("'","\\'")

    # touch empty.ttl in this directory first to make ARQ (sparqler)
happy
    if 0:
      cmd="".join(["roqet -q -n -e '",qtxt,"'"])
    else:
      cmd="".join(["sparqler --data empty.ttl '",qtxt,"'"])

    print "Running: ",cmd
    system(cmd)


Where sparqler is a script I have to run ARQ.


I also added a few prints to make a break between each test.



Results, with roqet:

With roqet 

$ 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 }
Running:  roqet -q -n -e '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 }
Running:  roqet -q -n -e '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)) }
Running:  roqet -q -n -e '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)) }'

@@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"}
Running:  roqet -q -n -e '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
Running:  roqet -q -n -e 'PREFIX books: <http://my.example/book/>
DESCRIBE books:book6'

@@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 } }
Running:  roqet -q -n -e '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 } }
Running:  roqet -q -n -e '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 } }
Running:  roqet -q -n -e '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 }
Running:  roqet -q -n -e 'PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name WHERE { ?x foaf:name ?name ORDER BY ?name }'
lt-roqet: Error - URI
file:///home/dajobe/w3c/writecvs/WWW/2001/sw/DataAccess/proto-wd/:1 -
syntax error, unexpected ORDER, expecting '}'
lt-roqet: Parsing query 'PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name WHERE { ?x foaf:name ?name ORDER BY ?name }' failed

@@found: example query: PREFIX bio: <http://bio.example/schema/#>
SELECT ?valence FROM http://another.example/protein-db.rdf WHERE { ?x
bio:protein ?valence } ORDER BY ?valence
Running:  roqet -q -n -e 'PREFIX bio: <http://bio.example/schema/#>
SELECT ?valence FROM http://another.example/protein-db.rdf WHERE { ?x
bio:protein ?valence } ORDER BY ?valence'
lt-roqet: Error - URI
file:///home/dajobe/w3c/writecvs/WWW/2001/sw/DataAccess/proto-wd/:1 -
The namespace prefix in "http:" was not declared.
lt-roqet: Error - URI
file:///home/dajobe/w3c/writecvs/WWW/2001/sw/DataAccess/proto-wd/:1 -
syntax error, unexpected $end, expecting NAMED or URI_LITERAL or
QNAME_LITERAL
lt-roqet: Parsing query 'PREFIX bio: <http://bio.example/schema/#>
SELECT ?valence FROM http://another.example/protein-db.rdf WHERE { ?x
bio:protein ?valence } ORDER BY ?valence' failed

@@found: example query: PREFIX bio: <http://bio.example/schema/#> ...
SELECT ?valence ... FROM http://another.example/protein-db.rdf WHERE
{ ?x bio:protein ?valence ... } ORDER BY ?valence ...
Running:  roqet -q -n -e 'PREFIX bio: <http://bio.example/schema/#> ...
SELECT ?valence ... FROM http://another.example/protein-db.rdf WHERE
{ ?x bio:protein ?valence ... } ORDER BY ?valence ...'
lt-roqet: Error - URI
file:///home/dajobe/w3c/writecvs/WWW/2001/sw/DataAccess/proto-wd/:1 -
syntax error, unexpected '.'
lt-roqet: Parsing query 'PREFIX bio: <http://bio.example/schema/#> ...
SELECT ?valence ... FROM http://another.example/protein-db.rdf WHERE
{ ?x bio:protein ?valence ... } ORDER BY ?valence ...' failed


With ARQ (CVS as of now)


$ 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 }
Running:  sparqler --data empty.ttl '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 }'
--------------
| book | 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 }
Running:  sparqler --data empty.ttl '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 }'
--------------
| book | 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)) }
Running:  sparqler --data empty.ttl '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)) }'
# ======== CONSTRUCT results 
@prefix myfoaf:  <http://my.example/jose/foaf.rdf#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix foaf:    <http://xmlns.com/foaf/0.1/> .

# ======== 

@@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"}
Running:  sparqler --data empty.ttl '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"}'
Ask => No

@@found: example query: PREFIX books: <http://my.example/book/> DESCRIBE
books:book6
Running:  sparqler --data empty.ttl 'PREFIX books:
<http://my.example/book/> DESCRIBE books:book6'
# ======== DESCRIBE results 
@prefix books:   <http://my.example/book/> .

# ======== 

@@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 } }
Running:  sparqler --data empty.ttl '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 } }'
------------------
| who | g | 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 } }
Running:  sparqler --data empty.ttl '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 } }'
------------------
| who | g | 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 } }
Running:  sparqler --data empty.ttl '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 } }'
------------------
| who | g | mbox |
==================
------------------

@@found: example query: PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name WHERE { ?x foaf:name ?name ORDER BY ?name }
Running:  sparqler --data empty.ttl 'PREFIX foaf:
<http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?x foaf:name ?name
ORDER BY ?name }'
Encountered "ORDER" at line 1, column 83.
Was expecting one of:
    "graph" ...
    "optional" ...
    "filter" ...
    "{" ...
    "}" ...
    ";" ...
    "," ...
    "." ...
    

@@found: example query: PREFIX bio: <http://bio.example/schema/#>
SELECT ?valence FROM http://another.example/protein-db.rdf WHERE { ?x
bio:protein ?valence } ORDER BY ?valence
Running:  sparqler --data empty.ttl 'PREFIX bio:
<http://bio.example/schema/#> SELECT ?valence FROM
http://another.example/protein-db.rdf WHERE { ?x bio:protein ?valence }
ORDER BY ?valence'
Line 1, column 64: Unresolved qname: http:

@@found: example query: PREFIX bio: <http://bio.example/schema/#> ...
SELECT ?valence ... FROM http://another.example/protein-db.rdf WHERE
{ ?x bio:protein ?valence ... } ORDER BY ?valence ...
Running:  sparqler --data empty.ttl 'PREFIX bio:
<http://bio.example/schema/#> ... SELECT ?valence ... FROM
http://another.example/protein-db.rdf WHERE { ?x
bio:protein ?valence ... } ORDER BY ?valence ...'
Encountered "." at line 1, column 43.
Was expecting one of:
    "prefix" ...
    "select" ...
    "describe" ...
    "construct" ...
    "ask" ...
    

$

Analysis in other emails

Dave

Received on Friday, 19 August 2005 19:47:34 UTC