Re: Datatype mappings

* ashok malhotra <ashok.malhotra@oracle.com> [2012-01-13 11:05-0800]
> I took the liberty of making an editorial pass at section 10.
> See attached.
> BTW:  I could not make sense of the last phrase of the last sentence:
> "and /OPTIONAL/ further implementation-defined types"
> -- 
> All the best, Ashok

To help folks compare, here are the mods that I see:

[[
The natural rdf literal is defined for SQL 2008 datatypes. … added to the SQL specification.
]]
is moved down by two notes.


=10 Datatype Conversions=
 
-This section defines the following mappings from SQL data values to RDF literals:
+This section defines mappings from SQL data values to RDF literals:
 

@10.1 Introduction (Informative)
 
+ 2. The natural RDF datatype corresponding to a SQL datatype is the value of the RDF datatype column in the row corresponding to the SQL datatype in the table below.

- 2. The natural RDF lexical form is similar, but produces only the lexical form of the typed literal                        and recommends that implementations perform XSD canonicalization.       It is used in R2RML when non-string columns are used in a string context, for example when a TIMESTAMP is used in an IRI template.
+ 3. The natural RDF lexical form is similar, but produces only the lexical form of the typed literal (not the RDF datatype) and recommends that implementations perform XSD canonicalization.       It is used in R2RML when non-string columns are used in a string context, for example when a TIMESTAMP is used in an IRI template. The natural RDF lexical form corresponding to a SQL data value is the lexical form of its corresponding natural RDF literal, with the additional constraint that the canonical lexical representation [XMLSCHEMA2] SHOULD be chosen.

- 3. The canonical RDF lexical form is again similar, but requires XSD canonicalization. It is used in the Direct Mapping when IRIs are generated.
+ 4. The canonical RDF lexical form is again similar, but requires XSD canonicalization. It is used in the Direct Mapping when IRIs are generated. The canonical RDF lexical form corresponding to a SQL data value is the lexical form of its corresponding natural RDF literal, with the additional constraint that the canonical lexical representation [XMLSCHEMA2] MUST be chosen.

- 5. The datatype-override RDF literal is a mapping that constructs typed literals by using the natural RDF lexical form and applying a specified datatype IRI. The mapping author is responsible for ensuring that the generated lexical
+ 5. The datatype-override RDF literal is a mapping that constructs typed literals by using the natural RDF lexical form and applying a specified datatype IRI. The mapping author is responsible for ensuring that the generated lexical
 
 The mappings cover all predefined SQL 2008 datatypes except INTERVAL. INTERVAL, vendor-specific types and types added to future SQL specifications should be mapped to RDF with extensions to the mapping to natural rdf literal.
+See below.
 
-The   mappings are referenced in the R2RML term generation rules.
+These mappings are referenced in the R2RML term generation rules.
 
-An informative summary of XSD lexical forms is provided                       to aid implementers.
+An informative summary of XSD lexical forms is provided in this specification to aid implementers.
 
@10.2 Natural Mapping of SQL Values

- 2. If dt is a character string type                                                                                                                                        , then the result is a plain literal without language tag whose lexical form is the SQL data value.
+ 2. If dt is a character string type (CHARACTER, CHARACTER VARYING, CHARACTER LARGE OBJECT, NATIONAL CHARACTER, NATIONAL CHARACTER VARYING, NATIONAL CHARACTER LARGE OBJECT), then the result is a plain literal without language tag whose lexical form is the SQL data value.


Perhaps the following four definitions seem redundant against 10.1. For them to be struck, 10.1 would need to be normative
 
-The natural RDF datatype corresponding to a SQL datatype is the value of the RDF datatype column in the row corresponding to the SQL datatype in the table above.
-
-The natural RDF lexical form corresponding to a SQL data value is the lexical form of its corresponding natural RDF literal, with the additional constraint that the canonical lexical representation [XMLSCHEMA2] SHOULD be chosen.
-
-The canonical RDF lexical form corresponding to a SQL data value is the lexical form of its corresponding natural RDF literal, with the additional constraint that the canonical lexical representation [XMLSCHEMA2] MUST be chosen.


The following normative definition:

-Cast to string is an implementation-dependent function that maps SQL data values to equivalent Unicode strings. It is undefined for the following kinds of SQL datatypes: collection types, row types, user-defined types without a
-user-defined string CAST, reference types whose referenced type does not have a user-defined string CAST, binary types, and OPTIONAL further implementation-defined types.

and the note after it:

-Cast to string is a fallback that handles vendor-specific and user-defined datatypes not supported by the R2RML processor. It can be implemented in a number of ways, including explicit SQL casts (“CAST(value AS VARCHAR(n))”, where n
-is an arbitrary large integer), implicit SQL casts (concatenation with the empty string), or by employing a database access API that presents return values as strings.

were rolled into a single normative defintion:

+Cast to string is an implementation-dependent function that maps SQL data values to equivalent Unicode strings. It is a fallback that can be used to handle vendor-specific and user-defined datatypes not supported by the R2RML
+processor. It can be implemented in a number of ways, including explicit SQL casts (“CAST(value AS VARCHAR(n))”, where n is an arbitrary large integer), implicit SQL casts (concatenation with the empty string), or by employing a
+database access API that presents return values as strings. Cast to string is undefined for the following kinds of SQL datatypes: collection types, row types, user-defined types without a user-defined string CAST, reference types
+whose referenced type does not have a user-defined string CAST, binary types, and OPTIONAL further implementation-defined types.

-- 
-ericP

Received on Saturday, 14 January 2012 21:14:23 UTC