On Mon, Nov 26, 2012 at 5:21 PM, Chris Dollin
<chris.dol...@epimorphics.com>wrote:

> On Monday, November 26, 2012 04:46:32 PM Reto Bachmann-Gmür wrote:
> > On Sun, Nov 25, 2012 at 3:19 PM, Andy Seaborne <a...@apache.org> wrote:
> >
> > > Slight confusion between identity and equivalence.  Two graph are
> > > equivalent by bNode-isomorphism; they are still different.
> > >
> >
> > Object.equals should implement an equivalence relation. As two graphs are
> > equivalent by rdf semantics iff they are isomorphic equals should return
> > true for isomorphic graphs.
>
> .equals() is tossed around fairly casually in Java programs (perhaps that's
> just me); it's not clear to me that having a modelorgraph's .equals() being
> graph isomorphism -- potentially muchly expensive if bnodes are in play --
> is the most effective choice.
>

For jena 1 Model.equals used to be isomorphism . This was clearly bad as
Models are mutable objects and so you could end up with broken HashSets or
-Maps if they have Models as keys. In Clerezza the equivalent to a jena
Model or Graph is an MGraph (where the M stands for mutable) for this there
is no isomorphism based equality. But if you take a time-slice of it then
equals is based on isomorphism. This is because Garph represents a medium
level of abstraction between the serialized graph and the expressed
content. Might not be cheap to compute yet the problem is easy compared to
comparing the expressed semantic content. This level of abstraction is
handy when doing things like synchronization and versioning based on
decomposed graphs. Or in situation were you don't want to assume logical
omniscience, e.g. we might have a:

HashMap<Graph, Set<Citizen>> petitionSigner which maps from a petition to
the citizens that signed it, if a citizen signs a petition we look up the
key and add them to the value. Would two petitions be equals just because
they logically entail the same people would be surprised to see what they
subscribed to. On the other hand if two petitions would not be considered
equals if they came on two different sheets of paper (or memory segments or
data connections) it would be very hard to find some allies.

>
> ["equals should implement equivalence" doesn't entail "equals is
>  isomorphism". Identity is an equivalence relation too.]
>

Leibniz introduced the principle that "Two entities that do not have any
properties allowing to distinguish them should be seen as a single entity"
now immutable graphs have no properties distinguishing so they should be
considered identical.

Btw, for bnodes the Identity of Indiscernibles doesn't hold (similar to
[2]), as  the graph

____                                          _____
|       | ------ foaf: knows ------>|           |
|       |                                         |           |
|___|  <---- foaf: knows ------  |_____|

contains two bnodes which even though they are not distinguishable they are
not the same as the graph is true for more possible worlds than

____
|       | ------ foaf: knows ---|
|       |                                   |
|___|  <----------------------|

the graph with only one bnode.

(I hope my poor ascii arts survives transport)

Cheers,
Reto

1. http://plato.stanford.edu/entries/identity/
2. http://plato.stanford.edu/entries/identity-indiscernible/


> --
> "The wizard seemed quite willing when I talked to him."  /Howl's Moving
> Castle/
>
> Epimorphics Ltd, http://www.epimorphics.com
> Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20
> 6PT
> Epimorphics Ltd. is a limited company registered in England (number
> 7016688)
>
>

Reply via email to