W3C home > Mailing lists > Public > w3c-rdfcore-wg@w3.org > December 2001

Re: PL: how a perl programmer might do datatypes in RDF

From: Graham Klyne <Graham.Klyne@MIMEsweeper.com>
Date: Wed, 05 Dec 2001 07:23:27 +0000
Message-Id: <5.1.0.14.2.20011205071918.03268e50@joy.songbird.com>
To: Dan Connolly <connolly@w3.org>
Cc: w3c-rdfcore-wg@w3.org
Nicely presented :-)

This looks like an approach I could live with.

I think the issue of "10" vs "010" needs to be clear -- you seem to be 
proposing that these ares distinct scalar values.  But under what 
conditions does:

     X foo "10" .

entail

     X foo "010" .

?

#g
--

At 05:51 PM 12/3/01 -0600, Dan Connolly wrote:
>In question-and-answer format:
>
>Q: how do I write integers and dates in RDF?
>
>A: the obvious way:
>         <ppl:age>10</ppl:age>
>
>         <shoes:size>10</shoes:size>
>
>         <dc:date>2001-12-03</dc:date>
>
>Q: er... when I write <age>10</age>, is 10 a string or a number?
>
>A: yes. ;-)
>
>learn to think like a perl programmer:
>
>@prefix ed: <http://www.w3.org/2000/08/eb58#>.
>@prefix dc: <http://purl.org/dc/elements/1.1/>.
>"""
>Scalars aren't necessarily one thing or another. There's no place to
>      declare a scalar variable to be of type "string", type "number",
>type
>      "reference", or anything else. Because of the automatic conversion
>of
>      scalars, operations that return scalars don't need to care (and in
>fact,
>      cannot care) whether their caller is looking for a string, a
>number, or a
>      reference.
>"""
>
>is ed:excerpt of [
>   = <http://www.perldoc.com/perl5.6/pod/perldata.html>;
>   dc:title "perldata";
>   dc:date "Sun, 09 Sep 2001 13:06:57 GMT" ].
>
>
>Q: but I thought strings and integers were disjoint; that's
>what the XML Schema spec says.
>
>A: hmm... so it does:
>   "Note that a consequence of the above is that, given ·value space·  A
>          and ·value space·  B where A and B are not related by
>·restriction· or
>          ·union·, for every pair of values a from A and b from B, a !=
>b."
>
>         -- http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#equal
>
>well, (a) I don't see how that follows "as a consequence of the above";
>(b) I don't see why the spec makes this constraint; it doesn't seem
>to exploit it. (c) if they really mean that the value spaces
>of the datatype string and integer don't intersect, then our
>literal-value/scalar space is a different space. I don't expect
>they'll mind, as long as we're clear on the difference. We do owe
>them a chance to review this departure from their design, I suppose.
>
>
>Q: how do I declare that my property takes integer or date values?
>
>A: the obvious way, using rdfs:range and the URIs provided
>in the XML Schema datatypes spec:
>
>         my:age rdfs:range <http://www.w3.org/2001/XMLSchema#int>.
>         dc:date rdfs:range dt:date.
>
>cf
>http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/#built-in-datatypes
>
>Q: what's the class-extension of .../XMLSchema#int? numbers or numerals?
>i.e. is it the lexical space or the value space?
>
>A: You can look at them as numerals if you like. 010 and 10
>are distinguishable, after all; you can string-compare them.
>It's definitely the lexical space that shows up in RDF/xml documents;
>but we already knew that. Formally,
>I'd say literal values. To a perl programmer, I'd say: scalars.
>
>
>Q: how can I tell if the value of a property is a string or an integer?
>         How can I query for real integers, not just
>         strings-that-look-like-integers?
>
>A: you can't. Do you really need to?
>A lot of perl programmers get a lot of stuff done without doing so.
>
>
>Q: how does this impact the model theory of 25 Sep?
>http://www.w3.org/TR/2001/WD-rdf-mt-20010925/
>
>A: it doesn't, really; all we need to specify is that Unicode
>character sequences (as expressed with RDF propertyElement content
>and N-triples terms) map 1-1 to literal values (aka scalars).
>
>
>Q: what about the other pros and cons from the mental
>dump?
>http://lists.w3.org/Archives/Public/w3c-rdfcore-wg/2001Nov/0295.html
>Does it require literals as subjects?
>
>A: I'm not certain. It does seem to suggest that
>         "10" rdf:type dt:integer.
>if that's what you mean.
>
>
>Q: requires DTs to be 'proper'?
>
>A: no. almost on the contrary; it's pretty promiscuous ;-)
>
>
>Q: requires user conform to idiom?
>
>A: no; that is: no idiom other than the obvious one that
>         folks have already chosen.
>
>Q: requires literals to be typed?
>
>A: no; on the contrary; pretty much lumps all literal types together
>
>
>Q: cannot express 'clashing' types
>
>A: ??? not sure what this means.
>
>
>Q: fully general?
>
>A: except for an inability to distinguish "10" from 10, yes, seems to
>be.
>
>
>Q: conforms to current usage?
>
>A: yes.
>
>
>Q: allows free type merging?
>
>A: dunno what this means.
>
>
>Q: compatible with DAML
>
>A: hmm... I suppose so.
>
>
>
>Q: Does each RDF document ential itself? in particular,
>simple ones like this one?
><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>             xmlns:dc="http://purl.org/dc/elements/1.1/">
>   <rdf:Description rdf:about="http://www.w3.org/">
>     <dc:title>World Wide Web Consortium</dc:title>
>   </rdf:Description>
></rdf:RDF>
>
>A: yes; of course.
>
>
>Q: how would you write the bus/bell example from Sergey's draft?
>   http://www-db.stanford.edu/~melnik/rdf/datatyping/
>
>A:
>         :bus_1 :isEmpty "true".
>         :bell_2 :isRinging "1".
>
>in full glory:
>
><rdf:RDF xmlns="http://www-db.stanford.edu/~melnik/rdf/datatyping/#"
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
>
>     <rdf:Description
>rdf:about="http://www-db.stanford.edu/~melnik/rdf/datatyping/#bell_2">
>         <isRinging>1</isRinging>
>     </rdf:Description>
>
>     <rdf:Description
>rdf:about="http://www-db.stanford.edu/~melnik/rdf/datatyping/#bus_1">
>         <isEmpty>true</isEmpty>
>     </rdf:Description>
></rdf:RDF>
>
>
>Q: how about the Jenny/Robbie example?
>
><rdf:RDF xmlns="http://www-db.stanford.edu/~melnik/rdf/datatyping/#"
>     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
>
>     <rdf:Description>
>         <age>P1Y</age>
>         <weightInKG>12</weightInKG>
>     </rdf:Description>
>
>     <rdf:Description>
>         <ageinYears>1</ageinYears>
>         <weightinKg>14</weightinKg>
>     </rdf:Description>
></rdf:RDF>
>
>I'm leaving out the octal bit. I suppose I could do it ala
>
>         weightInKG [ coerce:fromOctal "14" ].
>
>or some such, but I haven't bothered here.
>
>
>--
>Dan Connolly, W3C http://www.w3.org/People/Connolly/

------------------------------------------------------------
Graham Klyne                    MIMEsweeper Group
Strategic Research              <http://www.mimesweeper.com>
<Graham.Klyne@MIMEsweeper.com>
       __
      /\ \
     /  \ \
    / /\ \ \
   / / /\ \ \
  / / /__\_\ \
/ / /________\
\/___________/
Received on Thursday, 6 December 2001 08:12:41 EST

This archive was generated by hypermail pre-2.1.9 : Wednesday, 3 September 2003 09:43:01 EDT