Re: Datatypes (ISSUE-48)

--
Nuno Lopes



On 10 Aug 2011, at 12:01, Richard Cyganiak wrote:

> 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.  
> 
> Ok.
> 
>> 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.
Yes, the value transformations are actually defined in that section, it's nothing more than a rather long case distinction. I can collect these for the Wiki.


>> Did I miss some other question?
> 
> What was the story with the “and” for INTERVAL?
By reading the overview I was assuming the and referred to a complex datatype, however in the details it seems that it is actually a restriction on xdt:yearMonthDuration if the SQL type is a year-month duration and on xdt:dayTimeDuration if the SQL type is a day-time duration.  The problem is that so far I didn't find any definition for "year-month duration" and "day-time duration".

> 
> (I added an “Open Questions” subsection to the end of the wiki page.)
> 
> Best,
> Richard
> 
> 
> 
>> 
>> Cheers,
>> --
>> Nuno Lopes
>> 
>> 
>> 
>> On 9 Aug 2011, at 19:03, Richard Cyganiak wrote:
>> 
>>> Hi Nuno,
>>> 
>>> I had another look at the wiki page:
>>> http://www.w3.org/2001/sw/rdb2rdf/wiki/Mapping_SQL_datatypes_to_XML_Schema_datatypes
>>> 
>>> Ok, this answers what we ought to do with user-defined and constructed types.
>>> 
>>> There are still a couple of questions open from here:
>>> http://lists.w3.org/Archives/Public/public-rdb2rdf-wg/2011Aug/0017.html
>>> 
>>> Maybe you could comment on these?
>>> 
>>> Cheers,
>>> Richard
>> 
> 

Received on Wednesday, 10 August 2011 11:30:53 UTC