![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| ||||||||
| ||||||||
|
|
is a join between two relations on a foreign key in each ever meaningful? |
|
What I'm really trying to get at is whether a foreignkey-foreignkey join makes sense algebraically, and if so, do operations in higher- level abstractions (like E-R, facts) translate to them? |
|
Relvars are associated with an external predicate, which "documents" the "meaning" that is represented by [the tuples in] it. |
|
For example, if we have relvars R1 and R2 with predicates P(R1) and P(R2), respectively, then the external predicate associated with R1 INTERSECT R2 is "P(R1) AND P(R2)". |
|
You've got things the wrong way round. |
|
On Oct 3, 4:27 am, Erwin <e.sm... (AT) myonline (DOT) be> wrote: [...] As for the rest of your reply, you do not address whether higher-level abstractions can map to this questionable construction. |
|
On Oct 1, 2:07 pm, Rob <rmpsf... (AT) gmail (DOT) com> wrote: There must be thousands of db's that have Shipments, Invoices and Receivables tables with a foreign key referencing a Customer table. Obviously there will be people who will want to join two or more of those tables to compare Shipment_Value to Invoice_Amount or Receivable_Amount. Of course there are probably thousands, maybe millions, of people who have designed hundreds of databases that used no such join. And, probably thousands of people who have designed dozens of databases that used only such joins. |
|
Any help here is genuinely appreciated. |
#12
| ||||||||
| ||||||||
|
|
is a join between two relations on a foreign key in each ever meaningful? |
|
What I'm really trying to get at is whether a foreignkey-foreignkey join makes sense algebraically, and if so, do operations in higher- level abstractions (like E-R, facts) translate to them? |
|
Relvars are associated with an external predicate, which "documents" the "meaning" that is represented by [the tuples in] it. |
|
For example, if we have relvars R1 and R2 with predicates P(R1) and P(R2), respectively, then the external predicate associated with R1 INTERSECT R2 is "P(R1) AND P(R2)". |
|
You've got things the wrong way round. |
|
On Oct 3, 4:27 am, Erwin <e.sm... (AT) myonline (DOT) be> wrote: [...] As for the rest of your reply, you do not address whether higher-level abstractions can map to this questionable construction. |
|
On Oct 1, 2:07 pm, Rob <rmpsf... (AT) gmail (DOT) com> wrote: There must be thousands of db's that have Shipments, Invoices and Receivables tables with a foreign key referencing a Customer table. Obviously there will be people who will want to join two or more of those tables to compare Shipment_Value to Invoice_Amount or Receivable_Amount. Of course there are probably thousands, maybe millions, of people who have designed hundreds of databases that used no such join. And, probably thousands of people who have designed dozens of databases that used only such joins. |
|
Any help here is genuinely appreciated. |
#13
| ||||||||
| ||||||||
|
|
is a join between two relations on a foreign key in each ever meaningful? |
|
What I'm really trying to get at is whether a foreignkey-foreignkey join makes sense algebraically, and if so, do operations in higher- level abstractions (like E-R, facts) translate to them? |
|
Relvars are associated with an external predicate, which "documents" the "meaning" that is represented by [the tuples in] it. |
|
For example, if we have relvars R1 and R2 with predicates P(R1) and P(R2), respectively, then the external predicate associated with R1 INTERSECT R2 is "P(R1) AND P(R2)". |
|
You've got things the wrong way round. |
|
On Oct 3, 4:27 am, Erwin <e.sm... (AT) myonline (DOT) be> wrote: [...] As for the rest of your reply, you do not address whether higher-level abstractions can map to this questionable construction. |
|
On Oct 1, 2:07 pm, Rob <rmpsf... (AT) gmail (DOT) com> wrote: There must be thousands of db's that have Shipments, Invoices and Receivables tables with a foreign key referencing a Customer table. Obviously there will be people who will want to join two or more of those tables to compare Shipment_Value to Invoice_Amount or Receivable_Amount. Of course there are probably thousands, maybe millions, of people who have designed hundreds of databases that used no such join. And, probably thousands of people who have designed dozens of databases that used only such joins. |
|
Any help here is genuinely appreciated. |
#14
| |||
| |||
|
|
On Oct 1, 10:09 am, Rob <rmpsf... (AT) gmail (DOT) com> wrote: is a join between two relations on a foreign key in each ever meaningful? On Oct 2, 10:58 am, Rob <rmpsf... (AT) gmail (DOT) com> wrote: What I'm really trying to get at is whether a foreignkey-foreignkey join makes sense algebraically, and if so, do operations in higher- level abstractions (like E-R, facts) translate to them? Rob, I will enter this thread as I do most: you really don't understand the relational model. 1. (I quote Erwin for his versions of things I am saying.) On Oct 3, 4:27 am, Erwin <e.sm... (AT) myonline (DOT) be> wrote: * Relvars are associated with an external predicate, which "documents" the "meaning" that is represented by [the tuples in] it. Codd 1970: *"The meaning of [predicate logic predicate expression] COMPONENT(X, Y, Z) [given ordered-tuple set mathematics 'relation' COMPONENT] is that part X is an immediate component (or subassembly) of part Y, and Z units of part X are needed to assemble one unit of part Y". Such a parameterized statement is a 'predicate'. Codd meant that for modern relation (his "relationship") "the predicate for COMPONENT is that part SUB-PART is an immediate component (or subassembly) of part SUPER-PART, and QUANTITY units of part SUB-PART are needed to assemble one unit of part SUPER-PART". And that we might want to write "COMPONENT(X, Y, Z)" for "<SUB-PART X, SUPER-PART Y, QUANTITY Z> IN COMPONENT". When you give values for X, Y and Z or SUB.PART, SUPER.PART and QUANTITY you get a 'proposition', which is a statement that either holds or does not hold in a given world situation. ('Has truth value' 'TRUE' or 'FALSE'.) The (relational) extension of a predicate is the relation whose body is the set of tuples that make it into a proposition that holds in a given world situation. So we say (informally) that a relation is the extension of a predicate. A relation's attributes are the parameters of its predicate. 2. Each query relation expression has a predicate as follows. (This correspondence is typically described as "informal" (and spoken of vaguely if at all) but that is incorrect.) On Oct 3, 4:27 am, Erwin <e.sm... (AT) myonline (DOT) be> wrote: For example, if we have relvars R1 and R2 with predicates P(R1) and P(R2), respectively, then the external predicate associated with R1 INTERSECT R2 is "P(R1) AND P(R2)". The predicate of a relation expression that is a name of a relation variable or constant is its predicate. The predicate of a relation expression that is a JOIN is the AND of the predicates its operands; of a UNION is the OR; of a MINUS is the AND NOT; of a RESTRICT X=Y or of an ADD X AS Y is the AND X=Y; and of a PROJECTALLBUT X is the EXISTS X. The value of a query relation expression that is a relation name is its named relation's predicate's extension. Each relation operator is defined so that if its operand values are the extensions of their predicates then its result is the extension of its predicate. (As can be shown. Codd and (ADD) Hall et all defined them so this would be the case.) So by induction every query relation expression value is the extension of its predicate. So the predicate and result value of a query relation expression is independent of whether any normalization has been done or constraints have been defined. 3. Given the named relations' predicates and possible world situations, of the syntactically typed database values certain ('valid') values could arise and other ('invalid') ones definitely do not. The DBMS evaluates a dba-given overall database constraint expression and allows an assignment if and only if a proposed database value is valid. (This involves further relation operators for equality and nesting/aggregation.) So for values that the user got from (correctly) evaluating the predicates on every tuple for the world situation (all valid by definition), by this policy none is excluded and all are included. On Oct 3, 4:27 am, Erwin <e.sm... (AT) myonline (DOT) be> wrote: You've got things the wrong way round. The constraint expressions tell the user something if and only if the user doesn't know all the possible world situations. But a query predicate only ever depends on its relation expression and the named relations' predicates and its result value only further on the named relations' values. Neither depend on constraint expressions. (Of course, they are correlated with them.) Constraint expressions constrain updates. They do not constrain valid database values or affect query predicates or result values. If the user never made a mistake (incorrectly including/excluding tuples contrary to their named relations' predicates and the world situation) they would not need constraint expressions. Of course, the constraint expressions are also telling or confirming to the user important truths about the possible world situations in terms of the named relations' predicates; and can help the user understand those predicates and the world; and can help the user to rephrase queries and the DBMS to optimize queries. A constraint expression just expresses a truth. 4. Modern normalization/dependency theory says that there is a foreign key on attribute set K from a target D into a target F (domestic/ foreign) in a database when in all possible world situations ie in all valid database states K forms a key in F and all the subtuple values for K in D are also in F. (We can also speak of it being a foreign key in a given situation.) So there is a foreign key constraint on K from D to F if and only if certain expressions express certain things that hold in every world situation. This could happen for any two database named relations; it's just a relationship that happens to always hold for pairs of values of D and F in that database. And just like every constraint expression's proposition, the only way in which this has anything to do with a query predicate or result value is that the possible world situations and the named relations' predicates collectively determine them all. 5. The "relationship" with predicate "there is a foreign key on attribute set {...} from named relation R and T to named relation S" is a fact that either holds or does not hold. As a predicate, it is a proposition. It is a relationship on nothing. Its extension ie relation is DEE. In practice we don't mean a fact when we say "relationship". (Historically, TRUE and FALSE aren't even wffs.) You seem interested in the constraint-oriented "relationship" FK on K, D and F (in that order in wffs) with predicate "there is a foreign key on attribute set K from named relation D to named relation F". Note that D and F denote the names of named relations, not relation values. Note also that a foreign key relationship holds on a K, D and F when a certain thing is the case for all valid database values. You seem interested in constraint propositions on expression "S JOIN T" that can be inferred from certain constraint propositions on S and T when EXISTS X, SR, ST: FK(X, R, SR) AND FK(X, T, ST). Ie when the proposition "there is set X such that a foreign key on attribute set X from named relations R and T to named relations SR and ST respectively" holds. We can have foreign keys on arbitrary expressions. So we can have FKe with predicate "there is a foreign key on attribute set K from expression D to expression F". It happens to be the case that that FKe(k, "R", "SR") AND FKe(k, "T", "ST") implies FKe(k, "R JOIN T", "SR"). Also that FKe(k, "R JOIN T", "ST") . Also that R{K} SUBSETOF (R JOIN T){K}, and T{K} SUBSETOF (R JOIN T){K}. And lots of other things. (But not "relationships".) Though I suspect *you are interested in the first two. (Do you care whether both foreign keys are to be to the same target? They needn't.) Note that FKe is the relationship; FKe(k, "R JOIN T", "S") is a fact that holds when Fe(k, "R", "S") AND Fe(k, "T", "S") holds. But a JOIN does not "reveal" any of this. Evaluating S JOIN T for a particular world situation just tells you certain things are true of that world situation per the predicates of S and T. The predicates and facts above don't even involve the same world as the JOIN and named relation predicates. It is the properties of FK and JOIN that have relevant consequences. Nothing "reveals" a relationship. It is meaningless to talk about "the" relationship between some attributes/parameters. A predicate or an extension/relation each tell you something about a relationship independent of a world situation. You are not talking about a particular relationship unless you have both its predicate and a world situation or its predicate and its extension. Do not confuse relationships, predicates, extensions/relations and propositions. Don't even use the word 'relationship'.) 6. So every JOIN just says that you want the tuples that make two other predicates true at the same time. Regardless of constraint expressions. Every relation expression is "meaningful". And you are probably actually interested in constraint (proposition) inference. So most of the sentences in your posts don't make sense. You are not clear and you don't seem to have the relational understanding or habits of thinking and writing to characterize your problem. Working through any example you choose might help make this clear to you. You might be interested in messagehttp://groups.google.com/group/comp.databases.theory/msg/1963ce6c0d2a... . Also give up Codd, especially 40 years ago. (Which you misread, although you're right about a certain unnecessary restriction.) Read recent Date and Darwen. 7. On Oct 3, 11:05 am, Rob <rmpsf... (AT) gmail (DOT) com> wrote: On Oct 3, 4:27 am, Erwin <e.sm... (AT) myonline (DOT) be> wrote: [...] As for the rest of your reply, you do not address whether higher-level abstractions can map to this questionable construction. Your reply to Erwin basically totally misunderstands him. And his post was entirely on-topic. On Oct 2, 9:07 am, paul c <toledobythe... (AT) gmail (DOT) com> wrote: On Oct 1, 2:07 pm, Rob <rmpsf... (AT) gmail (DOT) com> wrote: There must be thousands of db's that have Shipments, Invoices and Receivables tables with a foreign key referencing a Customer table. Obviously there will be people who will want to join two or more of those tables to compare Shipment_Value to Invoice_Amount or Receivable_Amount. Of course there are probably thousands, maybe millions, of people who have designed hundreds of databases that used no such join. *And, probably thousands of people who have designed dozens of databases that used only such joins. I believe Paul's point was not about gut reactions but that of course such JOINs are meaningful. On Oct 1, 2:07 pm, Rob <rmpsf... (AT) gmail (DOT) com> wrote: Any help here is genuinely appreciated. I believe you mean this, but I don't believe you know what it means. Read and reread carefully. Think and write and rethink and rewrite carefully. Don't disagree. Ask people to clarify what they mean. Every time you disagreed you were wrong, and every time you agreed you misunderstood. When world views collide, resolve contradictions, doubt confirmations. Thank you for the opportunity to clarify my thoughts and their expression. (Ten minutes well spent.) (Joke.) (The ten minutes.) philip |
#15
| |||||||||||
| |||||||||||
|
|
On Monday, January 2, 2012 5:20:48 AM UTC-8, vldm10 wrote: Could you give a definition (or description) of the following terms: the world, the situation and the possible. |
|
Also could you give us a definition of the attributes in RM. |
|
It would be good if you can give us a definition of a predicate. Such a parameterized statement is a 'predicate'. Codd meant that for modern relation (his "relationship") "the predicate for COMPONENT is that part SUB-PART is an immediate component (or subassembly) of part SUPER-PART, and QUANTITY units of part SUB-PART are needed to assemble one unit of part SUPER-PART". Note that the predicate is a linguistic construct. When you give values for [...] SUB.PART, SUPER.PART and QUANTITY you get a 'proposition', which is a statement that either holds or does not hold in a given world situation. ('Has truth value' 'TRUE' or 'FALSE'.) |
|
Also give us a definition of the extensionality (of predicate). The (relational) extension of a predicate is the relation whose body is the set of tuples that make it into a proposition that holds in a given world situation. Since you're trying ”to translate” a formal language for Predicate Logic into English language |
|
Each query relation expression has a predicate as follows. |
|
Note that the terms "world", "situation" and "possible" does not exist in the RM. |
|
(This correspondence is typically described as "informal" (and spoken of vaguely if at all) but that is incorrect.) |
|
When you write about the meaning you are actually writing about the truth value of the corresponding proposition. |
|
Each query relation expression has a predicate as follows. |
|
We can also notice that interrogative (query) sentence has no truth- value. So by induction every query relation expression value is the extension of its predicate The (relational) extension of a predicate is the relation whose body is the set of tuples that make it into a proposition that holds in a given world situation. A relation's attributes are the parameters of its predicate. |
|
What does mean the pair (foreign- key, primary-key) in terms of database design? What do you design with this pair? Constraint expressions constrain updates. They do not constrain valid database values or affect query predicates or result values. Modern normalization/dependency theory says that there is a foreign key on attribute set K from a [source] D into a target F (domestic/ foreign) in a database when in all possible world situations ie in all valid database states K forms a key in F and all the subtuple values for K in D are also in F. This could happen for any two database named relations; it's just a relationship that happens to always hold for pairs of values of D and F in that database. |
#16
| |||
| |||
|
|
A query is a relation expression is a predicate, is a relation value, is (for 0-tuples) a truth value, is a (true) proposition (via substituting body tuples into its predicate), is a request for a relation value, is a request for a truth value, is a request for a (true) proposition. How we use terms colloquial terms is irrelevant. |
#17
| |||
| |||
|
|
Vladimir, 1. On Monday, January 2, 2012 5:20:48 AM UTC-8, vldm10 wrote: Could you give a definition (or description) of the following terms: the world, the situation and the possible. I just mean certain usual notions for logic and for states. A database changes state as it keeps describing some changing "world". A particular database state value describes a particular "situation". (So predicate logic uses a single situation; a dbms uses a sequence of them.) By "possible" situation I just mean a situation that could arise as the world changes. Also could you give us a definition of the attributes in RM. I just mean the usual unordered-attributes notion. A tuple is a set of attribute name-and-something pairs with a given name only appearing once. A relation has a heading and a body. A heading is a tuple of name-and-type pairs. A body is a set of tuples of name-and-value pairs. The heading and body tuples all have the same names. For each name every body value paired with it is of the heading type paired with it. I usually shorten "attribute name" to "attribute". 2. My last message already answers, contradicts, or obviates your other comments. Rather than me cutting and pasting the answers could you try finding them? Though I'll do a few: It would be good if you can give us a definition of a predicate. *Such a parameterized statement is a 'predicate'. Codd meant that for modern relation (his "relationship") "the predicate for COMPONENT is that part SUB-PART is an immediate component (or subassembly) of part SUPER-PART, and QUANTITY units of part SUB-PART are needed to assemble one unit of part SUPER-PART". Note that the predicate is a linguistic construct. When you give values for [...] SUB.PART, SUPER.PART and QUANTITY you get a 'proposition', which is a statement that either holds or does not hold in a given world situation. ('Has truth value' 'TRUE' or 'FALSE'.) "Predicate" gets used in lots of ways. I am using it as a mapping from a tuple to a proposition, with a proposition a mapping from a situation to a truth value reflecting whether the situation is a certain way. In other words a certain usual predicate logic notion. (A wff predicate symbol's interpretation/extension set (ordered-relation) is determined by a predicate/function/mapping which maps a tuple to a statement/proposition/function/mapping which maps a situation to a truth value.) *Also give us a definition of the extensionality (of predicate). The (relational) extension of a predicate is the relation whose body is the set of tuples that make it into a proposition that holds in a given world situation. Since you're trying ”to translate” a formal language for Predicate Logic into English language No, I am clearly not: Each query relation expression has a predicate as follows. The source of my translation is a relation expression. The target of my translation is a predicate. I don't care how you write the predicate. Note that the terms "world", "situation" and "possible" does not exist in the RM. The concepts do: *(This correspondence is typically described as "informal" (and spoken of vaguely if at all) but that is incorrect.) You cannot set the relation variables without observing the world and knowing what their predicates (parametrically) say about the the world. You cannot understand a query or its value without knowing the named relation predicates and what they (parametrically) say about the world. (Same for predicate symbols and wffs in predicate logic.) And the named relation predicates plus all possible situations determine possible states and so constraints. When you write about the meaning you are actually writing about the truth value of the corresponding proposition. No, I am not: Each query relation expression has a predicate as follows. "Meaning" gets used in lots of ways. I am giving a "predicate" ("parameterized proposition") as "meaning" of a "relation expression" in the relational model. (In the everyday sense a sentence/ proposition is itself a "meaning"; it merely "has" a truth value. In predicate logic a predicate symbol has a "meaning" (in a different sense) that is an interpretation/extension set. And a sentential wff has a "meaning" (in a different sense) that is a truth value.) I would agree that the "meaning" (in yet another sense) of a 0-tuple query result is a truth value. And I would agree that the "meaning" (in yet another sense) of a query value is the (necessarily true) proposition that is the conjunction of its present-tuple propositions and its negated absent-tuple propositions. We can also notice that interrogative (query) sentence has no truth- value. *So by induction every query relation expression value is the extension of its predicate The (relational) extension of a predicate is the relation whose body is the set of tuples that make it into a proposition that holds in a given world situation. *A relation's attributes are the parameters of its predicate. Your comment is specious. A query is a relation expression is a predicate, is a relation value, is (for 0-tuples) a truth value, is a (true) proposition (via substituting body tuples into its predicate), is a request for a relation value, is a request for a truth value, is a request for a (true) proposition. How we use terms colloquial terms is irrelevant. 3. *What does mean the pair (foreign- key, primary-key) in terms of database design? What do you design with this pair? *Constraint expressions constrain updates. They do not constrain valid database values or affect query predicates or result values. Modern normalization/dependency theory says that there is a foreign key on attribute set K from a [source] D into a target F (domestic/ foreign) in a database when in all possible world situations ie in all valid database states K forms a key in F and all the subtuple values for K in D are also in F. *This could happen for any two database named relations; it's just a relationship that happens to always hold for pairs of values of D and F in that database. If you wrote out named relation predicates then you would see that SQL "subtables" and ER "subtyping" involve propositions that are facts/ truths in all states. Like that is_a_s_thing(k1, ...) IMPLIES is_a_r_thing(k1, ...); ie that (s PROJECT {k1, ...}) SUBSETOF (r PROJECT {k1, ...}); ie that there is an inclusion dependency on {k1, ...} from "s" to "r". And that if also {k1, ...} is a key in r then also there is a foreign key on {k1, ...} from "s" to "r". Rob confused (changing) parent-child edges in the graph of a variable/ query relation value with those in the graph(s) of the (simultaneously meta, constant, redundant and operator-irrelevant) foreign key relation and/or subtable/subtype relation(s). And whether such facts/ truths hold has no bearing on what a query "means". You need to understand query predicates to understand the details and the explanation of this. 4. I expect to not necessarily be clear in a terse post. But you don't seem to have read closely enough to understand me. You misread me or you see a homonym and assume a meaning. Instead of trying to understand the (precise) system I tried to described. I hope things are clearer now. philip |
|
"Meaning" gets used in lots of ways. I am giving a "predicate" ("parameterized proposition") as "meaning" of a "relation expression" in the relational model. (In the everyday sense a sentence/ proposition is itself a "meaning"; it merely "has" a truth value. In predicate logic a predicate symbol has a "meaning" (in a different sense) that is an interpretation/extension set. And a sentential wff has a "meaning" (in a different sense) that is a truth value.) |
#18
| |||||
| |||||
|
|
On 10 sij, 07:29, com... (AT) hotmail (DOT) com wrote: |
|
My first question was: What does mean the pair (foreign-key, primary- key) in terms of database design? What do you design with this pair? What does mean the pair (foreign- key, primary-key) in terms of database design? What do you design with this pair? Modern normalization/dependency theory says that there is a foreign key on attribute set K from a [source] D into a target F (domestic/ foreign) in a database when in all possible world situations ie in all valid database states K forms a key in F and all the subtuple values for K in D are also in F. This could happen for any two database named relations; it's just a relationship that happens to always hold for pairs of values of D and F in that database. |
|
So in my opinion, a description of foreign keys in the terms of relations and predicates is not a theory about constructing, building and designing. |
|
why I cannot accept your opinion about entities. |
|
In your sentence: "A body is a set of tuples of name-and-value pairs" instead of name-and-value pairs you can put name-and-name pairs, because the value is in fact name (for this value). So when we assign a value to a variable, then we can say (semantically) that we "bind" the name of the value with the name of the variable. |
#19
| |||
| |||
|
|
Modern normalization/dependency theory says that there is a foreign key on attribute set K from a [source] D into a target F (domestic/ foreign) in a database when in all possible world situations ie in all valid database states K forms a key in F and all the subtuple values for K in D are also in F. This could happen for any two database named relations; it's just a relationship that happens to always hold for pairs of values of D and F in that database. COMPONENT <X part, Y part, Z part> {<leg, pony, 4>, <torso, pony, 1>} WANT <Y part> {<pony> , <ball>} |
|
COMPONENT(X, Y, Z) a X is an immediate component (or subassembly) of aY, and Z units of a X are needed to assemble one unit of a Y WANT(Y) I want a Y |
#20
| ||||||
| ||||||
|
|
On Monday, March 5, 2012 6:51:50 PM UTC-8, vldm10 wrote: On 10 sij, 07:29, com... (AT) hotmail (DOT) com wrote: Vladimir, My first question was: What does mean the pair (foreign-key, primary- key) in terms of database design? What do you design with this pair? Â*What does mean the pair (foreign- key, primary-key) in terms of database design? What do you design with this pair? Modern normalization/dependency theory says that there is a foreign key on attribute set K from a [source] D into a target F (domestic/ foreign) in a database when in all possible world situations ie in all valid database states K forms a key in F and all the subtuple values for K in D are also in F. Â*This could happen for any two database named relations; it's just a relationship that happens to always hold for pairs of values of D and F in that database. To understand the answer to your question you have to learn a bunch of things and unlearn a bunch of things. |
|
All primary keys are (candidate) keys. Picking one as primary has no more formal meaning than picking the name of an attribute or variable. The dba gives a predicate for each relation variable. The user puts into a relation variable the tuples that turn the predicate into a true statement. The (natural) join of two relations is always on common attributes. The result body holds the tuples that make <<the predicate of one> AND the predicate of the other>> into a true statement. Predicates: COMPONENT(X, Y, Z) Â* a X is an immediate component (or subassembly) of aY, Â* and Z units of a X are needed to assemble one unit of a Y WANT(Y) I want a Â*Y |
|
Variables: COMPONENT Â*<X part, Y part, Z part> Â*{<leg, pony, 4>, <torso, pony, 1>} WANT <Y part> {<pony>, <ball>} What the database says: Â*a leg is an immediate component (or subassembly) of a pony, and 4 units of a leg are needed to assemble one unit of a pony AND a torso is an immediate component (or subassembly) of a pony, and 1 unit of a torso is needed to assemble one unit of a pony AND it is not the case that <a leg is an immediate component (or subassembly) of a pony, and 7 units of a head is needed to assemble one unit of a pony AND it is not the case that <a wheel is an immediate component (or subassembly) of a pony, and 18 units of a wheel are needed to assemble one unit of a pony AND it is not the case that ... per any other absent COMPONENT tuple either AND I want a pony AND I want a ball AND I don't want a wheel AND I don't want a leg AND it is not the case that ... per any other absent WANT tuple either Query: WANT JOIN COMPONENT By the definition of JOIN this returns X, Y and Z such that I want a Y AND a X is an immediate component (or subassembly) of a Y, and Z units of a X are needed to assemble one unit of a Y. Result: <X part, Y part, Z part> {<leg, pony, 4>, <torso, pony, 1 What the query says: I want a pony AND a leg is an immediate component (or subassembly) of a pony, and 4 units of a leg are needed to assemble one unit of a pony AND I want a pony AND a torso is an immediate component (or subassembly) of a pony, and 1 unit of a torso is needed to assemble one unit of a pony AND it is not the case that <I want a pony AND a leg is an immediate component (or subassembly) of a pony, and 3 units of a leg are needed to assemble one unit of a pony AND it is not the case that ... per any other absent query tuple either If the relation variable predicates happen to be such that you could (and did or didn't) declare a foreign key from an attribute set in one relation variable to another then the tuples in the result will be limited in a certain unchanging way describable independently of what tuples are in them at any particular time; the limitation that we call a foreign key constraint. Nevertheless, the result will still be the tuples that make <<the predicate of one> AND <the predicate of the other>> into a true statement. Just declare the keys and foreign keys and other constraints to avoid update errors. Â*So in my opinion, a description of foreign keys in the terms of relations and predicates is not a theory about constructing, building and designing. I have tried to inform you. Try:http://bookboon.com/en/textbooks/it-.../download.html |
|
why I cannot accept your opinion about entities. Several of us have told you that ER is at best a heuristic to determine predicates. In your sentence: "A body is a set of tuples of name-and-value pairs" instead of name-and-value pairs you can put name-and-name pairs, because the value is in fact name (for this value). So when we assign a value to a variable, then we can say (semantically) that we "bind" the name of the value with the name of the variable. One can characterize a rational number (a kind of value) as having two parts, a numerator and a denominator, each an integer (a kind of value) (not numeral). I characterized a relation, not a relation variable. |
|
kind of value) has name and value pairs (a kind of value) as attribute parts. If you want to become informed, I suggest you read the links and try to understand what I wrote instead of balking. |
|
good luck, philip |
![]() |
| Thread Tools | |
| Display Modes | |
| |