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

RE: how a perl programmer might do datatypes in RDF

From: <Patrick.Stickler@nokia.com>
Date: Wed, 5 Dec 2001 20:52:05 +0200
Message-ID: <A03E60B17132A84F9B4BB5EEDE57957B160B0D@trebe006.NOE.Nokia.com>
To: connolly@w3.org, w3c-rdfcore-wg@w3.org

I thought the idea of scalars in Perl was that their interpretation
was delayed to the actual operation being applied. The rdfs:range
property is not IMO an operation. An operation would be something
like max(a,b) or add(x,y). If the Perl scalar approach were taken,
then *all* RDF would concern itself with would be the lexical forms
and interpretation would be left to applications and particular 
operations of applications and those operations/applications would
have to inspect and deduce data types and values themselves simply
based on the lexical characteristics of the scalar representation.

I don't really see how the PL proposal is different from the
PDU proposal in that what is suggested is that the interpretation
of a given scalar (lexical form) is based on the pairing of that
scalar (lexical form) with a data type identifier. That's exactly
what PDU suggests.

What am I missing here? (or am I missing anything?)

Cheers,

Patrick


> -----Original Message-----
> From: ext Dan Connolly [mailto:connolly@w3.org]
> Sent: 03 December, 2001 18:52
> To: w3c-rdfcore-wg@w3.org
> Subject: PL: how a perl programmer might do datatypes in RDF
> 
> 
> 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/
> 
Received on Wednesday, 5 December 2001 13:52:13 EST

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