Letractively / rdflib

Automatically exported from code.google.com/p/rdflib
Other
0 stars 0 forks source link

RDF parser blows up on SPARQL Example 8.3.3 #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set up any Graph at all.
2. Call Graph.query on the SPARQL query below, taken from section 8.3.3. of
the SPARQL spec.
3.

What is the expected output? What do you see instead?  I see this:
rdflib INFO: version: 2.4.0
Traceback (most recent call last):
  File
"/Users/bmacgregor/Documents/eclipse-python/hinote/src/hinotesite/flex/test.py",
line 122, in <module>
    elif switch == 5: test4()    
  File
"/Users/bmacgregor/Documents/eclipse-python/hinote/src/hinotesite/flex/test.py",
line 79, in test4
    graph.query(query)
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/r
dflib-2.4.0-py2.5-macosx-10.3-fat.egg/rdflib/Graph.py",
line 679, in query
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/r
dflib-2.4.0-py2.5-macosx-10.3-fat.egg/rdflib/sparql/bison/Processor.py",
line 28, in query
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/r
dflib-2.4.0-py2.5-macosx-10.3-fat.egg/rdflib/sparql/bison/Processor.py",
line 18, in Parse
SyntaxError: parse error at line 5, column 1: reached end-of-input,
expecting 'RIGHT_CURLY'

What version of the product are you using? On what operating system?
version: 2.4.0 on Mac OS X

Please provide any additional information below.

PREFIX  data:  <http://example.org/foaf/>
PREFIX  foaf:  <http://xmlns.com/foaf/0.1/>
PREFIX  rdfs:  <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?mbox ?nick ?ppd
FROM NAMED <http://example.org/foaf/aliceFoaf>
FROM NAMED <http://example.org/foaf/bobFoaf>
WHERE
{
  GRAPH data:aliceFoaf
  {
    ?alice foaf:mbox <mailto:alice@work.example> ;
           foaf:knows ?whom .
    ?whom  foaf:mbox ?mbox ;
           rdfs:seeAlso ?ppd .
    ?ppd  a foaf:PersonalProfileDocument .
  } .
  GRAPH ?ppd
  {
      ?w foaf:mbox ?mbox ;
         foaf:nick ?nick
  }
}

Original issue reported on code.google.com by bob.macg...@gmail.com on 5 Mar 2008 at 7:18

GoogleCodeExporter commented 9 years ago
My bad.  The above query was rejected, but not by the parser.
However, the following query works for SPARQLER, but is rejected
by the parser.

if __name__ == '__main__':
    from rdflib import URIRef, plugin, store
    from rdflib.Graph import Graph
    mystore = plugin.get('IOMemory', store.Store)()
    graph = Graph(mystore, URIRef("http://foo#bar"))
    query = """
select ?s ?o ?c
where {graph ?c {?s <http://foo#z> ?o} . filter (?s = <http://foo#a>) } 
"""
    graph.query(query)

Original comment by bob.macg...@gmail.com on 5 Mar 2008 at 4:03

GoogleCodeExporter commented 9 years ago

Original comment by eik...@gmail.com on 10 Feb 2009 at 8:29

GoogleCodeExporter commented 9 years ago

Original comment by eik...@gmail.com on 1 Feb 2010 at 8:36

GoogleCodeExporter commented 9 years ago
These issues involve bits that have been moved out of rdflib proper for now. We 
will re-open them 
or move them to rdfextas as appropriate.

Original comment by eik...@gmail.com on 11 Feb 2010 at 6:06