- From: Richard Cyganiak <richard@cyganiak.de>
- Date: Wed, 2 Nov 2011 20:04:17 +0000
- To: Eric Prud'hommeaux <eric@w3.org>
- Cc: public-rdb2rdf-comments@w3.org
On 2 Nov 2011, at 18:13, Eric Prud'hommeaux wrote: > My only issue with this is that folks have to go chasing down these implementation bars, which, as you are in a fine position to appreciate, is a PITA. Acknowledged. > How about normative text that says that the lexical representation is the canonical XML Schema Datatype form Well, it still needs to formally define how to get from a SQL value to an XSD value. It needs to describe a mapping of some sort. What you propose just states the range of the mapping function, but not its definition. R2RML defines the function by starting with the canonical SQL literal representation (which is defined as “Conversion to string” – the SQL expression for getting that canonical representation is CAST(xxx AS CHARACTER VARYING(yyy)), and then where necessary describing a transformation from that to the valid XSD form. I think this is the right way of doing it, because implementers can actually try it on the SQL prompt (if their DB is sufficiently compatible), and potentially use directly in their implementations. It also follows ISO/IEC 9075-14:2008, which uses the same CAST expression. This method also provides a decent fallback for any vendor-specific types – casting them to a string can't be completely wrong – and this is explicitly explained in the R2RML text. > and an informative table that indicates the ranges for minimal conformance Would this table say anything besides what's already in the XSD spec? If not, then I'd rather just add an informative note pointing to that document, as it does a better job at explaining the relevant issues than we can do in the appropriate amount of space. How about this: [[ Note: This mapping to XML Schema datatypes tends to rely on arbitrary-precision types such as xsd:decimal, xsd:integer and xsd:dateTime, since the precision of many SQL datatypes is not fixed in [SQL2], but implementation-defined. In practice, implementation considerations may require setting upper limits to the supported precision of these types. The XML Schema specification allows such “partial implementations”, and defines some minimum requirements and other constraints [XSD2-11]. ]] The [XSD2-11] link would go to http://www.w3.org/TR/xmlschema11-2/#partial-implementation . This section only exists in XML Schema 1.1, which isn't REC yet, so depending on their timeline we may have to link both to XSD 1.0 (normatively) and XSD 1.1 (informatively). > and examples of the canonical forms? R2RML already has plenty of examples for the conversion process, downwards from here: http://www.w3.org/2001/sw/rdb2rdf/r2rml/#datatype-table (Looking at this now I feel that the table at the end of 10.1, and the one in 10.2, ought to be combined into one.) Best, Richard > > >> Best, >> Richard >> >> [1] http://www.w3.org/TR/xmlschema11-2/#partial-implementation >> >> >> On 31 Oct 2011, at 03:39, Eric Prud'hommeaux wrote: >> >>> * Richard Cyganiak <richard@cyganiak.de> [2011-10-31 00:09+0000] >>>> On 30 Oct 2011, at 23:11, Eric Prud'hommeaux wrote: >>>>> A tool which uses e.g. floats or ints to manipulate the graph defined by R2RML would have to qualify its conformance by the version of the database to which it was connected (e.g. "offers R2RML for MySQL 5.01, but not Oracle 11G"). >>>> >>>> Neither floats nor ints are sufficient to represent xsd:decimal even if we consider only xsd:decimals restricted to 18 digits. >>> >>> True, and that does raise the bar for implementation. However, floating point and integer types are very commonly used in SQL and can be very simply implemented. >>> >>> >>>> Any programming language these days has some sort of arbitrary-precision decimal type in a readily available library. That is sufficient for conformance with any SQL 2008 conforming implementation of DECIMAL, regardless of how many digits it uses. >>>> >>>>> General compatibility with R2RML over any database can only be preserved if you don't use native types at any step of the e.g. query answering process. >>>> >>>> I have no idea what you're trying to say here. >>> >>> As you point out above, one needs to use arbitrary-precision decimals and not native datatypes to implement the arbitrary precision required by R2RML. >>> Some programs, e.g. Jena, use efficient native types for integers and arbitrary-precision only for decimals. >>> >>> >>>>> Applying the unbounded precision support to DM would mean that FeDeRate would no longer be an implementation (it uses Jena to parse and execute queries which I believe uses java native types) >>>> >>>> You may want to check that again. Jena uses BigDecimal to represent xsd:decimal. >>> >>> The query >>> ASK {FILTER (20000000000000000000/2=10000000000000000000)} >>> at <http://sparql.org/sparql.html> indicates that ARC supports up to, but no more than, 18 digit integers. >>> >>> >>>>> and SWObjects would have an even harder time as it is intended to connect multiple databases with potentially different maximum precisions. >>>> >>>> I don't understand the problem. When you query the DB you get back some value. Then you stuff that value into a BigDecimal. >>>> >>>> I don't understand how knowing that you're never going to see a decimal longer than 18 digits simplifies an implementation. It's not like it's particularly hard to write arbitrary-precision code. >>> >>> True, but do the use cases motivate raising the bar to that extent? Can we motivate Jena abandoning native integers? >>> >>> >>>> As far as I can see, the text in R2RML works fine, is easy to implement, easy to test, and meets user expectations. I have seen no evidence yet that changing the text would benefit users or implementers, and I have seen no argument being made why R2RML and DM should differ. As far as I can tell, you're trying to solve an imaginary problem. >>> >>> I don't foresee many implementations of arbitrary precision for integers and floats and I don't see much motivation for that. Further, it makes more sense to define the lexical values in terms of the XSD canonical types rather than via a recipe which some popular databases (e.g. MySQL) don't support. >>> >>> >>>> Best, >>>> Richard >>> >>> -- >>> -ericP >>> >> > > -- > -ericP
Received on Wednesday, 2 November 2011 20:04:55 UTC