[redland-dev] ANN/RFC: SPARQL Query Tool
Dave Beckett
dave.beckett at bristol.ac.uk
Mon Mar 7 19:07:36 GMT 2005
On Wed, 2 Mar 2005, Sebastian Dietzold wrote:
> Hi All, i've created a little php SPARQL Query Tool.
>
> UseIt: http://sebastian.dietzold.de/archive/2005/03/02/sparqlTool.php
> Source: http://sebastian.dietzold.de/archive/2005/03/02/sparqlTool.phps
>
> --- From http://sebastian.dietzold.de/blog/2005/03/02/sparqltool ---
nice.
> I've played around with Redland and php because i need some small scripts
> to modify rdf-models in a mysql db. First i wanted a tool to query an
> existing model for debugging. Dave Becketts demo works fine but has no
> options to query models in a mysql db. After two days of looking inside
> the error.log of my apache (actual, many redland-errors will only appear
> there and not in the html-output, because some functions are not
> implemented in the php-module yet), i can release the first version of the
> SPARQL Query Tool.
Yes, the structured error information is currently only available from C#,
Perl and Python (in redland bindings 1.0.0.2). It is best done as C
functions helping SWIG as it can be quite low level generating exceptions.
> With this script, you can query models from urls or mysql dbs with SPARQL.
> Actual, only variable binding results are supported (no graph or bool
> results). I also plan to add a file upload feature. In the next version i
> want a better handling with errors and warnings.
Boolean's quite easy :)
> To use this script with your own server, you need version 1.0.0.1 of the
> redland php bindings. The whole script ist only one file so it is easy to
> install. I think, it is a good demonstation example for the redland php
> bindings.
Thanks
I should make the source of the http://librdf.org/query demo public as it
shows how to get the error reports back in perl at least. Basically it's
like:
my $handler=sub {
my($code, $level, $facility, $message, $line, $column, $byte, $file, $uri)=@_;
if($level < 4) {
push(@warnings, [$message, $line]);
} else {
push(@errors, [$message, $line]);
}
...
}
RDF::Redland::set_log_handler($handler);
then later, if something fails, eg building a query:
eval '$query=new RDF::Redland::Query($query_string, $base_uri, undef, $query_language);';
if($@ || @errors || !$query) {
my $err=join("<br />", map {$_->[1].":".$_->[0]} @errors);
... print out the error ...
exit 0;
}
Warnings are checked elsewhere in a similar fashion, but they are not
fatal.
Dave
More information about the redland-dev
mailing list