incubator-jena-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Vesse <>
Subject Re: Reader/Writer registries
Date Tue, 10 Apr 2012 15:51:34 GMT
Setting to "" appears to be fine but setting to explicit null caused a NPE for some reason

I only noticed this because I was playing with something vaguely related and needed to actually
turn this on in the @AfterClass method and then discovered the bug

A better registry of readers and writers for SPARQL results, RDF triple and quads formats
would be nice since right now we have several different places doing this (the Jena reader/writer
registry, RIOTs language registry, Fuseki also has some MIME type related stuff.

I don't know if this is helpful but dotNetRDF has a single central registry which maps MIME
types and file extensions to readers/writers for various formats (and vice versa).  This gets
used for everything from just auto-detecting what the most likely parser is when a user asks
to load a file through to content negotiation in HTTP endpoints.

Implementing such a strategy for Jena would be harder because of its modular nature and I
don't know whether adding yet another registry would just complicate things further (even
if all the old registries just became facades to the new registry)


On Apr 10, 2012, at 1:18 AM, Paolo Castagna wrote:

> wrote:
>> Also fixed a bug with SysRiot.resetJenaReaders() related to setting the RDF/JSON
readers and writer class names to null (now uses empty strings instead)
> [...]
>> Modified: incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/
>> URL:
>> ==============================================================================
>> --- incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/ (original)
>> +++ incubator/jena/Jena2/ARQ/trunk/src/main/java/org/openjena/riot/ Tue
Apr 10 00:15:25 2012
>> @@ -103,8 +103,8 @@ public class SysRIOT
>>         RDFReaderFImpl.setBaseReaderClassName("Turtle", jenaTurtleReader) ;
>>         RDFReaderFImpl.setBaseReaderClassName("TTL",    jenaTurtleReader) ;
>> -        RDFReaderFImpl.setBaseReaderClassName("RDF/JSON", null) ;
>> -        RDFWriterFImpl.setBaseWriterClassName("RDF/JSON", null) ;
>> +        RDFReaderFImpl.setBaseReaderClassName("RDF/JSON", "") ;
>> +        RDFWriterFImpl.setBaseWriterClassName("RDF/JSON", "") ;
>>     }
>> }
> Yep, I remember that.
> The thing is that there is no explicit way to unregister a reader or a writer.
> What's the advantage of using "" instead of null? (I don't like both... ;-))
> Was null causing any problem?
> Perhaps, we should add an explicit unsetBase*ClassName(...) call.
> In future, it would be nice to give users the ability to easily register/unregister their
RDF readers and writers making easy for third parties to add their own  serialization formats
and/or parsers
> from native formats.
> Paolo

View raw message