Re: Datatypes (ISSUE-48)

On 10 Aug 2011, at 13:31, Ivan Herman wrote:
> So maybe I misunderstand the discussion. What is the output RDF graph? Is it:
> 
> <rowuri> <somepredicate> "2011-08-10"^^xsd:date .

That's what I'd like to see.

> <rowuri> <somepredicate> "2011-08-10"^^ANN . (the 'ANN' was used in Nuno's graph)
> 
> (Note that using 'ANN' as a datatype is valid per RDF.)

I'd think it's invalid. A datatype IRI has to be a valid absolute IRI.

> My reading of the mail is that it is the latter.

Nuno quoted from the SQL spec. I believe that the "ANN" there stood for some implementation-defined datatype URI that each RDBMS vendor would have to define. So it's just a placeholder, not an actual URI.

> If that is indeed the case, then I do not see why
> 
> <rowuri> <somepredicate> "2011-08-10"^^<newType> . 
> 
> would be any worse; in fact, I think it is better.

Well, I suppose that <newType> would be some new URI that we make up, like rr:DATE_sql2008.

We could do that, it would make a certain amount of sense.

But I wouldn't consider it very useful. Most SQL data values *can* be expressed directly as a typed literal using an appropriate existing XSD type.

So why not just work out the details of that mapping, and have the R2RML implementations generate XSD-typed literals.

Best,
Richard


> 
> If the output RDF graph will _always_ use xsd:date (or any other xsd types only) then I see your point. So it may well be that I was misled by the discussion.
> 
> Ivan
> 
> 
> On Aug 10, 2011, at 14:16 , Richard Cyganiak wrote:
> 
>> On 10 Aug 2011, at 12:31, Ivan Herman wrote:
>>> The question I asked is which of the two formalisms has a remote chance of being useful for the end user, ie, the consumer of the generated graph. That should be the decisive factor.
>> 
>> Well you already answered that question. Support for custom datatypes in RDF tools is poor.
>> 
>>> Note that what is below is not purely XSD any more: it is a derived type in terms of XML Schema. Ie, the proper interpretation of that datatype for the end user relies on an XML Schema toolset.
>> 
>> What matters is not the mapping from *SQL types* to *XSD types*, but the mapping from *SQL data values* to *XSD-typed literals*. And there is absolutely nothing wrong with mapping the SQL DATE value '2011-08-10' to "2011-08-10"^^xsd:date.
>> 
>> The facet restriction below states that the SQL DATE type (as specified in SQL 2008) doesn't support negative dates or dates with timezones, which are supported in out-of-the-box xsd:date. I don't see how that's even relevant to R2RML.
>> 
>> Best,
>> Richard
>> 
>> 
>>> 
>>> Ivan
>>> 
>>> 
>>>> 
>>>> Best,
>>>> Richard
>>>> 
>>>> 
>>>>> 
>>>>> I believe the type you described below would be:
>>>>> 
>>>>> <newType> a rdfs:Datatype ;
>>>>> owl:onDatatype xsd:string ;
>>>>> owl:withRestrictions (
>>>>> [ xsd:pattern "\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}" ]
>>>>> ) .
>>>>> 
>>>>> It is not overly pretty either (neither is the XML Schema based) but the question is which one could be used more efficiently in practice. I may be mistaken, but I do not know of any RDF environment that would interpret derived datatypes defined with XML Schemas. At least there are OWL environments that do, however (eg, they can check range restrictions based on literal values, stuff like that).
>>>>> 
>>>>> Ivan
>>>>> 
>>>>> 
>>>>> On Aug 10, 2011, at 12:35 , Nuno Lopes wrote:
>>>>> 
>>>>>> Hi Richard,
>>>>>> 
>>>>>> I added to the Wiki an explanation for the "or" mapping, most of them are left up to the implementation. 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.
>>>>>> 
>>>>>> Did I miss some other question?
>>>>>> 
>>>>>> 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
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> ----
>>>>> Ivan Herman, W3C Semantic Web Activity Lead
>>>>> Home: http://www.w3.org/People/Ivan/
>>>>> mobile: +31-641044153
>>>>> PGP Key: http://www.ivan-herman.net/pgpkey.html
>>>>> FOAF: http://www.ivan-herman.net/foaf.rdf
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>>> ----
>>> Ivan Herman, W3C Semantic Web Activity Lead
>>> Home: http://www.w3.org/People/Ivan/
>>> mobile: +31-641044153
>>> PGP Key: http://www.ivan-herman.net/pgpkey.html
>>> FOAF: http://www.ivan-herman.net/foaf.rdf
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
> 
> 
> ----
> Ivan Herman, W3C Semantic Web Activity Lead
> Home: http://www.w3.org/People/Ivan/
> mobile: +31-641044153
> PGP Key: http://www.ivan-herman.net/pgpkey.html
> FOAF: http://www.ivan-herman.net/foaf.rdf
> 
> 
> 
> 
> 
> 

Received on Wednesday, 10 August 2011 12:46:53 UTC