Re: Another view on analysis and ER

From: Jon Heggland <>
Date: Fri, 07 Dec 2007 12:17:34 +0100
Message-ID: <fjba56$p98$>

Quoth David BL:
> I wasn't actually intending that Location be necessary for
> identification of a marriage. I'll make the intensional definition
> clearer:-
> married(Husband, Wife, Location) :-
> Husband is *currently* married to Wife
> and they (last) got married at Location
> Candidate keys are { Husband } or { Wife }, enforcing monogamy
> integrity constraints.

So Marriage is a relationship between a Husband and a Wife, yet it is identified by either, not the combination? I thought I finally had the common definition of "relationship" pegged, and then this comes along.

I suppose I am looking for rigor where there is none, though. The definition of entity---something that is identified independently of other entities---is also rather half-baked. Take weak entities, for instance.

>> What if
>> Location does not correspond to an entity type? I assume that might be
>> the case if it were simply a spatial coordinate. Is marriage still a
>> relationship? If not, what is is?

> I agree that it is strange to think of a spatial coordinate as an
> entity type.

My attempted point was to posit that a Location might be a non-entity attribute, /or/ an entity (say, a church or temple or official building of some kind), and to ask whether this made any difference as to whether the marriage is a relationship or an entity.

>>> By contrast the following predicates are consistent with thinking of a
>>> marriage itself as an entity
>>>     husband(MarriageId, Husband).
>>>     wife(MarriageId, Wife).
>>>     location(MarriageId, Location).
>>> or maybe just
>>>     married(MarriageId, Husband, Wife, Location)
>>> Now whether one "thinks in ER" or "thinks in propositional encodings",
>>> there has to be good reason to introduce a MarriageId.
>> Perhaps marriage certificates has a unique number stamped on them, and
>> you want to record this in your database.

> Yes, that could be a reason. Consider the following intensional
> definition
> married(MarriageId, Husband, Wife, Location) :-
> The marriage identified by MarriageId was
> between Husband and Wife at Location.
> In this case the relation can record marriages that are no longer
> current, and the only candidate key is { MarriageId }.

And you say this now is an entity, right? But what if the MarriageId represents an entity, just like Husband and Wife presumably do? Do we not then have a situation analogous to the first case, except that the relationship is ternary? It is, after all, identified by one of the entities it relates, just like the first Marriage.

> Well I can see you are technically picking holes in my
> "characterisation" of entity, but I wasn't really putting forward a
> definition. I think the "characterisation" was very informal and more
> along the lines of being necessary but not sufficient.

Why necessary?

> Actually, I would prefer to steer clear of trying to pin down such
> informal words as "entity" and "relationship".

But that is one of the main points of my involvement in this discussion!

> However, I still believe particular entity types are implicit in the
> intensional definitions of the predicates. How can they not be?

I think the burden of proof is on your side here. I have tried to show that predicates can be interpreted as both entities and relationships (and probably even as parts of entities). You seem to admit as much, given that you you use the word "informal" about the whole E/R shebang. I note that Jan Hidders claimed that the E/R distinction carries through to the logical/relational level, but I cannot see how---except by arbitrary claims along the lines of "if a relvar has but one key, and this key's components are all foreign keys, then the relvar represents a relationship".

I have also tried to show that the predicates, with keys, represent more information---important information, at that---than a classification of things into entities and relationships, with entities having a single key and relationships being identified by their entities (or some subset thereof?). And that the predicate representation is simpler, in a way, than E/R, since it does not have the fuzzy distinction between entities and relationships---it only has the predicate construct. I therefore consider an E/R model insufficient, or too simplified to be of much use. This, of course, is a matter of taste.

> Although the intensional definitions are strictly outside the
> mathematical formalism of the RM, they are nevertheless fundamental to
> the meaning and purpose of the database.

Fundamental? Why?

I have a hypothesis. It is that you are so used to thinking about a database in terms of entities and relationships that it is impossible for you to view it any other way. (The idea of viewing a database as a collection of facts was a revelation for me in that regard.) In fact, I have the opposite problem; I am unable to look at an E/R diagram without thinking about relations.

Consider this proposition: "Jon was born in 1974", encoded in a relvar of the form Born(Person, Year). I think we'll agree that represents a fact about Jon. You would probably assume that Jon is an entity (though I'm unsure about what you'd call the relvar/predicate in itself---is it an entity (type)?). But I would also say that the proposition is as much a fact about the year 1974! Is 1974 an entity? I really don't care. Facts are all.

>>> Aren't you implying that a propositional encoding doesn't commit you
>>> to a decision about whether a marriage is implicitly or explicitly
>>> identified?   I fail to see how that is possible.

> This is the question I would like you to comment on! Do you agree
> that a predicate can treat a marriage like a relationship, or
> otherwise like an entity, which seems at odds with this idea of a
> neutral logical layer?

A propositional encoding does specify how this marriage is identified, yes. What I dispute is the distinction between implicit and explicit identification; between entities and relationship. A tuple/fact is identified by some combination of its attributes, that is all.

In order to be able to say that a predicate treats something like an entity or a relationship, you would need to define precisely what this treatment entails---i.e., you would have to 'pin down such informal words as "entity" and "relationship"'.

Even if you were able and willing to do that, it would be backwards to claim that the logical layer makes the distinction. You could with as much justification define some mapping from predicates to either ducks or cats, and then claim that the logical model is not animal-independent.

>> You define relationships as anything that can  be identified /only/ by
>> its related entitites---if there is an alternate key, the thing is an
>> entity. Correct? What is the rationale behind this rule?

> It is only a rather vague characterisation, and about as precise as
> the entity/relationship distinction deserves!
> My rationale is as follows: [...]

> Now in natural language we don't normally name instances of verbs or
> actions, but instead name subject and object. Eg "Jack kicks John".
> We don't think of the kick action as an entity that needs to be
> identified independently of Jack and John. Furthermore a kick is less
> tangible - it has a fleeting existence.

It seems to me that the more significant point is whether or not the kick exists independently of Jack and John. Presumably, it doesn't, and introducing/discovering an alternate identifier should not change this.

Is "X kicked Y at time T" (i.e. Jack can kick John multiple times) still a relationship? Perhaps the definition is "something that cannot be identified independently of other things", instead of "something that is identified solely by other things"? Although that would make a weak entity a kind of relationship...

> Note furthermore that verb phrases include other types of
> relationships that don't correspond to actions, such as "is less
> than", "has" or "is the father of". Note how silly it would seem to
> name a particular instance of a "has" relationship - ie between a
> particular pair of entities.

I have an apartment, and I can put a name to my ownership. But I see your point.

>> (And what if the alternative means of identification is also a
>> combination of entities?)

> Relationships won't tend to do that!

Never mind; with my current understanding of the "definition" of relation, it wouldn't make a difference.

> At this rather informal level of discussion, relationships are
> counterparts to relations and as we know,

They are? What, then, are the counterparts of entities and attributes?

Received on Fri Dec 07 2007 - 12:17:34 CET

Original text of this message