Conjugate transpose: Difference between revisions
clarify |
en>Flying sheep |
||
Line 1: | Line 1: | ||
In [[computer science]], '''domain relational calculus''' ('''DRC''') is a calculus that was introduced by Michel Lacroix and [[ Alain Pirotte]] as a [[declarative programming|declarative]] [[query language|database query language]] for the [[relational model|relational data model]].<ref name="LP77">Michel Lacroix, Alain Pirotte: Domain-Oriented Relational Languages. VLDB 1977: 370-378</ref> | |||
In DRC, ''queries'' have the form: | |||
:<math> \{\langle X_1, X_2, ...., X_n \rangle \mid p(\langle X_1, X_2, ...., X_n\rangle) \} </math> | |||
where each X<sub>i</sub> is either a domain variable or constant, and <math>p(\langle X_1, X_2, ...., X_n \rangle)</math> denotes a DRC ''formula''. The result of the query is the set of tuples X<sub>i</sub> to X<sub>n</sub> which makes the DRC formula true. | |||
This language uses the same operators as [[tuple calculus]], | |||
the logical connectives ∧ (and), ∨ (or) and ¬ (not). The [[existential quantification|existential quantifier]] (∃) and the [[universal quantification|universal quantifier]] (∀) can be used to bind the variables. | |||
Its computational expressiveness is equivalent to that of [[Relational algebra]].<ref name="Codd72a">[[E. F. Codd]]: Relational Completeness of Data Base Sub-languages. In R. Rustin, editor, Data Base Systems. Prentice Hall, 1972 </ref> | |||
==Examples== | |||
Let (A, B, C) mean (Rank, Name, ID) | |||
and (D, E, F) to mean (Name, DeptName, ID) | |||
Find all captains of the starship [[USS Enterprise (NCC-1701)|USS Enterprise]]: | |||
<math>\left\{ \ {\left\langle A, B, C \right\rangle} \mid {\left\langle A, B, C \right\rangle \in \mathrm{Enterprise} \ \land \ A = \mathrm{Captain} } \ \right\}</math> | |||
In this example, A, B, C denotes both the result set and a set in the table Enterprise. | |||
Find Names of Enterprise crewmembers who are in Stellar Cartography: | |||
<math> | |||
\begin{align} | |||
\{ {\left\langle B \right\rangle} & \mid {\exists A, C \ \left\langle A, B, C \right\rangle \in \mathrm{Enterprise} } \\ | |||
& \land \ {\exists D, E, F \ \left\langle D, E, F \right\rangle \in \mathrm{Departments} } \\ | |||
& \land \ F = C \ \land \ E = \mathrm{Stellar \ Cartography} \} \\ | |||
\end{align}</math> | |||
In this example, we're only looking for the name, and that's B. F = C is a requirement, because we need to find Enterprise crew members AND they are in the Stellar Cartography Department. | |||
An alternate representation of the previous example would be: | |||
<math>\left\{ \ {\left\langle B \right\rangle} \mid {\exists A, C \ \left\langle A, B, C \right\rangle \in \mathrm{Enterprise} } \ \land \ {\exists D \ \left\langle D, \mathrm{Stellar \ Cartography}, C \right\rangle \in \mathrm{Departments} } \ \right\}</math> | |||
In this example, the value of the requested F domain is directly placed in the formula and the C domain variable is re-used in the query for the existence of a department, since it already holds a crew member's id.</pre> | |||
Relational Data Model: | |||
The Relational model uses relation (table) to represent both entities and relationships | |||
among entities. A relation may be visualized as a table. However table is just one of the way, among many, to represent a relation. | |||
== See also == | |||
*[[Relational algebra]] | |||
*[[Relational calculus]] | |||
**[[Tuple relational calculus]] (TRC) | |||
* [[Aldat Relational Algebra]] | |||
* [[Domain algebra]] | |||
== References == | |||
<references/> | |||
[[Category:Relational model]] | |||
[[Category:Logical calculi]] |
Revision as of 14:36, 22 November 2013
In computer science, domain relational calculus (DRC) is a calculus that was introduced by Michel Lacroix and Alain Pirotte as a declarative database query language for the relational data model.[1]
In DRC, queries have the form:
where each Xi is either a domain variable or constant, and denotes a DRC formula. The result of the query is the set of tuples Xi to Xn which makes the DRC formula true.
This language uses the same operators as tuple calculus, the logical connectives ∧ (and), ∨ (or) and ¬ (not). The existential quantifier (∃) and the universal quantifier (∀) can be used to bind the variables.
Its computational expressiveness is equivalent to that of Relational algebra.[2]
Examples
Let (A, B, C) mean (Rank, Name, ID)
and (D, E, F) to mean (Name, DeptName, ID)
Find all captains of the starship USS Enterprise:
In this example, A, B, C denotes both the result set and a set in the table Enterprise.
Find Names of Enterprise crewmembers who are in Stellar Cartography:
In this example, we're only looking for the name, and that's B. F = C is a requirement, because we need to find Enterprise crew members AND they are in the Stellar Cartography Department.
An alternate representation of the previous example would be:
In this example, the value of the requested F domain is directly placed in the formula and the C domain variable is re-used in the query for the existence of a department, since it already holds a crew member's id.
Relational Data Model: The Relational model uses relation (table) to represent both entities and relationships among entities. A relation may be visualized as a table. However table is just one of the way, among many, to represent a relation.
See also
References
- ↑ Michel Lacroix, Alain Pirotte: Domain-Oriented Relational Languages. VLDB 1977: 370-378
- ↑ E. F. Codd: Relational Completeness of Data Base Sub-languages. In R. Rustin, editor, Data Base Systems. Prentice Hall, 1972