From 0e00fa62d4ef3286601e3faf548ed63a3cf1a01e Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Wed, 26 Feb 2025 17:04:25 +0100 Subject: [PATCH 1/5] improve definition of Literal --- spec/index.html | 208 ++++++++++++++++++++++++++---------------------- 1 file changed, 111 insertions(+), 97 deletions(-) diff --git a/spec/index.html b/spec/index.html index c4fc58a..5601f64 100644 --- a/spec/index.html +++ b/spec/index.html @@ -733,125 +733,139 @@

Literals

Literals are used for values such as strings, numbers, and dates.

A literal in an RDF graph consists of - two, three, or four elements, as follow:

+ two, three, or four elements, as follow.

    -
  1. a lexical form consisting of a sequence of - Unicode code points [[!UNICODE]] - which are Unicode scalar values, - and therefore do not contain - Unicode surrogate code points
  2. -
  3. a datatype IRI, being an IRI +
  4. A lexical form, being a [=string=]. +
  5. A datatype IRI, being an IRI identifying a datatype that determines how the lexical form maps - to a literal value
  6. -
  7. if and only if the datatype IRI is - http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, a + to a literal value.
  8. +
  9. If and only if the datatype IRI is + http://www.w3.org/1999/02/22-rdf-syntax-ns#langString or + http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString, a non-empty language tag as defined by [[!BCP47]]. The language tag MUST be well-formed according to section 2.2.9 of [[!BCP47]], and MUST be treated consistently, that is, in a case insensitive manner. - Two language tags are the same if they only differ by case.
  10. -
  11. if and only if the datatype IRI is + Two [[!BCP47]]-complying strings that differ only by case represent the same [=language tag=].
  12. +
  13. If and only if the datatype IRI is http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString, - a non-empty language tag - that MUST be well-formed according to section 2.2.9 - of [[!BCP47]], - and MUST be treated consistently, that is, in a case insensitive manner, - and a base direction that MUST be either `ltr` or `rtl`.
  14. + a base direction that MUST be either

A literal is a language-tagged string if the third element is present and the fourth element is not present. - Lexical representations of language tags MAY be case normalized, - (for example, by canonicalizing as defined by - BCP 47 section 4.5). -

- -

A literal is a directional language-tagged string + A literal is a directional language-tagged string if both the third element and fourth elements are present. - The third element, the language tag, is treated identically as in a language-tagged string, - and the fourth element, base direction, MUST be either `ltr` or `rtl`, which MUST be in lower case.

- -

The meanings of the base direction values are:

- - -

Please note that concrete syntaxes MAY support - simple literals consisting of only a - lexical form without any datatype IRI, language tag, or base direction. - Simple literals are syntactic sugar for abstract syntax - literals - with the datatype IRI - http://www.w3.org/2001/XMLSchema#string - (which is commonly abbreviated as xsd:string). - Similarly, most concrete syntaxes represent - language-tagged strings and directional language-tagged strings without - the datatype IRI because it always equals either - http://www.w3.org/1999/02/22-rdf-syntax-ns#langString (rdf:langString) - or http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString (rdf:dirLangString), respectively.

- -

The literal value associated with a literal is:

- - +

Literal term equality: - Two literals are term-equal (the same RDF literal) + two literals are term-equal (the same RDF term) if and only if:

-

Comparison is performed using +

Comparison of the [=lexical forms=] and of the [=datatype IRIs=] is performed using case sensitive matching - (see description of string comparison in - ) - except for language tags, where the comparison is performed using + (see description of string comparison in + ). + Comparison of the [=language tags=] is performed using ASCII case-insensitive matching. - Thus, two literals can have the same value - without being the same RDF term. - For example:

- -
-      "1"^^xs:integer
-      "01"^^xs:integer
-    
- -

denote the same value, but are not the - same literal RDF terms and are not - term-equal because their - lexical forms differ.

+

+ +
+

Representation of literals

+ +

Some concrete syntaxes MAY support + simple literals consisting of only a + lexical form without any datatype IRI, language tag, or base direction. + Simple literals are syntactic sugar for abstract syntax + literals + with the datatype IRI + http://www.w3.org/2001/XMLSchema#string + (which is commonly abbreviated as xsd:string). +

+ +

+ Similarly, most concrete syntaxes represent + language-tagged strings and directional language-tagged strings without + the datatype IRI because it always equals either + http://www.w3.org/1999/02/22-rdf-syntax-ns#langString (rdf:langString) + or http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString (rdf:dirLangString), respectively. +

+ +

+ Any [=string=] complying with [[!BCP47]] MAY be used to represent a [=language tag=] in concrete syntaxes or implementation. + Such strings MAY be case normalized, + (for example, by canonicalizing as defined by + BCP 47 section 4.5). + On the contrary, an implementation MAY preserve the case from the original representation, + provided that it processes it in a case-insensitive manner. +

+ + + +
+ +
+

Literal value

+ +

The literal value associated with a literal is defined as follow.

+ + + +

+ Thus, two literals can have the same value + without being the same RDF term. + For example:

+ +
+        "1"^^xsd:integer
+        "01"^^xsd:integer
+      
+ +

denote the same value, but are not the + same literal RDF terms because their + lexical forms differ.

+
From 77cd780e98080f603eb3f66d3fea1b388e2ac783 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Thu, 27 Feb 2025 11:45:09 +0100 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Olaf Hartig Co-authored-by: Gregg Kellogg --- spec/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/index.html b/spec/index.html index 5601f64..38ba6fd 100644 --- a/spec/index.html +++ b/spec/index.html @@ -797,17 +797,17 @@

Representation of literals

Similarly, most concrete syntaxes represent language-tagged strings and directional language-tagged strings without - the datatype IRI because it always equals either + the datatype IRI because it is always either http://www.w3.org/1999/02/22-rdf-syntax-ns#langString (rdf:langString) or http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString (rdf:dirLangString), respectively.

- Any [=string=] complying with [[!BCP47]] MAY be used to represent a [=language tag=] in concrete syntaxes or implementation. - Such strings MAY be case normalized, + Any [=string=] complying with [[!BCP47]] MAY be used to represent a [=language tag=] in concrete syntaxes or implementations. + Such strings MAY be case normalized (for example, by canonicalizing as defined by BCP 47 section 4.5). - On the contrary, an implementation MAY preserve the case from the original representation, + Alternatively, an implementation MAY preserve the case from the original representation, provided that it processes it in a case-insensitive manner.

@@ -822,7 +822,7 @@

Representation of literals

Literal value

-

The literal value associated with a literal is defined as follow.

+

The literal value associated with a literal is defined as follows.

  • If the literal is a language-tagged string, From 74f4ead9e6c50e4c63623bda5f174738d90b5b6f Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Fri, 28 Feb 2025 01:16:56 +0100 Subject: [PATCH 3/5] Update spec/index.html --- spec/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/index.html b/spec/index.html index 38ba6fd..c179cdb 100644 --- a/spec/index.html +++ b/spec/index.html @@ -813,8 +813,9 @@

    Representation of literals

From 8b6fbb5ee3f9546226e702925744c6cab665daff Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Fri, 28 Feb 2025 01:18:33 +0100 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Andy Seaborne --- spec/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/index.html b/spec/index.html index c179cdb..34d0af2 100644 --- a/spec/index.html +++ b/spec/index.html @@ -736,7 +736,7 @@

Literals

two, three, or four elements, as follow.

    -
  1. A lexical form, being a [=string=]. +
  2. A lexical form, being an [=RDF string=].
  3. A datatype IRI, being an IRI identifying a datatype that determines how the lexical form maps to a literal value.
  4. From e4063767c9b086da7358eedd912847a9a3ed4f36 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Champin Date: Fri, 28 Feb 2025 01:23:41 +0100 Subject: [PATCH 5/5] Update spec/index.html Co-authored-by: Andy Seaborne --- spec/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/index.html b/spec/index.html index 34d0af2..6ae0ff5 100644 --- a/spec/index.html +++ b/spec/index.html @@ -813,8 +813,8 @@

    Representation of literals