sorting in turtle serializer breaks with datetime · Issue #613 · RDFLib/rdflib (original) (raw)

if one represents a graph like the one below

    ex:gen1 a prov:End ;
        prov:time "2016-03-20T18:11:44.996521"^^xsd:dateTime,
            "2012-12-03T21:08:16.686000+00:00"^^xsd:dateTime .

the following line:
https://github.com/RDFLib/rdflib/blob/master/rdflib/plugins/serializers/turtle.py#L106

raises the following error:

TypeError: can't compare offset-naive and offset-aware datetimes

this should do a lexical sort rather than a numeric or datatype sort.