|
From: Stefano V. <ste...@gm...> - 2013-04-05 16:32:58
|
Hi everybody,
I am new to this mailing list so I hope this kind of questions is not OT.
I am experiencing an issue with a CONSTRUCT query using the SparqlWrapper:
I am collecting data from the Italian Parliament Sparql endpoint and I need
to fetch data about the laws discussed during one day and then write an
output file containing those data.
The construct query does all that but when I print the file the data is not
ordered by law code as I would want it to be.
If I try the same query on the Virtuoso panel the Parliament provides the
results match my needs but I run the same query with my python script the
output is correct but there is no order.
I already tried using ORDER BY instruction in my query but it didn't help.
The query is the following:
PREFIX ocd: <http://dati.camera.it/ocd/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX creator: <http://purl.org/dc/elements/1.1/creator>
PREFIX persona: <http://dati.camera.it/ocd/persona>
CONSTRUCT
{
?atto a <http://dati.camera.it/ocd/atto>.
?atto dc:date ?date .
?atto dc:title ?title .
?atto ocd:primo_firmatario ?primo_firmatario.
?atto ocd:altro_firmatario ?altro_firmatario.
?atto ocd:rif_richiestaParere ?rif_richiestaParere.
}
WHERE
{
?atto a <http://dati.camera.it/ocd/atto> .
?atto dc:date ?date .
?atto dc:title ?title .
OPTIONAL{?atto ocd:primo_firmatario ?primo_firmatario.}
OPTIONAL{?atto ocd:altro_firmatario ?altro_firmatario.}
OPTIONAL{?atto ocd:rif_richiestaParere ?rif_richiestaParere.}
FILTER(str(?date) = '20110117')
}
ORDER BY DESC(?atto)
And you can find all the code I am working on here (
https://github.com/verganis/parlamento_fetch), the script that I am using
is parlamento_fetch/c_atti.py
which runs like this
python parlamento_fetch/c_atti.py YYYYMMDD
*example:*
python parlamento_fetch/c_atti.py 20110111
Thanks in advance,
-------------------
Dott. Stefano Vergani
*IT Engineer | Web design | Developer*
*skype: verganis*
*Tel: 340.8604184*
*Mail: ste...@gm... *
<http://stefanovergani.vacau.com/>
<http://linconfessabile.wordpress.com/><http://it.linkedin.com/pub/stefano-vergani/8/929/89b>
|