On 22/08/13 05:27, Holger Knublauch wrote:
While upgrading to the latest Jena version, I noticed that the handling
of the language parameter has changed compared to earlier versions. The
language argument of Model.read is no longer treated with priority, but
instead it will try to "guess" the content type first:

RDFDataMgr.determineCT

         if ( ct == null || isTextPlain )
             ct = RDFLanguages.guessContentType(target) ;

         if ( ct == null && hintLang != null )
             ct = hintLang.getContentType() ;

This seems to violate the contract of the Model.read function, which states

     @param lang the langauge of the serialization

I believe if a language has been explicitly passed into the method, then
it should be used - users have the freedom to rely on the guessing
algorithm by selecting null as the language. Alternatively, the comment
of the Model.read function should be changed to clarify the new semantics.

Thanks
Holger


Holger,

Based on your experience, when does it make a difference?

There are three pieces of information to consider: content type (if from the web), the user specified language and the file extension. What happens when there is contradictory information is a pragmatic decision. Hence the "don't trust text/plain" part -- too many Turtle files come back text plain!

(I'm not a fan of sniffing the content because the sniffer wrapper can't be removed for the critical path for parsing).


        Andy




-----------------------

An .htaccess file for setting for RDF content types:

AddType  text/turtle             .ttl

AddType  application/rdf+xml     .rdf
AddType  application/ld+json     .jsonld
AddType  application/n-triples   .nt
AddType  application/owl+xml     .owl

AddType  text/trig               .trig
AddType  application/n-quads     .nq


Reply via email to