W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2012

Re: What's the difference between equality and identity?

From: C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>
Date: Wed, 18 Jul 2012 09:04:20 -0600
Cc: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>, "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-Id: <C5FF91DC-6528-47FE-96E8-DA0974D66642@blackmesatech.com>
To: "Costello, Roger L." <costello@mitre.org>

On Jul 18, 2012, at 6:30 AM, Costello, Roger L. wrote:

> Hi Folks,
> 
> In section "3.2.1 The Attribute Declaration Schema Component" of the structures specification it discusses attribute default and fixed values. 
> 
> It contains this sentence:
> 
>    Note that it is values that are checked, not strings, 
>    and that the test is for either equality or identity.
> 
> What is a test for "identity?"

It is a test, given a value called X and a value called Y, to
see whether value X and value Y are the same value or
not the same value. 

I see that Michael Kay has already pointed to the discussion
of the distinction in the Datatypes 1.1 spec, which addresses
the distinction between equality and identity more explicitly
than was done in 1.0.

> 
> Suppose I declare an attribute:
> 
>    <attribute name="number" type="integer" fixed="1" />
> 
> And in an XML instance I use the attribute:
> 
>    number="1.0"
> 
> Is 1.0 equal to 1, but not identical?

Well, there's an irrelevant complication in your example:  "1.0" is
not allowed as a lexical representation for an attribute declared
as integer, because it contains a decimal point.

But if we take the similar example where the attribute is declared
as being of type decimal, then the lexical forms "1" and "1.0" 
denote the same value.  The fixed-value constraint and the value 
given in the instance will compare both equal and identical.  
(It is the lexical forms that are different, not the values.)

> The sentence says "the test is for either equality or identity."  Does that mean one schema validator implementation can elect to test for equality while another implementation can elect to test for identity? 

No; if that were the intention, the spec would say that it was
implementation-defined (or implementation-dependent) whether
the test was for equality or for identity.  The sentence you quote
just means the test succeeds if the values are equal, or identical,
or both.

> 
> Will 
> 
>    number="1.0" 
> 
> be schema valid with one implementation and schema invalid with another?

I would not expect the result to differ between conforming implementations,
no.

> 
> /Roger
> 
> P.S. At the beginning of that paragraph it says:
> 
>    The {value constraint} property reproduces ...
> 
> I believe it should say:
> 
>    The {variety} property reproduces ...


Thanks.

When I look at the paragraph, though, I think the sentence is correct as it
stands:  it's not the {variety} property that reproduces in an XSD context the
functionality of default and #FIXED attribute declarations in DTDs, but the
{value constraint} property as a whole.  The {variety} property distinguishes
between default and fixed values, but it does not specify which value is to 
serve as the default or fixed value, and without that, the functionality of
the corresponding declarations in DTDs hasn't been reproduced.
 
-- 
****************************************************************
* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com 
* http://cmsmcq.com/mib                 
* http://balisage.net
****************************************************************
Received on Wednesday, 18 July 2012 15:04:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 18 July 2012 15:04:46 GMT