w3c / rdf-concepts

https://w3c.github.io/rdf-concepts/
Other
16 stars 2 forks source link

canonical mappings for datatypes #86

Closed pfps closed 3 months ago

pfps commented 6 months ago

Two datatypes provide a canonical mapping but there are no requirements for canonical mappings.

If canonical mappings are to be retained there needs to be requirements that these mapping must satisfy.

gkellogg commented 6 months ago

RDFa requires using Exclusive XML Canonicalization when serializing an XML Literal. The canonical mapping for rdf:XMLLiteral is based on this language. Possibly, the language could be removed from the datatype definition, but it clearly describes something that is useful.

JSON-LD 1.1 describes canonicalization as being the mapping to the value space, which is essentially JCS before it was standardized. Canonicalization of JSON datatypes is necessary for serializing the content of JSON literals.

XSD datatypes define Canonical Lexical Representations. I believe many RDF libraries expose a way of creating a canonicalized version of a literal using these mechanisms.

IMO, removing canonicalization sections for datatypes would be confusing to the user base.

The definition from XSD seems like a good starting point for such requirements:

A canonical lexical representation is a set of literals from among the valid set of literals for a datatype such that there is a one-to-one mapping between literals in the canonical lexical representation and values in the ·value space·.

afs commented 6 months ago

RDFa requiring Exclusive XML Canonicalization is different to RDF 1.1. It's a subset of values.

RDF 1.1 has RDF/XML value space of "DocumentFragment" which is a wider definition than RDF 1.0. Exclusive XML Canonicalization.

afs commented 5 months ago

If canonical mappings are to be retained there needs to be requirements that these mapping must satisfy.

For rdf:JSON and rdf:XMLLiteral, I don't see a reason why rdf-concepts needs to define the canonical mapping (strictly, "a canonical mapping" - these two have choices for white space and other things).

rdf:XMLLiteral is harder because there isn't a requirement on normalization on the value space.

RDFa choosing a canonicalization can be seen as a choice being made for RDFa.

JSON-LD is free to define a canonical form as that community needs and it is good to leave it to the community as to whether e.g. RFC8785 is the right choice.

pfps commented 4 months ago

I propose removing the only remaining canonical mapping, for rdf:XMLLiteral. As there are suggested RDF datatypes for which RDF does not define a canonical mapping, it does not make sense to keep this one.

It's removal should be documented in the change section.

gkellogg commented 3 months ago

Closed via https://github.com/w3c/rdf-concepts/pull/97.