W3C home > Mailing lists > Public > www-rdf-comments@w3.org > July to September 2002

Re: Datatypes, syntax and equality

From: Sandy Nicholson <sandy.nicholson@quadstone.com>
Date: Mon, 22 Jul 2002 18:17:41 +0100
To: Jonathan Borden <jonathan@openhealth.org>
Cc: www-rdf-logic@w3.org, www-rdf-comments@w3.org
Message-ID: <20020722171741.GA16843@quadstone.com>


You wrote:

> I think much of the problem which seems to be occuring with RDF
> datatyping efforts is a result of RDF assuming the XML "error" of
> treating everything as a string i.e. there is no lexical distinction
> between "10" and the integer 10, except as directed by a schema.

I'm not especially partial to XML syntax, but it seems unfair to criticise
it on the grounds that it makes no lexical distinction between the number
10 and its common decimal representation. The important thing is that it
makes some distinction between these - which I believe it does. There's no
particular reason - other than an aesthetic one - for using double quotes
or the lack of them to make this distinction.

> The other problem is what types of questions we are asking. The
> essence of the solution to this is that the equality function needs to
> be predicated by the type of its arguments.

I am rather averse to this kind of thing. From a traditional-logic point
of view, identity/equality is type-neutral; so I find this a bit strange:

> :John :age "20" .
> :Mary :size "20" .
> Does John's age equal(string) Mary's size: YES
> Does John's age equal(decimal) Mary's size:YES
> Does John's age equal(binary) Mary's size: illegal syntax for type
> it is YES for all valid equality functions => YES
> The string "20" is not "in range" for all ranges (e.g. xsd:binary) but that
> is a different question.
> :John :age "10" .
> :Billy :age "010" .
> Does Billy's age equal(string) John's age? NO
> Does Billy's age equal(decimal) John's age? YES
> it has different values for different equality functions => UNKNOWN

In the first example, how can you possibly enumerate all valid equality
`functions'? As the RDF property doesn't seem to come into it, it seems
that all you're really doing is comparing strings. (Perhaps that's the
point - this is your untyped case.) But consider the following variant

    <John> <AgeInYears> "20"
    <Mary> <AgeInMonths> "20"

Comparing John's AgeInYears and Mary's AgeInMonths using equal(string)
or equal(decimal) is fine. So you might conclude, as above, that the two
values are equal. However, you forgot to consider the equality predicate
equal(months). Using this predicate, the two are certainly not equal. Of
course, I wasn't able to obtain all the information that I needed from
the string "20" - but then again the elements of RDF triples don't occur
in isolation.

You go on to discuss typed literals and write that:

> When using typed literals the equality function is predicated on the types
> of the arguments
> :John :age xsd:decimal"2" .

Why extend the relatively simple idea of triples to quadruples, as you
appear to be doing here (necessitating a more-complex RDF model theory)
when instead you could write the following two triples?

    <John> <Age> :_a
    :_a <xsdr:decimal> "2"

Looking at this, I realise that there are things I haven't yet thought
about very fully (as a relative RDF newcomer!), but I suspect it's not
an insurmountable task to decide that John's age cannot be the same as
Billy's if Billy's age is specified in binary notation as follows:

    <Billy> <Age> :_b
    :_b <xsdr:binary> "11"

Sandy Nicholson
Received on Monday, 22 July 2002 13:17:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 21 September 2012 14:16:30 GMT