Skip to content

Literal sets language and datatype if made with other literal #2603

@WhiteGobo

Description

@WhiteGobo

Normally language and datatype cant be set at the same time. This fails in this case:

from rdflib import *
L1 = Literal("example", datatype=XSD.string)
L2 = Literal(L1, lang="en")
print(repr(L2))
# rdflib.term.Literal('example', lang='en', datatype=rdflib.term.URIRef('http://www.w3.org/2001/XMLSchema#string'))

In comparison setting it by hand Literal("example", lang="en", datatype=XSD.string) will result in an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions