Skip to content

Literal should always have a datatype #1326

Open
@white-gecko

Description

According to RDF 1.1 (https://www.w3.org/TR/rdf11-concepts/#section-Graph-Literal)

A literal in an RDF graph consists of two or three elements:

  • a lexical form, being a Unicode [UNICODE] string, which SHOULD be in Normal Form C [NFC],
  • a datatype IRI, being an IRI identifying a datatype that determines how the lexical form maps to a literal value, and
  • if and only if the datatype IRI is http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, a non-empty language tag as defined by [BCP47]. The language tag MUST be well-formed according to section 2.2.9 of [BCP47].

A literal is a language-tagged string if the third element is present. Lexical representations of language tags MAY be converted to lower case. The value space of language tags is always in lower case.

Please note that concrete syntaxes MAY support simple literals consisting of only a lexical form without any datatype IRI or language tag. Simple literals are syntactic sugar for abstract syntax literals with the datatype IRI http://www.w3.org/2001/XMLSchema#string. Similarly, most concrete syntaxes represent language-tagged strings without the datatype IRI because it always equals http://www.w3.org/1999/02/22-rdf-syntax-ns#langString.

So the datatype of Literals should always be set.

If a language is specified and a datatype it has to be ensured that the datatype is http://www.w3.org/1999/02/22-rdf-syntax-ns#langString

See also #670

Metadata

Assignees

Labels

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}`duplicateThis issue or pull request already existsparsingRelated to a parsing.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions