This wiki has been archived and is now read-only.


From RDF Working Group Wiki
Jump to: navigation, search

This is a proposal for addressing the following time-permitting item from the charter:

Reconcile various forms of string literals: at the moment we have plain literals, rdf:plainLiteral, and xsd:string literals. They are very very close to one another but they are officially different. In practice this means that, eg, SPARQL queries have to have a three branch UNION to handle all of these. Worth looking at some sort of a reconciliation of these.

Changes to RDF Concepts

(Note: this is not proposed spec text, but an attempt at a precise description of a technical solution.)

§1 There are no plain literals in the RDF abstract syntax. There are only typed literals.

§2 There is a datatype rdf:PlainLiteral. It can be used to express Unicode strings with and without language tags.

§3 RDF serializations MUST NOT expose rdf:PlainLiteral typed literals directly. Instead, they MUST provide syntactic features (sugar, if you like) that allows serialization of these literals as plain Unicode strings with an optional language tag. Example: "foo"@en instead of "foo@en"^^rdf:PlainLiteral

§4 RDF APIs MUST NOT expose rdf:PlainLiteral typed literals directly. Instead, they MUST provide access to these literals in the form of a plain Unicode string, with separate access to the optional language tag.

§5 There is a datatype xsd:string. Its values are Unicode strings. However, the xsd:string MUST NOT be used in actual typed literals. Instead, an rdf:PlainLiteral typed literal without language tag MUST be used.

§6 RDF serializations MAY allow the expression of xsd:string typed literals, but these MUST be converted to the rdf:PlainLiteral form upon parsing. The same applies to RDF APIs. Example: "foo"^^xsd:string and "foo" are both parsed to an rdf:PlainLiteral with Unicode string "foo" and no language tag.

§7 Some RDF APIs or query languages provide access to the datatype IRI of a literal. For rdf:PlainLiterals without language tag, the datatype xsd:string MUST be reported. For rdf:PlainLiterals with a language tag, the datatype rdf:PlainLiteral MUST be reported. Note: Legacy implementations may report “no datatype” in the cases above.

§8 Note: xsd:string and rdf:PlainLiteral MAY be used in rdfs:range statements to indicate that the objects of triples are Unicode strings without language tag (xsd:string), or Unicode string with or without a language tag (rdf:PlainLiteral).

Changes to RDF syntaxes

In all syntax specs: Declare plain literal syntax as syntactic sugar for rdf:PlainLiteral typed literals. Declare that xsd:string typed literals must be converted to rdf:PlainLiterals on parsing.

In SPARQL: @@ ah fuck this, gets too messy. Let's try StringLiterals/EntailmentProposal