Re: Datatypes (ISSUE-48)

Hi Nuno,

Thanks a lot for the response.

On 10 Aug 2011, at 11:35, Nuno Lopes wrote:
> I added to the Wiki an explanation for the "or" mapping, most of them are left up to the implementation.

Ok, thanks.

> Regarding the boolean type there is no mention and it seems to be mapped directly.  


> As for the dates and durations, the lexical values are restricted by the "xs:pattern" facet as I mentioned. For example the DATE SQL type is mapped to the XSD type:
> <xs:simpleType>
>  ANN
>  <xs:restriction base="xs:date">
>    <xs:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/>
>  </xs:restriction>
> </xs:simpleType>
> where ANN may indicate the original SQL datatype (implementation defined).  I'll add this example to the wiki.

Well, this explains how one can get a really precise XSD *type* that corresponds to the SQL *type*.

A question is still how to derive an XSD *value* from a SQL *value*. For example, given a SQL TIMESTAMP value, your work tells me that it will map to *some* xsd:dateTime value that matches a certain pattern. But what exactly is that value? How do I get the “lexical form” for use in RDF?

The answer is reasonably obvious for some types like strings and numbers, but it's a bit more tricky for the date/time types, the binary times, and intervals.

I suppose that Section 9.8 “Mapping values of SQL data types to values of XML Schema data types” of ISO 9075-14 has the answer.

For example, I see there: “If SQLT is a binary string type, then […] let XMLV be the base64 encoding as defined by [Schema2] of SQLV.” This tells me how exactly to get an xsd:base64Binary literal value from a BINARY-typed SQL value.

I guess that the R2RML spec should just refer to that section of the SQL spec for the details, but I'd like R2RML to be implementable without actually reading that spec, so I think that the R2RML spec should call out any surprising/non-obvious features of the SQL spec.

> Did I miss some other question?

What was the story with the “and” for INTERVAL?

(I added an “Open Questions” subsection to the end of the wiki page.)


> Cheers,
> --
> Nuno Lopes
> On 9 Aug 2011, at 19:03, Richard Cyganiak wrote:
>> Hi Nuno,
>> I had another look at the wiki page:
>> Ok, this answers what we ought to do with user-defined and constructed types.
>> There are still a couple of questions open from here:
>> Maybe you could comment on these?
>> Cheers,
>> Richard

Received on Wednesday, 10 August 2011 11:02:09 UTC