gjhiggins/rdflib — Issue #80: Literal init with both language and datatype
Author: gjhiggins
Created: 2011-10-19 01:14:26+00:00
State: open

Originally filed by kyleheus...@gmail.com on 2009-08-27T22:53:49

When you initialize a Literal type with both a language and datatype, only
datatype is set (language value is discarded and set to None)

But if you manually set a literal object's language attribute, it sticks
regardless of whether datatype was set.

When you serialize or call the literal's n3() method, it is possible to
output both language and datatype.

So, the question is, why can't a Literal be initialized with both langauge
and datatype (ie. via the __new__ method)?

ex.1
>> l = Literal(u'hello',u'en-us',XSD_NS['string'])
>> l.language
None
>> l.n3()
u'"hello"^^'

ex.2
>> l = Literal(u'hello',XSD_NS['string'])
>> l.language = u'en-us'
>> l.n3()
u'"hello"@en-us^^'