Skip to content

Literal equality fails for datatypes None and XSD.string #2123

@jfschaefer

Description

@jfschaefer

Example:

>>> from rdflib import Literal
>>> from rdflib.namespace import XSD
>>> Literal('foo') == Literal('foo', datatype=XSD.string)
False

According to https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal, every literal has a datatype (and a simple literal without a datatype should be considered syntactic sugar for literals of datatype http://www.w3.org/2001/XMLSchema#string).

The implementation in rdflib seems to follow the original RDF (not RDF 1.1), which allowed missing datatypes.

Related issues:

PS:
A similar problem would presumably occur with RDF.langString, except that setting both lang and datatype results in an error (which might also be an issue).

Metadata

Metadata

Assignees

Labels

accepting PRPRs for this issue will be considered.breaking changeThis involves or proposes breaking RDFLib's public API.bugSomething isn't workingconcept: RDF Literalconcept: datatypeRelates to the RDF literal datatype concept.coreRelates to core functionality of RDFLib, i.e. `rdflib.{graph,store,term}`feedback wantedFeedback from RDFLib users and contributors is wanted.needs discussionThis issue needs further discussion to find an optimal way to resolve it.parsingRelated to a parsing.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions