njh/easyrdf — Issue #51: Don't use echo for error messages
Author: osma
Created: 2011-10-19 19:13:48+00:00
State: open

I use easyrdf with a SPARQL endpoint that contains somewhat problematic URIs (e.g. URLs with typing errors). I noticed that when the SPARQL reply contains some "bad" URI, the EasyRdf SPARQL client prints (using echo) messages such as "Failed to parse object". This caused my PHP script to generate invalid XML and thus break in mysterious ways.

I had to wrap the sparql->query call in ob_start() / ob_end_clean() to get rid of the error messages. I think it would be better to use some other mechanism for reporting error conditions, such as a PHP warning which shows in the log but doesn't affect script output.

Now I know I should fix my URIs in the triple store, but what is considered a bad URI varies considerably between different RDF libraries and it's really difficult to catch all problems beforehand.