Hi Nicolas, Please find attached the README file from the Fyzz package.
I've followed the "Quick start" instructions". Everything works except:
******
>>> print ast.where [(SparqlVar('project'), ('', 'a'),
>>> ('http://usefulinc.com/ns/doap#', 'Project')), (SparqlVar('project'),
>>> ('http://usefulinc.com/ns/doap#', 'name'), SparqlVar('name'))]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'SparqlVar' is not defined
******
OK then, as per your suggestion - I'm back to python documentation, I may be
able to figure out why 'SparqlVar' is not defined.
Many thanks and best regards,
Jacek
-----Original Message-----
From: Nicolas Chauvat [mailto:[email protected]]
Sent: Wednesday, May 25, 2011 5:11 PM
To: Szymczyk, Jacek Janusz (HP Labs - Fusionopolis, South Twr #14 floor)
Cc: Sylvain Thénault; Python-Projects; Kirchberg, Markus; Ko, Ryan
Subject: Re: [Python-projects] Fyzz breaks under python 2.6.5 and 2.7
Hi,
On Wed, May 25, 2011 at 08:15:18AM +0000, Szymczyk, Jacek Janusz (HP Labs -
Fusionopolis, South Twr #14 floor) wrote:
> So far so good - it worked to this point, but executing next lines from the
> README results in the following:
>
> >>> ast = parse("""PREFIX doap: <http://usefulinc.com/ns/doap#>
> ... SELECT ?project ?name WHERE {
> ... ?project a doap:Project;
> ... doap:name ?name.
> ... }
> ... ORDER BY ?name LIMIT 5 OFFSET 10
> ... """)
> >>> print ast.selected
> [SparqlVar('project'), SparqlVar('name')]
So that works, doesn't it ?
> >>> [SparqlVar('project'), SparqlVar('name')]
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> NameError: name 'SparqlVar' is not defined
But the README.rst file does not suggest you type this, does it?
Quick start
-----------
The following lines of code should be enough to start::
>>> from fyzz.yappsparser import parse
>>> ast = parse("""PREFIX doap: <http://usefulinc.com/ns/doap#>
... SELECT ?project ?name WHERE {
... ?project a doap:Project;
... doap:name ?name.
... }
... ORDER BY ?name LIMIT 5 OFFSET 10
... """)
>>> print ast.selected
[SparqlVar('project'), SparqlVar('name')]
>>> print ast.prefixes
{'doap': 'http://usefulinc.com/ns/doap#'}
>>> print ast.orderby
[(SparqlVar('name'), 'asc')]
>>> print ast.limit, ast.offset
5 10
>>> print ast.where
[(SparqlVar('project'), ('', 'a'),
('http://usefulinc.com/ns/doap#', 'Project')),
(SparqlVar('project'), ('http://usefulinc.com/ns/doap#', 'name'),
SparqlVar('name'))]
The above code works out of the box.
> Again, as your German neighbors say: "devil is in the details" :-)
> But, it's a progress..only need to figure out whether the
> SparqlVar() is important . You wouldn't happen to have a
> documentation to fyzz somewhere in your archives ?
I suggest you take a look at the tutorial I sent you a link to in my
previous email:
> http://docs.python.org/tutorial/modules.html
This will help.
For a more detailed information, read
http://docs.python.org/tutorial/classes.html#python-scopes-and-namespaces
Python is a programming language that is very quick to learn, but not
to the point where you can jump right in without reading the first
page of the tutorial :)
Looking forward to your use of fyzz and the contributions that will
follow !
--
Nicolas Chauvat
logilab.fr - services en informatique scientifique et gestion de connaissances
README.rst
Description: README.rst
_______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects
